:root {
  color-scheme: dark;
  --bg: #080a0d;
  --panel: #10141a;
  --panel-2: #151b23;
  --panel-3: #1b232e;
  --text: #f3f5f7;
  --muted: #9aa7b5;
  --faint: #687584;
  --line: #25303d;
  --line-soft: rgba(255, 255, 255, 0.08);
  --accent: #43d1c8;
  --accent-2: #f1c96b;
  --danger: #ff6b76;
  --ok: #68d391;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  --ui-font: "Helvetica Neue", Helvetica, Arial, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --zh-font: "Source Han Sans SC", "Source Han Sans CN", "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", "Heiti SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-padding-top: 92px;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(67, 209, 200, 0.08), transparent 360px),
    linear-gradient(135deg, rgba(241, 201, 107, 0.05), transparent 440px),
    var(--bg);
  color: var(--text);
  font-family: var(--ui-font);
  line-height: 1.5;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, black, transparent 760px);
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--accent);
}

#library-grid,
#word-list {
  scroll-margin-top: 92px;
}

button,
input,
select {
  font: inherit;
}

button,
.primary-action {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(67, 209, 200, 0.38);
  border-radius: 8px;
  background: #d7fffb;
  color: #071111;
  padding: 0 16px;
  font-weight: 760;
  cursor: pointer;
  white-space: nowrap;
}

button:hover,
.primary-action:hover {
  background: #ffffff;
  color: #071111;
  border-color: #ffffff;
}

input,
select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b0f14;
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

.filters select {
  min-height: 40px;
  appearance: none;
  border-color: var(--line);
  background:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%) calc(100% - 18px) 50% / 6px 6px no-repeat,
    linear-gradient(135deg, var(--muted) 50%, transparent 50%) calc(100% - 14px) 50% / 6px 6px no-repeat,
    #0b0f14;
  color: var(--muted);
  padding: 0 34px 0 13px;
  font-size: 0.9rem;
  font-weight: 720;
}

.filters select:hover {
  color: var(--text);
  border-color: rgba(67, 209, 200, 0.34);
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(67, 209, 200, 0.14);
}

input[type="file"] {
  padding: 7px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line-soft);
  padding: 14px 16px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--faint);
  font-size: 0.74rem;
  font-weight: 780;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

td {
  color: #dbe2ea;
}

tr:last-child td {
  border-bottom: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  min-height: 68px;
  padding: 0 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 10, 13, 0.82);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 820;
  letter-spacing: 0.01em;
}

.brand picture {
  display: block;
  width: 24px;
  height: 24px;
}

.brand-logo {
  display: block;
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-search {
  position: relative;
  display: flex;
  align-items: center;
  width: min(360px, 34vw);
}

.header-search input {
  width: 100%;
  min-height: 36px;
}

.nav-links a,
.language-select {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  font-size: 0.9rem;
  font-weight: 680;
}

.nav-links a:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.language-select {
  gap: 8px;
  padding-right: 6px;
}

.language-select span {
  color: var(--faint);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.language-select a {
  min-height: 0;
  border: 0;
  padding: 0;
  color: var(--text);
  font-size: 0.86rem;
}

.app-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 72px;
}

.site-footer {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 0 0 36px;
  color: var(--faint);
  font-size: 0.86rem;
}

.site-footer a {
  color: var(--faint);
  font-weight: 500;
}

.site-footer a:hover {
  color: var(--muted);
}

.about-section {
  margin-bottom: 22px;
}

.about-section h2 {
  margin: 0 0 10px;
}

.about-section p {
  max-width: 760px;
  margin: 0 0 12px;
  color: var(--muted);
}

.reference-list {
  display: grid;
  max-width: 860px;
  gap: 10px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.reference-list a,
.about-section a {
  color: var(--text);
  font-weight: 740;
}

.page-header,
.show-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0;
  align-items: end;
  margin-bottom: 34px;
  padding: 34px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(67, 209, 200, 0.12), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02)),
    var(--panel);
  box-shadow: var(--shadow);
}

.show-hero {
  grid-template-columns: 170px minmax(0, 1fr);
  column-gap: 22px;
  align-items: center;
}

.show-hero > picture {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
}

.show-hero-poster {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.46);
}

.show-hero-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 820;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 14px;
  font-size: clamp(2.15rem, 5vw, 4.9rem);
  line-height: 0.94;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 4px;
  font-size: 1.35rem;
  line-height: 1.15;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 4px;
  font-size: 1rem;
  line-height: 1.25;
}

.lede {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--text);
  font-family: var(--zh-font);
  font-size: 1.02rem;
}

.movie-overview {
  margin-top: 14px;
  font-family: var(--ui-font);
  line-height: 1.55;
}

.back-link {
  display: inline-flex;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 680;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.hero-meta span,
.hero-meta a {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: #c7d0da;
  padding: 0 12px;
  font-size: 0.87rem;
  font-weight: 680;
}

.hero-meta a:hover {
  border-color: rgba(67, 209, 200, 0.5);
  color: var(--accent);
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 18px;
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

.section-head.compact {
  margin-bottom: 16px;
}

.empty-state,
.study-panel,
.table-card {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(16, 20, 26, 0.88);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
}

.empty-state,
.study-panel {
  padding: 24px;
}

.empty-state {
  text-align: center;
}

.empty-state p {
  color: var(--muted);
}

.show-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
}

.show-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(16, 20, 26, 0.82);
  padding: 10px;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.show-card a {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
}

.show-card:hover {
  transform: translateY(-2px);
  border-color: rgba(67, 209, 200, 0.36);
  background: rgba(21, 27, 35, 0.96);
}

.poster-frame {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  background: var(--panel-2);
  aspect-ratio: 2 / 3;
}

.poster-frame picture {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 2 / 3;
}

.poster-frame img,
.poster-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.poster-placeholder {
  display: grid;
  place-items: center;
  color: var(--faint);
  background: linear-gradient(135deg, #151b23, #202a36);
  font-weight: 720;
}

.poster-score {
  position: absolute;
  right: 9px;
  bottom: 9px;
  min-width: 42px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(8, 10, 13, 0.82);
  padding: 4px 8px;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 840;
  backdrop-filter: blur(10px);
}

.poster-rating {
  position: absolute;
  right: 9px;
  bottom: 43px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(8, 10, 13, 0.82);
  color: #f05a5f;
  padding: 4px 8px;
  font-size: 0.74rem;
  font-weight: 840;
  line-height: 1;
  backdrop-filter: blur(10px);
}

.poster-rating.is-rotten,
.hero-rating.is-rotten {
  color: #7fbf4d;
}

.poster-rating.is-imdb,
.hero-rating.is-imdb {
  color: #f1c96b;
}

.hero-rating.is-fresh {
  color: #f05a5f;
}

.show-card h3 {
  display: flex;
  height: 1.35em;
  min-width: 0;
  gap: 6px;
  align-items: baseline;
  margin: 12px 2px 0;
  overflow: hidden;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.35;
}

.title-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-year {
  margin-left: auto;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.86em;
  font-weight: 620;
}

.show-card p {
  margin: 6px 2px 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.cast-section {
  margin-bottom: 28px;
}

.cast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.cast-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(16, 20, 26, 0.72);
  padding: 8px;
  color: var(--text);
}

.cast-card:hover {
  border-color: rgba(67, 209, 200, 0.34);
  color: var(--text);
  background: rgba(21, 27, 35, 0.92);
}

.cast-card picture {
  display: block;
  width: 48px;
  height: 72px;
  aspect-ratio: 2 / 3;
}

.cast-card img,
.cast-photo-placeholder {
  display: block;
  width: 48px;
  height: 72px;
  aspect-ratio: 2 / 3;
  border-radius: 6px;
  object-fit: cover;
  background: linear-gradient(135deg, #151b23, #202a36);
}

.cast-card strong,
.cast-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cast-card strong {
  font-size: 0.94rem;
}

.cast-card small {
  color: var(--muted);
  font-size: 0.8rem;
}

.zh-subtitle {
  display: block;
  min-height: 1.25em;
  margin-top: 2px;
  overflow: visible;
  color: var(--text);
  font-family: var(--zh-font);
  font-size: 1rem;
  letter-spacing: 0;
  line-height: 1.25;
  text-overflow: ellipsis;
}

.title-pinyin {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-family: var(--ui-font);
  font-size: 0.92em;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pinyin .tone,
.title-pinyin .tone {
  color: inherit;
  font-weight: inherit;
}

.tone {
  font-weight: 700;
}

.tone-1 { color: #f05f5f; }
.tone-2 { color: #5fca7a; }
.tone-3 { color: #56a8f5; }
.tone-4 { color: #b98cff; }
.tone-0 { color: #9aa7b5; }

.show-hero .zh-subtitle {
  height: auto;
  max-width: 680px;
}

.show-card .zh-subtitle {
  min-height: 3.1em;
  height: auto;
  padding-bottom: 2px;
}

.hsk-breakdown {
  margin: 0;
}

.header-breakdown {
  margin-top: 18px;
  width: 100%;
}

.hsk-bar {
  display: flex;
  width: 100%;
  height: 28px;
  overflow: hidden;
  border-radius: 8px;
  background: #0b0f14;
}

.hsk-bar-mini {
  height: 8px;
  min-width: 120px;
}

.hsk-seg {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0 4px;
  color: #061014;
  font-size: 0.75rem;
  font-weight: 860;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hsk-0 { background: #758396; }
.hsk-1 { background: #61d394; }
.hsk-2 { background: #8ee36e; }
.hsk-3 { background: #d4df59; }
.hsk-4 { background: #f2c94c; }
.hsk-5 { background: #f2994a; }
.hsk-6 { background: #eb5757; color: #fff; }
.hsk-7 { background: #d7356d; color: #fff; }
.hsk-8 { background: #8e5cf7; color: #fff; }
.hsk-9 { background: #5a39b5; color: #fff; }
.cefr-a1 { background: #61d394; }
.cefr-a2 { background: #8ee36e; }
.cefr-b1 { background: #f2c94c; }
.cefr-b2 { background: #f2994a; }
.cefr-c1 { background: #eb5757; color: #fff; }
.cefr-c2 { background: #8e5cf7; color: #fff; }
.rating-generic { background: #43d1c8; }
.exam-score { background: #758396; }
.exam-level-0 { background: #61d394; }
.exam-level-1 { background: #7cdb81; }
.exam-level-2 { background: #a7df65; }
.exam-level-3 { background: #d4df59; }
.exam-level-4 { background: #f2c94c; }
.exam-level-5 { background: #f2a94a; }
.exam-level-6 { background: #f2994a; }
.exam-level-7 { background: #eb7657; }
.exam-level-8 { background: #eb5757; color: #fff; }
.exam-level-9 { background: #d7356d; color: #fff; }
.exam-level-10 { background: #8e5cf7; color: #fff; }
.exam-level-unknown { background: #758396; }

.hsk-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.82rem;
}

.hsk-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hsk-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.hsk-dot.hsk-1,
.hsk-1.hsk-dot { background: #61d394; }
.hsk-dot.hsk-2,
.hsk-2.hsk-dot { background: #8ee36e; }
.hsk-dot.hsk-3,
.hsk-3.hsk-dot { background: #d4df59; }
.hsk-dot.hsk-4,
.hsk-4.hsk-dot { background: #f2c94c; }
.hsk-dot.hsk-5,
.hsk-5.hsk-dot { background: #f2994a; }
.hsk-dot.hsk-6,
.hsk-6.hsk-dot { background: #eb5757; }
.hsk-dot.hsk-7,
.hsk-7.hsk-dot { background: #d7356d; }
.hsk-dot.hsk-8,
.hsk-8.hsk-dot { background: #8e5cf7; }
.hsk-dot.hsk-9,
.hsk-9.hsk-dot { background: #5a39b5; }
.hsk-dot.cefr-a1,
.cefr-a1.hsk-dot { background: #61d394; }
.hsk-dot.cefr-a2,
.cefr-a2.hsk-dot { background: #8ee36e; }
.hsk-dot.cefr-b1,
.cefr-b1.hsk-dot { background: #f2c94c; }
.hsk-dot.cefr-b2,
.cefr-b2.hsk-dot { background: #f2994a; }
.hsk-dot.cefr-c1,
.cefr-c1.hsk-dot { background: #eb5757; }
.hsk-dot.cefr-c2,
.cefr-c2.hsk-dot { background: #8e5cf7; }

.hsk-text-1 { color: #61d394; }
.hsk-text-2 { color: #8ee36e; }
.hsk-text-3 { color: #d4df59; }
.hsk-text-4 { color: #f2c94c; }
.hsk-text-5 { color: #f2994a; }
.hsk-text-6 { color: #ff7b7b; }
.hsk-text-7 { color: #ff6c9a; }

.difficulty-score {
  font-size: 1rem;
  font-weight: 860;
}

.difficulty-pill {
  display: inline-flex;
  min-width: 38px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 800;
}

.difficulty-pill.hsk-text-1 {
  border-color: rgba(97, 211, 148, 0.46);
  background: rgba(97, 211, 148, 0.12);
}

.difficulty-pill.hsk-text-2 {
  border-color: rgba(142, 227, 110, 0.46);
  background: rgba(142, 227, 110, 0.12);
}

.difficulty-pill.hsk-text-3 {
  border-color: rgba(212, 223, 89, 0.46);
  background: rgba(212, 223, 89, 0.12);
}

.difficulty-pill.hsk-text-4 {
  border-color: rgba(242, 201, 76, 0.48);
  background: rgba(242, 201, 76, 0.13);
}

.difficulty-pill.hsk-text-5 {
  border-color: rgba(242, 153, 74, 0.5);
  background: rgba(242, 153, 74, 0.13);
}

.difficulty-pill.hsk-text-6 {
  border-color: rgba(255, 123, 123, 0.52);
  background: rgba(255, 123, 123, 0.14);
}

.difficulty-pill.hsk-text-7 {
  border-color: rgba(255, 108, 154, 0.52);
  background: rgba(255, 108, 154, 0.14);
}

.table-card {
  overflow-x: auto;
}

.episode-table td:nth-child(3),
.episode-table td:nth-child(4) {
  white-space: nowrap;
}

.episode-table td:nth-child(5) {
  min-width: 190px;
}

.season-row td {
  border-top: 1px solid var(--line);
  background: rgba(67, 209, 200, 0.06);
  color: var(--text);
  font-weight: 780;
}

.season-row td:first-child {
  color: var(--accent);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.library-filters {
  justify-content: space-between;
}

.segmented-control {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b0f14;
}

.segmented-control label {
  display: inline-flex;
  cursor: pointer;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  border-right: 1px solid var(--line);
  color: var(--muted);
  padding: 0 13px;
  font-size: 0.9rem;
  font-weight: 720;
}

.segmented-control label:last-child span {
  border-right: 0;
}

.segmented-control input:checked + span {
  background: rgba(67, 209, 200, 0.14);
  color: var(--accent);
}

.library-pager {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.library-pager .pager-btn,
.library-pager .pager-status {
  min-height: 42px;
}

.library-pager .pager-status {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.word-table-tools {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.word-table-tools-bottom {
  margin-top: 8px;
  margin-bottom: 0;
}

.word-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(11, 15, 20, 0.8);
}

.word-table {
  min-width: 720px;
  font-size: 1rem;
}

.word-table td {
  padding: 10px 12px;
  vertical-align: middle;
}

.word-table tr:last-child td {
  border-bottom: 0;
}

.word-cell {
  width: 170px;
  min-width: 170px;
}

.word-table .hanzi,
.word-card .hanzi {
  display: block;
  overflow-wrap: anywhere;
  color: var(--text);
  font-family: var(--zh-font);
  font-size: 1.28rem;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.hanzi-tone {
  color: var(--text);
}

.hanzi-tone-1 { color: #f05f5f; }
.hanzi-tone-2 { color: #5fca7a; }
.hanzi-tone-3 { color: #56a8f5; }
.hanzi-tone-4 { color: #b98cff; }
.hanzi-tone-0 { color: #d8dee6; }

.zh-subtitle .hanzi-tone {
  font-size: 1.2rem;
  letter-spacing: 0.08em;
}

.word-card .hanzi {
  font-weight: 560;
}

.word-table .hanzi {
  font-size: 1.36rem;
  line-height: 1.2;
}

.hanzi.traditional {
  display: none;
}

.pinyin {
  display: block;
  margin-top: 0;
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.15;
}

.word-table .pinyin {
  font-size: 0.84rem;
  text-transform: lowercase;
}

.definition {
  min-width: 0;
  color: #d5dde6;
  font-size: 0.88rem;
  line-height: 1.32;
}

.word-table .definition {
  font-size: 0.96rem;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  justify-content: flex-end;
}

.word-table .badges {
  display: table-cell;
  min-width: 150px;
  text-align: right;
  white-space: nowrap;
}

.word-table .badge {
  margin: 2px 0 2px 5px;
}

.mobile-rating-strip {
  display: none;
}

.word-stack {
  display: grid;
  gap: 8px;
}

.word-card {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) max-content;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(11, 15, 20, 0.8);
  padding: 9px 12px;
}

.word-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  width: 170px;
}

.badge {
  display: inline-flex;
  min-height: 21px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 7px;
  font-size: 0.68rem;
  font-weight: 780;
  white-space: nowrap;
}

.badge-hsk,
.badge-rating {
  color: #061014;
}

.badge-hsk em {
  margin-right: 3px;
  font-style: italic;
  font-weight: 600;
}

.badge-tag,
.badge-status,
.badge-freq {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.tag-chengyu { background: rgba(242, 153, 74, 0.16); color: #ffc184; border-color: rgba(242, 153, 74, 0.28); }
.tag-xiehouyu { background: rgba(67, 209, 200, 0.12); color: #8cf7ee; border-color: rgba(67, 209, 200, 0.28); }
.tag-kouyu { background: rgba(104, 211, 145, 0.14); color: #a8efc3; border-color: rgba(104, 211, 145, 0.28); }
.tag-name { background: rgba(142, 92, 247, 0.18); color: #c7b4ff; border-color: rgba(142, 92, 247, 0.32); }
.tag-phrase { background: rgba(104, 211, 145, 0.14); color: #a8efc3; border-color: rgba(104, 211, 145, 0.28); }
.tag-interjection { background: rgba(255, 255, 255, 0.04); color: #b5c0cc; border-color: var(--line); }
.tag-onomatopoeia { background: rgba(255, 255, 255, 0.04); color: #b5c0cc; border-color: var(--line); }
.tag-estimated { background: rgba(242, 201, 76, 0.1); color: #f2c94c; border-color: rgba(242, 201, 76, 0.28); }
.tag-rare { background: rgba(255, 107, 118, 0.14); color: #ffb2ba; border-color: rgba(255, 107, 118, 0.3); }

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
}

.word-pager {
  justify-content: flex-end;
  margin: 0;
}

.pager-btn {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
  padding: 0 10px;
  font-size: 0.83rem;
  text-decoration: none;
}

.pager-btn:hover:not(.is-disabled) {
  border-color: rgba(67, 209, 200, 0.45);
  background: rgba(67, 209, 200, 0.1);
  color: var(--accent);
}

.pager-btn.is-disabled {
  opacity: 0.38;
}

.pager-status,
.muted,
.muted.small {
  color: var(--muted);
}

.muted.small {
  font-size: 0.84rem;
}

@media (max-width: 820px) {
  .topbar {
    position: sticky;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 10px 12px;
    padding: 12px 18px;
  }

  .nav-links {
    display: contents;
  }

  .header-search {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    width: 38px;
    margin-right: 46px;
    z-index: 60;
  }

  .header-search::before {
    position: absolute;
    top: 10px;
    left: 11px;
    width: 12px;
    height: 12px;
    border: 1.6px solid var(--text);
    border-radius: 999px;
    pointer-events: none;
    content: "";
  }

  .header-search::after {
    position: absolute;
    top: 23px;
    left: 23px;
    width: 7px;
    height: 1.6px;
    border-radius: 999px;
    background: var(--text);
    transform: rotate(45deg);
    transform-origin: left center;
    pointer-events: none;
    content: "";
  }

  .header-search input {
    width: 38px;
    min-height: 38px;
    border-color: var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: transparent;
    cursor: pointer;
    padding: 0;
    caret-color: transparent;
  }

  .header-search input::placeholder {
    color: transparent;
  }

  .header-search:focus-within {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: stretch;
    width: 100%;
    margin-right: 0;
  }

  .header-search:focus-within::before,
  .header-search:focus-within::after {
    display: none;
  }

  .header-search:focus-within input {
    width: 100%;
    background: #0b0f14;
    color: var(--text);
    cursor: text;
    padding: 0 12px;
    caret-color: var(--text);
  }

  .header-search:focus-within input::placeholder {
    color: var(--faint);
  }

  .app-shell {
    width: min(100% - 24px, 1180px);
    padding-top: 20px;
  }

  .site-footer {
    width: min(100% - 24px, 1180px);
    padding-bottom: 28px;
  }

  .page-header {
    grid-template-columns: 1fr;
    padding: 22px;
  }

  .show-hero {
    grid-template-columns: 128px minmax(0, 1fr);
    column-gap: 18px;
    align-items: start;
    padding: 22px;
  }

  .show-hero > picture,
  .show-hero-poster {
    width: 128px;
    height: 192px;
    max-width: none;
  }

  h1 {
    font-size: clamp(2rem, 13vw, 3.4rem);
  }

}

@media (max-width: 520px) {
  .nav-links a {
    padding: 0 10px;
    font-size: 0.84rem;
  }

  .header-search {
    width: 38px;
  }

  .header-search:focus-within {
    width: 100%;
  }

  .page-header,
  .show-hero,
  .study-panel,
  .empty-state {
    padding: 18px;
  }

  .show-hero {
    grid-template-columns: 86px minmax(0, 1fr);
    column-gap: 14px;
    align-items: start;
  }

  .show-hero > picture,
  .show-hero-poster {
    width: 86px;
    height: 129px;
    max-width: none;
    border-radius: 6px;
  }

  .show-hero h1 {
    font-size: 1.42rem;
    line-height: 1.12;
  }

  .show-hero .zh-subtitle .hanzi-tone {
    font-size: 1.05rem;
  }

  .show-hero .title-pinyin,
  .movie-overview {
    font-size: 0.86rem;
  }

  .movie-overview {
    margin-top: 10px;
    line-height: 1.38;
  }

  .show-hero .hero-meta {
    gap: 6px;
    margin-top: 12px;
  }

  .show-hero .hero-meta span,
  .show-hero .hero-meta a {
    min-height: 28px;
    padding: 0 9px;
    font-size: 0.76rem;
  }

  .show-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .word-card {
    grid-template-columns: 96px minmax(0, 1fr) max-content;
    gap: 8px;
    padding: 8px;
  }

  .word-head {
    width: 96px;
  }

  .word-card .hanzi {
    font-size: 1.14rem;
  }

  .badges {
    justify-content: flex-end;
  }

  .word-table-wrap {
    overflow-x: visible;
    max-width: 100%;
  }

  .word-table,
  .word-table tbody,
  .word-table tr,
  .word-table td {
    min-width: 0;
    max-width: 100%;
    display: block;
    width: 100%;
  }

  .word-table {
    table-layout: fixed;
  }

  .word-table tr {
    position: relative;
    display: grid;
    grid-template-columns: minmax(72px, 26%) minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    border-bottom: 1px solid var(--line-soft);
    padding: 9px 0 9px 8px;
    overflow: hidden;
  }

  .word-table td {
    border-bottom: 0;
    padding: 0;
  }

  .word-table .word-cell {
    width: auto;
    min-width: 0;
    max-width: 100%;
    padding-left: 8px;
  }

  .mobile-rating-strip {
    position: absolute;
    top: 9px;
    bottom: 9px;
    left: 0;
    display: block;
    width: 4px;
    border-radius: 999px;
  }

  .word-table .hanzi {
    font-size: 1.08rem;
  }

  .word-table .pinyin {
    font-size: 0.78rem;
    line-height: 1.25;
  }

  .word-table .definition {
    font-size: 0.88rem;
    line-height: 1.28;
  }

  .word-table .badges {
    grid-column: 2;
    min-width: 0;
    max-width: 100%;
    margin-top: 4px;
    text-align: left;
    white-space: normal;
  }

  .word-table .badge-rating {
    display: none;
  }

  .filters select {
    width: 100%;
  }

  .segmented-control,
  .segmented-control label,
  .segmented-control span {
    flex: 1;
  }

  .segmented-control span {
    justify-content: center;
  }
}
