/* ───────────── Atlas Rush ───────────── */
:root {
  --bg: #030a1f;
  --ocean: #061638;
  --panel: #08173d;
  --line: #17295c;
  --line2: #27428a;
  --land: #13264f;
  --land-line: #2a4586;
  --rest: #0d1c40;
  --got: #3d7bff;
  --got-hi: #9dbcff;
  --miss: #ff5d73;
  --ice: #e9f0ff;
  --mute: #8396c8;
  --ok: #59e3a8;
  --display: "Sora", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --pad: clamp(14px, 2.6vw, 32px);
}
* { box-sizing: border-box; margin: 0; }
html { color-scheme: dark; background: var(--bg); }
body {
  height: 100vh; height: 100dvh; overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--bg); color: var(--ice);
  font-family: var(--display); -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--got-hi); outline-offset: 3px; }
::selection { background: var(--got); color: #fff; }
kbd { font-family: var(--mono); font-size: .8em; padding: 2px 7px; border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 4px; background: var(--bg); }

/* ── top bar ── */
.top {
  position: relative; z-index: 10;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  min-height: 62px; padding: 8px var(--pad);
  border-bottom: 1px solid var(--line); background: var(--bg);
}
.exit { justify-self: start; font-family: var(--mono); font-size: 13px; color: var(--mute); text-decoration: none; transition: color .2s; white-space: nowrap; }
.exit:hover { color: var(--ice); }
.exit span { display: inline-block; transition: transform .3s var(--ease); }
.exit:hover span { transform: translateX(-4px); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: -.01em; }
.brand svg { width: 24px; height: 24px; color: var(--got); }
.hud { justify-self: end; display: flex; gap: clamp(16px, 3vw, 34px); opacity: .35; transition: opacity .4s; }
body.playing .hud, body.over .hud { opacity: 1; }
.hud div { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.hud small { font-family: var(--mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--mute); }
.hud b { font-family: var(--mono); font-weight: 700; font-size: 22px; font-variant-numeric: tabular-nums; }
.hud b i { font-style: normal; font-weight: 400; font-size: 14px; color: var(--mute); }
.hud b.bump { animation: bump .35s var(--ease); }
@keyframes bump { 40% { transform: translateY(-3px); color: var(--got-hi); } }
#clock.low { color: var(--miss); animation: low 1s steps(2) infinite; }
@keyframes low { 50% { opacity: .55; } }

/* ── map ── */
.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: radial-gradient(120% 90% at 50% 40%, #071a44, var(--bg) 70%); }
.map { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.map.drag { cursor: grabbing; }
.map .sphere { fill: var(--ocean); stroke: var(--line2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.map .grat { fill: none; stroke: rgba(110, 150, 255, .08); stroke-width: .6; vector-effect: non-scaling-stroke; }
.map .rest { fill: var(--rest); stroke: var(--land-line); stroke-width: .4; stroke-opacity: .6; vector-effect: non-scaling-stroke; }
.map .c { fill: var(--land); stroke: var(--land-line); stroke-width: .6; vector-effect: non-scaling-stroke; transition: fill .6s var(--ease); }
.map .dot { fill: var(--land); stroke: var(--land-line); stroke-width: 1; vector-effect: non-scaling-stroke; transition: fill .6s var(--ease); }
.map .got { fill: var(--got); stroke: var(--got-hi); }
.map .got.new { animation: lit 1.1s var(--ease); }
@keyframes lit { 0% { fill: #fff; } 35% { fill: var(--got-hi); } }
.map .miss { fill: var(--miss); fill-opacity: .7; stroke: #ffb3be; }
.map .hl { fill: #fff !important; fill-opacity: 1 !important; }
.map .ping { fill: none; stroke: var(--got-hi); vector-effect: non-scaling-stroke; stroke-width: 2; pointer-events: none; transform-box: fill-box; transform-origin: center; animation: ping 1.1s var(--ease) forwards; }
@keyframes ping { from { transform: scale(.2); opacity: 1; } to { transform: scale(1); opacity: 0; } }

.zoom { position: absolute; right: var(--pad); bottom: 16px; z-index: 3; display: flex; flex-direction: column; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; background: rgba(3, 10, 31, .85); }
.zoom button { width: 38px; height: 38px; border: 0; background: none; font-size: 19px; color: var(--mute); transition: background .2s, color .2s; }
.zoom button + button { border-top: 1px solid var(--line); }
.zoom button:hover { background: var(--line); color: var(--ice); }

.tip { position: fixed; z-index: 20; pointer-events: none; padding: 5px 10px; border-radius: 6px; background: var(--ice); color: var(--bg); font-size: 13px; font-weight: 600; white-space: nowrap; transform: translate(-50%, calc(-100% - 12px)); }
.tip.miss { background: var(--miss); color: #fff; }

/* ── panels (start / end) ── */
.panel {
  position: absolute; z-index: 5; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(560px, calc(100% - 2 * var(--pad))); max-height: calc(100% - 28px); overflow: auto;
  padding: clamp(22px, 4vw, 38px);
  background: rgba(5, 15, 42, .92); border: 1px solid var(--line2); border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55), 0 0 0 1px rgba(61, 123, 255, .08) inset;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: pop .55s var(--ease) both;
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, -46%) scale(.98); } }
.kicker { font-family: var(--mono); font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--got-hi); }
.panel h1 { margin-top: 12px; font-size: clamp(32px, 6vw, 48px); font-weight: 800; letter-spacing: -.035em; line-height: 1.02; }
.panel h1 em { font-style: normal; color: var(--got); }
.sub { margin-top: 14px; font-size: 15px; line-height: 1.55; color: var(--mute); }

.modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 26px; }
.mode {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 16px 6px 12px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line);
  transition: border-color .2s, background .2s, transform .15s;
}
.mode:hover { border-color: var(--line2); }
.mode:active { transform: translateY(1px); }
.mode b { font-family: var(--mono); font-size: 30px; font-weight: 700; line-height: 1.1; }
.mode span { font-size: 12px; color: var(--mute); }
.mode small { min-height: 1.3em; margin-top: 6px; font-family: var(--mono); font-size: 10px; letter-spacing: .06em; color: var(--got-hi); }
.mode[aria-checked="true"] { background: var(--got); border-color: var(--got-hi); }
.mode[aria-checked="true"] span, .mode[aria-checked="true"] small { color: #fff; }

.custom { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); animation: drop .3s var(--ease); }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }
.custom span { flex: 1; font-size: 14px; color: var(--mute); }
.custom input { width: 70px; height: 36px; text-align: center; font-family: var(--mono); font-size: 18px; font-weight: 700; border-radius: 6px; border: 1px solid var(--line2); background: var(--bg); -moz-appearance: textfield; }
.custom input::-webkit-inner-spin-button, .custom input::-webkit-outer-spin-button { -webkit-appearance: none; }
.step { width: 36px; height: 36px; border-radius: 6px; border: 1px solid var(--line2); background: none; font-size: 18px; }
.step:hover { background: var(--line); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 52px; padding: 0 26px; margin-top: 22px; width: 100%;
  border: 1px solid var(--got); border-radius: 10px; background: var(--got); color: #fff;
  font-family: var(--mono); font-size: 14px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  transition: background .2s, border-color .2s, transform .1s;
}
.btn:hover { background: #5a90ff; }
.btn:active { transform: translateY(1px); }
.btn span { transition: transform .3s var(--ease); }
.btn:hover span { transform: translateX(5px); }
.btn.ghost { background: transparent; border-color: var(--line2); color: var(--ice); }
.btn.ghost:hover { background: var(--line); }

/* end screen */
.big { margin-top: 10px; display: flex; align-items: baseline; gap: 6px; font-family: var(--mono); }
.big b { font-size: clamp(58px, 12vw, 86px); font-weight: 700; line-height: 1; letter-spacing: -.04em; }
.big span { font-size: 22px; color: var(--mute); }
.end .sub b { color: var(--ice); font-weight: 600; }
.end .sub .new { color: var(--ok); }
.end-cont { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 20px; }
.end-cont div { padding: 10px 12px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); }
.end-cont small { display: block; font-size: 11px; color: var(--mute); }
.end-cont b { font-family: var(--mono); font-size: 16px; }
.end-cont b i { font-style: normal; color: var(--mute); font-weight: 400; font-size: 12px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row .btn { margin-top: 20px; }
.missed { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.missed summary { cursor: pointer; font-size: 14px; color: var(--mute); }
.missed summary b { font-family: var(--mono); color: var(--miss); margin-left: 4px; }
.missed h4 { margin: 14px 0 6px; font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--mute); }
.missed ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.missed li button { padding: 4px 9px; border-radius: 5px; border: 1px solid rgba(255, 93, 115, .35); background: rgba(255, 93, 115, .08); font-size: 13px; color: #ffd0d7; }
.missed li button:hover { background: rgba(255, 93, 115, .25); }

/* ── dock (input + continent progress) ── */
.dock {
  position: relative; z-index: 10;
  display: grid; grid-template-columns: minmax(280px, 420px) 1fr auto; align-items: center; gap: 14px 22px;
  padding: 12px var(--pad) max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--bg);
}
.entry { position: relative; }
#guess {
  width: 100%; height: 50px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--line2); background: var(--panel);
  font-size: 17px; font-weight: 600; outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
#guess::placeholder { color: var(--mute); font-weight: 400; }
#guess:focus { border-color: var(--got); box-shadow: 0 0 0 4px rgba(61, 123, 255, .2); }
#guess:disabled { opacity: .45; }
#guess.ok { border-color: var(--ok); box-shadow: 0 0 0 4px rgba(89, 227, 168, .2); }
#guess.bad { border-color: var(--miss); box-shadow: 0 0 0 4px rgba(255, 93, 115, .2); animation: shake .32s linear; }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }
.flash { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); pointer-events: none; font-family: var(--mono); font-size: 12px; color: var(--mute); opacity: 0; transition: opacity .25s; white-space: nowrap; }
.flash.show { opacity: 1; }
.entry.msg #guess::placeholder { color: transparent; }
.flash.ok { color: var(--ok); }
.flash.bad { color: var(--miss); }

.conts { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.cont { min-width: 0; }
.cont div { display: flex; justify-content: space-between; gap: 6px; font-size: 12px; color: var(--mute); white-space: nowrap; }
.cont div span { overflow: hidden; text-overflow: ellipsis; }
.cont b { font-family: var(--mono); font-weight: 500; color: var(--ice); font-variant-numeric: tabular-nums; }
.cont i { display: block; height: 4px; margin-top: 6px; border-radius: 2px; background: var(--line); overflow: hidden; }
.cont i u { display: block; height: 100%; width: 0; background: var(--got); transition: width .5s var(--ease); }
.cont.done b { color: var(--ok); }
.cont.done i u { background: var(--ok); }

.giveup { height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line2); background: none; font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); transition: color .2s, border-color .2s, background .2s; }
.giveup:hover:not(:disabled) { color: var(--ice); border-color: var(--miss); background: rgba(255, 93, 115, .1); }
#menu:hover { border-color: var(--got); background: rgba(61, 123, 255, .12); }
.giveup:disabled { opacity: .35; cursor: default; }

@media (max-width: 980px) {
  .dock { grid-template-columns: 1fr auto; }
  .conts { grid-column: 1 / -1; grid-row: 2; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 14px; }
}
@media (max-width: 620px) {
  .top { grid-template-columns: auto 1fr; }
  .brand { display: none; }
  .hud b { font-size: 19px; }
  .modes { grid-template-columns: repeat(2, 1fr); }
  .end-cont { grid-template-columns: repeat(2, 1fr); }
  .zoom { bottom: 10px; }
  .zoom button { width: 34px; height: 34px; }
  #guess { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
