  :root {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface2: #334155;
    --border: #475569;
    --text: #e2e8f0;
    --text2: #94a3b8;
    --accent: #38bdf8;
    --accent2: #818cf8;
    --success: #4ade80;
    --danger: #f87171;
    --warning: #fbbf24;
    --radius: 12px;
    --radius-sm: 8px;
  }

  * { margin: 0; padding: 0; box-sizing: border-box; }

  body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
  }

  .container {
    width: 100%;
    max-width: 700px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-top: 20px;
  }

  .header {
    text-align: center;
    margin-bottom: 6px;
  }
  .header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  .header .subtitle {
    color: var(--text2);
    font-size: 0.85rem;
    margin-top: 2px;
  }

  .diff-select {
    display: flex;
    gap: 8px;
    justify-content: center;
  }
  .diff-btn {
    padding: 7px 18px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text2);
    cursor: pointer;
    font-size: 0.85rem;
    transition: border-color 0.2s, color 0.2s, background-color 0.2s;
  }
  .diff-btn:hover { border-color: var(--accent); color: var(--text); }
  .diff-btn.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }

  .target-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 20px;
    text-align: center;
  }
  .target-card .label {
    color: var(--text2);
    font-size: 0.8rem;
    margin-bottom: 6px;
  }
  .target-card .target-letters {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-size: 1.4rem;
    font-weight: 700;
  }
  .target-card .target-letters .start {
    color: var(--success);
  }
  .target-card .target-letters .arrow {
    color: var(--text2);
    font-size: 1.1rem;
  }
  .target-card .target-letters .goal {
    color: var(--accent);
    animation: pulse 2s ease-in-out infinite;
  }
  @keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
  }
  .target-card .explain {
    color: var(--text2);
    font-size: 0.75rem;
    margin-top: 4px;
  }

  .chain-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 14px;
    min-height: 60px;
  }
  .chain-section h3 {
    font-size: 0.8rem;
    color: var(--text2);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
  .chain-words {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    min-height: 32px;
  }
  .chain-word {
    background: var(--surface2);
    padding: 5px 13px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
  }
  .chain-word.first {
    background: rgba(74, 222, 128, 0.15);
    border: 1px solid var(--success);
  }
  .chain-arrow {
    color: var(--accent);
    font-weight: 700;
    font-size: 0.85rem;
  }
  .chain-placeholder {
    color: var(--text2);
    font-style: italic;
    font-size: 0.85rem;
  }

  .current-req {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--surface);
    border-radius: var(--radius);
  }
  .current-req .hint-text {
    color: var(--text2);
    font-size: 0.85rem;
  }
  .current-req .prefix-badge {
    background: var(--accent);
    color: #000;
    padding: 3px 12px;
    border-radius: 6px;
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: 0.04em;
  }

  .input-area {
    display: flex;
    gap: 8px;
  }
  .input-area input {
    flex: 1;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 1.05rem;
    outline: none;
    transition: border-color 0.2s;
  }
  .input-area input:focus {
    border-color: var(--accent);
  }
  .input-area input.error {
    border-color: var(--danger);
    animation: shake 0.4s ease;
  }
  @keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
  }

  .btn {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s, color 0.2s, border-color 0.2s;
    white-space: nowrap;
  }
  .btn:active { transform: scale(0.96); }
  .btn-primary {
    background: var(--accent);
    color: #000;
  }
  .btn-primary:hover { background: #7dd3fc; }
  .btn-secondary {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
  }
  .btn-secondary:hover { background: #475569; }
  .btn-hint {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning);
    border: 1px solid rgba(251, 191, 36, 0.3);
  }
  .btn-hint:hover { background: rgba(251, 191, 36, 0.25); }
  .btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
  }

  .message {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-align: center;
    font-size: 0.9rem;
    display: none;
  }
  .message.show { display: block; }
  .message.info { background: rgba(56, 189, 248, 0.12); color: var(--accent); }
  .message.success { background: rgba(74, 222, 128, 0.12); color: var(--success); }
  .message.error { background: rgba(248, 113, 113, 0.12); color: var(--danger); }

  .hints-panel {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 12px;
    display: none;
  }
  .hints-panel.show { display: block; }
  .hints-panel h3 {
    font-size: 0.78rem;
    color: var(--warning);
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 0.05em;
  }
  .hint-words {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .hint-word {
    appearance: none;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.25);
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
  }
  .hint-word:hover {
    background: rgba(251, 191, 36, 0.25);
    border-color: var(--warning);
  }

  .solve-section {
    margin: 0;
  }
  .solve-section .btn-hint {
    display: block;
    margin: 0 auto;
  }
  .solve-panel {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 14px;
    margin-top: 8px;
  }
  .solution-title {
    margin: 0 0 8px;
    color: var(--text2);
    font-size: 0.8rem;
  }
  .solve-panel .solution-row {
    display: block;
    padding: 3px 0;
    line-height: 2.2;
  }
  .solution-word,
  .solution-link {
    display: inline-block;
    white-space: nowrap;
  }
  .solve-chain {
    display: inline;
    line-height: 2.2;
    font-size: 0.95rem;
  }
  .solve-chain .sw-head {
    background: transparent;
    color: var(--accent);
    padding: 0;
    border-radius: 0;
    font-weight: 400;
  }
  .solve-chain .sw-tail {
    background: transparent;
    color: var(--warning);
    padding: 0;
    border-radius: 0;
    font-weight: 400;
    margin-right: 0;
  }
  .solve-chain .sw-overlap {
    color: var(--success);
    font-weight: 400;
  }
  .solve-chain .sw-body {
    color: var(--text);
  }
  .solve-chain .sw-arrow {
    color: var(--text2);
    margin: 0 4px;
  }

  .stats-bar {
    display: flex;
    justify-content: space-around;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 12px;
  }
  .stat {
    text-align: center;
  }
  .stat .value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent);
  }
  .stat .label {
    font-size: 0.7rem;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 100;
    justify-content: center;
    align-items: center;
  }
  .overlay.show { display: flex; }
  .overlay-card {
    background: var(--surface);
    border: 2px solid var(--success);
    border-radius: var(--radius);
    padding: 28px;
    text-align: center;
    max-width: 440px;
  }
  .overlay-card .trophy { font-size: 3rem; margin-bottom: 10px; }
  .overlay-card h2 { color: var(--success); margin-bottom: 8px; }
  .overlay-card .chain-summary {
    color: var(--text2);
    margin: 10px 0;
    line-height: 1.7;
  }
  .overlay-card .chain-summary .accent-word {
    color: var(--accent);
    font-weight: 600;
  }
  .overlay-card .chain-summary .last-word {
    color: var(--success);
    font-weight: 600;
  }
  .overlay-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
  }

  :root {
    color-scheme: light;
    --paper: #f3f0e7;
    --paper-deep: #ebe5d7;
    --ink: #171715;
    --muted: #666157;
    --rule: #b8b0a0;
    --rule-strong: #292824;
    --head: #235b9a;
    --tail: #765500;
    --overlap: #28704d;
    --error: #a63124;
    --serif: Georgia, "Noto Serif SC", "Songti SC", "Times New Roman", Times, serif;
    --sans: "Aptos Narrow", "Noto Sans SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    --mono: "Courier New", Courier, monospace;
  }

  * { box-sizing: border-box; }

  html { min-width: 0; background: #ddd7c9; }

  body {
    display: block;
    min-width: 0;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    color: var(--ink);
    background:
      linear-gradient(90deg, rgb(77 65 46 / 0.025) 1px, transparent 1px) 0 0 / 28px 28px,
      linear-gradient(rgb(77 65 46 / 0.018) 1px, transparent 1px) 0 0 / 28px 28px,
      var(--paper);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.45;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
  }

  button, input { font: inherit; }
  button, a { touch-action: manipulation; -webkit-tap-highlight-color: rgb(35 91 154 / .15); }
  button { cursor: pointer; }
  button:focus-visible, input:focus-visible {
    outline: 3px solid rgb(35 91 154 / 0.28);
    outline-offset: 3px;
  }
  h1, h2, h3 { scroll-margin-top: 24px; }

  .skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 2000;
    padding: 11px 14px;
    color: var(--paper);
    background: var(--ink);
    font: 700 12px/1 var(--mono);
    transform: translateY(-180%);
  }
  .skip-link:focus { transform: translateY(0); }

  .page {
    position: relative;
    width: min(100%, 1440px);
    min-height: 100vh;
    margin: 0 auto;
    padding: 24px clamp(22px, 4.8vw, 72px) 34px;
  }

  .page::before {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    content: "";
    opacity: 0.24;
    background-image:
      radial-gradient(circle at 12% 26%, rgb(38 30 18 / 0.08) 0 0.55px, transparent 0.8px),
      radial-gradient(circle at 72% 62%, rgb(38 30 18 / 0.06) 0 0.5px, transparent 0.75px);
    background-size: 9px 11px, 13px 15px;
  }

  .container {
    width: 100%;
    max-width: none;
    display: block;
    padding: 0;
  }

  .utility-bar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 31px;
    border-top: 2px solid var(--rule-strong);
    border-bottom: 1px solid var(--rule-strong);
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1;
    letter-spacing: 0.105em;
    text-transform: uppercase;
  }

  .utility-copy { color: var(--muted); text-align: right; }
  .utility-actions { display: flex; align-items: center; gap: 18px; }
  .language-switch { display: inline-flex; border: 1px solid var(--ink); }
  .language-btn {
    min-height: 44px;
    padding: 6px 10px;
    border: 0;
    border-right: 1px solid var(--ink);
    color: var(--ink);
    background: transparent;
    font-family: var(--sans);
    font-size: 12px;
    line-height: 1;
    letter-spacing: 0;
    text-transform: none;
  }
  .language-btn:last-child { border-right: 0; }
  .language-btn:hover { background: var(--paper-deep); }
  .language-btn.active { color: var(--paper); background: var(--ink); }

  .masthead {
    display: grid;
    grid-template-columns: minmax(210px, 1fr) minmax(420px, 1.4fr) minmax(270px, 1fr);
    align-items: center;
    min-height: 112px;
    border-bottom: 4px double var(--rule-strong);
  }

  .edition-note {
    max-width: 31ch;
    margin: 0;
    color: var(--muted);
    font-family: var(--serif);
    font-size: 14px;
    line-height: 1.35;
    text-wrap: pretty;
  }

  .header { margin: 0; text-align: initial; }
  .header h1 {
    margin: 0;
    color: var(--ink);
    background: none;
    -webkit-text-fill-color: currentColor;
    font-family: var(--serif);
    font-size: clamp(41px, 4.2vw, 66px);
    font-weight: 700;
    line-height: 0.98;
    letter-spacing: 0;
    text-align: center;
    text-wrap: balance;
  }
  .brand-lockup {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: .16em;
  }
  .brand-divider { color: var(--rule-strong); font-size: .55em; font-weight: 400; }
  .brand-zh { font-size: .58em; letter-spacing: .04em; }

  .diff-select {
    justify-self: end;
    display: inline-flex;
    gap: 0;
    border: 1px solid var(--ink);
  }
  .mode-control { justify-self: end; text-align: right; }
  .mode-description {
    max-width: 36ch;
    margin: 7px 0 0;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 10px;
    line-height: 1.35;
  }
  .rules-list { margin: 10px 0 0; padding-left: 19px; color: var(--muted); }
  .rules-list li { margin: 0 0 7px; line-height: 1.45; }

  .diff-btn {
    min-width: 76px;
    min-height: 44px;
    padding: 8px 13px;
    border: 0;
    border-right: 1px solid var(--ink);
    border-radius: 0;
    color: var(--ink);
    background: transparent;
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: background-color 120ms ease, color 120ms ease;
  }
  .diff-btn:last-child { border-right: 0; }
  .diff-btn:hover { color: var(--ink); border-color: var(--ink); background: var(--paper-deep); }
  .diff-btn.active, .diff-btn.active:hover {
    color: var(--paper);
    border-color: var(--ink);
    background: var(--ink);
    font-weight: 700;
  }

  .layout {
    display: grid;
    grid-template-columns: minmax(0, 2.25fr) minmax(280px, 0.75fr);
    gap: clamp(34px, 5vw, 76px);
    padding-top: 30px;
  }
  .main-column, .margin-column { min-width: 0; }

  .section-kicker {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 12px;
    color: var(--ink);
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }
  .section-kicker::after { flex: 1; height: 1px; content: ""; background: var(--rule-strong); }

  .target-card {
    padding: 0 0 25px;
    border: 0;
    border-bottom: 1px solid var(--rule);
    border-radius: 0;
    background: transparent;
    text-align: initial;
  }
  .target-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 28px;
  }
  .loop-copy h2 {
    max-width: 20ch;
    margin: 0;
    font-family: var(--serif);
    font-size: clamp(26px, 2.5vw, 38px);
    font-weight: 400;
    line-height: 1.12;
    letter-spacing: -0.025em;
    text-wrap: balance;
  }
  .loop-copy p {
    max-width: 57ch;
    margin: 10px 0 0;
    color: var(--muted);
    font-family: var(--serif);
    font-size: 15px;
    text-wrap: pretty;
  }
  .target-card .target-letters {
    display: flex;
    grid-column: 1;
    align-items: center;
    justify-content: flex-start;
    justify-self: start;
    gap: 11px;
    text-align: left;
    white-space: nowrap;
    font-family: var(--mono);
    font-size: clamp(31px, 3.4vw, 51px);
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.045em;
  }
  .target-card .target-letters .start { color: var(--head); }
  .target-card .target-letters .goal { color: var(--tail); }
  .target-card .target-letters .arrow {
    color: var(--muted);
    font-family: var(--serif);
    font-size: 0.7em;
    font-weight: 400;
  }

  .chain-section {
    min-height: 0;
    padding: 25px 0 24px;
    border-radius: 0;
    border-bottom: 1px solid var(--rule);
    background: transparent;
  }
  .chain-section h3 { margin-bottom: 12px; color: var(--ink); }
  .chain-words {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    min-height: 0;
    font-family: var(--serif);
    font-size: clamp(27px, 2.8vw, 43px);
    line-height: 1.2;
    letter-spacing: -0.025em;
  }
  .chain-word, .chain-word.first {
    padding: 0;
    border: 0;
    border-radius: 0;
    color: var(--ink);
    background: transparent;
    font-size: inherit;
    font-weight: 400;
    white-space: nowrap;
  }
  .chain-origin { color: var(--tail); font-weight: 700; }
  .chain-handoff {
    color: var(--head);
    font-weight: 700;
    text-decoration: underline dotted;
    text-decoration-thickness: 1px;
    text-underline-offset: .16em;
  }
  .chain-question { color: var(--head); font-weight: 700; }
  .chain-arrow { color: var(--muted); font-size: 0.9em; font-weight: 400; }
  .chain-placeholder { color: var(--muted); font-family: var(--serif); font-size: 20px; }

  .entry-section { padding: 24px 0 25px; border-bottom: 2px solid var(--rule-strong); }
  .entry-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 13px;
  }
  .entry-heading h2 {
    margin: 0;
    font-family: var(--serif);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.015em;
  }
  .current-req {
    display: none;
    align-items: baseline;
    justify-content: flex-end;
    gap: 7px;
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 13px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
  }
  .current-req .hint-text { color: var(--muted); font-size: inherit; }
  .current-req .prefix-badge {
    padding: 0;
    border-radius: 0;
    color: var(--head);
    background: transparent;
    font-size: 1.15em;
    font-weight: 700;
    letter-spacing: 0;
  }
  .input-area { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
  .input-area input {
    width: 100%;
    min-width: 0;
    height: 61px;
    padding: 7px 15px 4px;
    border: 1px solid var(--ink);
    border-bottom-width: 4px;
    border-radius: 0;
    color: var(--ink);
    background:
      repeating-linear-gradient(90deg, transparent 0 40px, rgb(23 23 21 / 0.08) 40px 41px),
      rgb(255 255 255 / 0.35);
    font-family: var(--mono);
    font-size: 29px;
    font-weight: 700;
    letter-spacing: 0.06em;
  }
  .input-area input:focus { border-color: var(--head); background-color: rgb(255 255 255 / 0.62); }
  .input-area input.error { border-color: var(--error); animation: shake 0.4s ease; }

  .btn {
    min-height: 44px;
    padding: 9px 15px;
    border-radius: 0;
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.055em;
    text-transform: uppercase;
    transition: transform 100ms ease, background-color 120ms ease, color 120ms ease;
  }
  .btn:active { transform: translateY(2px); }
  .btn-primary {
    min-width: 132px;
    border: 2px solid var(--ink);
    color: var(--paper);
    background: var(--ink);
    box-shadow: 4px 4px 0 var(--rule);
  }
  .btn-primary:hover { color: #fff; border-color: var(--head); background: var(--head); }
  .btn-primary:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--rule); }
  .btn-secondary, .btn-hint {
    border: 1px solid var(--ink);
    color: var(--ink);
    background: transparent;
  }
  .btn-secondary:hover, .btn-hint:hover { color: var(--paper); background: var(--ink); }
  .btn:disabled { opacity: 0.45; cursor: not-allowed; }

  .message {
    display: none;
    margin-top: 12px;
    padding: 9px 12px;
    border-radius: 0;
    border-left: 4px solid var(--head);
    background: rgb(255 255 255 / 0.28);
    color: var(--ink);
    font-family: var(--serif);
    font-size: 15px;
    font-weight: 400;
    text-align: left;
  }
  .message.show { display: block; }
  .message.error { color: var(--error); border-color: var(--error); background: rgb(166 49 36 / 0.07); }
  .message.success { color: var(--overlap); border-color: var(--overlap); background: rgb(40 112 77 / 0.07); }
  .message.info { color: var(--head); border-color: var(--head); background: rgb(35 91 154 / 0.07); }

  .hints-panel {
    display: none;
    margin-top: 13px;
    padding: 13px 0 0;
    border-radius: 0;
    border-top: 1px solid var(--rule);
    background: transparent;
  }
  .hints-panel.show { display: block; }
  .hints-panel h3 {
    margin-bottom: 8px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.08em;
  }
  .hint-words { gap: 6px; }
  .hint-word {
    padding: 4px 9px;
    border: 1px solid var(--rule-strong);
    border-radius: 0;
    color: var(--ink);
    background: transparent;
    font-family: var(--mono);
  }
  .hint-word:hover { border-color: var(--head); color: var(--paper); background: var(--head); }

  .solve-section { margin: 0; padding-top: 21px; }
  .solve-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 13px;
  }
  .solve-heading h2 { margin: 0; font-family: var(--serif); font-size: 23px; font-weight: 700; }
  .solve-section .btn-hint { display: inline-block; min-width: 158px; margin: 0; }
  .solve-panel {
    margin-top: 0;
    padding: 13px 0 11px;
    border-radius: 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    background: transparent;
  }
  .solution-title { margin: 0 0 7px; color: var(--muted); font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
  .solve-panel .solution-row {
    display: block;
    padding: 3px 0;
    color: var(--ink);
    font-family: var(--mono);
    font-size: clamp(18px, 1.7vw, 25px);
    line-height: 1.55;
  }
  .solution-word, .solution-link { display: inline-block; white-space: nowrap; }
  .solve-chain .sw-head { color: var(--head); background: transparent; padding: 0; font-weight: 400; }
  .solve-chain .sw-tail { color: var(--tail); background: transparent; padding: 0; font-weight: 400; }
  .solve-chain .sw-overlap { color: var(--overlap); font-weight: 400; }
  .solve-chain .sw-body { color: var(--ink); }
  .solve-chain .sw-arrow { margin: 0 7px; color: var(--muted); }

  .margin-column { padding-left: 22px; border-left: 1px solid var(--rule-strong); }
  .margin-title {
    margin: 0;
    padding: 0 0 9px;
    border-bottom: 3px double var(--rule-strong);
    font-family: var(--serif);
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
  }
  .stats-bar { display: block; padding: 5px 0 18px; border-radius: 0; background: transparent; }
  .stat {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 14px;
    padding: 11px 0 9px;
    border-bottom: 1px solid var(--rule);
    text-align: left;
  }
  .stat .label { grid-column: 1; grid-row: 1; color: var(--muted); font-size: 14px; letter-spacing: 0; text-transform: none; }
  .stat .value { grid-column: 2; grid-row: 1; color: var(--ink); font-family: var(--serif); font-size: 24px; font-weight: 400; font-variant-numeric: tabular-nums; }
  .side-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 0 24px; border-bottom: 1px solid var(--rule-strong); }
  .side-actions .btn { min-width: 0; padding: 10px 12px; }
  .note-block { padding: 19px 0; border-bottom: 1px solid var(--rule); }
  .note-block h3 { margin: 0 0 10px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.105em; text-transform: uppercase; }
  .note-block p { margin: 0; color: var(--muted); font-family: var(--serif); font-size: 14px; line-height: 1.5; text-wrap: pretty; }
  .color-key { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; font-size: 14px; }
  .color-key li { display: grid; grid-template-columns: 24px minmax(0, 1fr); align-items: center; gap: 9px; }
  .key-mark { width: 24px; height: 6px; background: currentColor; }
  .key-head { color: var(--head); } .key-tail { color: var(--tail); } .key-overlap { color: var(--overlap); }
  .key-copy { color: var(--ink); }

  .overlay { overscroll-behavior: contain; background: rgb(23 23 21 / 0.76); backdrop-filter: blur(2px); }
  .overlay-card {
    width: min(92vw, 520px);
    max-width: 520px;
    padding: 32px;
    border: 2px solid var(--ink);
    border-radius: 0;
    color: var(--ink);
    background: var(--paper);
    box-shadow: 10px 10px 0 rgb(0 0 0 / 0.22);
    text-align: left;
  }
  .overlay-card .trophy { margin: 0 0 6px; color: var(--muted); font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }
  .overlay-card h2 { margin: 0 0 10px; color: var(--ink); font-family: var(--serif); font-size: 42px; }
  .overlay-card .chain-summary { margin: 10px 0; color: var(--muted); font-family: var(--serif); line-height: 1.7; }
  .overlay-card .chain-summary .accent-word { color: var(--head); }
  .overlay-card .chain-summary .last-word { color: var(--overlap); }
  .overlay-actions { justify-content: flex-start; margin-top: 18px; }

  @keyframes ink-reveal {
    from { opacity: 0; transform: translateY(14px); clip-path: inset(0 0 100% 0); }
    to { opacity: 1; transform: translateY(0); clip-path: inset(0 0 0 0); }
  }
  @keyframes rule-draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  @keyframes target-settle { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

  .utility-bar { animation: target-settle 500ms cubic-bezier(.16,1,.3,1) both; }
  .masthead::after {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -4px;
    height: 1px;
    content: "";
    background: var(--rule-strong);
    transform-origin: left center;
    animation: rule-draw 800ms 120ms cubic-bezier(.16,1,.3,1) both;
  }
  .masthead { position: relative; }
  .header h1 { animation: ink-reveal 760ms 80ms cubic-bezier(.16,1,.3,1) both; }
  .edition-note { animation: ink-reveal 620ms 180ms cubic-bezier(.16,1,.3,1) both; }
  .diff-select { animation: target-settle 560ms 250ms cubic-bezier(.16,1,.3,1) both; }
  .target-card .section-kicker { animation: target-settle 520ms 300ms cubic-bezier(.16,1,.3,1) both; }
  .loop-copy h2 { animation: ink-reveal 720ms 350ms cubic-bezier(.16,1,.3,1) both; }
  .loop-copy p { animation: target-settle 560ms 480ms cubic-bezier(.16,1,.3,1) both; }
  .chain-section > .section-kicker, .margin-title, .solve-heading h2 { animation: target-settle 620ms 520ms cubic-bezier(.16,1,.3,1) both; }

  @media (max-width: 980px) {
    .page { padding-inline: 28px; }
    .masthead { grid-template-columns: 1fr auto; gap: 18px 24px; padding: 18px 0; }
    .header h1 { grid-column: 1 / -1; grid-row: 1; }
    .edition-note { grid-column: 1; grid-row: 2; }
    .mode-control { grid-column: 2; grid-row: 2; }
    .layout { grid-template-columns: minmax(0, 1fr); gap: 34px; }
    .margin-column {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 0 28px;
      padding: 20px 0 0;
      border-top: 2px solid var(--rule-strong);
      border-left: 0;
    }
    .margin-title { grid-column: 1 / -1; }
    .stats-bar, .side-actions { grid-column: 1; }
    .note-block { grid-column: 2; }
  }

  @media (max-width: 680px) {
    body { font-size: 15px; }
    .page { padding: 10px 16px max(24px, env(safe-area-inset-bottom)); }
    .utility-bar { min-height: 44px; align-items: center; justify-content: flex-end; gap: 8px; padding: 0; font-size: 11px; line-height: 1.25; }
    .utility-bar > span:first-child, .utility-copy { display: none; }
    .utility-actions { width: 100%; justify-content: flex-end; gap: 8px; }
    .language-btn { min-height: 42px; padding-inline: 11px; }
    .masthead { display: flex; min-height: 0; flex-direction: column; align-items: stretch; gap: 9px; padding: 12px 0; }
    .header h1 { align-self: center; font-size: clamp(32px, 10.5vw, 45px); }
    .edition-note { display: none; }
    .mode-control { align-self: stretch; text-align: center; }
    .mode-description { display: none; }
    .diff-select { width: 100%; }
    .diff-btn { flex: 1; min-width: 0; }
    .layout { gap: 24px; padding-top: 14px; }
    .target-card { padding-bottom: 16px; }
    .target-inner { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .target-card .target-letters { grid-column: 1; order: -1; font-size: clamp(31px, 11vw, 43px); }
    .loop-copy h2 { font-size: 24px; }
    .loop-copy p { margin-top: 6px; font-size: 14px; }
    .chain-section { padding: 16px 0; }
    .chain-words { gap: 5px 8px; font-size: 26px; }
    .entry-section { padding: 16px 0 18px; }
    .entry-heading { display: block; }
    .entry-heading h2 { font-size: 21px; }
    .current-req { justify-content: flex-start; margin-top: 5px; }
    .input-area { grid-template-columns: minmax(0, 1fr); }
    .input-area input { height: 54px; font-size: 25px; }
    .btn-primary { width: 100%; }
    .solve-heading { align-items: stretch; flex-direction: column; }
    .solve-section .btn-hint { width: 100%; }
    .solve-panel .solution-row { font-size: 18px; }
    .margin-column { display: block; }
  }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }
  }
