/* Panels are pale glass photographic plates lying on a black sky; notes on them are in ink. */
:root {
  --plate: #E3E8EA; --plate-2: #CBD4D9; --ink: #122029; --ink-2: #475963; --blue: #1F4E9E; --red: #B01E35; --mark: #F0C419;
  --gap: 12px; --edge: max(12px, env(safe-area-inset-left));
  --plate-edge: inset 0 0 0 4px var(--plate), inset 0 0 0 5px var(--plate-2);
  font-family: "Bahnschrift", "DIN Alternate", "Barlow", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px; line-height: 1.4; font-variant-numeric: tabular-nums; color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; overscroll-behavior: none; }
#sky, #marks, #stage { position: fixed; inset: 0; width: 100%; height: 100%; }
#marks { pointer-events: none; }
#stage { touch-action: none; outline: none; cursor: grab; }
body.keys #stage:focus-visible { box-shadow: inset 0 0 0 2px var(--mark); }
#stage.aim { cursor: crosshair; }
#stage.dragging { cursor: grabbing; }
[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; border-radius: 3px; background: var(--plate-2); padding: 7px 11px; min-height: 34px; cursor: pointer; text-align: left; }
button:hover:not(:disabled) { background: #B7C3CA; }
button:disabled { opacity: .45; cursor: default; }
button.main { background: var(--blue); color: #fff; }
button.main:hover:not(:disabled) { background: #173C7C; }
button.danger { color: var(--red); background: #EBD9DB; }
button.danger:hover:not(:disabled) { background: var(--red); color: #fff; }
button.plain { background: none; padding: 4px 6px; min-height: 28px; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
button[aria-pressed="true"] { background: var(--mark); }
:is(button, input, select, textarea, a, summary):focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
#rail :focus-visible, #modes :focus-visible, #place :focus-visible { outline-color: var(--mark); }
select, input[type=text], input[type=search], input[type=number], textarea { width: 100%; background: #F3F6F7; border: 1px solid #9FB0B9; border-radius: 3px; padding: 7px 9px; min-height: 34px; }
textarea { font: 13px/1.5 ui-monospace, Consolas, Menlo, monospace; resize: vertical; min-height: 150px; white-space: pre; overflow: auto; }
h2 { font-size: 21px; font-weight: 600; margin: 0 0 4px; line-height: 1.2; }
h3 { font-size: 15px; font-weight: 600; margin: 18px 0 6px; }
p { margin: 0 0 10px; max-width: 62ch; }
.quiet { color: var(--ink-2); }
.row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.plate, #card, #options, #drawer, #brief, #matter { background: var(--plate); box-shadow: var(--plate-edge); border-radius: 3px; padding: 16px; }

/* Sliders: an ink rule with a plain weight on it. */
.field { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; margin: 8px 0; align-items: baseline; }
.field > input[type=range] { grid-column: 1 / -1; }
.field > select, .field > input:not([type=range]) { grid-column: 1 / -1; margin-top: 3px; }
.field output { font-weight: 600; text-align: right; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; margin: 0; background: none; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 2px; background: var(--ink-2); }
input[type=range]::-moz-range-track { height: 2px; background: var(--ink-2); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 20px; margin-top: -9px; background: var(--blue); border-radius: 2px; }
input[type=range]::-moz-range-thumb { width: 12px; height: 20px; border: 0; background: var(--blue); border-radius: 2px; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--blue); margin: 0; }
label.check { display: flex; gap: 9px; align-items: center; min-height: 34px; cursor: pointer; }

/* Top */
#place { position: fixed; left: var(--edge); top: max(10px, env(safe-area-inset-top)); color: var(--plate); display: flex; gap: 12px; align-items: center; max-width: 60vw; }
#place h1 { font-size: 23px; font-weight: 600; margin: 0; line-height: 1.1; text-shadow: 0 1px 8px #000; }
#place p { margin: 2px 0 0; text-shadow: 0 1px 6px #000; }
#place button, #modes button { color: var(--ink); background: var(--plate); }
#place button:hover, #modes button:hover { background: #fff; }
#modes { position: fixed; right: max(12px, env(safe-area-inset-right)); top: max(10px, env(safe-area-inset-top)); display: flex; gap: 4px; }
#modes button[aria-pressed="true"] { background: var(--mark); }

/* Tools */
#rail { position: fixed; left: var(--edge); top: 92px; display: flex; flex-direction: column; gap: 3px; }
#rail button { display: flex; align-items: center; gap: 9px; background: var(--plate); min-height: 40px; min-width: 112px; padding: 6px 12px 6px 9px; }
#rail button:hover { background: #fff; }
#rail button[aria-pressed="true"] { background: var(--mark); }
#rail svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#options { position: fixed; left: calc(var(--edge) + 122px); top: 92px; width: 268px; max-height: 70vh; overflow: auto; }

/* Selected object */
#card { position: fixed; right: max(12px, env(safe-area-inset-right)); top: 58px; bottom: 96px; width: 312px; overflow: auto; overscroll-behavior: contain; height: fit-content; max-height: calc(100vh - 160px); }
#card .name { font-size: 21px; font-weight: 600; border-color: transparent; background: none; padding: 2px 4px; margin: 0 0 0 -5px; width: calc(100% - 34px); }
#card .name:hover, #card .name:focus { background: #F3F6F7; border-color: #9FB0B9; }
#card .close { position: absolute; right: 10px; top: 12px; }
#card .verdict { font-weight: 600; margin: 0 0 8px; }
dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; margin: 0; }
dt { color: var(--ink-2); } dd { margin: 0; text-align: right; font-weight: 600; }
details { margin-top: 10px; border-top: 1px solid var(--plate-2); padding-top: 8px; }
summary { cursor: pointer; font-weight: 600; padding: 4px 0; }

/* Time */
#time { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(10px, env(safe-area-inset-bottom)); width: min(860px, calc(100vw - 24px)); background: var(--plate); box-shadow: var(--plate-edge); border-radius: 3px; padding: 9px 14px; display: grid; grid-template-columns: auto auto 1fr auto auto auto; gap: 4px 12px; align-items: center; }
#time .pause { min-width: 74px; text-align: center; }
#time .read { min-width: 168px; }
#time .read b { display: block; font-weight: 600; white-space: nowrap; }
#time .read span { color: var(--ink-2); font-size: 13px; white-space: nowrap; }
#time .load { width: 74px; font-size: 13px; color: var(--ink-2); }
#time .load i { display: block; height: 4px; background: var(--plate-2); margin-top: 3px; }
#time .load i b { display: block; height: 100%; background: var(--blue); width: 0; }

#log { position: fixed; left: var(--edge); bottom: 84px; width: min(390px, 60vw); display: flex; flex-direction: column; gap: 3px; pointer-events: none; }
#log div { color: #F3F6F7; background: rgba(6, 14, 20, .78); padding: 6px 10px; border-left: 3px solid var(--plate-2); font-size: 14px; transition: opacity .6s; }
#log div.big { border-color: var(--mark); } #log div.bad { border-color: #E4566A; }
#log div.old { opacity: 0; }
#matter { position: fixed; left: 50%; transform: translateX(-50%); bottom: 88px; width: min(440px, calc(100vw - 24px)); padding: 12px 16px; }
#matter progress { width: 100%; height: 6px; accent-color: var(--blue); display: block; margin: 6px 0 8px; }
#brief { position: fixed; left: 50%; transform: translateX(-50%); top: 12px; width: min(460px, calc(100vw - 24px)); padding: 12px 16px; }
#brief p { margin: 0 0 6px; }
#brief.won { background: var(--mark); box-shadow: none; }

#drawer { position: fixed; right: max(12px, env(safe-area-inset-right)); top: 58px; bottom: 96px; width: min(440px, calc(100vw - 24px)); overflow: auto; overscroll-behavior: contain; }
#drawer > .close, #welcome .close { position: absolute; right: 12px; top: 12px; }
.list { list-style: none; margin: 8px 0; padding: 0; }
.list li { border-top: 1px solid var(--plate-2); padding: 9px 0; }
.list li > button.pickme { width: 100%; background: none; padding: 2px 4px; margin: 0 -4px; }
.list li > button.pickme:hover { background: var(--plate-2); }
.list b { font-weight: 600; } .list .medal { float: right; font-weight: 600; }
.medal::before { content: ""; display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 6px; background: #B08D57; }
.medal.gold::before { background: #E0AE00; } .medal.silver::before { background: #8E9AA1; } .medal.bronze::before { background: #A5673F; }
.err { color: var(--red); font-weight: 600; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
td, th { text-align: left; padding: 5px 8px 5px 0; border-top: 1px solid var(--plate-2); vertical-align: top; font-weight: 400; }
th { color: var(--ink-2); border: 0; }
.chart { position: relative; margin: 6px 0; } .chart canvas { width: 100%; height: 150px; display: block; touch-action: none; }

/* Atlas: the whole screen becomes the plate. */
#atlas { position: fixed; inset: 0; color: var(--ink); pointer-events: none; }
#atlas > * { pointer-events: auto; }
#atlas .find { position: absolute; left: var(--edge); top: max(12px, env(safe-area-inset-top)); bottom: 12px; width: min(320px, calc(100vw - 24px)); display: flex; flex-direction: column; }
#atlas .find ul { overflow: auto; flex: 1; margin: 8px -6px 0; padding: 0 6px; }
#atlas .find li { padding: 0; } #atlas .find li > button { width: 100%; background: none; margin: 0; padding: 7px 4px; }
#atlas .find li > button:hover { background: var(--plate-2); }
#atlas .find h3 { margin: 12px 0 2px; }
#atlas .leave { position: absolute; right: 12px; top: 12px; background: var(--ink); color: var(--plate); }
#atlas .star { position: absolute; right: 12px; bottom: 12px; width: min(330px, calc(100vw - 24px)); background: var(--plate); box-shadow: var(--plate-edge), 0 0 0 1px var(--ink); padding: 16px; border-radius: 3px; }

#welcome { position: fixed; left: var(--edge); bottom: 96px; width: min(410px, calc(100vw - 24px)); background: var(--plate); box-shadow: var(--plate-edge); border-radius: 3px; padding: 20px; }
#welcome h2 { font-size: 34px; letter-spacing: .01em; }
#welcome .go { display: grid; gap: 5px; margin-top: 12px; }
#welcome .go button { width: 100%; }
#welcome.open ~ #log { display: none; }
body.welcome #rail, body.welcome #log, body.welcome #options { display: none; }
body.atlas :is(#place, #modes, #rail, #options, #card, #log, #time, #matter, #brief, #drawer, #welcome) { display: none; }

@media (max-width: 760px) {
  :root { font-size: 14px; }
  #place { max-width: calc(100vw - 24px); } #place h1 { font-size: 18px; }
  #modes { top: 62px; right: auto; left: var(--edge); flex-wrap: wrap; }
  #rail { top: auto; bottom: 104px; transform: none; left: 0; right: 0; flex-direction: row; overflow-x: auto; padding: 4px var(--edge); gap: 4px; }
  #rail button { min-width: 0; flex: none; padding: 6px 10px; }
  #options { left: var(--edge); right: var(--edge); width: auto; top: auto; bottom: 156px; transform: none; max-height: 34vh; }
  #card { left: var(--edge); right: var(--edge); width: auto; top: auto; bottom: 156px; max-height: 38vh; }
  #drawer { left: 12px; right: 12px; width: auto; top: 108px; bottom: 104px; }
  #log { bottom: 158px; width: calc(100vw - 24px); }
  #time { grid-template-columns: auto 1fr auto auto; padding: 8px 10px; } #time .slide { grid-column: 1 / -1; grid-row: 2; } #time .load { display: none; } #time .read { min-width: 0; }
  #brief { top: 104px; } #matter { bottom: 158px; }
  #welcome { bottom: 104px; }
  #atlas .find { top: 62px; bottom: auto; max-height: 45vh; }
}
@media (max-height: 620px) and (min-width: 761px) { #rail button { min-height: 34px; } #card { max-height: calc(100vh - 150px); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
