/* ==========================================================================
   CLOUD PIRATES — HUD & interface
   ========================================================================== */
:root {
  --navy: #141a3a;
  --navy-2: #1f2752;
  --ink: #0d1128;
  --sky: #7cc4f2;
  --lav: #a99be8;
  --lav-2: #c9bff2;
  --cream: #fff4dc;
  --cream-2: #f3e3bd;
  --gold: #f2c14e;
  --gold-2: #ffdf8a;
  --gold-d: #b5801f;
  --glass: rgba(17, 22, 54, 0.78);
  --glass-2: rgba(28, 35, 80, 0.86);
  --line: rgba(255, 244, 220, 0.14);
  --line-2: rgba(255, 244, 220, 0.26);
  --text: #fff4dc;
  --muted: #c3c0e4;
  --radius: 14px;
  --gutter: 16px;
  --font: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --pixel: "Pixelify Sans", "Outfit", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --shadow: 0 10px 30px rgba(8, 10, 30, 0.35), 0 2px 0 rgba(8, 10, 30, 0.25);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--navy);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, a { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--gold-2);
  outline-offset: 2px;
  border-radius: 8px;
}

.skip {
  position: fixed; left: 12px; top: -60px; z-index: 100;
  background: var(--gold); color: var(--ink); padding: 8px 14px; border-radius: 10px;
  font-weight: 700; text-decoration: none; transition: top .2s;
}
.skip:focus { top: 12px; }

/* ---------- WORLD CANVAS ---------- */
#world {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh; height: 100dvh;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
  cursor: crosshair;
  background: #7cc4f2;
}
.fade {
  position: fixed; inset: 0; z-index: 60; pointer-events: none;
  background: var(--navy); opacity: 1; transition: opacity .45s ease;
}
.fade.off { opacity: 0; }

/* ---------- SHARED PANELS ---------- */
.glass, .hud-top > *, .ca-panel, .hud-progress, .tool-btn, .card, .tutorial {
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  backdrop-filter: blur(10px) saturate(1.2);
}
.chip {
  font-family: var(--pixel); font-weight: 600; font-size: 12px; letter-spacing: .04em;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(242, 193, 78, .16); color: var(--gold-2);
  border: 1px solid rgba(242, 193, 78, .4);
}
.kicker {
  margin: 0 0 4px; font-family: var(--pixel); font-weight: 600; font-size: 12px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--gold-2);
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.gold { color: var(--gold-2); }

/* ---------- TOP HUD ---------- */
.hud-top {
  position: fixed; z-index: 30;
  top: calc(12px + var(--safe-t)); left: var(--gutter); right: var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  pointer-events: none;
}
.hud-top > * { pointer-events: auto; }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 14px 7px 8px; border-radius: var(--radius);
  background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow);
  text-decoration: none; transition: border-color .2s, transform .2s;
}
.brand:hover { border-color: var(--line-2); transform: translateY(-1px); }
.brand-logo { width: 30px; height: 30px; background: var(--ink); border-radius: 8px; padding: 2px; }
.brand-name { font-family: var(--pixel); font-weight: 700; font-size: 19px; letter-spacing: .01em; white-space: nowrap; }

.nav {
  display: flex; gap: 2px; padding: 5px; border-radius: var(--radius);
  background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.nav-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: none; border: 0; padding: 8px 14px; border-radius: 10px;
  font-weight: 600; font-size: 14px; color: var(--cream); text-decoration: none;
  transition: background .18s, color .18s;
}
.nav-btn:hover { background: rgba(255, 244, 220, .08); }
.nav-btn.active { background: rgba(169, 155, 232, .22); color: #fff; box-shadow: inset 0 0 0 1px rgba(169,155,232,.45); }
.nav-btn svg { width: 16px; height: 16px; }
.nav-social { display: none; }

.hud-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 42px; height: 42px; display: inline-grid; place-items: center;
  border-radius: 12px; background: var(--glass); border: 1px solid var(--line);
  box-shadow: var(--shadow); cursor: pointer; text-decoration: none;
  transition: transform .18s, border-color .18s, background .18s;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { transform: translateY(-2px); border-color: var(--line-2); background: var(--glass-2); }
.menu-btn { display: none; }
.menu-btn .m-close { display: none; }
.menu-btn[aria-expanded="true"] .m-open { display: none; }
.menu-btn[aria-expanded="true"] .m-close { display: inline; }

.buy-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 12px;
  font-family: var(--pixel); font-weight: 700; font-size: 16px; letter-spacing: .04em;
  color: var(--ink); text-decoration: none; white-space: nowrap; cursor: pointer;
  background: linear-gradient(180deg, #ffe39a 0%, #f2c14e 55%, #e2a83a 100%);
  border: 1px solid #ffeab3;
  box-shadow: 0 4px 0 var(--gold-d), 0 10px 24px rgba(242, 193, 78, .28);
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.buy-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--gold-d), 0 14px 30px rgba(242,193,78,.36); filter: brightness(1.04); }
.buy-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--gold-d); }
.buy-btn.is-disabled {
  cursor: not-allowed; filter: grayscale(.75) brightness(.8); opacity: .78;
  box-shadow: 0 3px 0 #6c6a7c;
}
.buy-btn.is-disabled:hover { transform: none; }
.buy-btn.wide { width: 100%; height: 50px; font-size: 18px; margin: 14px 0 8px; }

/* ---------- WELCOME ---------- */
.welcome {
  position: fixed; z-index: 10; left: 50%; top: calc(86px + var(--safe-t));
  transform: translateX(-50%); width: min(680px, calc(100vw - 32px));
  text-align: center; pointer-events: none;
  transition: opacity .9s ease, transform .9s ease;
  text-shadow: 0 2px 0 rgba(13, 17, 40, .45), 0 4px 18px rgba(13, 17, 40, .45);
}
.welcome.gone { opacity: 0; transform: translate(-50%, -12px); }
.welcome-kicker { margin: 0 0 6px; font-family: var(--pixel); font-weight: 600; font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-2); }
.welcome h1 {
  margin: 0; font-family: var(--pixel); font-weight: 700;
  font-size: clamp(30px, 4.2vw, 50px); line-height: 1.02; letter-spacing: .01em; color: #fff;
}
.welcome-lede { margin: 8px auto 0; max-width: 600px; font-size: clamp(15px, 1.6vw, 18px); font-weight: 500; color: #fff; }
.welcome-tag {
  display: inline-block; margin: 12px 0 0; padding: 5px 14px; border-radius: 999px;
  font-weight: 600; font-size: 14px; color: var(--ink); text-shadow: none;
  background: rgba(255, 244, 220, .88); box-shadow: 0 3px 0 rgba(13,17,40,.25);
}

/* ---------- PROGRESS ---------- */
.hud-progress {
  position: fixed; z-index: 20; right: var(--gutter); bottom: calc(76px + var(--safe-b));
  display: flex; align-items: center; gap: 10px;
  padding: 7px 14px 7px 7px; border-radius: var(--radius);
  background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.compass svg { width: 40px; height: 40px; display: block; }
#compassNeedle { transform-origin: 20px 20px; transition: transform .25s linear; }
.progress-text { display: flex; flex-direction: column; line-height: 1.25; }
.pt-k { font-family: var(--pixel); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-2); }
#progressText { font-size: 13px; font-weight: 600; white-space: nowrap; }

/* ---------- CONTRACT PANEL ---------- */
.ca-panel {
  position: fixed; z-index: 25; left: var(--gutter); bottom: calc(16px + var(--safe-b));
  width: min(470px, calc(100vw - 32px));
  padding: 10px 12px 10px 14px; border-radius: var(--radius);
  background: var(--glass); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.ca-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ca-label { font-family: var(--pixel); font-weight: 600; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-2); }
.ca-net { font-size: 12px; color: var(--muted); }
.ca-row { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.ca-text {
  flex: 1; min-width: 0; font-family: var(--mono); font-size: 13px; color: #fff;
  white-space: normal; word-break: break-all; line-height: 1.35;
}
.ca-text.is-empty { font-family: var(--font); font-weight: 600; color: var(--cream-2); }
.ca-short { display: none; }
.ca-note { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.ca-note:empty { display: none; }

.copy-btn {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 12px; border-radius: 10px;
  background: rgba(242, 193, 78, .14); border: 1px solid rgba(242, 193, 78, .55);
  color: var(--gold-2); font-weight: 700; font-size: 13px;
  transition: background .15s, transform .15s;
}
.copy-btn svg { width: 15px; height: 15px; }
.copy-btn:hover:not(:disabled) { background: rgba(242, 193, 78, .26); transform: translateY(-1px); }
.copy-btn.copied { background: rgba(95, 191, 154, .22); border-color: #8fe0b8; color: #b9f3d6; }
.copy-btn:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.6); }

/* ---------- TOOLS ---------- */
.hud-tools {
  position: fixed; z-index: 20; right: var(--gutter); bottom: calc(16px + var(--safe-b));
  display: flex; gap: 8px;
}
.tool-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 46px; padding: 0 14px;
  border-radius: 12px; background: var(--glass); border: 1px solid var(--line);
  box-shadow: var(--shadow); font-weight: 600; font-size: 13px;
  transition: transform .15s, background .15s, border-color .15s;
}
.tool-btn svg { width: 18px; height: 18px; }
.tool-btn:hover { transform: translateY(-2px); background: var(--glass-2); border-color: var(--line-2); }
#soundBtn .snd-on { display: none; }
#soundBtn[aria-pressed="true"] .snd-on { display: inline; }
#soundBtn[aria-pressed="true"] .snd-off { display: none; }
#soundBtn[aria-pressed="true"] { border-color: rgba(242,193,78,.55); color: var(--gold-2); }

/* ---------- PROMPT ---------- */
.prompt {
  position: fixed; z-index: 15; left: 0; top: 0;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px 8px 8px; border-radius: 12px;
  background: var(--cream); color: var(--ink); border: 0;
  font-weight: 700; font-size: 14px; white-space: nowrap;
  box-shadow: 0 4px 0 #c9b48a, 0 10px 24px rgba(13,17,40,.35);
  will-change: transform;
  animation: bob 1.8s ease-in-out infinite;
}
.prompt::after {
  content: ""; position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%);
  border: 7px solid transparent; border-bottom: 0; border-top-color: var(--cream);
}
.prompt .key {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px;
  background: var(--navy); color: var(--gold-2); font-family: var(--pixel); font-size: 15px;
}
@keyframes bob { 50% { margin-top: -4px; } }

/* ---------- JOYSTICK ---------- */
.joy-ghost {
  position: fixed; z-index: 12; left: 28px; bottom: calc(118px + var(--safe-b));
  width: 92px; height: 92px; border-radius: 50%;
  border: 2px dashed rgba(255, 244, 220, .5); background: rgba(20, 26, 58, .18);
  display: grid; place-items: center; pointer-events: none;
  transition: opacity .3s;
}
.joy-ghost span { font-size: 11px; font-weight: 700; text-align: center; width: 60px; line-height: 1.15; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.joy-ghost.used { opacity: 0; }
.joy {
  position: fixed; z-index: 14; left: 0; top: 0; width: 110px; height: 110px; margin: -55px 0 0 -55px;
  border-radius: 50%; background: rgba(20, 26, 58, .3); border: 2px solid rgba(255, 244, 220, .55);
  pointer-events: none; opacity: 0; transition: opacity .15s;
}
.joy.on { opacity: 1; }
.joy-knob {
  position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px;
  border-radius: 50%; background: var(--cream); box-shadow: 0 3px 0 #c9b48a, 0 6px 16px rgba(0,0,0,.3);
}

/* ---------- CARDS ---------- */
.card {
  position: fixed; z-index: 40; color: var(--text);
  background: linear-gradient(180deg, rgba(31, 39, 82, .95), rgba(17, 22, 54, .96));
  border: 1px solid var(--line-2); border-radius: 18px;
  box-shadow: 0 24px 60px rgba(8, 10, 30, .5), inset 0 1px 0 rgba(255,255,255,.06);
  animation: cardIn .28s cubic-bezier(.2,.8,.2,1);
}
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.card h2 { margin: 0 0 8px; font-family: var(--pixel); font-weight: 700; font-size: 26px; line-height: 1.1; outline: none; }
.card h3 { margin: 0 0 4px; font-size: 16px; }
.card p { margin: 0 0 12px; }
.x-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(255,244,220,.06); color: var(--cream); font-size: 15px; flex: none;
  transition: background .15s;
}
.x-btn:hover { background: rgba(255,244,220,.14); }
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.primary-btn, .ghost-btn, .social-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px; border-radius: 12px; font-weight: 700; font-size: 14px;
  text-decoration: none; transition: transform .15s, background .15s, box-shadow .15s;
}
.primary-btn { background: var(--cream); color: var(--ink); border: 0; box-shadow: 0 3px 0 #c9b48a; }
.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 0 #c9b48a; }
.ghost-btn { background: transparent; color: var(--cream); border: 1px solid var(--line-2); }
.ghost-btn:hover { background: rgba(255,244,220,.08); }
.social-btn { background: rgba(169,155,232,.18); border: 1px solid rgba(169,155,232,.5); color: #fff; cursor: pointer; }
.social-btn svg { width: 17px; height: 17px; }
.social-btn:hover { transform: translateY(-2px); background: rgba(169,155,232,.3); }
[data-social].is-disabled { opacity: .55; cursor: not-allowed; }
[data-social].is-disabled:hover { transform: none; }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--muted); text-decoration: underline; font-size: 13px; }
.link-btn:hover { color: var(--cream); }

/* ---------- DISCOVERY ---------- */
.discovery {
  right: var(--gutter); top: 50%; transform: translateY(-50%);
  width: min(380px, calc(100vw - 32px)); padding: 16px 18px 18px;
  animation: discIn .3s cubic-bezier(.2,.8,.2,1);
}
@keyframes discIn { from { opacity: 0; transform: translateY(-46%); } }
.discovery .x-btn { position: absolute; right: 12px; top: 12px; z-index: 2; }
.disc-art {
  height: 150px; margin: -4px -6px 14px; border-radius: 12px; overflow: hidden;
  display: grid; place-items: center;
  background: linear-gradient(180deg, #4f86d6 0%, #7cc4f2 55%, #c9bff2 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.disc-art canvas { image-rendering: pixelated; image-rendering: crisp-edges; max-width: 92%; max-height: 92%; }
.disc-story { color: #efeaff; }
.disc-detail {
  padding: 8px 12px; border-radius: 10px; font-size: 14px; font-weight: 600;
  background: rgba(242,193,78,.12); border-left: 3px solid var(--gold); color: var(--gold-2);
}

/* ---------- LOGBOOK ---------- */
.logbook {
  right: var(--gutter); top: calc(72px + var(--safe-t)); bottom: calc(16px + var(--safe-b));
  width: min(480px, calc(100vw - 32px));
  display: flex; flex-direction: column; overflow: hidden;
}
.log-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 8px 18px; }
.log-title { font-family: var(--pixel); font-weight: 600; font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.tabs { display: flex; gap: 4px; padding: 0 14px 10px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs [role="tab"] {
  flex: none; background: none; border: 1px solid transparent; padding: 7px 12px; border-radius: 10px;
  font-weight: 600; font-size: 14px; color: var(--muted);
}
.tabs [role="tab"]:hover { color: var(--cream); background: rgba(255,244,220,.06); }
.tabs [role="tab"][aria-selected="true"] { color: var(--ink); background: var(--cream); }
.log-body { overflow-y: auto; padding: 18px 18px 22px; overscroll-behavior: contain; }
.sec > p { color: #e9e5ff; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.feature { padding: 12px; border-radius: 12px; background: rgba(255,244,220,.05); border: 1px solid var(--line); }
.feature h3 { font-size: 14px; margin: 6px 0 2px; }
.feature p { font-size: 13px; color: var(--muted); margin: 0; }
.f-ico { font-size: 20px; color: var(--gold-2); }
.join { margin-top: 18px; padding: 16px; border-radius: 14px; background: rgba(169,155,232,.1); border: 1px solid rgba(169,155,232,.3); }
.join .row-btns { margin-bottom: 10px; }

.facts { margin: 14px 0 0; display: grid; gap: 2px; }
.facts > div { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: 14px; }
.facts dd { margin: 0; font-weight: 700; text-align: right; }
.facts .fact-ca { flex-direction: column; align-items: stretch; }
.facts .fact-ca dd { display: flex; align-items: center; gap: 10px; text-align: left; }
.ca-text.big { font-size: 13px; white-space: normal; word-break: break-all; }
.tba { color: var(--cream-2) !important; font-weight: 600 !important; font-style: italic; }
.disclaimer { margin-top: 14px !important; padding: 12px; border-radius: 12px; font-size: 12.5px; color: var(--muted); background: rgba(0,0,0,.18); border: 1px solid var(--line); }

/* ---------- MAP ---------- */
.chart {
  position: relative; width: 100%; aspect-ratio: 2 / 1; margin: 12px 0;
  border-radius: 14px; overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 40%, rgba(255,255,255,.35), transparent 60%),
    repeating-linear-gradient(0deg, rgba(90,50,32,.05) 0 2px, transparent 2px 9px),
    linear-gradient(160deg, #f8ecd0, #ecd8ac 60%, #e0c58f);
  box-shadow: inset 0 0 0 2px rgba(90,50,32,.35), inset 0 0 40px rgba(120,70,30,.25);
}
.chart-route { position: absolute; inset: 0; width: 100%; height: 100%; }
.pin {
  position: absolute; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: 0; padding: 2px; color: #3a2414; border-radius: 8px;
}
.pin canvas { image-rendering: pixelated; width: 46px; height: auto; transition: transform .18s; filter: drop-shadow(0 2px 0 rgba(90,50,32,.3)); }
.pin span { font-size: 10.5px; font-weight: 700; line-height: 1.1; white-space: nowrap; background: rgba(255,248,232,.8); padding: 1px 5px; border-radius: 5px; }
.pin:hover canvas, .pin.sel canvas { transform: scale(1.12); }
.pin.unknown canvas { filter: brightness(0) opacity(.28) blur(.4px); }
.pin.unknown span { color: #7b5a3c; font-style: italic; }
.pin.sel span { background: #3a2414; color: var(--gold-2); }
.chart-ship {
  position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%;
  background: #c0392b; box-shadow: 0 0 0 3px rgba(192,57,43,.25); pointer-events: none;
  transition: left .2s linear, top .2s linear;
}
.chart-ship::after { content: "you"; position: absolute; left: 14px; top: -3px; font-size: 10px; font-weight: 800; color: #8a2a1f; }
.chart-rose { position: absolute; right: 10px; top: 8px; font-family: var(--pixel); font-weight: 700; color: rgba(58,36,20,.6); }
.chart-detail { min-height: 64px; padding: 12px 14px; border-radius: 12px; background: rgba(255,244,220,.05); border: 1px solid var(--line); }
.chart-detail h3 { font-family: var(--pixel); font-size: 18px; }
.chart-detail p { margin: 0 0 8px; font-size: 14px; color: #e9e5ff; }
.secret-list { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 6px; }
.secret-list li { display: flex; gap: 10px; align-items: center; font-size: 14px; padding: 8px 12px; border-radius: 10px; background: rgba(255,244,220,.04); border: 1px dashed var(--line-2); }
.secret-list li.found { border-style: solid; border-color: rgba(242,193,78,.45); }
.secret-list .s-ico { color: var(--gold-2); }

/* ---------- TUTORIAL ---------- */
.tutorial {
  position: fixed; z-index: 35; left: var(--gutter); bottom: calc(118px + var(--safe-b));
  width: min(440px, calc(100vw - 32px)); padding: 16px 18px 18px; border-radius: 18px;
  background: var(--glass-2); border: 1px solid var(--line-2); box-shadow: 0 20px 50px rgba(8,10,30,.45);
  animation: cardIn .35s cubic-bezier(.2,.8,.2,1);
}
.tut-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.tut-head h2 { margin: 0; font-family: var(--pixel); font-size: 22px; }
.tut-list { margin: 0 0 10px; padding: 0; list-style: none; display: grid; gap: 8px; }
.tut-list li { padding-left: 18px; position: relative; font-size: 14.5px; color: #efeaff; }
.tut-list li::before { content: ""; position: absolute; left: 2px; top: 8px; width: 7px; height: 7px; background: var(--gold); transform: rotate(45deg); }
.keys { display: inline-flex; gap: 3px; vertical-align: middle; }
kbd {
  display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 5px;
  border-radius: 6px; background: var(--cream); color: var(--ink);
  font-family: var(--pixel); font-size: 13px; font-weight: 700; box-shadow: 0 2px 0 #c9b48a;
}
.tut-note { margin: 0 0 12px; font-size: 12.5px; color: var(--muted); }

/* ---------- TOAST ---------- */
.toast {
  position: fixed; z-index: 70; left: 50%; top: calc(76px + var(--safe-t));
  transform: translate(-50%, -12px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 12px; max-width: calc(100vw - 32px); text-align: center;
  background: var(--cream); color: var(--ink); font-weight: 700; font-size: 14px;
  box-shadow: 0 4px 0 #c9b48a, 0 14px 30px rgba(8,10,30,.35);
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.noscript { position: fixed; inset: auto 16px 16px; z-index: 99; padding: 14px; border-radius: 12px; background: var(--cream); color: var(--ink); font-weight: 600; }

/* ---------- INPUT-SPECIFIC ---------- */
.only-touch { display: none; }
@media (pointer: coarse) {
  .only-touch { display: revert; }
  .joy-ghost.only-touch { display: grid; }
  .only-kbd { display: none !important; }
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1100px) {
  .tool-label { display: none; }
  .tool-btn { width: 46px; padding: 0; justify-content: center; }
}
@media (max-width: 900px) {
  .hud-top { flex-wrap: nowrap; }
  .menu-btn { display: inline-grid; }
  .hide-sm { display: none; }
  .nav {
    position: absolute; top: calc(100% + 8px); right: 0; width: min(280px, calc(100vw - 32px));
    flex-direction: column; padding: 8px; gap: 2px;
    opacity: 0; transform: translateY(-6px); visibility: hidden; pointer-events: none;
    transition: opacity .18s, transform .18s, visibility 0s .18s;
    background: var(--glass-2);
  }
  .nav.open { opacity: 1; transform: none; visibility: visible; pointer-events: auto; transition: opacity .18s, transform .18s; }
  .nav-btn { padding: 12px 14px; font-size: 15px; width: 100%; justify-content: flex-start; }
  .nav-social { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
}
@media (max-width: 760px) {
  :root { --gutter: 12px; }
  .brand { padding: 6px 10px 6px 6px; gap: 8px; }
  .brand-logo { width: 28px; height: 28px; }
  .brand-name { font-size: 16px; }
  .buy-btn { padding: 0 12px; font-size: 14px; height: 40px; }
  .icon-btn { width: 40px; height: 40px; }
  .welcome { top: calc(70px + var(--safe-t)); }
  .welcome-lede { font-size: 14px; }
  .welcome-tag { font-size: 12.5px; }

  .ca-panel { left: var(--gutter); right: var(--gutter); width: auto; bottom: calc(10px + var(--safe-b)); padding: 8px 8px 8px 12px; }
  .ca-head { display: none; }
  .ca-row { margin: 0; }
  .ca-row::before { content: "CA"; font-family: var(--pixel); font-weight: 700; font-size: 12px; color: var(--gold-2); letter-spacing: .1em; }
  .ca-text[data-ca-full] { font-size: 12px; }
  .ca-note { font-size: 11.5px; }

  .hud-tools { bottom: calc(var(--ca-h, 66px) + 20px + var(--safe-b)); right: var(--gutter); gap: 6px; }
  .tool-btn { width: 42px; height: 42px; }
  .hud-progress { top: calc(64px + var(--safe-t)); bottom: auto; left: var(--gutter); right: auto; padding: 4px 10px 4px 4px; gap: 8px; }
  .compass svg { width: 30px; height: 30px; }
  .pt-k { display: none; }
  #progressText { font-size: 11.5px; }
  .welcome { top: calc(110px + var(--safe-t)); }

  .discovery, .logbook {
    left: 0; right: 0; width: auto; bottom: 0; top: auto; transform: none;
    border-radius: 20px 20px 0 0; max-height: 84vh; max-height: 84dvh;
    padding-bottom: calc(18px + var(--safe-b));
    animation: sheetIn .3s cubic-bezier(.2,.8,.2,1);
  }
  .logbook { top: auto; height: 84vh; height: 84dvh; padding-bottom: var(--safe-b); }
  .discovery { overflow-y: auto; }
  .disc-art { height: 120px; }
  @keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } }
  .feature-grid { grid-template-columns: 1fr; }
  .feature { display: grid; grid-template-columns: 30px 1fr; column-gap: 8px; }
  .feature .f-ico { grid-row: span 2; }
  .feature h3 { margin: 0; }
  .tutorial { left: var(--gutter); right: var(--gutter); width: auto; bottom: calc(var(--ca-h, 66px) + 72px + var(--safe-b)); }
  .tut-list li { font-size: 14px; }
  .joy-ghost { left: 20px; bottom: calc(var(--ca-h, 66px) + 22px + var(--safe-b)); width: 78px; height: 78px; }
  .pin canvas { width: 32px; }
  .pin span { font-size: 9px; }
  .card h2 { font-size: 22px; }
}
@media (max-width: 460px) {
  .brand .chip { display: none; }
}
@media (max-width: 340px) {
  .brand-name { display: none; }
  .tool-btn { width: 40px; height: 40px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .welcome { display: none; }
  .tutorial { bottom: auto; top: 64px; max-height: calc(100vh - 140px); overflow-y: auto; }
  .hud-progress { top: calc(62px + var(--safe-t)); bottom: auto; left: var(--gutter); right: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}
