    /* ── tokens ───────────────────────────────────────────────── */
    :root {
      --obsidian:  #0D0D0D;
      --surface:   #1C1C1C;
      --raised:    #2A2A2A;
      --l1:        #F2F3F5;
      --l2:        #BDC4CE;
      --l3:        #96A0AB;
      --l4:        #6B737C;
      --ipa:       #0E8A4E;
      --crimson:   #C0294A;
      --gold:      #BF7A10;
      --emerald:   #0E8A4E;
      --sapphire:  #1C4FBF;
      --font:      'Plus Jakarta Sans', sans-serif;
      --safe-btm:  env(safe-area-inset-bottom, 0px);
    }

    /* ── reset ────────────────────────────────────────────────── */
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
    html {
      height: 100%;
      background: var(--obsidian);
    }
    body {
      height: 100%;
      background: var(--obsidian);
      color: var(--l1);
      font-family: var(--font);
      -webkit-font-smoothing: antialiased;
      overflow: hidden;
      user-select: none;
      -webkit-tap-highlight-color: transparent;
      display: flex;
      align-items: stretch;
      justify-content: center;
    }

    /* ── app shell ────────────────────────────────────────────── */
    #app {
      display: flex;
      flex-direction: column;
      width: 100%;
      max-width: 430px;
      height: 100%;
      max-height: min(100%, 915px);
      position: relative;
      overflow: hidden;
    }

    /* ── screens ──────────────────────────────────────────────── */
    .screen {
      display: none;
      flex: 1;
      flex-direction: column;
      overflow: hidden;
      position: relative;
      min-height: 0;
    }
    .screen.active { display: flex; }

    /* ── nav ──────────────────────────────────────────────────── */
    #nav {
      display: flex;
      background: var(--obsidian);
      border-top: 1px solid rgba(255,255,255,.06);
      padding-bottom: calc(6px + var(--safe-btm));
      flex-shrink: 0;
      z-index: 100;
    }
    .nav-tab {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 2px;
      padding: 10px 0 4px;
      cursor: pointer;
      background: none;
      border: none;
      color: #3D4249;
      font-family: var(--font);
      transition: color .15s;
      -webkit-tap-highlight-color: transparent;
    }
    .nav-tab.active  { color: var(--l1); }
    .nav-tab.inactive { cursor: default; }
    .nav-tab svg { width: 20px; height: 20px; flex-shrink: 0; }
    .nav-label {
      font-size: 8px;
      font-weight: 400;
      letter-spacing: .04em;
    }
    .nav-pip {
      width: 3px; height: 3px;
      border-radius: 50%;
      background: var(--l1);
      opacity: 0;
    }
    .nav-tab.active .nav-pip { opacity: 1; }

    /* ── study screen ─────────────────────────────────────────── */
    #study-screen { flex: 1; overflow: hidden; position: relative; }

    #card-area {
      position: absolute;
      inset: 0;
    }

    /* ── card base ────────────────────────────────────────────── */
    .card {
      position: absolute;
      inset: 0;
      display: flex;
      flex-direction: column;
      background: var(--obsidian);
      cursor: pointer;
    }

    /* ── card image ───────────────────────────────────────────── */
    .card-image {
      position: relative;
      flex-shrink: 0;
      height: 50%;
      overflow: hidden;
      background: #111;
    }
    .card-image img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      object-position: center top;
      display: block;
    }
    /* bottom scrim: image fades into obsidian */
    .card-image::after {
      content: '';
      position: absolute;
      bottom: 0; left: 0; right: 0;
      height: 70%;
      background: linear-gradient(to bottom, transparent 0%, var(--obsidian) 100%);
      pointer-events: none;
    }

    /* ── card body ────────────────────────────────────────────── */
    .card-body {
      flex: 1;
      display: flex;
      flex-direction: column;
      padding: 12px 24px 0;
      min-height: 0;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }

    /* ── word row ─────────────────────────────────────────────── */
    .word-row {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      flex-shrink: 0;
    }
    .word-display {
      font-weight: 300;
      color: var(--l1);
      line-height: 1.1;
      letter-spacing: -.01em;
      text-align: center;
    }
    .w-pfx { color: var(--l3); }
    .w-dot { color: #2a2e33; }
    .w-stm { color: var(--l1); }
    .sound-icon {
      opacity: .3;
      flex-shrink: 0;
      width: 16px;
      height: 16px;
      color: var(--l1);
    }

    /* ── IPA ──────────────────────────────────────────────────── */
    .ipa-text {
      font-size: 13px;
      font-weight: 400;
      color: var(--ipa);
      margin-top: 4px;
      min-height: 18px;
      flex-shrink: 0;
    }

    /* ── front card specifics ─────────────────────────────────── */
    .tap-hint {
      font-size: 13px;
      font-weight: 400;
      color: var(--l4);
      text-align: center;
      letter-spacing: .06em;
      padding-bottom: 18px;
      margin-top: auto;
    }

    /* ── back card content ────────────────────────────────────── */
    #card-back { cursor: default; }

    .english-translation {
      font-size: 36px;
      font-weight: 300;
      color: var(--l3);
      margin-top: 10px;
      line-height: 1.25;
      flex-shrink: 0;
      text-align: center;
    }
    .pos-label {
      font-size: 13px;
      font-weight: 400;
      color: var(--l4);
      margin-top: 10px;
      flex-shrink: 0;
      text-align: left;
    }
    .sentences {
      margin-top: auto;
      padding-bottom: 28px;
      display: flex;
      flex-direction: column;
      gap: 6px;
      flex-shrink: 0;
    }
    .sentence-shona {
      font-size: 20px;
      font-weight: 300;
      color: var(--l2);
      font-style: normal;
      line-height: 1.6;
    }
    .sentence-english {
      font-size: 17px;
      font-weight: 300;
      color: var(--l3);
      line-height: 1.6;
    }

    /* ── card bottom ──────────────────────────────────────────── */
    .card-bottom {
      flex-shrink: 0;
      margin-top: auto;
    }

    /* ── progress strip ───────────────────────────────────────── */
    .progress-strip {
      height: 3px;
      display: flex;
      width: 100%;
    }
    .seg { height: 100%; transition: width .4s ease; }
    .seg-forgot   { background: var(--crimson); }
    .seg-learning { background: var(--gold); }
    .seg-review   { background: var(--emerald); }
    .seg-mature   { background: var(--sapphire); }

    /* ── rating buttons ───────────────────────────────────────── */
    .rating-buttons {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 1.5px;
      padding: 6px 6px 10px;
    }
    .rating-btn {
      position: relative;
      overflow: hidden;
      border-radius: 5px;
      padding: 8px 2px;
      border: none;
      cursor: pointer;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 3px;
      -webkit-tap-highlight-color: transparent;
    }
    /* top gloss */
    .rating-btn::after {
      content: '';
      position: absolute;
      top: 0; left: 0; right: 0;
      height: 52%;
      background: linear-gradient(to bottom,
        rgba(255,255,255,.36),
        rgba(255,255,255,.10),
        transparent);
      pointer-events: none;
      z-index: 1;
    }
    /* bottom shadow */
    .rating-btn::before {
      content: '';
      position: absolute;
      bottom: 0; left: 0; right: 0;
      height: 35%;
      background: linear-gradient(to top, rgba(0,0,0,.2), transparent);
      pointer-events: none;
      z-index: 1;
    }
    .btn-1 { background: var(--crimson); }
    .btn-2 { background: var(--gold); }
    .btn-3 { background: var(--emerald); }
    .btn-4 { background: var(--sapphire); }
    .btn-label {
      font-size: 13px;
      font-weight: 400;
      font-family: var(--font);
      color: #fff;
      white-space: nowrap;
      position: relative;
      z-index: 2;
      letter-spacing: .02em;
      text-transform: lowercase;
    }
    .btn-interval {
      font-size: 11px;
      color: rgba(255,255,255,.6);
      position: relative;
      z-index: 2;
    }

    /* ── preview bar ──────────────────────────────────────────── */
    #preview-bar {
      display: none;
      background: rgba(191,122,16,.15);
      border-bottom: 1px solid rgba(191,122,16,.3);
      padding: 6px 16px;
      font-size: 11px;
      font-weight: 400;
      color: var(--gold);
      letter-spacing: .04em;
      flex-shrink: 0;
      text-align: center;
    }
    #preview-bar.show { display: block; }

    /* ── empty state ──────────────────────────────────────────── */
    #study-empty {
      display: none;
      position: absolute;
      inset: 0;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 14px;
      padding: 48px 32px;
      text-align: center;
    }
    #study-empty.show { display: flex; }
    .empty-mark {
      width: 40px; height: 40px;
      opacity: .25;
      color: var(--l1);
    }
    .empty-title {
      font-size: 18px;
      font-weight: 300;
      color: var(--l1);
    }
    .empty-sub {
      font-size: 12px;
      font-weight: 300;
      color: var(--l4);
      line-height: 1.7;
    }
    .empty-next {
      font-size: 10px;
      font-weight: 400;
      color: var(--l3);
      margin-top: 4px;
    }
    .empty-progress {
      font-size: 10px;
      font-weight: 400;
      color: var(--l4);
      margin-top: 2px;
    }
    .empty-practice-btn {
      margin-top: 14px;
      background: none;
      border: 1px solid rgba(255,255,255,.1);
      border-radius: 8px;
      color: var(--l3);
      font-family: var(--font);
      font-size: 12px;
      font-weight: 400;
      padding: 10px 22px;
      cursor: pointer;
      -webkit-tap-highlight-color: transparent;
      letter-spacing: .02em;
    }
    .empty-practice-btn:active { opacity: .6; }

    /* ── practice bar ─────────────────────────────────────────── */
    #practice-bar {
      display: none;
      background: rgba(14,138,78,.12);
      border-bottom: 1px solid rgba(14,138,78,.25);
      padding: 6px 16px;
      font-size: 11px;
      font-weight: 400;
      color: var(--emerald);
      letter-spacing: .04em;
      flex-shrink: 0;
      text-align: center;
    }
    #practice-bar.show { display: block; }

    /* ── welcome screen ───────────────────────────────────────── */
    #welcome-screen {
      display: none;
      position: absolute;
      inset: 0;
      background: var(--obsidian);
      flex-direction: column;
      align-items: center;
      justify-content: flex-end;
      padding: 0 28px calc(44px + var(--safe-btm));
      z-index: 200;
      text-align: center;
    }
    #welcome-screen.show { display: flex; }
    .ws-logo {
      font-size: 56px;
      font-weight: 300;
      color: var(--l1);
      letter-spacing: -.02em;
      line-height: 1;
      margin-bottom: 6px;
    }
    .ws-pos {
      font-size: 10px;
      font-weight: 400;
      color: var(--l4);
      letter-spacing: .06em;
      margin-bottom: 28px;
    }
    .ws-rule {
      width: 28px;
      height: 1px;
      background: rgba(255,255,255,.08);
      margin: 0 auto 24px;
    }
    .ws-ch-label {
      font-size: 10px;
      font-weight: 400;
      color: var(--emerald);
      letter-spacing: .08em;
      margin-bottom: 8px;
    }
    .ws-ch-desc {
      font-size: 15px;
      font-weight: 300;
      color: var(--l2);
      line-height: 1.55;
      margin-bottom: 28px;
    }
    .ws-steps {
      display: flex;
      flex-direction: column;
      gap: 11px;
      width: 100%;
      margin-bottom: 32px;
      text-align: left;
    }
    .ws-step {
      display: flex;
      align-items: flex-start;
      gap: 10px;
      font-size: 12px;
      font-weight: 300;
      color: var(--l3);
      line-height: 1.5;
    }
    .ws-step-n {
      font-size: 9px;
      font-weight: 400;
      color: var(--l4);
      background: var(--surface);
      border-radius: 50%;
      width: 18px;
      height: 18px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      margin-top: 1px;
    }
    .ws-btn {
      width: 100%;
      background: var(--sapphire);
      border: none;
      border-radius: 10px;
      padding: 16px;
      font-family: var(--font);
      font-size: 15px;
      font-weight: 400;
      color: #fff;
      cursor: pointer;
      position: relative;
      overflow: hidden;
      -webkit-tap-highlight-color: transparent;
      letter-spacing: .01em;
    }
    .ws-btn::after {
      content: '';
      position: absolute;
      top: 0; left: 0; right: 0;
      height: 52%;
      background: linear-gradient(to bottom, rgba(255,255,255,.25), rgba(255,255,255,.08), transparent);
      pointer-events: none;
    }
    .ws-btn:active { opacity: .8; }

    /* ── chapter intro screen ──────────────────────────────────── */
    #chapter-intro {
      display: none;
      position: absolute;
      inset: 0;
      background: var(--obsidian);
      flex-direction: column;
      align-items: center;
      justify-content: flex-end;
      padding: 0 28px calc(44px + var(--safe-btm));
      z-index: 100;
      text-align: center;
    }
    #chapter-intro.show { display: flex; }
    .ci-lock {
      width: 28px; height: 28px;
      color: var(--emerald);
      opacity: .75;
      margin-bottom: 12px;
    }
    .ci-eyebrow {
      font-size: 9px;
      font-weight: 400;
      color: var(--emerald);
      letter-spacing: .12em;
      text-transform: uppercase;
      margin-bottom: 6px;
    }
    .ci-num {
      font-size: 13px;
      font-weight: 400;
      color: var(--l4);
      letter-spacing: .04em;
      margin-bottom: 4px;
    }
    .ci-name {
      font-size: 30px;
      font-weight: 300;
      color: var(--l1);
      line-height: 1.2;
      margin-bottom: 14px;
    }
    .ci-desc {
      font-size: 14px;
      font-weight: 300;
      color: var(--l3);
      line-height: 1.65;
      margin-bottom: 6px;
    }
    .ci-count {
      font-size: 10px;
      font-weight: 400;
      color: var(--l4);
      letter-spacing: .04em;
      margin-bottom: 40px;
    }
    .ci-btn {
      width: 100%;
      background: var(--emerald);
      border: none;
      border-radius: 10px;
      padding: 16px;
      font-family: var(--font);
      font-size: 15px;
      font-weight: 400;
      color: #fff;
      cursor: pointer;
      position: relative;
      overflow: hidden;
      -webkit-tap-highlight-color: transparent;
      letter-spacing: .01em;
    }
    .ci-btn::after {
      content: '';
      position: absolute;
      top: 0; left: 0; right: 0;
      height: 52%;
      background: linear-gradient(to bottom, rgba(255,255,255,.25), rgba(255,255,255,.08), transparent);
      pointer-events: none;
    }
    .ci-btn:active { opacity: .8; }

    /* ── mobile layout tweaks ─────────────────────────────────── */
    @media (max-width: 430px) {
      .sentences {
        padding-bottom: 80px;
      }
    }