.dict-app {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 40px);
  min-height: 100vh;
}

/* Header */
.dict-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: background 120ms ease, color 120ms ease;
}

.back-link:hover {
  background: var(--surface-2);
  color: var(--teal);
}

.back-link svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.header-center {
  text-align: center;
}

.header-center h1 {
  font-size: 22px;
  color: var(--ink);
}

.dict-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.header-stats {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.header-stats span {
  color: var(--teal-dark);
  font-size: 18px;
}

/* Search */
.search-bar {
  position: relative;
  margin-top: 20px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  pointer-events: none;
}

.search-bar input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 44px 0 44px;
  color: var(--ink);
  font-size: 16px;
  background: var(--surface);
  outline: none;
  transition: border-color 160ms ease;
}

.search-bar input:focus {
  border-color: var(--teal);
}

.clear-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.clear-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.clear-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

/* Filters */
.filter-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 5px 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 120ms ease;
}

.filter-btn:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.filter-btn.is-active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

/* Band filter row */
.band-row {
  align-items: center;
}

.filter-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.band-btn {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 120ms ease;
}

.band-btn:hover {
  border-color: #e67e22;
  color: #e67e22;
}

.band-btn.is-active {
  background: #e67e22;
  border-color: #e67e22;
  color: #fff;
}

/* Band badge on word card */
.word-card-band {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  background: #fef3e2;
  color: #e67e22;
  line-height: 1.4;
}

/* Word Grid */
.word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.word-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  align-items: start;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease;
}

.word-card:hover {
  border-color: var(--teal);
  transform: translateY(-1px);
}

.word-card-word {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.word-card-pos {
  font-size: 11px;
  color: var(--teal-dark);
  font-weight: 700;
  background: rgba(29, 127, 117, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  text-align: center;
  align-self: center;
}

.word-card-zh {
  grid-column: 1 / -1;
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.word-card-phonetic {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 24px;
  padding-bottom: 40px;
}

.page-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--teal);
  background: var(--surface-2);
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.page-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.page-info {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  min-width: 60px;
  text-align: center;
}

/* Detail Modal */
.detail-modal {
  position: relative;
  width: min(100%, 480px);
  padding: 28px;
}

.close-detail {
  position: absolute;
  top: 12px;
  right: 12px;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.detail-word {
  margin: 0;
  font-size: 36px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
}

.speak-btn {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--teal);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
  flex-shrink: 0;
}

.speak-btn:hover {
  background: var(--teal);
  color: #fff;
}

.speak-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.detail-phonetic {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 18px;
  font-style: italic;
}

.detail-pos-row {
  margin-top: 10px;
}

.detail-pos {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(29, 127, 117, 0.1);
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 700;
  border-radius: 6px;
}

.detail-band {
  display: inline-block;
  padding: 3px 10px;
  margin-left: 6px;
  background: #fef3e2;
  color: #e67e22;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
}

.detail-section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.detail-section h3 {
  margin: 0 0 8px;
  color: var(--amber);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-zh {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}

.meaning-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.meaning-pos {
  flex: 0 0 auto;
  color: var(--teal-dark);
  font-weight: 600;
}

.meaning-def {
  min-width: 0;
}

.detail-def {
  margin: 0;
  color: #33403b;
  font-size: 15px;
  line-height: 1.6;
}

/* Empty state */
.empty-grid {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
  font-size: 15px;
}

@media (max-width: 600px) {
  .dict-header {
    flex-wrap: wrap;
    justify-content: center;
  }

  .header-center {
    order: -1;
    width: 100%;
  }

  .word-grid {
    grid-template-columns: 1fr;
  }
}
