/* The game's look for the web: its palette (PrototypeBuilder), the title screen and the menu's buttons. */
@font-face { font-family: "Space Mono"; font-weight: 400; src: url("fonts/SpaceMono-Regular.ttf"); font-display: swap; }
@font-face { font-family: "Space Mono"; font-weight: 700; src: url("fonts/SpaceMono-Bold.ttf"); font-display: swap; }
@font-face { font-family: "Archivo Black"; font-weight: 400; src: url("fonts/ArchivoBlack-Regular.ttf"); font-display: swap; }
@font-face { font-family: "Space Grotesk"; font-weight: 400; src: url("fonts/SpaceGrotesk-Regular.ttf"); font-display: swap; }
@font-face { font-family: "Space Grotesk"; font-weight: 500; src: url("fonts/SpaceGrotesk-Medium.ttf"); font-display: swap; }
@font-face { font-family: "Space Grotesk"; font-weight: 700; src: url("fonts/SpaceGrotesk-Bold.ttf"); font-display: swap; }

:root {
  --background: #111318; --ruled: #1A1D24; --bar: #2A2E38; --outline: #3A3F4B; --backdrop: #22252D;
  --paper: #F2F0EA; --muted: #9AA0AE; --player: #FFD23F; --player-light: #FFE27A; --interactive: #5CD3F5;
  --danger: #FF4D5E; --hot: #FF8A3D;
  --mono: "Space Mono", ui-monospace, "DejaVu Sans Mono", monospace;
  --grotesk: "Space Grotesk", system-ui, sans-serif;
  --black: "Archivo Black", "Arial Black", sans-serif;
  --row: 64px; --gap: 8px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; color: var(--paper); font: 400 15px/1.5 var(--grotesk);
  /* The ruled page every level is written on. */
  background: var(--background) repeating-linear-gradient(to bottom, transparent 0 89px, var(--ruled) 89px 90px);
  padding-block: calc(24px + env(safe-area-inset-top, 0px)) calc(32px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.page { max-width: 1200px; margin: 0 auto; display: grid; gap: 24px; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--player); outline-offset: 2px; }

.banner { position: relative; display: grid; justify-items: center; padding: 28px 0 8px; overflow: hidden; }
.backdrop {
  /* Starts under the tagline, so only the title stands on it, as on the title screen. */
  position: absolute; inset: 56px 0 0; margin: 0; font: 400 20px/2.6 var(--mono); letter-spacing: .25em; color: var(--backdrop);
  white-space: pre; overflow: hidden; pointer-events: none; user-select: none;
}
.tagline { position: relative; margin: 0; font: 400 12px var(--mono); letter-spacing: .35em; color: var(--muted); text-align: center; }
.title-lower, .title-upper { position: relative; margin: 0; line-height: 1; letter-spacing: -.02em; }
.title-lower { margin-top: 18px; font: 400 clamp(44px, 9vw, 88px) / 1 var(--mono); }
.title-upper { margin-top: 6px; font: 400 clamp(54px, 13vw, 132px) / 1 var(--black); color: var(--player); }

header { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px 20px; }
h1 { font: 700 32px/1.1 var(--grotesk); margin: 0 0 4px; }
.count { color: var(--muted); font-size: 14px; }

.button {
  display: inline-flex; align-items: center; justify-content: center; height: 48px; padding: 0 24px;
  border: 1px solid var(--outline); border-radius: 10px; background: var(--background); color: var(--paper);
  font: 500 17px var(--grotesk); text-decoration: none;
}
.button:hover { border-color: var(--player); }
.button.primary { height: 56px; border: 0; background: var(--player); color: var(--background); font-weight: 700; font-size: 20px; }
.button.primary:hover { background: var(--player-light); }
.button:disabled { opacity: .55; cursor: default; }
.button.primary:disabled:hover { background: var(--player); }

.upload { background: var(--background); border: 1px solid var(--bar); border-radius: 12px; padding: 16px; display: grid; gap: 10px; }
.upload label { font: 700 17px var(--grotesk); }
.line { display: flex; gap: 8px; flex-wrap: wrap; }
.field {
  flex: 1 1 280px; min-width: 0; height: 56px; padding: 0 14px; background: var(--ruled); color: var(--paper);
  border: 1px solid var(--outline); border-radius: 10px; font: 400 15px var(--mono);
}
.field:focus { border-color: var(--player); outline: none; }
.field::placeholder { color: var(--muted); opacity: 1; }
.message { min-height: 22px; font-size: 14px; color: var(--muted); }
.message.bad { color: var(--danger); }
.message.good { color: var(--paper); }
.pasted { display: grid; gap: 8px; }
.pasted-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.pasted-name { font: 700 17px var(--grotesk); overflow-wrap: anywhere; }

.main { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 28px; align-items: start; }
.list {
  display: grid; gap: var(--gap); overflow-y: auto; scrollbar-color: var(--outline) transparent; padding: 3px;
  max-height: calc(9 * (var(--row) + var(--gap)));
}
.row {
  display: grid; grid-template-columns: 160px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 12px;
  align-items: center; width: 100%; height: var(--row); padding: 0 12px 0 8px; text-align: left;
  background: var(--background); border: 1px solid var(--bar); border-radius: 10px;
}
.row:hover { border-color: var(--outline); }
.row[aria-current="true"] { border-color: var(--player); box-shadow: inset 0 0 0 1px var(--player); }
.row .thumb { grid-row: 1 / 3; width: 160px; height: 40px; border-radius: 4px; overflow: hidden; }
.row .thumb svg { display: block; width: 160px; height: 40px; }
.row .title { font: 500 16px/1.25 var(--grotesk); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; align-self: end; }
.row .sentence { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; align-self: start; }
.more { width: 100%; }

.sentence { margin: 0; font-family: var(--mono); color: var(--muted); }
.sentence mark { background: none; color: var(--player); font-weight: 700; }

.detail { display: grid; gap: 14px; min-width: 0; }
.detail h2 { font: 700 28px/1.2 var(--grotesk); margin: 0 0 2px; overflow-wrap: anywhere; }
.strip {
  /* Always scrollable, so the scrollbar's room is there before the picture is sized to what is left. */
  --height: 300px; height: var(--height); overflow-x: scroll; overflow-y: hidden; border: 1px solid var(--bar);
  border-radius: 10px; background: var(--background); cursor: grab; scrollbar-color: var(--outline) transparent;
  touch-action: pan-x;
}
.strip.small { --height: 180px; }
.strip.dragging { cursor: grabbing; user-select: none; }
.strip svg { display: block; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { display: none; }
.chip {
  display: inline-flex; gap: 6px; align-items: baseline; padding: 3px 9px; border: 1px solid var(--outline);
  border-radius: 6px; font-size: 13px; color: var(--paper);
}
.chip b { font: 700 13px var(--mono); }
.chip.enemy b { color: var(--danger); }
.chip.fact { color: var(--muted); }
.chip.fact b { order: 1; }
.chip.fact b { color: var(--paper); font-family: var(--grotesk); }
.code {
  display: block; max-height: 7.5em; overflow-y: auto; padding: 10px 12px; background: var(--ruled);
  border: 1px solid var(--outline); border-radius: 10px; font: 400 12px/1.5 var(--mono); color: var(--muted);
  word-break: break-all; user-select: all; scrollbar-color: var(--outline) transparent;
}
.copy { width: 100%; }
.hint { margin: 0; color: var(--muted); font-size: 14px; }
footer { color: var(--muted); font-size: 13px; }

/* The two pages link to each other from the header. */
.links { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* High scores: the runs beside the fastest finish of each level. */
.scores { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 28px; align-items: start; }
.board { display: grid; gap: 8px; min-width: 0; }
.board h2 { font: 700 22px/1.2 var(--grotesk); margin: 0; }
.table {
  width: 100%; border-collapse: separate; border-spacing: 0; background: var(--background);
  border: 1px solid var(--bar); border-radius: 10px; overflow: hidden;
}
.table th {
  padding: 10px 12px; text-align: left; font: 500 12px var(--grotesk); letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--bar);
}
.table td { padding: 8px 12px; border-bottom: 1px solid var(--ruled); font: 400 15px var(--mono); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
#runs tbody tr:nth-child(-n + 3) .score { color: var(--player); font-weight: 700; }
.table .num { text-align: right; }
.table .name { overflow-wrap: anywhere; white-space: normal; }
.table .level { font-family: var(--grotesk); }
.table tr.open td { color: var(--muted); }
.table .empty { padding: 20px 12px; color: var(--muted); font-family: var(--grotesk); white-space: normal; }
.mark { color: var(--hot); font-size: 11px; vertical-align: 2px; }
.board .more { margin-top: 4px; }
/* The fastest times stay in view beside a long list of runs. */
.scores > .board:last-child { position: sticky; top: 16px; }

@media (max-width: 1000px) {
  .scores { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .scores > .board:last-child { position: static; }
}

@media (max-width: 860px) {
  body { padding-block: calc(12px + env(safe-area-inset-top, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)); }
  .page { gap: 18px; }
  h1 { font-size: 26px; }
  .main { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .list { max-height: calc(6 * (var(--row) + var(--gap))); }
  .strip { --height: 220px; }
  .strip.small { --height: 140px; }
  .upload .button { flex: 1 1 100%; }
  .table .wide { display: none; }
  .table th, .table td { padding-inline: 8px; }
  .backdrop { font-size: 14px; inset-block-start: 44px; }
  .tagline { font-size: 10px; letter-spacing: .18em; }
}

@media (max-width: 420px) {
  .row { grid-template-columns: 112px minmax(0, 1fr); }
  .row .thumb, .row .thumb svg { width: 112px; height: 28px; }
}
