/* ═══════════ Summit · pixel alpine ═══════════ */

:root {
  --font-px: 'Pixelify Sans', 'Courier New', monospace;
  --font-num: 'Silkscreen', 'Courier New', monospace;
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --bg: #cfe3ef; --bg2: #c4dcea; --panel: #fffdf7; --panel2: #f1ece0; --ink: #22303c; --muted: #66717d; --line: #d9d0bd;
  --accent: #d9482b; --accent-d: #a8331c; --gold: #f2b33d; --good: #3f8a4f; --good-l: #5fae6a; --bad: #c8412f; --pine: #2d6340; --steel: #59636f;
  --shadow: rgba(34, 48, 60, .9); --soft: rgba(34, 48, 60, .18); --sign: #a86c42; --sign-d: #6b4028; --sign-ink: #fff4dc;
  --ease: cubic-bezier(.2, .8, .2, 1); --spring: cubic-bezier(.34, 1.56, .64, 1);
}
:root[data-tod="morning"] { --bg: #f4dcc8; --bg2: #efd2bc; }
:root[data-tod="evening"] { --bg: #e7c8c9; --bg2: #dfbcbf; }
:root[data-tod="night"] {
  --bg: #121a2e; --bg2: #0f1628; --panel: #1f2a40; --panel2: #29354d; --ink: #edf1f7; --muted: #a5b0c0; --line: #3b4862;
  --shadow: rgba(0, 0, 0, .75); --soft: rgba(0, 0, 0, .35); --sign: #7c5034; --sign-d: #4d301f;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
html { overflow-x: hidden; }
body {
  min-height: 100vh; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--ink); font-variant-ligatures: none;
  background-color: var(--bg);
  background-image: linear-gradient(45deg, var(--bg2) 25%, transparent 25%, transparent 75%, var(--bg2) 75%), linear-gradient(45deg, var(--bg2) 25%, transparent 25%, transparent 75%, var(--bg2) 75%);
  background-size: 16px 16px; background-position: 0 0, 8px 8px;
  transition: background-color .6s;
}
.sky-bg { display: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
canvas { image-rendering: pixelated; image-rendering: crisp-edges; }

.app { max-width: 1220px; margin: 0 auto; padding: 0 16px 40px; }

/* ── Header ── */
.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 0; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo { width: 44px; height: 44px; image-rendering: pixelated; }
.logo-cab { animation: logoRide 4s steps(8) infinite; }
@keyframes logoRide { 0%, 100% { transform: translate(-6px, 2px); } 50% { transform: translate(6px, -4px); } }
.wordmark { font-family: var(--font-px); font-weight: 700; font-size: 32px; line-height: 1; letter-spacing: .5px; text-shadow: 3px 3px 0 var(--gold); }
.wordmark small { display: none; }
.tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tbtn {
  height: 40px; min-width: 40px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--panel); border: 3px solid var(--ink); border-radius: 8px; box-shadow: 0 3px 0 var(--shadow);
  font-family: var(--font-px); font-size: 15px; text-decoration: none; transition: transform .08s, box-shadow .08s;
}
.tbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: square; stroke-linejoin: miter; }
.tbtn:hover { background: var(--panel2); }
.tbtn:active, .tbtn.on { transform: translateY(3px); box-shadow: 0 0 0 var(--shadow); }
.tbtn.on { background: var(--gold); color: #22303c; }
.tbtn .lbl { display: none; }
@media (min-width: 820px) { .tbtn .lbl { display: inline; } }
@media (max-width: 560px) {
  .tools { width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(32px, 1fr)); gap: 5px; }
  .tbtn { padding: 0 4px; min-width: 0; }
  .sign small .long { display: none; }
  .wordmark { font-size: 28px; }
}

/* ── Layout with docked notebook ── */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
@media (min-width: 1040px) { body.pad-open .layout { grid-template-columns: minmax(0, 1fr) 370px; } }
main { min-width: 0; max-width: 860px; width: 100%; margin: 0 auto; }
.foot { text-align: center; margin-top: 30px; font-size: 13px; color: var(--muted); }

/* ── Day header ── */
.dayhead { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: end; margin: 4px 0 12px; }
.daylabel { font-family: var(--font-px); font-size: 15px; color: var(--muted); }
.daylabel b { color: var(--ink); font-family: var(--font-num); font-size: 20px; }
.badge { display: inline-block; font-family: var(--font-px); font-size: 12px; padding: 1px 8px; border-radius: 4px; background: var(--ink); color: var(--panel); vertical-align: 2px; }
.tabs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.tab {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border-radius: 8px;
  background: var(--panel); border: 3px solid var(--line); font-weight: 800; font-size: 14px; color: var(--muted); transition: transform .15s var(--spring);
}
.tab .em { font-size: 18px; line-height: 1; }
.tab .sc { font-family: var(--font-num); font-size: 15px; color: var(--ink); min-width: 22px; text-align: right; }
.tab:hover:not(:disabled) { transform: translateY(-2px); }
.tab.on { border-color: var(--ink); color: var(--ink); box-shadow: 0 3px 0 var(--shadow); }
.tab:disabled { cursor: not-allowed; opacity: .55; }
.climbbox { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 3px solid var(--ink); border-radius: 10px; padding: 6px 12px 6px 6px; box-shadow: 0 4px 0 var(--shadow); }
.climb-canvas { width: 144px; height: 68px; display: block; border-radius: 4px; }
.alt { line-height: 1.1; }
.alt b { font-family: var(--font-num); font-size: 20px; display: block; }
.alt span { font-size: 12px; color: var(--muted); font-weight: 700; }
@media (max-width: 560px) { .dayhead { grid-template-columns: 1fr; } .climbbox { justify-self: start; } }

/* ── Stage (pixel scene) ── */
.stage { position: relative; border: 3px solid var(--ink); border-radius: 10px; overflow: hidden; box-shadow: 0 6px 0 var(--shadow); background: #1b2440; }
.scene-host { position: relative; width: 100%; aspect-ratio: 320 / 166; }
.scene-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.scene-host.jolt { animation: jolt .4s steps(4); }
@keyframes jolt { 25% { transform: translateX(-6px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
.stage-label { position: absolute; left: 10px; top: 10px; z-index: 2; display: flex; gap: 6px; align-items: center; padding: 3px 10px; border-radius: 6px;
  background: var(--panel); border: 3px solid var(--ink); font-family: var(--font-px); font-size: 14px; color: var(--ink); box-shadow: 0 3px 0 var(--shadow);
  animation: dropIn .6s var(--spring) both .3s; pointer-events: none; }
.stage-label i { font-style: normal; color: var(--muted); }
.stage-hint { position: absolute; right: 10px; bottom: 10px; z-index: 2; font-family: var(--font-px); font-size: 12px; color: #fff; background: rgba(20, 26, 40, .7); padding: 2px 8px; border-radius: 4px; pointer-events: none;
  animation: hint 7s steps(1) both 1.5s; }
@keyframes hint { 0%, 99% { opacity: 1; } 100% { opacity: 0; } }
@keyframes dropIn { from { opacity: 0; transform: translateY(-14px); } }

/* ── Wooden station signs ── */
.signs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.sign {
  position: relative; padding: 10px 14px 12px; border-radius: 6px; min-width: 0; color: var(--sign-ink);
  background: repeating-linear-gradient(180deg, var(--sign) 0 9px, var(--sign-d) 9px 11px);
  border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--shadow); transform: rotate(-.8deg); animation: signIn .5s var(--spring) both;
}
.sign.big { text-align: right; transform: rotate(.8deg); animation-delay: .08s; }
.sign::before, .sign::after { content: ''; position: absolute; top: 7px; width: 6px; height: 6px; background: var(--ink); opacity: .7; }
.sign::before { left: 7px; } .sign::after { right: 7px; }
@keyframes signIn { from { opacity: 0; transform: translateY(10px) rotate(0); } }
.sign small { display: block; font-family: var(--font-px); font-size: 12px; letter-spacing: 1px; opacity: .9; text-transform: uppercase; }
.sign b { display: block; font-size: 18px; line-height: 1.25; text-shadow: 2px 2px 0 rgba(0, 0, 0, .35); overflow-wrap: anywhere; }
.sign .val { font-family: var(--font-num); font-size: 13px; margin-top: 3px; color: #ffe6a8; animation: rise .5s var(--ease) both .3s; }

/* ── Card ── */
.card { margin-top: 16px; padding: 18px; border-radius: 12px; background: var(--panel); border: 3px solid var(--ink); box-shadow: 0 6px 0 var(--shadow); }
.rise { animation: rise .5s var(--ease) both; animation-delay: calc(var(--d, 0) * 70ms); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.prompt { font-family: var(--font-px); font-weight: 700; font-size: clamp(22px, 4.4vw, 30px); line-height: 1.15; margin: 0; }
.prompt .prop { background: var(--gold); color: #22303c; padding: 0 8px; border-radius: 6px; box-shadow: 0 3px 0 #b8851f; white-space: nowrap; }
.sub { color: var(--muted); font-size: 14px; margin: 10px 0 0; }

.guess { display: flex; gap: 10px; margin-top: 16px; }
.guess input { flex: 1; min-width: 0; height: 56px; padding: 0 16px; font-size: 18px; font-weight: 700; background: var(--panel2); border: 3px solid var(--ink); border-radius: 10px; box-shadow: inset 0 3px 0 var(--soft); }
.guess input:focus { outline: 4px solid color-mix(in srgb, var(--gold) 60%, transparent); outline-offset: 1px; }
.btn {
  position: relative; overflow: hidden; height: 56px; padding: 0 20px; border-radius: 10px; border: 3px solid var(--ink);
  background: var(--accent); color: #fff; font-family: var(--font-px); font-weight: 700; font-size: 19px; white-space: nowrap; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; box-shadow: 0 5px 0 var(--shadow); transition: transform .08s, box-shadow .08s, background .15s;
}
.btn:hover { background: #e85b3d; }
.btn:active { transform: translateY(5px); box-shadow: 0 0 0 var(--shadow); }
.btn:disabled { opacity: .7; cursor: wait; }
.btn.alt { background: var(--panel); color: var(--ink); } .btn.alt:hover { background: var(--panel2); }
.btn.green { background: var(--good); } .btn.green:hover { background: var(--good-l); }
.btn.sm { height: 44px; font-size: 16px; padding: 0 14px; box-shadow: 0 4px 0 var(--shadow); }
.btn .ripple { position: absolute; background: rgba(255, 255, 255, .45); transform: scale(0); animation: ripple .5s steps(5); pointer-events: none; }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
.btn.busy::before { content: ''; width: 12px; height: 12px; background: #fff; animation: blinkSq .5s steps(2) infinite; }
@keyframes blinkSq { 50% { opacity: .2; } }
.link { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; font-size: 14px; font-weight: 700; }
.link:hover { color: var(--ink); }
@media (max-width: 520px) { .guess { flex-direction: column; } .guess .btn { width: 100%; } }

.pips { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; color: var(--muted); flex-wrap: wrap; }
.pip { width: 18px; height: 18px; border: 3px solid var(--line); border-radius: 3px; background: var(--panel2); transition: transform .3s var(--spring); }
.pip.used { background: var(--bad); border-color: var(--ink); transform: scale(1.1); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 18px; }
.msg:empty { display: none; }
.msg { margin-top: 12px; }
.note { padding: 12px 14px; border-radius: 10px; border: 3px solid var(--ink); background: var(--panel2); font-weight: 700; animation: popIn .25s steps(3); }
.note.bad { background: color-mix(in srgb, var(--bad) 18%, var(--panel)); }
.note.warn { background: color-mix(in srgb, var(--gold) 26%, var(--panel)); }
@keyframes popIn { from { transform: scale(.94); opacity: 0; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip { border: 3px solid var(--ink); background: var(--panel); border-radius: 999px; padding: 4px 12px; font-weight: 800; font-size: 14px; box-shadow: 0 3px 0 var(--shadow); }
.chip:hover { background: var(--gold); color: #22303c; }

/* first guess */
.gcard { margin-top: 16px; display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; padding: 14px; border: 3px dashed var(--ink); border-radius: 12px; background: var(--panel2); }
.meter { display: grid; justify-items: center; gap: 6px; min-width: 96px; }
.meter b { font-family: var(--font-num); font-size: 40px; line-height: 1; }
.meter .cells { display: grid; grid-template-columns: repeat(10, 8px); gap: 2px; }
.meter .cells i { height: 12px; background: var(--line); border-radius: 1px; }
.meter .cells i.on { animation: cellOn .3s steps(2) both; animation-delay: calc(var(--d) * 70ms + 200ms); }
.meter .cells i.on.green { background: var(--good-l); } .meter .cells i.on.yellow { background: #e8c53a; } .meter .cells i.on.orange { background: #ef8f3a; } .meter .cells i.on.red { background: var(--bad); }
@keyframes cellOn { from { background: var(--line); transform: scaleY(.3); } }
.gcard.compact .meter b { font-size: 30px; }
.gcard .said { font-size: 14px; color: var(--muted); }
.gcard .judged { font-weight: 800; font-size: 17px; line-height: 1.3; }
.gcard .judged .val { color: var(--accent); font-family: var(--font-num); font-size: 14px; white-space: nowrap; }
.deduce { margin-top: 12px; font-size: 14px; color: var(--muted); display: flex; gap: 10px; align-items: center; }
.deduce .fogicon { flex: none; width: 30px; height: 16px; background: repeating-linear-gradient(90deg, #dde6ef 0 3px, #f5f8fb 3px 6px); border: 3px solid var(--ink); border-radius: 4px; animation: fogSlide 1.2s steps(3) infinite; }
@keyframes fogSlide { 50% { transform: translateX(3px); } }
.choices { display: flex; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.choices .btn { flex: 1 1 210px; height: 66px; flex-direction: column; gap: 0; line-height: 1.1; }
.choices .btn small { font-family: var(--font); font-weight: 800; font-size: 12px; opacity: .9; }

/* reveal */
.verdict { display: flex; align-items: center; gap: 18px; }
.verdict .score { font-family: var(--font-num); font-size: 58px; line-height: .95; }
.verdict .score small { font-size: 14px; color: var(--muted); display: block; font-family: var(--font-px); }
.verdict h3 { font-family: var(--font-px); font-size: 30px; margin: 0; line-height: 1.05; }
.verdict p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.verdict .pop { animation: pop .6s var(--spring) both .15s; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }

.gauge { margin: 24px 0 8px; }
.gauge .bar { position: relative; height: 22px; padding: 3px; border: 3px solid var(--ink); border-radius: 6px; background: var(--panel2); }
.gauge .cells { display: grid; grid-template-columns: repeat(31, 1fr); gap: 2px; height: 100%; }
.gauge .cells i { border-radius: 1px; animation: cellOn .25s steps(2) both; animation-delay: calc(var(--d) * 25ms + 150ms); }
.gauge .cells i.g0 { background: #b8c3cc; } .gauge .cells i.g1 { background: #c9d9a8; } .gauge .cells i.g2 { background: #a6cf7f; } .gauge .cells i.g3 { background: #7dbb5f; } .gauge .cells i.g4 { background: #4f9a46; }
:root[data-tod="night"] .gauge .cells i.g0 { background: #3d4a62; }
.gauge .mid { position: absolute; left: 50%; top: -10px; bottom: -10px; width: 4px; background: var(--ink); transform: translateX(-50%); }
.gauge .mk { position: absolute; top: 50%; width: 24px; height: 26px; left: 0; transform: translate(-50%, -50%); transition: left 1.4s var(--spring); z-index: 2;
  background: var(--accent); border: 3px solid var(--ink); border-radius: 5px; box-shadow: 0 3px 0 var(--shadow); display: grid; place-items: center; color: #fff; font: 12px var(--font-num); }
.gauge .mk::before { content: ''; position: absolute; left: 50%; top: -9px; width: 3px; height: 6px; background: var(--ink); transform: translateX(-50%); }
.gauge .mk:not(.ghost)::after { content: ''; position: absolute; inset: 4px 3px 9px; background: #bfe3f5; border-radius: 1px; }
.gauge .mk.ghost { background: #5b7cfa; width: 20px; height: 20px; z-index: 1; }
.gauge .legend { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 14px; font-size: 12px; color: var(--muted); font-weight: 800; }
.gauge .legend b { display: block; font-family: var(--font-num); font-size: 13px; color: var(--ink); }
.gauge .legend .c { text-align: center; color: var(--good); } .gauge .legend .r { text-align: right; }

.facts { display: grid; gap: 8px; margin-top: 16px; }
.fact { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--panel2); border: 3px solid var(--line);
  animation: rise .45s var(--ease) both; animation-delay: calc(var(--d, 0) * 90ms + 200ms); }
.fact .n { width: 30px; height: 30px; border-radius: 6px; display: grid; place-items: center; background: var(--panel); border: 2px solid var(--line); font-family: var(--font-num); font-size: 12px; color: var(--muted); }
.fact .w { min-width: 0; overflow-wrap: anywhere; }
.fact .w small { display: block; color: var(--muted); font-size: 13px; }
.fact .s { font-family: var(--font-num); font-size: 22px; }
.fact.final { border-color: var(--ink); }
.fact.best { border-color: var(--good); background: color-mix(in srgb, var(--good-l) 18%, var(--panel)); }
.fact.best .n { background: var(--good); border-color: var(--ink); color: #fff; }
.beatskipper { margin: 8px 0 0; font-weight: 800; color: var(--good); animation: pop .6s var(--spring) both .3s; }
.h4 { font-family: var(--font-px); font-size: 19px; margin: 24px 0 10px; display: flex; gap: 8px; align-items: center; }
.shimmer { height: 58px; border-radius: 10px; border: 3px dashed var(--line); display: grid; align-items: center; padding: 0 14px; color: var(--muted); font-weight: 800; font-size: 14px; animation: blinkSq 1s steps(2) infinite; }

.crowd { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 680px) { .crowd { grid-template-columns: 1fr 1fr; } }
.histo { display: flex; align-items: flex-end; gap: 4px; height: 80px; padding: 6px; border: 3px solid var(--line); border-radius: 10px; background: var(--panel2); }
.histo i { flex: 1; background: #a9b7c4; border: 2px solid var(--ink); border-bottom: 0; border-radius: 3px 3px 0 0; transform-origin: bottom; animation: barUp .5s steps(5) both; animation-delay: calc(var(--d) * 50ms + 250ms); min-height: 3px; }
.histo i.me { background: var(--accent); }
@keyframes barUp { from { transform: scaleY(0); } }
.histo-l { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); padding: 3px 4px 0; font-family: var(--font-num); }
.beat { margin: 0 0 10px; }
.beat b { font-family: var(--font-num); font-size: 24px; color: var(--accent); }
.toplist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.toplist li { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 8px; background: var(--panel2); border: 3px solid var(--line);
  animation: rise .45s var(--ease) both; animation-delay: calc(var(--d) * 80ms + 300ms); }
.toplist .rk { font-family: var(--font-num); color: var(--muted); }
.toplist .nm { min-width: 0; overflow-wrap: anywhere; font-weight: 800; }
.toplist .nm small { display: block; color: var(--muted); font-weight: 600; font-size: 12px; }
.toplist .sc { font-family: var(--font-num); font-size: 17px; }
.empty { color: var(--muted); font-size: 14px; }

/* summary */
.summary { text-align: center; }
.pano { position: relative; width: min(100%, 520px); margin: 8px auto 0; }
.pano-canvas { width: 100%; height: auto; display: block; border: 3px solid var(--ink); border-radius: 8px; background: #9dcdf1; }
:root[data-tod="night"] .pano-canvas { background: #1b2851; }
.pano .camp { position: absolute; font-family: var(--font-px); font-size: 11px; background: var(--panel); border: 2px solid var(--ink); border-radius: 4px; padding: 0 5px; white-space: nowrap; animation: rise .4s var(--ease) both; }
.pano .camp:nth-of-type(1) { animation-delay: .3s; } .pano .camp:nth-of-type(2) { animation-delay: .6s; } .pano .camp:nth-of-type(3) { animation-delay: .9s; } .pano .camp:nth-of-type(4) { animation-delay: 1.2s; }
.summary .total { font-family: var(--font-num); font-size: 52px; line-height: 1; margin-top: 12px; }
.summary .total small { font-size: 18px; color: var(--muted); }
.summary .altline { font-family: var(--font-px); font-size: 18px; color: var(--accent); }
.summary .altline span { font-family: var(--font-num); font-size: 15px; }
.summary .mini { display: flex; justify-content: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.summary .mini span { padding: 4px 12px; border-radius: 8px; background: var(--panel2); border: 3px solid var(--line); font-weight: 800; animation: rise .45s var(--ease) both; animation-delay: calc(var(--d) * 90ms + 600ms); }
.countdown { margin-top: 14px; color: var(--muted); font-size: 14px; }
.countdown b { font-family: var(--font-num); color: var(--ink); font-size: 16px; }
.tip { display: inline-block; margin-top: 10px; font-size: 14px; color: var(--muted); }

/* archive */
.archive { display: grid; gap: 8px; margin-top: 14px; }
.aday { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 10px; background: var(--panel2); border: 3px solid var(--line);
  text-decoration: none; transition: border-color .15s, transform .15s; animation: rise .4s var(--ease) both; animation-delay: calc(var(--d) * 40ms); }
.aday:hover { border-color: var(--ink); transform: translateX(3px); }
.aday .num { font-family: var(--font-num); font-size: 18px; }
.aday .d { color: var(--muted); font-size: 14px; }
.aday .s { display: flex; gap: 6px; }
.aday .s span { min-width: 38px; text-align: center; font-family: var(--font-num); font-size: 13px; padding: 2px 5px; border-radius: 5px; }
.sq { border: 2px solid var(--ink); }
.sq.green { background: #78c46b; color: #1d2b14; } .sq.yellow { background: #f5d547; color: #3a2e00; } .sq.orange { background: #f39a3c; color: #2b1606; } .sq.red { background: #e5604f; color: #fff; }

/* modals */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(14, 20, 32, .55); animation: fadeIn .2s both; }
@keyframes fadeIn { from { opacity: 0; } }
.modal-card { position: relative; width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; padding: 22px; border-radius: 12px; background: var(--panel); border: 3px solid var(--ink); box-shadow: 0 8px 0 var(--shadow); animation: modalIn .3s steps(4) both; }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px); } }
.modal-card h2 { font-family: var(--font-px); font-size: 28px; margin: 0 0 12px; }
.modal-card .x { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 8px; border: 3px solid var(--ink); background: var(--panel2); font-weight: 900; }
.steps { display: grid; gap: 12px; }
.stepc { display: grid; grid-template-columns: 76px 1fr; gap: 14px; align-items: center; padding: 12px; border-radius: 10px; background: var(--panel2); border: 3px solid var(--ink); animation: rise .45s var(--ease) both; animation-delay: calc(var(--d) * 120ms); }
.stepc canvas, .stepc svg { width: 76px; height: 60px; border: 2px solid var(--ink); border-radius: 6px; }
.stepc p { margin: 0; font-size: 15px; }
.stepc b.n { display: block; font-family: var(--font-px); font-size: 17px; }
.statgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; text-align: center; }
.statgrid b { display: block; font-family: var(--font-num); font-size: 24px; line-height: 1.2; }
.statgrid span { font-size: 11px; color: var(--muted); font-weight: 800; }
.bars { margin-top: 16px; }
.bars .bar { display: grid; grid-template-columns: 70px 1fr; gap: 8px; align-items: center; font-family: var(--font-num); font-size: 11px; margin-bottom: 6px; }
.bars .bar i { display: block; height: 20px; border: 2px solid var(--ink); border-radius: 4px; background: var(--gold); font-style: normal; text-align: right; padding-right: 6px; min-width: 26px; line-height: 16px; color: #22303c;
  transform-origin: left; animation: grow .5s steps(6) both; animation-delay: calc(var(--d) * 80ms); }
@keyframes grow { from { transform: scaleX(0); } }
textarea.box { width: 100%; min-height: 90px; padding: 10px 12px; border-radius: 10px; border: 3px solid var(--ink); background: var(--panel2); resize: vertical; }

/* Skipper */
.skipper { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: start; }
.portrait { width: 184px; height: 184px; border: 3px solid var(--ink); border-radius: 10px; background: repeating-linear-gradient(0deg, #9dcdf1 0 8px, #b4d9f3 8px 16px); display: grid; place-items: center; box-shadow: 0 4px 0 var(--shadow); overflow: hidden; }
.portrait canvas { width: 176px; height: 176px; animation: skBob 1.6s steps(2) infinite; }
@keyframes skBob { 50% { transform: translateY(4px); } }
.sk-text h2 { margin-bottom: 0; }
.sk-role { margin: 0 0 8px; font-family: var(--font-px); color: var(--accent); }
.sk-quote { margin: 0 0 10px; padding: 10px 12px; background: var(--panel2); border: 3px solid var(--ink); border-radius: 10px; font-weight: 800; }
.sk-facts { margin: 0; padding-left: 18px; font-size: 14px; }
@media (max-width: 520px) { .skipper { grid-template-columns: 1fr; justify-items: center; } }

#toast { position: fixed; left: 50%; bottom: 24px; z-index: 90; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; transition: .25s;
  background: var(--ink); color: var(--panel); padding: 10px 16px; border-radius: 10px; font-weight: 800; max-width: calc(100% - 32px); box-shadow: 0 4px 0 var(--shadow); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.loading { padding: 80px 0; text-align: center; color: var(--muted); font-family: var(--font-px); }
.spinner-cab { width: 40px; height: 30px; margin: 0 auto 14px; background: var(--accent); border: 3px solid var(--ink); border-radius: 6px; position: relative; animation: cabBob 1s steps(4) infinite; }
.spinner-cab::after { content: ''; position: absolute; left: 5px; right: 5px; top: 4px; height: 9px; background: #bfe3f5; }
.spinner-cab::before { content: ''; position: absolute; left: 50%; top: -12px; width: 3px; height: 9px; background: var(--ink); }
@keyframes cabBob { 0%, 100% { transform: translateX(-16px); } 50% { transform: translateX(16px); } }

/* ═══════════ Field notebook (pad.js markup) ═══════════ */
.pad { display: none; flex-direction: column; overflow: hidden; border-radius: 12px; background: var(--panel); border: 3px solid var(--ink); box-shadow: 0 6px 0 var(--shadow); }
body.pad-open .pad { display: flex; animation: padIn .3s steps(4) both; }
@keyframes padIn { from { opacity: 0; transform: translateX(20px); } }
@media (min-width: 1040px) { .pad { position: sticky; top: 12px; max-height: calc(100vh - 24px); } }
@media (max-width: 1039px) {
  .pad { position: fixed; left: 8px; right: 8px; bottom: 0; height: 56vh; z-index: 40; border-radius: 12px 12px 0 0; border-bottom: 0; }
  body.pad-open .pad { animation-name: sheetIn; }
  body.pad-open main { padding-bottom: 56vh; }
}
@keyframes sheetIn { from { transform: translateY(100%); } }
.pad-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 3px solid var(--ink); background: var(--gold); color: #22303c; }
.pad-head h3 { margin: 0; font-family: var(--font-px); font-size: 20px; }
.pad-head .x { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; border: 3px solid #22303c; background: #fff; color: #22303c; }
.pad-head .x .px { width: 14px; height: 14px; }
.pad-sum { font-size: 13px; padding: 6px 12px; background: var(--panel2); border-bottom: 2px dashed var(--line); overflow-wrap: anywhere; }
.pad-tabs { display: flex; gap: 4px; padding: 8px 10px 0; }
.pad-tabs button { flex: 1; padding: 6px 4px; font-family: var(--font-px); font-size: 14px; border: 3px solid var(--ink); border-bottom: 0; border-radius: 8px 8px 0 0; background: var(--panel2); color: var(--muted); }
.pad-tabs button.on { background: var(--panel); color: var(--ink); }
.pad-body { flex: 1; overflow: auto; padding: 12px; border-top: 3px solid var(--ink); margin-top: -3px; }
.pad-body h4 { font-family: var(--font-px); font-size: 17px; margin: 0 0 6px; }
.pad-body p.help { font-size: 13px; margin: 0 0 10px; color: var(--muted); }
.pad-body .formula { font-family: var(--font-num); font-size: 11px; background: var(--panel2); border: 2px dashed var(--line); padding: 1px 5px; border-radius: 4px; white-space: nowrap; color: var(--ink); }
.prow { display: grid; grid-template-columns: 1fr 108px; gap: 6px; margin-bottom: 8px; align-items: end; }
.prow label { font-size: 12px; font-weight: 800; color: var(--muted); display: block; margin-bottom: 2px; }
.pin, .psel { width: 100%; height: 40px; border: 3px solid var(--ink); border-radius: 8px; background: var(--panel2); padding: 0 10px; font-weight: 800; color: var(--ink); }
.psel { padding: 0 4px; font-size: 14px; }
.pres { margin-top: 10px; padding: 12px; border: 3px solid var(--ink); border-radius: 10px; background: color-mix(in srgb, var(--gold) 22%, var(--panel)); animation: popIn .25s steps(3); }
.pres .big { font-family: var(--font-num); font-size: 22px; line-height: 1.15; overflow-wrap: anywhere; }
.pres .also { font-size: 12px; color: var(--muted); margin-top: 4px; }
.pres.err { background: color-mix(in srgb, var(--bad) 16%, var(--panel)); font-weight: 800; font-size: 14px; }
.pbtn { height: 36px; padding: 0 12px; border: 3px solid var(--ink); border-radius: 8px; background: var(--panel); color: var(--ink); font-weight: 800; font-size: 13px; box-shadow: 0 3px 0 var(--shadow); }
.pbtn:active { transform: translateY(3px); box-shadow: none; }
.pbtn.go { background: var(--gold); color: #22303c; }
.notes { display: grid; gap: 6px; margin-top: 8px; }
.nrow { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; padding: 6px 8px; background: var(--panel2); border: 2px solid var(--ink); border-radius: 8px; }
.nrow b { display: block; font-size: 14px; overflow-wrap: anywhere; }
.nrow span { font-family: var(--font-num); font-size: 11px; color: var(--muted); }
.nrow .acts { display: flex; gap: 4px; }
.nrow .acts button { height: 28px; padding: 0 8px; border: 2px solid var(--ink); border-radius: 6px; background: var(--panel); font-size: 12px; font-weight: 800; color: var(--ink); }
.addform { display: grid; gap: 6px; padding: 10px; margin-top: 8px; border: 3px dashed var(--line); border-radius: 10px; }
.addform .two { display: grid; grid-template-columns: 1fr 108px; gap: 6px; }
.calc-in { width: 100%; height: 44px; border: 3px solid var(--ink); border-radius: 8px; font-family: var(--font-num); font-size: 15px; padding: 0 10px; background: var(--panel2); color: var(--ink); }
.calc-prev { font-family: var(--font-num); min-height: 22px; font-size: 12px; color: var(--muted); padding: 4px 2px; }
.calc-prev.bad { color: var(--bad); }
.keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.keys button { height: 38px; border: 2px solid var(--ink); border-radius: 6px; background: var(--panel); font-family: var(--font-px); font-size: 16px; color: var(--ink); }
.keys button.op { background: var(--panel2); }
.keys button.eq { background: var(--gold); color: #22303c; grid-column: span 2; }
.hist { margin-top: 10px; font-family: var(--font-num); font-size: 11px; border: 2px solid var(--ink); border-radius: 8px; background: var(--panel2); max-height: 150px; overflow: auto; }
.hist div { padding: 4px 8px; border-bottom: 1px solid var(--line); cursor: pointer; overflow-wrap: anywhere; }
.hist div:last-child { border-bottom: 0; }

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