@layer reset, base, layout, components, responsive;
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, p { margin: 0; }
  button, input { font: inherit; }
  button, a { -webkit-tap-highlight-color: transparent; }
  button { cursor: pointer; }
  [hidden] { display: none !important; }
}
@layer base {
  :root { color-scheme: light; --paper: #f7f7fc; --ink: #292b49; --muted: #717288; --line: #dedfeb; --accent: #3454c5; --warm: #f3b56a; --rust: #d7563d; --serif: Georgia, 'Times New Roman', serif; --han: 'Noto Serif CJK SC', 'Songti SC', SimSun, serif; }
  body { background: var(--paper); color: var(--ink); font: 15px/1.6 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
  a { color: inherit; text-decoration: none; }
  button { color: inherit; }
  button:disabled { cursor: default; }
  button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #d7563d; outline-offset: 5px; }
  h1, h2 { font-family: var(--serif); font-weight: 400; letter-spacing: -.045em; line-height: 1.12; }
  h1 { font-size: clamp(32px, 3.1vw, 43px); }
  h2 { font-size: 33px; }
  h3 { font-size: 12px; font-weight: 600; }
  ::selection { background: #f3b56a88; }
}
@layer layout {
  .page-shell { max-width: 1120px; padding: 0 44px; margin: auto; }
  .site-header { min-height: 128px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
  .brand { display: flex; align-items: center; gap: 15px; }
  .brand-seal { display: grid; place-content: center; width: 45px; height: 54px; border: 1px solid #bb4933; background: var(--rust); color: #fff8ef; font: 20px/1.12 var(--han); border-radius: 2px 2px 7px 2px; transform: rotate(-3deg); }
  .brand-name { display: block; font-family: var(--serif); font-size: 31px; line-height: 1.2; letter-spacing: -1px; }
  .brand-dot { color: var(--rust); }
  .brand-note { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; letter-spacing: .03em; }
  .main-nav { display: flex; align-items: center; gap: 30px; border-bottom: 1px solid var(--line); min-height: 51px; }
  .main-nav a { font-size: 12px; padding: 15px 0 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
  .main-nav a[aria-current] { border-color: var(--accent); font-weight: 650; }
  .main-nav a:hover { color: var(--rust); }
  .nav-note { color: var(--muted); font-size: 10px; margin-left: auto; letter-spacing: .04em; }
  .nav-note span { margin: 0 9px; opacity: .5; }
  main { min-height: 600px; }
  .app-grid { display: grid; grid-template-columns: minmax(0, 1fr) 258px; gap: 68px; padding: 45px 0 38px; align-items: start; }
  .section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 24px; }
  .eyebrow { color: var(--rust); font-size: 9px; font-weight: 650; letter-spacing: .16em; margin-bottom: 12px; }
  .puzzle-date { color: var(--muted); font-size: 11px; text-align: right; white-space: nowrap; padding-bottom: 3px; }
  .practice-notes { border-left: 1px solid var(--line); padding-left: 29px; margin-top: 3px; }
  .notes-heading > p:last-child { font-size: 12px; color: var(--muted); margin-top: 16px; }
  .notes-heading h2 { line-height: 1.2; }
  .site-footer { display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--line); color: var(--muted); padding: 23px 0 28px; font-size: 10px; }
  .site-footer > span:first-child { font-family: var(--han); font-size: 15px; color: var(--ink); }
  .site-footer a { margin-left: auto; }
}
@layer components {
  .skip-link { position: fixed; top: -80px; left: 15px; z-index: 100; padding: 12px; background: white; }
  .skip-link:focus { top: 12px; }
  .quiet-button, .primary-button, .text-button, .icon-button { border: none; background: none; font-weight: 550; }
  .quiet-button { border: 1px solid var(--line); border-radius: 5px; font-size: 11px; padding: 9px 13px; display: inline-flex; align-items: center; gap: 9px; justify-content: center; }
  .quiet-button:hover { background: #eeeff8; }
  .help-button { border: none; padding-right: 0; }
  .help-button > span { border: 1px solid #9296b1; border-radius: 50%; width: 16px; height: 16px; display: inline-grid; place-content: center; font-size: 10px; }
  .primary-button { color: #fffdf9; background: var(--accent); display: inline-flex; align-items: center; justify-content: center; gap: 17px; padding: 11px 18px; border-radius: 5px; font-size: 12px; line-height: 1.5; }
  .primary-button:hover { background: #2843a3; }
  .primary-button:disabled { background: #e5e7f3; color: #858ba8; }
  .text-button { color: var(--muted); font-size: 11px; padding: 10px 0; }
  .text-button:disabled { opacity: .4; }
  .icon-button { font-size: 25px; line-height: 1; padding: 3px 7px; }
  .puzzle-card { background: #ffffff; border: 1px solid var(--line); border-radius: 9px; padding: 27px 34px 22px; box-shadow: 0 3px 9px #292b4903; }
  .clue-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; }
  .small-seal { color: var(--rust); border: 1px solid #e7a58f; border-radius: 2px; font: 15px var(--han); display: inline-grid; place-content: center; width: 23px; height: 23px; }
  .clue { font-family: var(--serif); font-size: 21px; line-height: 1.45; margin: 15px 0 27px; text-wrap: pretty; }
  .board-heading, .tile-bank-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 10px; margin-bottom: 12px; }
  .board-heading > :last-child, .tile-bank-heading > :last-child { color: var(--muted); font-size: 9px; }
  .guess-board { width: min(100%, 294px); display: grid; gap: 8px; margin: 0 auto; }
  .guess-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .guess-cell { aspect-ratio: 1.13; border: 1px solid #e6e7f0; border-radius: 5px; display: grid; place-content: center; font: 29px/1 var(--han); background: #f9f9fd; }
  .guess-row.active .guess-cell { background: #ffffff; border-color: #bbc4e9; }
  button.guess-cell { border-color: #6c83cc !important; background: #edf1ff !important; }
  .guess-cell.correct { background: #4963c9; border-color: #4963c9; color: #fffdf9; }
  .guess-cell.present { background: var(--warm); border-color: var(--warm); color: #51381c; }
  .guess-cell.absent { background: #e5e7f0; border-color: #e5e7f0; color: #6e738c; }
  .guess-actions { display: flex; align-items: center; justify-content: space-between; margin: 16px auto 0; max-width: 294px; }
  .game-message { min-height: 17px; margin-top: 11px; text-align: center; color: var(--muted); font-size: 10px; }
  .tile-bank-heading { border-top: 1px solid #e8e9f2; padding-top: 20px; margin-top: 18px; margin-bottom: 13px; }
  .tile-bank { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 7px; }
  .character-tile { min-width: 0; aspect-ratio: .95; background: #f0f2fd; border: 1px solid #d9def3; border-bottom-width: 3px; border-radius: 4px; font: 23px/1 var(--han); transition: background .12s, transform .12s; }
  .character-tile:not(:disabled):hover { background: #e4eafe; border-color: #8399e0; transform: translateY(-2px); }
  .character-tile.selected { background: #e9edfb; color: #9aa5cc; border-color: #dbe1f5; border-bottom-width: 1px; }
  .character-tile.eliminated { opacity: .35; background: #e9eaf1; border-bottom-width: 1px; }
  .character-tile:disabled:not(.selected):not(.eliminated) { opacity: .55; }
  .legend { display: flex; justify-content: center; gap: 16px; margin-top: 20px; color: var(--muted); font-size: 9px; }
  .legend > span { display: inline-flex; align-items: center; gap: 5px; }
  .legend-dot { width: 7px; height: 7px; display: inline-block; border-radius: 2px; }
  .legend-dot.correct, .example-tile.correct { background: #4963c9; }
  .legend-dot.present, .example-tile.present { background: var(--warm); }
  .legend-dot.absent, .example-tile.absent { background: #d8ddeb; }
  .under-card-note { text-align: center; color: var(--muted); font-size: 10px; margin: 17px 0 0; }
  .under-card-note span { color: var(--rust); margin-right: 5px; }
  .stats-grid { display: grid; grid-template-columns: 1fr 1fr; margin: 27px 0 24px; gap: 21px 12px; }
  .stat-number { display: block; font-family: var(--serif); font-size: 30px; line-height: 1.1; }
  .stat-label { display: block; font-size: 9px; color: var(--muted); margin-top: 5px; }
  .distribution-section { border-top: 1px solid var(--line); padding-top: 19px; }
  .distribution { margin-top: 13px; display: grid; gap: 6px; }
  .distribution-row { display: grid; grid-template-columns: 9px 1fr; gap: 9px; align-items: center; font-size: 10px; color: var(--muted); }
  .distribution-bar { min-width: 19px; height: 20px; background: #dce3ff; border-radius: 2px; text-align: right; padding-right: 6px; line-height: 20px; color: var(--accent); font-size: 9px; }
  .distribution-bar.empty { background: #e8eaf4; color: #8a91ac; }
  .subtle-note { color: var(--muted); font-size: 11px; line-height: 1.65; }
  .distribution-section .subtle-note { font-size: 9px; margin-top: 12px; }
  .margin-note { margin-top: 28px; padding: 20px 0 22px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .margin-characters { display: block; font: 24px var(--han); letter-spacing: .17em; }
  .margin-pinyin { color: var(--rust); display: block; font: italic 11px var(--serif); margin: 7px 0 11px; }
  .margin-note p { font: italic 17px/1.5 var(--serif); color: #70728e; }
  .local-note { color: var(--muted); font-size: 9px; margin-top: 18px; }
  .result { text-align: center; border-radius: 6px; background: #eef2ff; padding: 20px 12px; margin-top: 15px; }
  .result .eyebrow { margin-bottom: 10px; }
  .answer { font: 37px/1.5 var(--han); letter-spacing: .16em; padding-left: .16em; }
  .answer-pinyin { font: italic 13px var(--serif); color: var(--muted); min-height: 10px; margin-top: 3px; }
  .result-actions { display: flex; justify-content: center; gap: 12px; margin-top: 15px; }
  .history-section { padding: 43px 0 50px; }
  .history-section .section-heading { align-items: center; }
  .history-description { color: var(--muted); font-size: 13px; max-width: 570px; }
  .backup-actions { display: flex; gap: 8px; }
  .history-summary { display: flex; flex-wrap: wrap; gap: 35px; padding: 28px 0; }
  .history-list { border-top: 1px solid var(--line); margin-bottom: 22px; }
  .history-row { display: grid; grid-template-columns: 1fr 90px 120px 20px; align-items: center; gap: 18px; border-bottom: 1px solid var(--line); padding: 18px 12px; font-size: 12px; }
  .history-row:hover { background: #eff1fb; }
  .history-title { font-family: var(--serif); font-size: 18px; }
  .history-title small { display: block; font: 10px -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: var(--muted); margin-top: 4px; }
  .history-outcome { font-size: 10px; }
  .history-outcome.won { color: var(--accent); }
  .history-outcome.lost { color: var(--rust); }
  .history-outcome.playing { color: var(--muted); }
  .history-empty { padding: 50px 20px; text-align: center; }
  .history-empty h2 { font-size: 28px; margin-bottom: 12px; }
  .history-empty p { color: var(--muted); margin-bottom: 23px; font-size: 12px; }
  .notice { border: 1px solid #e3b284; background: #fff2e3; padding: 13px 17px; font-size: 12px; margin-top: 22px; border-radius: 5px; }
  .error-notice { margin: 45px 0; }
  .error-notice p { margin: 15px 0; }
  .loading { padding: 70px 0; color: var(--muted); font-family: var(--serif); font-size: 22px; }
  dialog { max-width: min(510px, calc(100% - 30px)); width: 510px; background: #ffffff; border: 1px solid var(--line); border-radius: 12px; padding: 28px 32px 32px; color: var(--ink); max-height: calc(100dvh - 40px); }
  dialog::backdrop { background: #242d5877; backdrop-filter: blur(3px); }
  .dialog-heading { display: flex; justify-content: space-between; align-items: center; }
  .dialog-heading .eyebrow { margin-bottom: 0; }
  dialog h2 { margin: 13px 0 20px; font-size: 36px; }
  dialog p, dialog li { font-size: 12px; }
  dialog ol { padding-left: 20px; margin: 20px 0; }
  dialog li { padding-left: 5px; margin-bottom: 7px; }
  .help-colors { margin: 20px 0; }
  .help-colors p { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
  .example-tile { display: grid; place-content: center; border-radius: 4px; width: 36px; height: 36px; flex-shrink: 0; font: 24px var(--han); }
  .example-tile.correct { color: #fffdf9; }
  dialog .subtle-note { margin: 15px 0 22px; font-size: 11px; }
  .toast { position: fixed; bottom: 25px; left: 50%; transform: translateX(-50%); background: var(--ink); color: white; border-radius: 7px; padding: 12px 20px; font-size: 12px; z-index: 20; max-width: calc(100% - 30px); box-shadow: 0 4px 30px #0002; }
}
@layer responsive {
  @media (min-width: 1300px) { .page-shell { max-width: 1160px; } .app-grid { gap: 80px; grid-template-columns: minmax(0, 1fr) 280px; } }
  @media (max-width: 850px) { .page-shell { padding: 0 28px; } .app-grid { gap: 30px; grid-template-columns: minmax(0, 1fr) 210px; } .practice-notes { padding-left: 22px; } .puzzle-card { padding: 24px; } .nav-note { display: none; } .puzzle-date { max-width: 100px; white-space: normal; } .tile-bank { gap: 5px; } .character-tile { font-size: 21px; } .notes-heading h2 { font-size: 29px; } }
  @media (max-width: 650px) { .page-shell { max-width: 480px; padding: 0 20px; } .site-header { min-height: 102px; gap: 10px; } .brand-name { font-size: 28px; } .brand-note { font-size: 10px; } .brand { gap: 11px; } .brand-seal { width: 37px; height: 46px; font-size: 17px; } .help-button { font-size: 0; gap: 0; } .help-button > span { width: 27px; height: 27px; font-size: 14px; } .main-nav { justify-content: space-between; gap: 20px; } .main-nav a { font-size: 11px; } .app-grid { grid-template-columns: 1fr; gap: 40px; padding: 30px 0; } .section-heading { margin-bottom: 20px; } h1 { font-size: 34px; } .puzzle-date { font-size: 10px; } .puzzle-card { padding: 23px 22px 20px; } .clue { font-size: 20px; margin-bottom: 24px; } .character-tile { font-size: 22px; } .practice-notes { padding: 27px 0 0; border: none; border-top: 1px solid var(--line); } .notes-heading h2 { font-size: 30px; } .notes-heading h2 br { display: none; } .notes-heading > p:last-child { margin-top: 9px; } .stats-grid { grid-template-columns: repeat(4, 1fr); margin: 22px 0; } .stat-number { font-size: 28px; } .stat-label { font-size: 9px; } .margin-note { display: none; } .local-note { margin-top: 20px; } .local-note br { display: none; } .site-footer { flex-wrap: wrap; row-gap: 8px; } .site-footer a { margin-left: auto; } .legend { gap: 11px; font-size: 8px; } .history-section { padding-top: 29px; } .history-section .section-heading { align-items: flex-start; flex-direction: column; gap: 22px; } .history-row { grid-template-columns: 1fr 58px 80px 10px; gap: 7px; padding: 15px 2px; font-size: 10px; } .history-title { font-size: 16px; } .history-outcome { font-size: 9px; } .history-summary { gap: 25px; } .history-summary .stat-number { font-size: 27px; } }
  @media (max-width: 360px) { .page-shell { padding: 0 14px; } .puzzle-card { padding: 20px 15px; } .character-tile { font-size: 20px; } .legend { gap: 8px; } .clue { font-size: 19px; } .puzzle-date { max-width: 84px; } h1 { font-size: 30px; } }
  @media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
}
