/* Layout concept: a cutting-mat workbench. Target strip on top, your strip below, controls, then a folded-corner result sheet. */
  :root {
    --paper: #E6EBF3;
    --mat: #DCE3EF;
    --grid: #CBD4E4;
    --sheet: #F8FAFD;
    --ink: #131A2A;
    --muted: #566178;
    --line: #BFC9DB;
    --crease: #8794AF;
    --accent: #2A47F5;
    --on-accent: #FFFFFF;
    --good: #0E9F55;
    --bad: #D6343C;
    --f-display: 'Bricolage Grotesque', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --f-body: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --f-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --paper: #0B101B; --mat: #111827; --grid: #1B2640; --sheet: #182033; --ink: #E9EFFA;
      --muted: #8F9CB8; --line: #27324A; --crease: #5C6B8C; --accent: #7189FF; --on-accent: #0B101B;
      --good: #3DD68C; --bad: #FF6B72; color-scheme: dark;
    }
  }
  :root[data-theme="dark"] {
    --paper: #0B101B; --mat: #111827; --grid: #1B2640; --sheet: #182033; --ink: #E9EFFA;
    --muted: #8F9CB8; --line: #27324A; --crease: #5C6B8C; --accent: #7189FF; --on-accent: #0B101B;
    --good: #3DD68C; --bad: #FF6B72; color-scheme: dark;
  }

  * { box-sizing: border-box; }
  [hidden] { display: none !important; }
  body {
    background: var(--paper); color: var(--ink); font-family: var(--f-body); font-size: 16px; line-height: 1.45;
    padding-block: 20px 48px;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    -webkit-tap-highlight-color: transparent;
  }
  .app { max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
  button { font: inherit; color: inherit; cursor: pointer; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

  header { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
  .brand { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
  h1 { font-family: var(--f-display); font-weight: 800; font-size: 44px; line-height: 1; letter-spacing: -0.03em; margin: 0; font-variation-settings: "opsz" 96; }
  .tag { font-family: var(--f-mono); font-size: 12px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
  .modes { display: flex; gap: 6px; align-items: center; }
  .seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--sheet); }
  .seg button { border: 0; background: transparent; padding: 8px 12px; font-size: 14px; font-weight: 600; color: var(--muted); }
  .seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
  .icon-btn { width: 36px; height: 36px; border: 1px solid var(--line); background: var(--sheet); border-radius: 8px; font-weight: 700; }

  .lede { margin: 0; color: var(--muted); font-size: 15px; min-height: 22px; }
  .lede b { color: var(--ink); font-weight: 600; }

  .mat {
    background-color: var(--mat);
    background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 20px 20px;
    border: 1px solid var(--line); border-radius: 10px; padding: 14px 12px 12px;
    display: flex; flex-direction: column; gap: 10px; min-width: 0;
  }
  .row-label { display: flex; justify-content: space-between; align-items: center; font-family: var(--f-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding-inline: 2px; }
  .row-label .faint { text-transform: none; letter-spacing: 0; }
  .pips { display: inline-flex; gap: 4px; align-items: center; }
  .pip { width: 14px; height: 6px; border-radius: 2px; background: var(--ink); opacity: .85; }
  .pip.used { background: transparent; border: 1px solid var(--crease); opacity: 1; }
  .pips-text { margin-right: 6px; }

  .target { display: flex; justify-content: center; gap: 3px; padding-block: 2px 6px; }
  .tcell {
    display: grid; place-items: center; font-family: var(--f-mono); font-weight: 700; color: var(--ink);
    border: 2px solid var(--ink); border-radius: 5px; background: var(--sheet);
  }
  .divider { height: 0; border-top: 1px dashed var(--crease); margin-block: 2px; }

  .strip { position: relative; margin-inline: auto; perspective: 700px; }
  .strip.shake { animation: shake .4s; }
  .cell { position: absolute; top: 4px; will-change: transform; transition: left .35s cubic-bezier(.3,.7,.2,1); }
  .tile {
    position: absolute; inset: 2px; border-radius: 6px; display: grid; place-items: center;
    font-family: var(--f-mono); font-weight: 700; color: var(--ink);
    background: var(--sheet);
    background: color-mix(in srgb, var(--accent) calc(var(--h, 0) * 100%), var(--sheet));
    border: 1px solid var(--line);
    box-shadow: 0 2px 0 var(--line), 0 6px 10px -6px rgba(10,20,50,.35);
    transition: transform .15s;
  }
  .tile[data-hi="1"] { color: var(--on-accent); border-color: transparent; }
  .cell.will .tile { transform: translateY(-3px); box-shadow: 0 0 0 2px var(--accent), 0 8px 12px -6px rgba(10,20,50,.4); }
  .cell.pop .tile { animation: pop .3s; }
  .cell.won .tile { background: var(--good); color: #fff; border-color: transparent; animation: pop .45s both; }

  .crease { position: absolute; top: 0; border: 0; background: transparent; padding: 0; z-index: 3; }
  .crease::before { content: ""; position: absolute; left: 50%; top: 2px; bottom: 2px; border-left: 2px dashed var(--crease); transform: translateX(-1px); transition: border-color .15s; }
  .crease:hover::before, .crease:focus-visible::before { border-left-color: var(--accent); border-left-style: solid; }
  .crease.hint::before { border-left: 3px solid var(--accent); animation: pulse 1s infinite alternate; }
  .crease:disabled { cursor: default; }

  .status { min-height: 22px; font-size: 14px; text-align: center; color: var(--muted); }
  .status.bad { color: var(--bad); font-weight: 600; }
  .status.good { color: var(--good); font-weight: 600; }

  .controls { display: flex; gap: 8px; flex-wrap: wrap; }
  .btn { padding: 10px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--sheet); font-weight: 600; font-size: 15px; min-height: 44px; }
  .btn:hover:not(:disabled) { border-color: var(--ink); }
  .btn:disabled { opacity: .45; cursor: default; }
  .btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
  .controls .btn { flex: 1 1 0; }

  .practice { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .practice .lbl { font-family: var(--f-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); width: 100%; }
  .chip { padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--sheet); font-size: 14px; font-weight: 600; }
  .chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

  .sheet {
    position: relative; background: var(--sheet); border: 1px solid var(--line); padding: 20px 20px 18px;
    clip-path: polygon(0 0, calc(100% - 28px) 0, 100% 28px, 100% 100%, 0 100%);
    display: flex; flex-direction: column; gap: 12px;
  }
  .sheet::after { content: ""; position: absolute; top: 0; right: 0; width: 28px; height: 28px; background: linear-gradient(225deg, transparent 50%, var(--line) 50%); }
  .sheet h2 { font-family: var(--f-display); font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin: 0; line-height: 1.05; }
  .sheet p { margin: 0; color: var(--muted); }
  .emoji { font-size: 22px; letter-spacing: 3px; line-height: 1.2; }
  .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 1px dashed var(--crease); padding-top: 12px; }
  .stat b { display: block; font-family: var(--f-mono); font-size: 24px; line-height: 1.1; }
  .stat span { font-size: 12px; color: var(--muted); }
  .actions { display: flex; gap: 8px; flex-wrap: wrap; }
  .actions .btn { flex: 1 1 140px; }
  .next { font-family: var(--f-mono); font-size: 13px; }
  #shareBox { width: 100%; min-height: 96px; font-family: var(--f-mono); font-size: 13px; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 8px; }

  footer { font-size: 12px; color: var(--muted); text-align: center; }
  /* AD SLOT: paste your ad network's embed snippet inside #ad-slot once you have an approved account. */
  #ad-slot:empty { display: none; }
  #ad-slot { display: flex; justify-content: center; min-height: 0; }

  .overlay { position: fixed; inset: 0; z-index: 20; background: rgba(8, 12, 22, .6); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
  .overlay[hidden] { display: none; }
  .card { background: var(--sheet); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 20px; max-width: 440px; width: 100%; display: flex; flex-direction: column; gap: 12px; }
  .card h2 { font-family: var(--f-display); font-size: 28px; font-weight: 800; margin: 0; letter-spacing: -0.02em; }
  .card ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
  .example { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; background: var(--mat); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
  .mini { display: inline-flex; gap: 3px; align-items: center; }
  .mini i { font-style: normal; width: 30px; height: 30px; display: grid; place-items: center; font-family: var(--f-mono); font-weight: 700; font-size: 14px; background: var(--sheet); border: 1px solid var(--line); border-radius: 5px; box-shadow: 0 2px 0 var(--line); }
  .mini i.t { border: 2px solid var(--ink); box-shadow: none; }
  .mini s { width: 0; height: 30px; border-left: 2px dashed var(--crease); margin-inline: 3px; text-decoration: none; }
  .arrow { font-family: var(--f-mono); color: var(--muted); }

  @keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.14); } 100% { transform: scale(1); } }
  @keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
  @keyframes pulse { from { opacity: .35; } to { opacity: 1; } }
  @media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
  }
  @media (max-width: 420px) {
    h1 { font-size: 38px; }
    .mat { padding-inline: 8px; }
  }

/* ---------- Added: site navigation, streak chip, content pages ---------- */
a { color: var(--accent); text-underline-offset: 3px; }
a.btn { display: inline-grid; place-items: center; text-decoration: none; color: var(--ink); }
.lede a { font-weight: 600; white-space: nowrap; }
.streak { font-family: var(--f-mono); font-size: 12px; padding: 3px 8px; border-radius: 999px; background: var(--ink); color: var(--paper); letter-spacing: .02em; white-space: nowrap; }
.sitenav { display: flex; gap: 18px; font-size: 14px; font-weight: 600; flex-wrap: wrap; margin-top: -6px; }
.sitenav a { color: var(--muted); text-decoration: none; }
.sitenav a:hover, .sitenav a[aria-current="page"] { color: var(--ink); text-decoration: underline; }

.about { display: flex; flex-direction: column; gap: 14px; border-top: 1px dashed var(--crease); padding-top: 22px; margin-top: 8px; }
.about h2, .doc h2 { font-family: var(--f-display); font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin: 0; line-height: 1.15; }
.about p, .doc p, .doc li { margin: 0; max-width: 62ch; }
.faq { display: flex; flex-direction: column; gap: 8px; }
.faq details, .doc details { border: 1px solid var(--line); background: var(--sheet); border-radius: 8px; padding: 10px 14px; }
.faq summary, .doc summary { cursor: pointer; font-weight: 600; }
.faq details p, .doc details p { margin-top: 8px; color: var(--muted); }

.doc { display: flex; flex-direction: column; gap: 14px; }
.doc h1 { font-size: 36px; margin-bottom: 2px; }
.doc ul, .doc ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
.doc .meta { font-family: var(--f-mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.doc .cta { align-self: flex-start; }
.crumbs { font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.pager { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-weight: 600; font-size: 14px; }

.steps { display: flex; flex-direction: column; gap: 12px; }
.step { border: 1px solid var(--line); background: var(--sheet); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.step .lbl { font-family: var(--f-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.step .row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mini.sm i { width: 26px; height: 26px; font-size: 12px; }
.mini.sm s { height: 26px; }

.archive { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; list-style: none; padding: 0; }
.archive li { margin: 0; }
.archive a { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); background: var(--sheet); border-radius: 8px; text-decoration: none; color: var(--ink); min-width: 0; }
.archive a:hover { border-color: var(--ink); }
.archive b { font-family: var(--f-mono); font-size: 15px; }
.archive span { font-size: 12px; color: var(--muted); }
.archive li.done a { border-color: var(--good); }
.archive li.done b::after { content: " \2713"; color: var(--good); }
.tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.logo { font-family: var(--f-display); font-weight: 800; font-size: 36px; line-height: 1; letter-spacing: -0.03em; color: var(--ink); text-decoration: none; font-variation-settings: "opsz" 96; }
