
  :root {
    --cream:      #FFF7E8;
    --paper:      #FFFCF2;
    --off:        #F4EEDB;
    --ink:        #15132B;
    --ink-soft:   #2A2748;
    --muted:      #6A6588;
    --brand:      #6C63FF;
    --brand-deep: #4A41D4;
    --sun:        #FFC233;
    --mustard:    #FFC233;
    --hot:        #FF4F8B;
    --teal:       #1FC8A9;
    --mint:       #6EE7CF;
    --coral:      #FF8966;
    --good:       #2ECC71;
    --bad:        #E74C3C;
  }
  * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  html, body {
    margin: 0; padding: 0;
    min-height: 100vh;
    background: var(--cream);
    color: var(--ink);
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    background-image:
      radial-gradient(circle at 12% 8%,  rgba(255, 79, 139, 0.10) 0, transparent 38%),
      radial-gradient(circle at 88% 20%, rgba(108, 99, 255, 0.12) 0, transparent 42%),
      radial-gradient(circle at 50% 95%, rgba(31, 200, 169, 0.10) 0, transparent 45%);
    background-attachment: fixed;
    overflow-x: hidden;
    user-select: none;
    -webkit-user-select: none;
  }
  body::before {
    content: "";
    position: fixed; inset: 0;
    background-image:
      radial-gradient(rgba(31, 27, 58, 0.05) 1px, transparent 1px),
      radial-gradient(rgba(31, 27, 58, 0.025) 1px, transparent 1px);
    background-size: 24px 24px, 16px 16px;
    background-position: 0 0, 12px 12px;
    pointer-events: none;
    z-index: 0;
  }
  body {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 22px 16px 60px;
  }
  .wrap {
    width: 100%;
    max-width: 600px;
    text-align: center;
    position: relative;
    z-index: 1;
  }

  /* ---- Top brand nav ---- */
  .topnav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    gap: 12px;
    text-align: left;
  }
  .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--ink);
  }
  .logo-mark {
    width: 38px; height: 38px;
    background: var(--ink);
    border-radius: 10px;
    display: grid;
    place-items: center;
    color: var(--sun);
    font-family: 'Fredoka', sans-serif;
    font-weight: 900;
    font-size: 22px;
    transform: rotate(-4deg);
    box-shadow: 3px 3px 0 var(--hot);
    flex-shrink: 0;
  }
  .logo-text {
    font-family: 'Fredoka', sans-serif;
    font-weight: 800;
    font-size: 17px;
    letter-spacing: -0.01em;
    line-height: 1;
  }
  .logo-text .dot-mark { color: var(--hot); }
  .logo-text .tld { color: var(--brand); }
  .back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--paper);
    border: 2.5px solid var(--ink);
    border-radius: 999px;
    padding: 7px 14px;
    color: var(--ink);
    text-decoration: none;
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    font-size: 13px;
    box-shadow: 3px 3px 0 var(--ink);
    transition: transform 0.1s, box-shadow 0.1s;
    flex-shrink: 0;
  }
  .back-link:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 var(--ink);
  }
  .back-link:active {
    transform: translate(1px, 1px);
    box-shadow: 2px 2px 0 var(--ink);
  }

  /* ---- Header ---- */
  h1 {
    font-family: 'Fredoka', sans-serif;
    font-size: clamp(40px, 8vw, 64px);
    font-weight: 900;
    margin: 12px 0 4px;
    letter-spacing: 0.02em;
    line-height: 0.95;
    color: var(--ink);
    text-shadow: 4px 4px 0 var(--mustard), 8px 8px 0 var(--brand);
    transform: rotate(-1.5deg);
    display: inline-block;
  }
  h1 .dot { color: var(--hot); display: inline-block; transform: scale(1.3) translateY(2px); }
  .sub {
    margin-top: 18px;
    font-size: 13px; font-weight: 700;
    color: var(--brand);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 18px;
  }

  /* ---- Panel ---- */
  .panel {
    background: var(--paper);
    border: 3px solid var(--ink);
    border-radius: 22px;
    padding: 26px 24px 28px;
    box-shadow: 12px 12px 0 var(--ink);
    position: relative;
    text-align: left;
  }
  .panel::after {
    content: "";
    position: absolute;
    top: -12px; right: -12px;
    width: 52px; height: 52px;
    background: var(--mustard);
    transform: rotate(15deg);
    border: 3px solid var(--ink);
    border-radius: 12px;
    z-index: 0;
  }
  .panel::before {
    content: "DAILY";
    position: absolute;
    top: 10px; right: 0;
    z-index: 1;
    transform: rotate(15deg);
    font-family: 'Fredoka', sans-serif;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.1em;
    color: var(--ink);
  }

  /* ---- Status bar ---- */
  .status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-family: 'Fredoka', sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--brand);
    position: relative;
    z-index: 2;
    padding-right: 44px;
  }
  .status strong { color: var(--ink); font-weight: 800; }

  /* ---- Display: current → target ---- */
  .display {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 10px;
    margin: 0 auto 18px;
    max-width: 440px;
  }
  .display .box {
    flex: 1;
    background: var(--cream);
    border: 3px solid var(--ink);
    border-radius: 14px;
    padding: 12px 8px 10px;
    text-align: center;
    box-shadow: 4px 4px 0 var(--ink);
    min-width: 0;
  }
  .display .box .lbl {
    font-family: 'Fredoka', sans-serif;
    font-size: 11px;
    color: var(--brand);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 4px;
  }
  .display .box .val {
    font-family: 'Fredoka', sans-serif;
    font-size: 34px;
    font-weight: 900;
    color: var(--ink);
    line-height: 1;
    font-variant-numeric: tabular-nums;
  }
  .display .box.cur .val { color: var(--ink); }
  .display .box.tgt { background: var(--ink); border-color: var(--ink); }
  .display .box.tgt .lbl { color: var(--mustard); }
  .display .box.tgt .val { color: var(--mustard); }
  .display .arrow {
    align-self: center;
    font-family: 'Fredoka', sans-serif;
    font-size: 24px;
    color: var(--ink);
    font-weight: 900;
    padding: 0 2px;
  }
  .display .box.cur.match { background: var(--good); border-color: var(--ink); }
  .display .box.cur.match .val { color: white; }
  .display .box.cur.match .lbl { color: white; }

  /* ---- Optimal callout ---- */
  .optimal-row {
    display: flex;
    justify-content: center;
    margin: -4px 0 16px;
  }
  .optimal-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 18px;
    background: var(--ink);
    border: 2.5px solid var(--ink);
    border-radius: 999px;
    box-shadow: 3px 3px 0 var(--brand);
    font-family: 'Fredoka', sans-serif;
    font-weight: 800;
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--cream);
  }
  .optimal-pill strong {
    color: var(--mustard);
    font-size: 18px;
    letter-spacing: 0;
    line-height: 1;
  }

  /* ---- Grid ---- */
  .ngrid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin: 0 auto 18px;
    width: 100%;
    max-width: 460px;
    aspect-ratio: 1 / 1;
    padding: 10px;
    background: var(--cream);
    border: 3px solid var(--ink);
    border-radius: 18px;
    box-shadow: 5px 5px 0 var(--ink);
  }
  .ncell {
    position: relative;
    background: var(--paper);
    border: 2px solid var(--ink);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fredoka', sans-serif;
    font-weight: 800;
    font-size: clamp(14px, 3.4vw, 20px);
    color: var(--ink);
    cursor: default;
    transition: transform 0.08s, background 0.15s, color 0.15s, box-shadow 0.1s;
    user-select: none;
    box-shadow: 1.5px 1.5px 0 var(--ink);
  }
  .ncell .badge {
    position: absolute;
    top: 2px;
    left: 2px;
    background: var(--ink);
    color: var(--cream);
    font-size: 9px;
    font-weight: 800;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 5px;
    letter-spacing: 0.04em;
  }
  .ncell.start {
    background: var(--teal);
    color: white;
    border-color: var(--ink);
    font-size: clamp(9px, 2.1vw, 12px);
    letter-spacing: 0.1em;
    font-weight: 900;
  }
  .ncell.start .badge { background: white; color: var(--ink); }
  .ncell.start-current {
    box-shadow: 3px 3px 0 var(--ink);
    transform: translate(-1px, -1px);
  }
  .ncell.visited {
    background: var(--off);
    color: var(--ink-soft);
    box-shadow: 1px 1px 0 var(--ink);
    opacity: 0.85;
  }
  .ncell.visited .badge { background: var(--brand); }
  .ncell.current {
    background: var(--hot);
    color: white;
    border-color: var(--ink);
    box-shadow: 3px 3px 0 var(--ink);
    transform: translate(-1px, -1px);
  }
  .ncell.current .badge { background: white; color: var(--hot); }
  .ncell.adjacent {
    cursor: pointer;
    background: var(--mint);
  }
  .ncell.adjacent:hover {
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--ink);
  }
  .ncell.adjacent:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 var(--ink);
  }
  .ncell.dead {
    opacity: 0.5;
  }

  /* ---- Buttons ---- */
  .btn {
    appearance: none;
    border: 3px solid var(--ink);
    background: var(--mustard);
    color: var(--ink);
    font-family: 'Fredoka', sans-serif;
    font-weight: 800;
    font-size: 16px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 13px 28px;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 4px 5px 0 var(--ink);
    transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.2s;
    margin: 4px;
  }
  .btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 6px 0 var(--ink); }
  .btn:active { transform: translate(2px, 3px); box-shadow: 1px 2px 0 var(--ink); }
  .btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: 4px 5px 0 var(--ink) !important;
  }
  .btn.primary { background: var(--hot); color: white; }
  .btn.go      { background: var(--good); color: white; }
  .btn.next    { background: var(--brand); color: white; }
  .btn.share   { background: var(--teal); color: white; }
  .btn.ghost {
    background: var(--paper);
    color: var(--ink);
  }
  .btn.small {
    font-size: 13px;
    padding: 9px 16px;
  }
  .btn-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
  }

  /* ---- Prompt ---- */
  .prompt {
    font-family: 'Fredoka', sans-serif;
    font-size: 17px;
    font-weight: 600;
    margin: 12px 0 18px;
    min-height: 24px;
    color: var(--ink);
    text-align: center;
    line-height: 1.4;
  }
  .prompt .accent { color: var(--hot); font-weight: 800; }
  .prompt .teal   { color: var(--teal); font-weight: 800; }

  /* ---- Scoreline ---- */
  .scoreline {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 18px 0 8px;
    flex-wrap: wrap;
  }
  .scoreline > div {
    background: var(--cream);
    border: 2.5px solid var(--ink);
    border-radius: 14px;
    padding: 12px 16px;
    text-align: center;
    min-width: 90px;
    box-shadow: 3px 3px 0 var(--ink);
  }
  .scoreline .num {
    font-family: 'Fredoka', sans-serif;
    color: var(--ink);
    font-weight: 800;
    font-size: 22px;
    line-height: 1;
    display: block;
    margin-bottom: 4px;
  }
  .scoreline > div > div:last-child {
    font-size: 11px;
    font-weight: 700;
    color: var(--brand);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-family: 'Fredoka', sans-serif;
  }

  /* ---- Final score ---- */
  .final {
    padding: 8px 0;
    text-align: center;
  }
  .final .label {
    color: var(--brand);
    font-size: 12px;
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }
  .final .bigscore-card {
    margin: 14px auto 8px;
    background: var(--ink);
    color: var(--cream);
    padding: 22px 28px 18px;
    border-radius: 22px;
    text-align: center;
    box-shadow: 6px 6px 0 var(--brand);
    transform: rotate(-1deg);
    border: 3px solid var(--ink);
    font-family: 'Fredoka', sans-serif;
    display: inline-block;
  }
  .final .bigscore {
    font-family: 'Fredoka', sans-serif;
    font-size: 56px;
    font-weight: 900;
    color: var(--mustard);
    line-height: 1;
    margin: 4px 0 6px;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
  }
  .final .flavor {
    color: var(--cream);
    font-size: 16px;
    font-weight: 700;
    margin-top: 6px;
    letter-spacing: 0.04em;
  }
  .final .stars {
    font-size: 28px;
    margin: 10px 0 0;
    letter-spacing: 0.08em;
  }

  .footer-note {
    margin-top: 18px;
    font-size: 12px;
    color: var(--brand);
    opacity: 0.85;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-align: center;
  }

  @media (max-width: 480px) {
    .panel { padding: 22px 12px 24px; }
    .ngrid { padding: 6px; gap: 4px; }
    .ncell { font-size: 14px; border-radius: 8px; }
    .ncell.start { font-size: 9px; }
    .ncell .badge { font-size: 8px; padding: 2px 3px; }
    .scoreline { gap: 8px; }
    .scoreline > div { padding: 10px 12px; min-width: 70px; }
    .final .bigscore { font-size: 44px; }
    .display .box .val { font-size: 28px; }
    .display .arrow { font-size: 20px; }
  }
