/* EPICENTRE — one 320px column: map, tray, traces, result.
   Target is a phone at 390 x 844 with everything above the fold. */

:root {
    --bg: #10131a;
    --ink: #e8eaf0;
    --dim: #8b93a7;
    --line: #2a3040;
    --accent: #f2c14e;
    --pin: #e05a4f;
    --truth: #4ec9a8;
    --trace: #9fd0ff;
    --column: 320px;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    overscroll-behavior: none;
}

body {
    touch-action: manipulation;
}

.shell {
    max-width: 460px;
    margin: 0 auto;
    padding: 10px 12px 28px;
}

svg {
    display: block;
    width: 100%;
    height: auto;
}

.masthead {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 8px;
}

.masthead h1 {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .16em;
    margin: 0;
}

.puzzle-no {
    color: var(--dim);
    font-size: 12px;
    letter-spacing: .06em;
}

.instruction {
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 9px;
}

.notice {
    color: var(--dim);
    text-align: center;
    padding-top: 40px;
}

.mapwrap, #tray, #traces, #result {
    width: 100%;
    max-width: var(--column);
    margin-left: auto;
    margin-right: auto;
}

#map {
    background: #0b0e14;
    border: 1px solid var(--line);
    border-radius: 10px;
    touch-action: none;
}

.station {
    fill: none;
    stroke: #cfd6e6;
    stroke-width: 1.7;
}

.station-label, .scalebar-label {
    font-size: 13px;
    fill: #cfd6e6;
}

.scalebar {
    fill: none;
    stroke: var(--dim);
    stroke-width: 1.4;
}

.scalebar-label {
    font-size: 11.5px;
    fill: var(--dim);
}

/* The `hidden` attribute is an HTML global; the UA stylesheet rule that implements
   it does not reach SVG elements, so an SVG <g hidden> renders happily and the
   whole answer sits on the board before the player has dropped anything. Author
   rule, so it does. */
#reveal[hidden] {
    display: none;
}

.lag-circle {
    fill: none;
    stroke: var(--truth);
    stroke-width: 1;
    opacity: .42;
}

.answer-dot {
    fill: var(--truth);
}

.answer-ring {
    fill: none;
    stroke: var(--truth);
    stroke-width: 1.4;
}

.drop-marker {
    fill: var(--pin);
}

/* The tray, and only the tray, is the grab handle. */
#tray {
    margin-top: 9px;
    height: 48px;
    border: 1px dashed var(--line);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--dim);
    font-size: 13px;
    touch-action: none;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

/* Once the pin is spent the tray has no job — collapse it rather than leaving a
   48px hole between the map and the traces. */
#tray.spent {
    display: none;
}

#pin {
    width: 26px;
    height: 34px;
    flex: 0 0 auto;
    touch-action: none;
    -webkit-user-drag: none;
}

#traces {
    margin-top: 9px;
}

.trace {
    margin-bottom: 2px;
}

.trace-label, .axis text {
    font-size: 13px;
    fill: #cfd6e6;
}

.trace-baseline {
    stroke: #232838;
    fill: none;
}

.trace-line {
    fill: none;
    stroke: var(--trace);
    stroke-width: 1;
    stroke-linejoin: round;
}

.axis path {
    stroke: var(--dim);
    fill: none;
}

.axis text {
    font-size: 11px;
    fill: var(--dim);
}

#result {
    margin-top: 14px;
    text-align: center;
}

#dist {
    font-size: 34px;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

#band {
    font-size: 15px;
    font-weight: 600;
    margin-top: 2px;
    color: var(--dim);
}

#band.near {
    color: var(--truth);
}

#blurb {
    color: var(--dim);
    font-size: 13px;
    margin: 8px 0 0;
}

/* ---- the reveal: where on Earth it actually was ---- */
.where {
    margin: 16px 0 0;
}

.reveal-map {
    background: #0b0e14;
    border: 1px solid var(--line);
    border-radius: 10px;
}

/* The inset is a 340-unit viewBox drawn at ~320 CSS px, so a stroke under about
   0.8 units lands on less than a pixel and reads as grey haze. */
.reveal-coast {
    fill: none;
    stroke: #93a0b8;
    stroke-width: 1.1;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.reveal-country {
    fill: none;
    stroke: #78849c;
    stroke-width: 0.9;
}

.reveal-state {
    fill: none;
    stroke: #4d5771;
    stroke-width: 0.8;
}

.reveal-lake {
    fill: none;
    stroke: #4a5875;
    stroke-width: 0.8;
}

/* The blank rectangle the player was actually staring at, in its real place. */
.reveal-frame {
    fill: none;
    stroke: var(--accent);
    stroke-width: 0.9;
    opacity: 0.75;
}

.where figcaption {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--dim);
}

.where figcaption strong {
    display: block;
    color: var(--ink);
    font-weight: 600;
}

.where .facts {
    display: block;
    font-variant-numeric: tabular-nums;
}

.where a {
    display: inline-block;
    margin-top: 6px;
    color: var(--trace);
    text-decoration: none;
}

.where a:hover,
.where a:focus-visible {
    text-decoration: underline;
}

#stats {
    display: flex;
    justify-content: center;
    gap: 22px;
    margin-top: 18px;
    color: var(--dim);
    font-size: 12px;
    text-align: center;
}

#stats b {
    display: block;
    color: var(--ink);
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

button, a.button {
    background: var(--accent);
    color: #1b1b1b;
    border: 0;
    border-radius: 9px;
    padding: 12px 18px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    margin-top: 14px;
}

a.button {
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

button.ghost, a.button.ghost {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line);
    font-weight: 500;
}

/* ---- the archive: /days ---- */

.masthead .back {
    color: var(--dim);
    font-size: 12px;
    letter-spacing: .06em;
    text-decoration: none;
}

.masthead .back:hover,
.masthead .back:focus-visible {
    text-decoration: underline;
}

.days {
    width: 100%;
    max-width: var(--column);
    margin: 12px auto 0;
    padding: 0;
    list-style: none;
}

.days a {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 11px 2px;
    border-bottom: 1px solid var(--line);
    color: inherit;
    text-decoration: none;
}

.days a:hover .day-date,
.days a:focus-visible .day-date {
    text-decoration: underline;
}

.day-no {
    min-width: 34px;
    color: var(--dim);
    font-size: 12px;
    letter-spacing: .06em;
}

.day-status {
    margin-left: auto;
    color: var(--dim);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.day-status.played {
    color: var(--ink);
}

#selftest-report {
    font: 11px ui-monospace, Consolas, monospace;
    white-space: pre-wrap;
}
