:root {
  color-scheme: light;
  --paper: #f7f4ec;
  --panel: #fffdf8;
  --ink: #192e27;
  --muted: #526158;
  --line: #dcdace;
  --deep: #1d3a30;
  --soft: #eaece2;
  --seal: #a54032;
  --serif: Georgia, "Noto Serif SC", "Songti SC", SimSun, serif;
  --calligraphy: "Kaiti SC", KaiTi, STKaiti, "Songti SC", SimSun, serif;
  --sans: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; color: var(--ink); background: var(--paper); font: 16px/1.5 var(--sans); }
main { flex: 1; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .42; }
:focus-visible { outline: 2px solid var(--seal); outline-offset: 4px; }
p, h1, h2 { margin: 0; }
.shell { width: min(1170px, calc(100% - clamp(36px, 7vw, 110px))); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.site-header { border-bottom: 1px solid var(--line); background: #faf8f2; }
.header-inner { min-height: 71px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 15px; }
.brand { display: inline-flex; justify-self: start; align-items: center; gap: 11px; white-space: nowrap; }
.brand-mark { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 7px; background: var(--seal); color: #fff8e9; font: 700 24px/1 var(--serif); }
.brand-name { font: 700 20px/1.1 var(--serif); letter-spacing: .06em; }
nav { display: flex; height: 100%; gap: clamp(12px, 2.4vw, 31px); }
nav a { position: relative; display: grid; align-content: center; gap: 1px; min-height: 52px; color: var(--muted); font-size: 14px; font-weight: 650; white-space: nowrap; }
nav a:hover, nav a[aria-current] { color: var(--ink); }
nav a[aria-current]::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: var(--seal); content: ""; }
.header-progress { justify-self: end; display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 20px; color: var(--muted); font-size: 11px; font-weight: 650; white-space: nowrap; }
.header-progress:hover { background: var(--soft); }
.progress-dot { width: 6px; height: 6px; border-radius: 50%; background: #51836c; }

.hero { display: grid; grid-template-columns: minmax(0, .93fr) minmax(0, 1.07fr); align-items: center; gap: clamp(32px, 6vw, 93px); padding-block: clamp(31px, 5.7vw, 78px) clamp(31px, 4.5vw, 61px); }
.eyebrow { color: var(--deep); font: 750 11px/1.3 var(--sans); letter-spacing: .13em; }
.hero-label { display: flex; align-items: center; gap: 7px; }
.seal-line { display: inline-block; width: 18px; height: 2px; background: var(--seal); }
.hero h1 { margin-top: 17px; font: 700 clamp(42px, 5.4vw, 72px)/1.1 var(--serif); letter-spacing: -.06em; }
.hero-period { color: var(--seal); }
.hero-intro { max-width: 46ch; margin-top: clamp(17px, 2.3vw, 27px); font-size: clamp(14px, 1.7vw, 17px); line-height: 1.75; }
.hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 19px; margin-top: 25px; }
.hero-actions .primary { min-width: 155px; }
.plain-link { display: inline-flex; align-items: center; gap: 7px; min-height: 39px; color: var(--deep); font-size: 13px; font-weight: 720; white-space: nowrap; }
.plain-link:hover { text-decoration: underline; text-underline-offset: 4px; }

.cover { position: relative; isolation: isolate; min-height: clamp(338px, 37vw, 475px); display: grid; grid-template-rows: auto 1fr auto; padding: clamp(17px, 2.4vw, 29px); overflow: hidden; border-radius: 3px; background: radial-gradient(ellipse at 52% 46%, #2a5040 0, #19382e 64%, #142d25 100%); color: #f4e6cb; box-shadow: 0 14px 30px #213c261e; }
.cover::before { position: absolute; z-index: -1; inset: 10px; border: 1px solid #e8e3ba32; content: ""; }
.cover::after { position: absolute; z-index: -1; inset: 11px; background-image: radial-gradient(#d9e3c322 .65px, transparent .8px); background-size: 13px 13px; opacity: .65; content: ""; }
.cover-top, .cover-bottom { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: #d0d8bc; font: 650 clamp(8px, 1.1vw, 11px)/1.1 var(--mono); letter-spacing: .12em; white-space: nowrap; }
.cover-top span:first-child { color: #f5e5c7; font: 700 14px/1 var(--serif); letter-spacing: .19em; }
.cover-body { position: relative; display: grid; place-items: center; min-height: 0; }
.cover-grid { position: relative; display: grid; place-items: center; width: min(68%, 302px); aspect-ratio: 1; border: 1px solid #d8dec05c; background: linear-gradient(0deg, transparent calc(50% - .5px), #d8dec038 50%, transparent calc(50% + .5px)), linear-gradient(90deg, transparent calc(50% - .5px), #d8dec038 50%, transparent calc(50% + .5px)); }
.cover-grid::before, .cover-grid::after { position: absolute; left: 50%; top: 50%; width: 141%; border-top: 1px dashed #d8dec038; transform: translate(-50%, -50%) rotate(45deg); content: ""; }
.cover-grid::after { transform: translate(-50%, -50%) rotate(-45deg); }
.cover-glyph { z-index: 1; margin-top: -.07em; color: #faedcc; font: 400 clamp(151px, 19vw, 248px)/1 var(--calligraphy); }
.cover-side { position: absolute; left: 0; top: 50%; color: #c3cfaf; font: 650 9px/1 var(--mono); letter-spacing: .17em; white-space: nowrap; writing-mode: vertical-rl; transform: translateY(-50%) rotate(180deg); }
.cover-seal { position: absolute; right: 2.5%; bottom: 13%; display: grid; place-items: center; width: 33px; height: 39px; border: 1px solid #ebb3a1; border-radius: 3px; background: #a54736; color: #fff1d5; font: 700 12px/1 var(--serif); letter-spacing: .07em; writing-mode: vertical-rl; text-orientation: upright; }
.cover-numbers { color: #f5e5c7; font-variant-numeric: tabular-nums; }

.learning-strip { display: grid; grid-template-columns: 1.07fr repeat(3, 1fr); align-items: stretch; border-block: 1px solid var(--line); }
.strip-intro, .strip-item { padding: 19px clamp(12px, 2.2vw, 28px); }
.strip-intro { padding-left: 0; align-self: center; }
.strip-intro h2 { margin-top: 4px; font: 700 clamp(19px, 2.7vw, 30px)/1.2 var(--serif); }
.strip-item { display: grid; align-content: start; gap: 2px; border-left: 1px solid var(--line); }
a.strip-item:hover { background: var(--soft); }
.strip-label, .strip-detail { color: var(--muted); font-size: 12px; }
.strip-item strong { font: 650 29px/1.13 var(--serif); font-variant-numeric: tabular-nums; }
.strip-detail { font-size: 11px; }

.sample-section { padding-block: clamp(35px, 6vw, 73px) clamp(40px, 6vw, 75px); }
.sample-heading { display: flex; justify-content: space-between; align-items: end; gap: 14px; margin-bottom: 19px; }
.sample-heading h2 { margin-top: 6px; font: 700 clamp(24px, 4vw, 43px)/1.19 var(--serif); letter-spacing: -.04em; }
.sample-heading p:not(.eyebrow) { margin-top: 7px; color: var(--muted); font-size: 14px; }
.sample-characters { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); margin: 0; padding: 0; border: 1px solid var(--line); list-style: none; background: var(--panel); }
.sample-characters li { display: grid; justify-items: center; padding-bottom: 7px; }
.sample-characters li + li { border-left: 1px solid var(--line); }
.sample-characters a { width: 100%; min-height: clamp(65px, 8vw, 94px); display: grid; justify-items: center; align-content: center; gap: 6px; }
.sample-characters a:hover { background: var(--soft); }
.sample-characters a:focus-visible { outline-offset: -4px; }
.sample-number { color: var(--muted); font: 11px/1 var(--mono); }
.sample-characters strong { font: 400 clamp(25px, 4.5vw, 48px)/1.1 var(--calligraphy); }

.study-layout { display: grid; grid-template-columns: minmax(155px, .65fr) minmax(0, 1.65fr); align-items: start; gap: clamp(24px, 5.5vw, 80px); padding-block: clamp(32px, 6vw, 78px) 60px; }
.overview { padding-top: clamp(5px, 3.5vw, 48px); }
.overview h1, .index-heading h1 { margin-top: 9px; font: 700 clamp(38px, 5.2vw, 68px)/1.15 var(--serif); letter-spacing: -.05em; }
.intro { max-width: 35ch; margin-top: 16px; color: var(--muted); font-size: 15px; }
.progress-block { margin-top: 28px; max-width: 290px; }
.progress-block p { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; }
.progress-block strong { color: var(--deep); font-variant-numeric: tabular-nums; }
progress { width: 100%; height: 5px; display: block; margin-top: 8px; border: 0; background: #e5e4d9; color: var(--deep); }
progress::-webkit-progress-bar { background: #e5e4d9; }
progress::-webkit-progress-value { background: var(--deep); }
progress::-moz-progress-bar { background: var(--deep); }
.review-link { display: inline-flex; gap: 8px; align-items: center; min-height: 37px; margin-top: 5px; color: var(--deep); font-size: 13px; font-weight: 650; }
.review-link:hover { text-decoration: underline; }

.character-panel { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); column-gap: clamp(17px, 3vw, 38px); padding: clamp(17px, 3vw, 35px); border: 1px solid var(--line); border-radius: 4px; background: var(--panel); box-shadow: 0 12px 38px #263f1e0b; }
.panel-top { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 20px; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.status-label { color: var(--muted); font-size: 12px; }
.glyph-space { min-height: clamp(160px, 26vw, 285px); display: grid; justify-items: center; align-content: center; gap: 7px; padding-block: 12px; }
.glyph { color: var(--ink); font: 400 clamp(108px, 14vw, 180px)/1.1 var(--calligraphy); }
.pronounce { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: 5px; background: transparent; color: var(--deep); font-size: 13px; font-weight: 650; }
.pronounce:hover, .pronounce.playing { border-color: #a2b5a7; background: var(--soft); }
.pronounce.playing svg { color: var(--seal); }
.pronounce-compact { width: 38px; height: 38px; padding: 0; border-color: transparent; }
.pronounce-compact span { display: none; }
.pronunciation-note { position: fixed; z-index: 3; right: 16px; bottom: 16px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); color: var(--ink); box-shadow: 0 4px 20px #263f1e22; font-size: 14px; }
.pronunciation-note:empty { display: none; }
.definition { align-self: center; min-height: 95px; padding: 7px 0 7px 19px; border-left: 1px solid var(--line); }
.meaning { margin-top: 9px; font-size: clamp(16px, 2vw, 23px); line-height: 1.35; overflow-wrap: anywhere; }
.definition .button { margin-top: 9px; }
.ratings { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 15px; border-top: 1px solid var(--line); }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 44px; padding: 8px 13px; border: 1px solid transparent; border-radius: 5px; font-size: 14px; font-weight: 700; text-align: center; }
.primary { background: var(--deep); color: #fffdf5; }
.primary:hover { background: #112e23; }
.secondary { border-color: var(--line); background: var(--panel); color: var(--deep); }
.secondary:not(:disabled):hover { background: var(--soft); }
.action-arrow { margin-left: auto; font-size: 16px; }
.study-nav { grid-column: 1 / -1; display: flex; justify-content: space-between; margin-top: 12px; }
.study-nav button { min-height: 33px; padding: 4px 0; border: 0; background: transparent; color: var(--muted); font-size: 13px; }
.study-nav button:not(:disabled):hover { color: var(--deep); text-decoration: underline; }
.empty { min-height: 335px; grid-template-columns: 1fr; align-content: center; justify-items: start; gap: 13px; }
.empty h2 { font: 700 29px/1.25 var(--serif); }
.empty > p:not(.eyebrow) { color: var(--muted); font-size: 14px; }

.index-view { padding-block: 43px 57px; }
.index-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 24px; }
.index-heading h1 { font-size: clamp(33px, 5.1vw, 57px); }
.index-heading p:not(.eyebrow) { color: var(--muted); margin-top: 8px; font-size: 14px; }
.search { min-width: min(250px, 100%); color: var(--deep); font-size: 13px; font-weight: 650; }
.search input { display: block; width: 100%; min-height: 43px; margin-top: 5px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); color: var(--ink); }
.index-list { border: 1px solid var(--line); border-radius: 4px; overflow: hidden; background: var(--panel); }
.index-columns, .index-entry { display: grid; grid-template-columns: 65px 76px minmax(0, 1fr); gap: 12px; align-items: center; padding: 9px 17px; text-align: left; }
.index-columns { grid-template-columns: 65px 76px minmax(0, 1fr) 38px; background: var(--deep); color: #edf1dd; font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.index-columns span:last-child { text-align: center; }
.index-list ul { padding: 0; margin: 0; list-style: none; }
.index-list li { display: grid; grid-template-columns: minmax(0, 1fr) 55px; align-items: center; }
.index-list li + li { border-top: 1px solid var(--line); }
.index-entry { width: 100%; min-height: 53px; border: 0; background: transparent; color: var(--ink); }
.index-entry:hover { background: var(--soft); }
.index-entry:focus-visible { outline-offset: -3px; }
.index-number { color: var(--muted); font: 12px/1.2 var(--mono); }
.index-glyph { font: 400 28px/1 var(--calligraphy); }
.index-meaning { font-size: 14px; overflow-wrap: anywhere; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 15px; }
.pagination p, .no-results { color: var(--muted); font-size: 13px; }
.no-results { padding: 18px; }

.site-footer { background: #eaece2; border-top: 1px solid var(--line); }
.footer-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; padding-block: 15px; color: var(--muted); font-size: 12px; }
.footer-brand { color: var(--ink); font: 700 18px/1.2 var(--serif); letter-spacing: .05em; }
.site-footer a:hover { text-decoration: underline; }

@media (max-width: 800px) {
  .hero { gap: 26px; }
  .hero h1 { font-size: clamp(40px, 5.6vw, 48px); }
  .cover { min-height: 306px; }
  .cover-glyph { font-size: clamp(128px, 20vw, 173px); }
}

@media (max-width: 650px) {
  .shell { width: min(560px, calc(100% - 32px)); }
  .header-inner { min-height: 61px; grid-template-columns: auto 1fr; gap: 12px; }
  nav { justify-content: end; gap: clamp(9px, 3.2vw, 20px); }
  .header-progress { display: none; }
  .hero { grid-template-columns: 1fr; gap: 24px; padding-block: 28px 26px; }
  .hero h1 { margin-top: 10px; font-size: clamp(42px, 9.5vw, 58px); }
  .hero-intro { margin-top: 12px; }
  .hero-actions { margin-top: 16px; }
  .cover { min-height: 285px; }
  .cover-grid { width: min(65%, 203px); }
  .cover-glyph { font-size: 151px; }
  .learning-strip { grid-template-columns: repeat(3, 1fr); }
  .strip-intro { grid-column: 1 / -1; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .strip-item { padding: 12px 8px; }
  .strip-item:nth-child(2) { border-left: 0; padding-left: 0; }
  .sample-characters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sample-characters li:nth-child(5) { border-left: 0; }
  .sample-characters li:nth-child(n+5) { border-top: 1px solid var(--line); }
  .study-layout { grid-template-columns: 1fr; gap: 19px; padding-block: 24px 36px; }
  .overview { padding-top: 0; }
  .overview h1 { margin-top: 5px; font-size: 39px; }
  .intro { margin-top: 5px; font-size: 14px; }
  .progress-block { margin-top: 13px; max-width: none; }
  .review-link { min-height: 24px; }
  .glyph-space { min-height: 148px; }
  .index-view { padding-block: 26px 38px; }
  .index-heading { flex-direction: column; align-items: stretch; gap: 13px; }
}

@media (max-width: 405px) {
  .brand { gap: 6px; }
  .brand-mark { width: 30px; height: 30px; font-size: 20px; }
  .brand-name { font-size: 18px; }
  nav a { font-size: 13px; }
  .sample-heading { flex-wrap: wrap; }
  .character-panel { grid-template-columns: 1fr; }
  .definition { min-height: 73px; padding: 10px 0 13px; border-left: 0; border-top: 1px solid var(--line); }
  .button { flex-wrap: wrap; gap: 4px 5px; padding-inline: 8px; }
  .index-columns, .index-entry { grid-template-columns: 41px 40px minmax(0, 1fr); gap: 6px; padding-inline: 10px; }
  .index-columns { grid-template-columns: 41px 40px minmax(0, 1fr) 38px; }
  .index-list li { grid-template-columns: minmax(0, 1fr) 48px; }
}

@media (max-width: 360px) {
  .header-inner { gap: 8px; }
  .brand-name { font-size: 15px; letter-spacing: .025em; }
  nav { gap: 7px; }
  nav a { font-size: 12px; }
  .hero h1 { font-size: 37px; }
}
