/* ---------- COLORS: same set as the other pages ---------- */
  :root {
    --bg: #0c0813;
    --line: #2f2246;
    --purple: #7a3fc4;
    --purple-soft: #b795ee;
    --text-main: #f3ecf4;
    --text-dim: #9a8ca8;
    --crimson: #cc1a30;
    --crimson-dim: #7a1020;
    --gold: #f2b94b;
    --gold-dim: #b8892f;
    box-sizing: border-box;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  html { scroll-padding-top: env(safe-area-inset-top, 0px); }
  * { box-sizing: border-box; }

  body {
    margin: 0;
    color: var(--text-main);
    font-family: 'Space Mono', monospace;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
      radial-gradient(ellipse 90% 55% at 50% 22%, rgba(122,63,196,0.34), transparent 70%),
      radial-gradient(ellipse 100% 40% at 50% 100%, rgba(70,24,110,0.40), transparent 70%),
      var(--bg);
  }

  /* ---------- STARS (same three layers) ---------- */
  body::before {
    content: "";
    position: fixed; inset: 0; pointer-events: none; z-index: 0;
    background-image:
      radial-gradient(1px 1px at 12px 18px,  rgba(255,245,250,0.55), transparent 60%),
      radial-gradient(1px 1px at 61px 88px,  rgba(255,245,250,0.45), transparent 60%),
      radial-gradient(1px 1px at 104px 41px, rgba(255,245,250,0.50), transparent 60%),
      radial-gradient(1px 1px at 143px 121px,rgba(255,245,250,0.40), transparent 60%),
      radial-gradient(1px 1px at 37px 119px, rgba(255,245,250,0.50), transparent 60%);
    background-size: 151px 149px, 173px 167px, 197px 181px, 211px 199px, 131px 137px;
  }
  body::after {
    content: "";
    position: fixed; inset: 0; pointer-events: none; z-index: 0;
    background-image:
      radial-gradient(1.5px 1.5px at 45px 30px,   rgba(255,250,255,0.95), transparent 60%),
      radial-gradient(1.5px 1.5px at 130px 95px,  rgba(255,250,255,0.85), transparent 60%),
      radial-gradient(1.5px 1.5px at 210px 160px, rgba(255,250,255,0.90), transparent 60%);
    background-size: 257px 233px, 293px 271px, 331px 307px;
    animation: twinkle 5s ease-in-out infinite alternate;
  }
  .stars-gold {
    position: fixed; inset: 0; pointer-events: none; z-index: 0;
    background-image:
      radial-gradient(2px 2px at 80px 60px,   rgba(242,185,75,0.95), transparent 60%),
      radial-gradient(2px 2px at 190px 140px, rgba(242,185,75,0.80), transparent 60%);
    background-size: 389px 353px, 431px 397px;
    animation: twinkle 7s ease-in-out infinite alternate;
    animation-delay: -3s;
  }
  @keyframes twinkle { from { opacity: 0.45; } to { opacity: 1; } }
  @media (prefers-reduced-motion: reduce) {
    body::after, .stars-gold { animation: none; }
  }

  header, main, footer { position: relative; z-index: 1; }
  .pixel { font-family: 'Press Start 2P', monospace; }

  header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
  }
  .logo { display: flex; align-items: center; gap: 10px; font-size: 13px; letter-spacing: 1px; }
  .login-link {
    font-size: 12px;
    color: var(--purple-soft);
    border: 1px solid var(--line);
    padding: 8px 14px;
    border-radius: 3px;
    text-decoration: none;
    background: rgba(122,63,196,0.12);
  }

  main {
    flex: 1;
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 24px 20px 64px;
  }
  .back {
    display: inline-block;
    font-size: 12px;
    color: var(--text-dim);
    text-decoration: none;
    margin-bottom: 22px;
  }
  .title-row { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
  .title-row svg { width: 38px; height: 38px; flex: none; }
  h1.pixel {
    font-size: 15px;
    line-height: 1.7;
    margin: 0;
    text-shadow: 0 0 14px rgba(204,26,48,0.55);
  }
  .sub { font-size: 13px; color: var(--text-dim); margin: 0 0 26px; line-height: 1.6; }

  /* ---------- TABS ---------- */
  .tabs {
    display: flex;
    align-items: stretch;
    gap: 2px;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    flex: none;
    background: none;
    border: 0;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    color: var(--text-dim);
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 13px;
    padding: 14px 14px;
    cursor: pointer;
    white-space: nowrap;
  }
  .tab[aria-selected="true"] {
    color: var(--gold);
    border-bottom-color: var(--crimson);
  }
  .tab:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
  .tab-sep { flex: none; width: 1px; background: var(--line); margin: 10px 8px; }

  /* ---------- PANELS ---------- */
  .panel { padding: 24px 0 8px; }
  .panel[hidden] { display: none; }
  .note { font-size: 12px; color: var(--purple-soft); margin: 0 0 22px; line-height: 1.6; }
  .pointer {
    display: inline-block;
    font-size: 12px;
    color: var(--gold);
    text-decoration: none;
    border: 1px dashed var(--gold-dim);
    border-radius: 3px;
    padding: 9px 12px;
    margin-bottom: 26px;
  }

  .block {
    border-left: 3px solid var(--purple);
    padding: 2px 0 2px 16px;
    margin-bottom: 26px;
  }
  .block h3 { font-size: 14px; margin: 0 0 8px; color: var(--text-main); }
  .block p { font-size: 13px; line-height: 1.7; color: var(--text-dim); margin: 0; }

  .step { display: flex; gap: 14px; margin-bottom: 24px; }
  .num {
    flex: none;
    width: 36px;
    height: 36px;
    border: 2px solid var(--gold-dim);
    background: #120a1e;
    color: var(--gold);
    font-family: 'Press Start 2P', monospace;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
  }
  .step h3 { font-size: 14px; margin: 6px 0 8px; }
  .step p { font-size: 13px; line-height: 1.7; color: var(--text-dim); margin: 0; }

  .callout {
    margin-top: 12px;
    border: 1px dashed var(--line);
    border-radius: 4px;
    padding: 14px 16px;
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.6;
  }
  .callout a { color: var(--gold); text-decoration: none; font-weight: 700; }

  /* ---------- CAVEATS: grouped under one small "More" toggle per step ---------- */
  /* Built with native <details>/<summary> so it works with no JavaScript.
     Default view shows only a small "More" link, not a full box, so a step
     with several snags doesn't get visually loud until someone asks for it. */
  .caveat-toggle {
    margin: -8px 0 24px 50px;
  }
  .caveat-toggle summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--gold);
    padding: 6px 0;
  }
  .caveat-toggle summary::-webkit-details-marker { display: none; }
  .caveat-toggle summary::after {
    content: "▸";
    color: var(--gold-dim);
    transition: transform 0.15s ease;
  }
  .caveat-toggle[open] summary::after { transform: rotate(90deg); }

  .caveat-list {
    margin-top: 6px;
    padding-left: 16px;
    border-left: 2px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  .caveat-item-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
  }
  /* severity marker: gold = common/normal, crimson = bigger issue.
     Add class "sev-severe" to a dot to switch it -- nothing else changes. */
  .sev-dot {
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gold);
  }
  .sev-dot.sev-severe { background: var(--crimson); }
  .caveat-item p {
    font-size: 12px;
    line-height: 1.7;
    color: var(--text-dim);
    margin: 6px 0 0;
  }

  @media (max-width: 480px) {
    .caveat-toggle { margin-left: 0; }  /* phones: not indented under the number */
  }

  footer {
    border-top: 1px solid var(--line);
    padding: 22px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    justify-content: center;
    font-size: 12px;
  }
  footer a { color: var(--text-dim); text-decoration: none; border-bottom: 1px dotted var(--line); }

  .assist-btn {
    position: fixed;
    bottom: calc(78px + env(safe-area-inset-bottom, 0px)); /* lifted clear of the footer links */
    right: 18px;
    z-index: 2;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: #1a0f2a;
    border: 2px solid var(--gold-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 1px var(--crimson-dim), 0 0 20px rgba(204,26,48,0.45);
    cursor: pointer;
    padding: 0;
  }
  .assist-btn svg { width: 30px; height: 30px; }

  @media (min-width: 760px) {
    h1.pixel { font-size: 18px; }
    .tab { font-size: 14px; padding: 14px 18px; }
  }


  /* SAVE-MY-PLACE: per-step "Mark done" + progress meter (free feature; saves to a free account) */
  .pmeter { --n:5; --done:0; position:relative; height:10px; background:var(--slot); border:1px solid var(--line); border-radius:3px; overflow:hidden; flex:1; min-width:0; }
  .pmeter > i { position:absolute; inset:0 auto 0 0; width:calc(100% * var(--done) / var(--n)); background:var(--purple-soft); transition:width .25s; }
  .pmeter::after { content:""; position:absolute; inset:0; background:repeating-linear-gradient(90deg,transparent 0,transparent calc(100% / var(--n) - 2px),var(--slot) calc(100% / var(--n) - 2px),var(--slot) calc(100% / var(--n))); }
  .pbar { display:flex; align-items:center; gap:12px; margin:0 0 6px; font-size:12px; color:var(--text-dim); }
  .pbar b { color:var(--text-main); font-weight:700; white-space:nowrap; }
  .save-note { font-size:12px; line-height:1.6; color:var(--text-dim); margin:0 0 22px; }
  .save-note a { color:var(--gold); }
  .done-btn { margin-top:10px; font:inherit; font-size:12px; color:var(--gold); background:transparent; border:1px solid var(--gold-dim); padding:6px 12px; border-radius:3px; cursor:pointer; }
  .step.is-done .num { background:var(--gold); color:#0c0813; border-color:var(--gold); }
  .step.is-done h3 { color:var(--text-dim); }
  .step.is-done .done-btn { color:var(--text-dim); border-color:var(--line); }

/* tabs as tiles */
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; overflow: visible; border-bottom: 0; padding: 4px 0 6px; }
.tabs .tab.tile { display: flex; flex-direction: column; align-items: center; gap: 8px; white-space: normal; text-align: center; margin: 0; padding: 14px 8px 12px; background: rgba(23,16,36,0.88); border: 1px solid var(--line); border-radius: 6px; transition: border-color .15s, transform .15s; }
.tabs .tab.tile:hover { border-color: var(--purple); transform: translateY(-2px); }
.tabs .tab.tile[aria-selected="true"] { border-color: var(--crimson); box-shadow: 0 0 0 1px var(--crimson-dim), 0 0 16px rgba(204,26,48,0.25); color: var(--gold); }
.tabs .tab.tile:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.tile-ic { width: 48px; height: 48px; padding: 6px; border: 2px solid var(--gold-dim); border-radius: 4px; background: var(--slot); box-sizing: border-box; display: block; }
.tile-ic svg { width: 100%; height: 100%; display: block; }
.tile-name { font-size: 13px; line-height: 1.3; }
.tile-steps { font-size: 11px; font-weight: 400; color: var(--text-dim); }
@media (max-width: 640px) { .tabs { grid-template-columns: repeat(2, 1fr); } }
@media (prefers-reduced-motion: reduce) { .tabs .tab.tile { transition: none; transform: none !important; } }
/* hidden icons in the page header (per-tab header) */
.title-row svg[hidden] { display: none; }
/* lists inside guide blocks (added at build time) */
.block ul, .block ol { margin: 10px 0 0; padding-left: 20px; font-size: 13px; line-height: 1.7; color: var(--text-dim); }
.block li { margin: 0 0 8px; }
.block p + p, .block p + ul, .block p + ol, .block ul + p, .block ol + p { margin-top: 10px; }
.block b { color: var(--text-main); overflow-wrap: anywhere; }
.block li, .block p { overflow-wrap: anywhere; }
.block a { color: var(--gold); }
.caveat-item p + p { margin-top: 10px; }
/* jump links, dropdowns, command boxes in the Basics guide (draft 4). Gold is only for clickable things. */
.jump { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px 0 0; font-size: 12px; line-height: 1.4; color: var(--text-dim); }
.jump a { color: var(--purple-soft); border: 1px solid var(--purple); border-radius: 3px; padding: 5px 9px; text-decoration: none; }
.jump a:hover, .jump a:focus-visible { background: rgba(122, 63, 196, 0.18); }
.jump a.go-start { color: var(--gold); border-color: var(--gold-dim); }
.jump a.go-start:hover, .jump a.go-start:focus-visible { background: rgba(242, 185, 75, 0.12); }
.jump a.go-move { color: var(--gold); border-color: var(--gold-dim); }
.jump a.go-move:hover, .jump a.go-move:focus-visible { background: rgba(242, 185, 75, 0.12); }
.jump a.go-update { color: #e8758a; border-color: #b3243b; }
.jump a.go-update:hover, .jump a.go-update:focus-visible { background: rgba(200, 40, 70, 0.16); }
#panel-basics > .jump { margin: 0 0 14px; }
#panel-basics .block { scroll-margin-top: 16px; }
.block code { color: var(--text-main); background: var(--slot); border-radius: 3px; padding: 1px 5px; font-family: inherit; }
.block code.cmd { display: inline-block; margin: 6px 0; padding: 6px 10px; word-break: normal; overflow-wrap: anywhere; border-left: 2px solid var(--line); }
.block details.dd { margin: 12px 0 0; text-align: left; }
.block details.dd > summary { text-align: left; line-height: 1.4; }
.dd-body { margin-top: 8px; padding-left: 16px; border-left: 2px solid var(--line); }
.dd-body ul { margin: 6px 0 0; padding-left: 18px; }
.dd-body, .dd-body b, .dd-body li, .dd-body p, .caveat-item p, .caveat-item b { overflow-wrap: anywhere; }
.dd-body li { margin: 0 0 8px; }
.block.milestone { border-left-color: var(--gold-dim); background: linear-gradient(90deg, rgba(242, 185, 75, 0.07), transparent 70%); padding-top: 12px; padding-bottom: 10px; }
.block.update { border-left-color: #b3243b; background: linear-gradient(90deg, rgba(200, 40, 70, 0.10), transparent 70%); padding-top: 12px; padding-bottom: 10px; }
.block.update .milestone-kicker { color: #e8758a; }
.milestone-kicker { margin: 0 0 2px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--purple-soft, var(--text-dim)); }
/* saved progress: "Mark done" under each guide step, meter above the guide */
.pbar-wrap { margin: 0 0 18px; }
.pbar-wrap .save-note { margin: 6px 0 0; }
.done-row { margin-top: 8px; }
.done-row .done-btn { margin-top: 0; }
li.is-done > b:first-child { color: var(--text-dim); }
li.is-done::marker { color: var(--gold); }
li.is-done .done-btn { color: var(--text-dim); border-color: var(--line); }
