.words-top {
  margin-bottom: 1.25rem;
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.category-scroll {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.cat-chip {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.45);
  color: var(--ink);
  font-family: "Noto Sans SC", "DM Sans", sans-serif;
  font-size: 0.92rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.cat-chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #f4f7f5;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.ghost-btn,
.file-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
}

.ghost-btn:hover,
.file-btn:hover {
  border-color: rgba(31, 111, 91, 0.45);
}

.search-field input {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65);
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font: inherit;
  min-width: 12rem;
  color: var(--ink);
}

.words-status {
  min-height: 1.25rem;
  margin: 0 0 1rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.words-status.is-error {
  color: var(--seal);
}

.words-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  gap: 0.9rem;
}

.word-stats {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 600;
}

.word-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
}

.word-stat-icon {
  width: 0.95rem;
  height: 0.95rem;
  opacity: 0.75;
}

.word-stat.is-pass {
  color: #b8891a;
}

.word-stat.is-draw {
  color: var(--jade-deep);
}

.word-stat.is-draw .word-stat-icon {
  opacity: 0.95;
}

.word-stat.is-pass .word-stat-icon {
  opacity: 0.95;
}

.word-stat.is-fail {
  color: #8b5a2b;
}

.word-stat.is-fail .word-stat-icon {
  opacity: 0.95;
}

.word-stat-n {
  font-variant-numeric: tabular-nums;
  min-width: 0.7rem;
}

.hanzi-speak {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  font-family: "Noto Sans SC", "DM Sans", sans-serif;
  font-size: inherit;
  font-weight: 700;
  color: inherit;
  border-radius: 0.35rem;
  /* Speaker cursor: click = play audio */
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cg fill='none' stroke='%231f6f5b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 11h3.2l5.3-4.2v14.4L8.2 17H5z' fill='%231f6f5b' fill-opacity='.15'/%3E%3Cpath d='M18.2 10.2a5.2 5.2 0 0 1 0 7.6'/%3E%3Cpath d='M20.8 7.6a9 9 0 0 1 0 12.8'/%3E%3C/g%3E%3C/svg%3E") 4 14, pointer;
}

.hanzi-speak:hover {
  color: var(--jade-deep);
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cg fill='none' stroke='%231a4f42' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 11h3.2l5.3-4.2v14.4L8.2 17H5z' fill='%231a4f42' fill-opacity='.2'/%3E%3Cpath d='M18.2 10.2a5.2 5.2 0 0 1 0 7.6'/%3E%3Cpath d='M20.8 7.6a9 9 0 0 1 0 12.8'/%3E%3C/g%3E%3C/svg%3E") 4 14, pointer;
}

.data-table tbody tr.is-clickable {
  cursor: pointer;
}

.word-card .word-stats {
  margin-top: 0.35rem;
}

.practice-stats {
  display: flex;
  justify-content: center;
  margin-top: 0.85rem;
}

.practice-stats .word-stats {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--line);
}

.practice-lists {
  display: grid;
  gap: 0.45rem;
  justify-items: center;
  margin-top: 1.75rem;
  max-width: 28rem;
}

.practice-lists-label {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.practice-lists-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
}

.practice-list-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
  color: var(--jade-deep);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.practice-list-chip:hover {
  border-color: rgba(31, 111, 91, 0.4);
  background: rgba(31, 111, 91, 0.08);
}

.word-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 1.1rem 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(8px);
  text-align: center;
  transition: border-color 0.2s ease;
}

.word-card.is-clickable {
  cursor: pointer;
}

.word-card.is-clickable:focus-visible {
  outline: 2px solid var(--jade);
  outline-offset: 2px;
}

.word-card-spacer {
  width: 2.1rem;
  height: 2.1rem;
  flex: 0 0 auto;
}

.word-card:hover {
  border-color: rgba(31, 111, 91, 0.35);
}

.word-card-row {
  display: grid;
  grid-template-columns: 2rem 1fr 2rem;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
}

.word-card-hanzi {
  margin: 0;
  font-family: "Noto Sans SC", sans-serif;
  font-size: clamp(2.2rem, 5.5vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
  letter-spacing: 0.04em;
  text-align: center;
}

.icon-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--jade);
  font-size: 0.85rem;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.icon-btn svg {
  width: 1rem;
  height: 1rem;
  display: block;
}

.icon-btn:hover {
  background: var(--jade);
  border-color: var(--jade);
  color: #f7faf8;
}

.icon-btn.is-danger {
  color: var(--seal);
}

.icon-btn.is-danger:hover {
  background: var(--seal);
  border-color: var(--seal);
  color: #fff;
}

.word-card-pinyin {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--jade);
  letter-spacing: 0.04em;
}

.word-card-ru {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ink-soft);
  line-height: 1.35;
}

.word-freq {
  margin: 0.45rem 0 0;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: rgba(26, 36, 33, 0.48);
}

.word-card .word-freq {
  margin-top: auto;
  padding-top: 0.35rem;
}

.word-freq-inline {
  margin: 0;
  white-space: nowrap;
}

.word-freq-practice {
  margin: 0;
  font-size: 0.85rem;
  text-align: center;
  color: rgba(26, 36, 33, 0.55);
}

.practice-freq {
  margin-top: 0.25rem;
  width: 100%;
}

.practice-freq:empty {
  display: none;
}

.cell-freq {
  font-size: 0.78rem;
  color: rgba(26, 36, 33, 0.5);
  white-space: nowrap;
}

.word-card-cat {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: rgba(26, 36, 33, 0.45);
}

.sheet {
  border: none;
  border-radius: 1.1rem;
  padding: 0;
  max-width: 28rem;
  width: calc(100% - 2rem);
  background: #f7faf8;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.sheet::backdrop {
  background: rgba(26, 36, 33, 0.35);
}

.sheet-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.4rem;
}

.sheet-form h2 {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
}

.sheet-hint {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.sheet-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.sheet-form input,
.sheet-form select,
.sheet-form textarea {
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  padding: 0.65rem 0.8rem;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.form-error {
  margin: 0;
  min-height: 1.1rem;
  color: var(--seal);
  font-size: 0.9rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 640px) {
  .words-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-field {
    flex: 1 1 100%;
  }

  .search-field input {
    width: 100%;
    min-width: 0;
  }
}
