  /* ── SITE TOKENS ───────────────────────────────────── */
  :root {
    --green:      #4fc431;
    --green-dark: #3aad1f;
    --green-dim:  rgba(79,196,49,0.08);
    --green-dim2: #2d6e1f;
    --bg:         #0f1620;
    --bg2:        #18202e;
    --bg3:        #222c3c;
    --text:       #e8edf4;
    --text-muted: #8fa0b8;
    --border:     #2a3547;
    --radius:     16px;
    --mono:       'JetBrains Mono', monospace;
    --sans:       'DM Sans', sans-serif;
  }

  [data-theme="light"] {
    --bg:         #dde4ef;
    --bg2:        #eaf0f8;
    --bg3:        #d0d9e8;
    --text:       #0f1a2e;
    --text-muted: #3d5070;
    --border:     #b0bdd0;
    --green:      #2d8a14;
    --green-dark: #1f6b0d;
    --green-dim:  rgba(45,138,20,0.08);
    --green-dim2: #1f6b0d;
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }
  html { scroll-behavior: smooth; }

  body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
  }

  /* ── NAV ───────────────────────────────────────────── */
  nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15,22,32,0.92);
    border-bottom: 1px solid var(--border);
    padding: 0 32px;
    display: flex;
    align-items: center;
    height: 64px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    gap: 16px;
    flex-shrink: 0;
  }
  [data-theme="light"] nav { background: rgba(234,240,248,0.95); }

  .nav-back {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: color 0.2s, border-color 0.2s;
    white-space: nowrap;
  }
  .nav-back:hover { color: var(--green); border-color: var(--green); }

  .nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
  }
  .nav-logo img { height: 32px; width: auto; }
  .nav-brand { font-family: var(--mono); font-size: 0.82rem; color: var(--green); font-weight: 700; }

  .nav-title {
    margin-left: auto;
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .theme-btn {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    transition: 0.2s;
    line-height: 1;
    flex-shrink: 0;
    width: auto;
    height: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .theme-btn:hover { color: var(--text); }

  /* ── PAGE CONTENT ──────────────────────────────────── */
  .wrap {
    max-width: 940px;
    margin: 0 auto;
    padding: 40px 24px 56px;
    flex: 1;
    width: 100%;
  }

  .page-label {
    font-family: var(--mono);
    font-size: 0.73rem;
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 10px;
  }

  h1 {
    font-family: var(--mono);
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    margin-bottom: 10px;
    line-height: 1.2;
  }

  .subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
    max-width: 680px;
    line-height: 1.7;
  }

  /* ── RHYME CARD ─────────────────────────────────────── */
  .rhyme {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.4rem;
    font-size: 0.95rem;
    line-height: 1.85;
    color: var(--text-muted);
    font-family: var(--mono);
    margin-bottom: 2.5rem;
  }

  /* ── PANELS ─────────────────────────────────────────── */
  section.panel {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    margin-bottom: 2rem;
  }

  .panel-title {
    font-family: var(--mono);
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text);
  }

  .panel-title .badge {
    font-family: var(--mono);
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: var(--green-dim);
    color: var(--green);
    border: 1px solid var(--green-dim2);
    border-radius: 100px;
    padding: 0.15rem 0.6rem;
  }

  .panel-desc {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0.3rem 0 1.4rem;
    line-height: 1.65;
  }

  /* ── CONTROLS ────────────────────────────────────────── */
  .controls {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.3rem;
    flex-wrap: wrap;
  }

  button {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 10px;
    width: 38px;
    height: 38px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
    font-family: var(--sans);
  }
  button:hover { background: var(--bg2); border-color: var(--green); color: var(--green); }
  button:active { transform: translateY(1px); }
  button:disabled { opacity: 0.35; cursor: not-allowed; }
  button.wide {
    width: auto;
    padding: 0 1rem;
    font-size: 0.82rem;
    margin-left: auto;
    border-radius: 10px;
  }

  .step-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-family: var(--mono);
  }

  /* ── LABELS ──────────────────────────────────────────── */
  .label {
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
  }

  /* ── WORD SEQUENCE ───────────────────────────────────── */
  .seq {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 1.4rem;
  }
  .seq span {
    padding: 3px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-family: var(--mono);
    color: var(--bg3);
  }
  .seq span.done { color: var(--text-muted); background: var(--bg3); }
  .seq span.now  { color: var(--green); background: var(--green-dim); border: 1px solid var(--green-dim2); }

  /* ── 2-COL GRID ──────────────────────────────────────── */
  .grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.4rem;
  }
  @media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

  /* ── INFO BOXES ──────────────────────────────────────── */
  .box {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.85rem 1rem;
  }
  .box .heading {
    font-family: var(--mono);
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.5rem;
  }
  .box .value {
    font-family: var(--mono);
    font-size: 0.95rem;
    word-break: break-word;
    color: var(--text);
  }

  /* ── DICTIONARY BOX ──────────────────────────────────── */
  .dict-box {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    max-height: 220px;
    overflow-y: auto;
    margin-bottom: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 3px 14px;
    font-family: var(--mono);
    font-size: 0.82rem;
  }
  .dict-box div.old { color: var(--text-muted); }
  .dict-box div.new { color: var(--green); font-weight: 600; }

  /* ── REBUILT TEXT ────────────────────────────────────── */
  .rebuilt {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.1rem;
    font-size: 0.95rem;
    line-height: 1.85;
    min-height: 2.6em;
    color: var(--text);
  }
  .rebuilt span.new { color: var(--green); font-weight: 600; }

  /* ── THIS-STEP BOX ───────────────────────────────────── */
  .this-step {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.9rem 1rem;
    font-size: 0.875rem;
    line-height: 1.75;
    color: var(--text-muted);
  }
  .this-step .hl { color: var(--green); font-weight: 600; font-family: var(--mono); }

  /* ── FINAL NOTE ──────────────────────────────────────── */
  .final-note {
    display: none;
    margin-top: 1.2rem;
    border: 1px solid var(--green-dim2);
    background: var(--green-dim);
    border-radius: 10px;
    padding: 0.9rem 1.1rem;
    font-size: 0.875rem;
    color: var(--green);
    line-height: 1.65;
  }

  /* ── FOOTER ──────────────────────────────────────────── */
  footer {
    background: var(--bg2);
    border-top: 1px solid var(--border);
    padding: 28px 32px;
    text-align: center;
    flex-shrink: 0;
  }
  footer p { font-family: var(--mono); font-size: 0.78rem; color: var(--text-muted); }
  footer span { color: var(--green); }

  @media (max-width: 520px) {
    nav { padding: 0 16px; }
    .nav-title { display: none; }
  }
