/* Tema: tegneserie-garasje à la Mujaffa-spillet – marineblå topp, mintgrønn vegg,
   blå paneler med tykke mørke kanter og cyan knapper. */
:root {
  --navy: #0a1a4a;
  --navy-2: #0f2a66;
  --outline: #071a3d;
  --panel: #1672c2;
  --panel-2: #0f5ea6;
  --cyan: #3fbff2;
  --cyan-hi: #b8f3ff;
  --label: #3d72d6;      /* «PENGE:»-blå */
  --value: #c9f1ff;      /* lyse tall i toppen */
  --red: #ec2a1f;        /* tittel */
  --yellow: #ffd93b;     /* «nyt»-gul */
  --accent: #e055b8;     /* rosa teppe */
  --accent-soft: rgba(224, 85, 184, .35);
  --text: #ffffff;
  --muted: #bcdcff;
  --border: rgba(255, 255, 255, .22);
  --guess: #1971c2;
  --ok: #2b8a3e;
  --radius: 18px;
  --display: Impact, "Arial Black", "Franklin Gothic Heavy", "Helvetica Neue", sans-serif;
  --ui: "Arial Black", "Trebuchet MS", Verdana, system-ui, sans-serif;
}

* { box-sizing: border-box; }
button, a, input { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }

body {
  font-family: "Trebuchet MS", Verdana, system-ui, sans-serif;
  /* Mintgrønn garasjevegg med lysere gulv */
  background: linear-gradient(180deg, #86d4b6 0%, #8fd8bb 62%, #c8efdc 62%, #d9f5e7 100%);
  color: var(--text);
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

a { color: var(--yellow); }
code { font-family: ui-monospace, Consolas, monospace; font-size: .9em; }

/* ---------- Topplinje ---------- */

.topbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy) 55%, var(--navy-2) 55%, var(--navy-2) 100%);
  border-bottom: 4px solid var(--outline);
}
.topbar h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.9rem;
  font-style: italic;
  font-weight: 900;
  line-height: 1;
  color: var(--red);
  letter-spacing: .01em;
  white-space: nowrap;
  transform: rotate(-3deg) skewX(-6deg);
  text-shadow:
    2px 2px 0 #3a0000,
    -1px -1px 0 #3a0000,
    1px -1px 0 #3a0000,
    -1px 1px 0 #3a0000;
}
.topbar h1 .accent {
  color: #4f78c9;
  text-shadow:
    2px 2px 0 #050d26,
    -1px -1px 0 #050d26;
}
.stats {
  display: flex; align-items: center; gap: 18px;
  font-family: var(--ui);
  font-size: .95rem;
  color: var(--label);
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stats strong { color: var(--value); font-size: 1.25em; }
.icon-btn {
  width: 36px; height: 36px; padding: 0;
  border: 3px solid var(--outline); border-radius: 8px;
  background: linear-gradient(180deg, #7fd8ff, var(--cyan));
  font-size: 1.05rem; line-height: 1; cursor: pointer;
}
@media (hover: hover) { .icon-btn:hover { background: var(--cyan-hi); } }
.icon-btn { position: relative; }
.sound-btns { display: flex; gap: 6px; }
/* Av: grå knapp med rød skråstrek over ikonet */
.icon-btn.off { background: #8aa3bd; }
.icon-btn.off::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 26px; height: 3px; border-radius: 2px;
  background: var(--red); box-shadow: 0 0 0 1px var(--outline);
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* ---------- Hovedmeny ---------- */

.menu { display: none; }
body.in-menu .menu {
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(10, 26, 74, .35) 0%, rgba(10, 26, 74, .15) 45%, rgba(10, 26, 74, .55) 100%),
    url("../effekter/Moholt_studentby_drone_aug_25_BS-1.webp") center / cover no-repeat;
}
body.in-menu .layout { display: none; }
body.in-menu .stats > span:not(.sound-btns) { display: none; }

.menu-card {
  width: min(440px, 100%);
  max-height: 100%;
  overflow: auto;
  display: flex; flex-direction: column; align-items: stretch; gap: 12px;
  padding: 26px 24px;
  background: var(--panel);
  border: 4px solid var(--outline);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 3px #2a9ae6, 0 12px 40px rgba(0, 0, 0, .45);
  text-align: center;
}
.menu-card h2 {
  margin: 0 0 4px;
  font-family: var(--ui); font-size: 2rem; color: #6fe3ff;
  text-transform: uppercase; letter-spacing: .03em;
  text-shadow: 2px 2px 0 var(--outline);
}
.menu-card h2.menu-title {
  font-family: var(--display); font-style: italic; text-transform: none;
  font-size: clamp(2rem, 8vw, 2.9rem); line-height: 1.05;
  color: var(--red);
  transform: rotate(-3deg) skewX(-6deg);
  text-shadow: 3px 3px 0 #3a0000, -1px -1px 0 #3a0000, 1px -1px 0 #3a0000, -1px 1px 0 #3a0000;
}
.menu-title .accent { color: #6fa0ff; text-shadow: 3px 3px 0 #050d26, -1px -1px 0 #050d26; }
.menu-tagline { margin: 0 0 8px; color: var(--value); font-weight: 700; }
.menu-btn { padding: 13px; font-size: 1.15rem; }
.menu-error { margin: 4px 0 0; color: #ffd0d0; font-weight: 700; }

/* ---------- Layout ---------- */

.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 14px;
  padding: 14px;
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}

.panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 4px solid var(--outline);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 3px #2a9ae6, 0 4px 0 rgba(7, 26, 61, .35);
  overflow: hidden;
}

/* ---------- Bilde ---------- */

.photo-frame {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 8px;
  padding: 0;
  border: 3px solid var(--outline);
  border-radius: 12px;
  overflow: hidden;
  background: var(--navy);
  cursor: zoom-in;
}
.photo-frame img { display: block; width: 100%; height: 100%; object-fit: contain; transition: opacity .2s; }
.photo-frame.loading img { opacity: .25; }
.photo-hint {
  position: absolute; right: 10px; bottom: 10px;
  padding: 4px 10px; border-radius: 999px;
  border: 2px solid var(--outline);
  background: var(--yellow); color: var(--outline);
  font-family: var(--ui); font-size: .72rem; text-transform: uppercase;
  pointer-events: none;
}

/* ---------- Kart ---------- */

.map {
  flex: 1; min-height: 0;
  margin: 8px 8px 0;
  border: 3px solid var(--outline);
  border-radius: 12px;
}

.mapview {
  position: relative;
  overflow: hidden;
  background: #efe9dc;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.mapview.dragging { cursor: grabbing; }
.mapview-img {
  position: absolute; left: 0; top: 0;
  max-width: none;
  transform-origin: 0 0;
  pointer-events: none;
  will-change: transform;
}
.mapview-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.mapview-guess {
  position: absolute; left: 0; top: 0; max-width: none; pointer-events: none; user-select: none;
  filter: drop-shadow(0 0 1.5px #000) drop-shadow(0 2px 3px rgba(0, 0, 0, .5)); /* hvit do må synes på kartet */
}
.mapview-controls { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 6px; }
.mapview-controls button {
  width: 38px; height: 38px;
  border: 3px solid var(--outline); border-radius: 8px;
  background: linear-gradient(180deg, #7fd8ff, var(--cyan));
  color: var(--outline);
  font-family: var(--ui); font-size: 1.2rem; line-height: 1; cursor: pointer;
}
@media (hover: hover) { .mapview-controls button:hover { background: var(--cyan-hi); } }

/* Linjer og markører (SVG) */
.ml { stroke: #1f2328; stroke-width: 2.5; stroke-dasharray: 7 6; stroke-linecap: round; }
.ml.calib { stroke: var(--ok); }
.zone { fill: none; stroke: rgba(0, 95, 170, .8); stroke-width: 4.5; }
.zone-label { font-size: 14px; fill: #08558f; }
.mk { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .45)); }
.mk-guess circle { fill: var(--guess); stroke: #fff; stroke-width: 3; }
.mk-guess { filter: none; } /* skuddhullet har egen skygge */
.mk-answer .ring, .mk-selected .ring { fill: none; stroke: #c2185b; stroke-width: 3.5; }
.mk-answer .dot, .mk-selected .dot { fill: #c2185b; }
.mk-point circle { fill: #e8590c; stroke: #fff; stroke-width: 2; }
.mk-calib circle { fill: var(--ok); stroke: #fff; stroke-width: 2; }
.mk-label {
  font: 700 12px "Trebuchet MS", Verdana, system-ui, sans-serif;
  fill: #1f2328;
  stroke: #fff; stroke-width: 3.5px; stroke-linejoin: round;
  paint-order: stroke;
  text-anchor: middle;
}
.mk-answer .mk-label, .mk-selected .mk-label { font-size: 14px; fill: #c2185b; }

.map-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  min-height: 64px;
}
.message { flex: 1; font-size: .95rem; line-height: 1.4; }
.message strong { color: var(--value); }
.message .points { color: var(--yellow); }
.message .hint { color: var(--muted); }
.error { color: #ffd0d0; font-weight: 700; }

/* ---------- Knapper ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 16px;
  border: 3px solid var(--outline); border-radius: 9px;
  background: linear-gradient(180deg, #6fd3ff 0%, var(--cyan) 55%, #1f9ad8 100%);
  color: var(--outline);
  font-family: var(--ui); font-size: .9rem; font-weight: 900;
  text-transform: uppercase; letter-spacing: .03em; text-decoration: none;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .45);
  cursor: pointer; white-space: nowrap;
}
@media (hover: hover) { .btn:hover:not(:disabled) { background: var(--cyan-hi); } }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary {
  min-width: 130px;
  background: linear-gradient(180deg, #d4f8ff 0%, #8eeaff 55%, #4fd0f5 100%);
}
@media (hover: hover) { .btn.primary:hover:not(:disabled) { background: #ffffff; } }
.btn:disabled { opacity: .45; cursor: default; }
.btn.wide { width: 100%; margin-top: 16px; padding: 12px; font-size: 1.05rem; }
.end-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.end-buttons .btn { flex: 1 1 140px; padding: 12px; font-size: 1.05rem; }
.linklike { border: 0; background: none; padding: 0; color: #a3144c; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }

/* ---------- Mujaffa-popup ---------- */

.popup {
  --popup-bottom: max(16px, env(safe-area-inset-bottom));
  position: fixed; left: calc(16px + 20vw); bottom: var(--popup-bottom); z-index: 30;
  /* Samme ramme som panelene: blått kort med tykk mørk kant */
  padding: 5px;
  background: var(--panel);
  border: 4px solid var(--outline);
  border-radius: 16px;
  box-shadow: inset 0 0 0 2px #2a9ae6, 0 8px 24px rgba(0, 0, 0, .4);
  pointer-events: none;
  /* Helt ut av skjermen: egen høyde + avstanden til bunnen + litt ekstra */
  transform: translateY(calc(100% + var(--popup-bottom) + 30px));
  visibility: hidden;
  transition: transform .35s ease-in, visibility 0s linear .35s;
}
.popup.show {
  transform: translateY(0);
  visibility: visible;
  transition: transform .45s cubic-bezier(.34, 1.56, .64, 1), visibility 0s; /* spretter litt */
}
.popup img { display: block; height: min(40vh, 300px); width: auto; border: 3px solid var(--outline); border-radius: 10px; }

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5, 12, 35, .94);
  cursor: zoom-out;
}
.lightbox img { max-width: 96vw; max-height: 92dvh; object-fit: contain; }
.lightbox-close {
  position: absolute; top: 12px; right: 16px;
  border: 0; background: none; color: #fff; font-size: 2.2rem; cursor: pointer;
}

/* ---------- Eksplosjon ---------- */

.explosion {
  position: absolute; inset: 0; z-index: 1;
  background: #ff9966; /* samme farge som kanten av GIF-en */
  cursor: pointer;
  transition: opacity var(--fade-ms, 700ms) ease-out;
}
.explosion img { display: block; width: 100%; height: 100%; object-fit: cover; }
.explosion.fading { opacity: 0; pointer-events: none; }

/* ---------- Sluttskjerm ---------- */

.overlay {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: rgba(5, 15, 45, .65);
}
.dialog {
  position: relative;
  width: min(540px, 100%);
  max-height: 92dvh;
  overflow: hidden; /* bare .end-scroll scroller */
  display: flex; flex-direction: column;
  padding: 24px;
  background: var(--panel);
  border: 4px solid var(--outline);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 3px #2a9ae6, 0 12px 40px rgba(0, 0, 0, .4);
  text-align: center;
}
.dialog h2, .leaderboard h3 {
  margin: 0 0 4px;
  font-family: var(--ui);
  font-size: 2rem;
  color: #6fe3ff;
  text-transform: uppercase;
  letter-spacing: .03em;
  text-shadow: 2px 2px 0 var(--outline);
}
.total {
  margin: 4px 0;
  font-family: var(--display);
  font-size: 3rem;
  color: var(--yellow);
  font-variant-numeric: tabular-nums;
  text-shadow: 3px 3px 0 var(--outline);
}
.total .of { font-family: var(--ui); font-size: 1rem; color: var(--muted); text-shadow: none; text-transform: uppercase; }
.best { margin: 0 0 16px; color: var(--muted); font-weight: 700; }
/* Sluttskjermen: tittel/poeng, toppliste-skjemaet og knappene står fast. Bare
   resultatlisten og selve topplisten scroller, hver for seg. Under hverandre på
   telefon, side om side på bred skjerm (se @media nederst). */
.dialog > * { flex-shrink: 0; }
.dialog > .end-body {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; gap: 20px;
}
.end-results { flex: 0 1 auto; min-height: 100px; overflow-y: auto; }
.end-body > .leaderboard {
  flex: 0 1 auto; min-height: 170px;
  display: flex; flex-direction: column;
}
.end-body > .leaderboard[hidden] { display: none; }
.end-body > .leaderboard > * { flex-shrink: 0; }
.end-body > .leaderboard > .lb-list { flex: 0 1 auto; min-height: 0; overflow-y: auto; }
.summary thead th { position: sticky; top: 0; background: var(--panel); }
.summary { width: 100%; border-collapse: collapse; text-align: left; font-size: .95rem; }
.summary th {
  color: var(--value); font-family: var(--ui); font-size: .78rem; text-transform: uppercase;
  border-bottom: 2px solid var(--outline); padding: 6px 4px;
}
.summary td { padding: 8px 4px; border-bottom: 1px solid var(--border); vertical-align: top; }
.summary .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.summary .sub { display: block; color: var(--muted); font-size: .8rem; }

/* Toppliste */
.leaderboard { margin-top: 20px; text-align: left; }
.end-body > .leaderboard { margin-top: 0; } /* avstanden kommer fra gap */
.leaderboard h3 { margin: 0 0 10px; font-size: 1.5rem; text-align: center; }
.lb-form { display: flex; flex-wrap: wrap; gap: 8px; }
.lb-form .btn { flex: 1 0 auto; }
.lb-form input {
  flex: 999 1 160px; min-width: 0;
  padding: 8px 12px;
  border: 3px solid var(--outline); border-radius: 9px;
  background: #fff; color: #10203f;
  font: inherit; font-size: 16px; font-weight: 700; /* 16px hindrer zoom på iOS */
}
.lb-form input:focus { outline: 3px solid var(--yellow); outline-offset: 0; }
.lb-status { margin: 8px 0; color: var(--muted); font-size: .9rem; text-align: center; }
.lb-list {
  margin: 0; padding: 4px; list-style: none; counter-reset: lb;
  background: var(--panel-2);
  border: 3px solid var(--outline); border-radius: 12px;
}
.lb-list li {
  counter-increment: lb;
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px;
}
.lb-list li:nth-child(odd) { background: rgba(255, 255, 255, .08); }
.lb-list li::before { content: counter(lb) "."; width: 1.8em; color: var(--muted); font-variant-numeric: tabular-nums; }
.lb-list li.empty::before { content: none; }
.lb-list li.empty { justify-content: center; color: var(--muted); }
.lb-list li.you { background: var(--accent); font-weight: 700; }
.lb-list li.you::before { color: #fff; }
.lb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-score { font-family: var(--ui); color: var(--yellow); font-variant-numeric: tabular-nums; }
.lb-list li.you .lb-score { color: #fff; }

/* ---------- Plasseringsmodus ---------- */

.editor-layout { grid-template-columns: 340px minmax(0, 1fr); }
.sidebar { padding: 12px; gap: 10px; }
.banner { padding: 8px 10px; border-radius: 8px; border: 2px solid var(--outline); background: var(--yellow); color: var(--outline); font-size: .9rem; }
.progress { margin: 0; font-family: var(--ui); text-transform: uppercase; color: #6fe3ff; }
.apt-list { flex: 1; min-height: 0; overflow: auto; margin: 0; padding: 0; list-style: none; }
.apt {
  display: grid; grid-template-columns: 1fr auto; gap: 0 8px;
  width: 100%; padding: 7px 10px; margin-bottom: 4px;
  border: 2px solid transparent; border-radius: 8px;
  background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.apt:hover { background: rgba(255, 255, 255, .1); }
.apt.selected { background: var(--cyan-hi); border-color: var(--outline); color: var(--outline); }
.apt.selected .apt-addr { color: #24507f; }
.apt-name { font-weight: 700; }
.apt-status { color: var(--muted); font-weight: 700; }
.apt.placed .apt-status { color: #8dffa8; }
.apt.placed.selected .apt-status { color: var(--ok); }
.apt-addr { grid-column: 1 / -1; color: var(--muted); font-size: .82rem; }
.tools { display: flex; flex-direction: column; gap: 8px; border-top: 2px solid var(--outline); padding-top: 10px; }
.tools .row { display: flex; gap: 8px; }
.tools .row .btn { flex: 1; }
.note { margin: 0; font-size: .85rem; color: var(--muted); }
.warning { color: var(--yellow); }

/* ---------- Mobil ---------- */

@media (max-width: 800px) {
  .topbar { padding: 6px 10px; padding-top: max(6px, env(safe-area-inset-top)); gap: 8px; }
  .topbar h1 { font-size: 1.2rem; }
  .stats { gap: 10px; font-size: .8rem; }
  .icon-btn { width: 34px; height: 34px; border-width: 2px; }
  .layout {
    display: flex; flex-direction: column; gap: 6px;
    padding: 6px;
    padding-left: max(6px, env(safe-area-inset-left));
    padding-right: max(6px, env(safe-area-inset-right));
    padding-bottom: max(6px, env(safe-area-inset-bottom));
  }
  .panel { border-width: 3px; border-radius: 14px; box-shadow: inset 0 0 0 2px #2a9ae6; }
  .photo-panel { flex: 0 0 30%; }
  .map-panel { flex: 1; }
  .photo-frame { margin: 5px; border-width: 2px; }
  .photo-hint { right: 6px; bottom: 6px; padding: 3px 8px; font-size: .65rem; }
  .map { margin: 5px 5px 0; border-width: 2px; }
  .mapview-controls { top: 6px; right: 6px; }
  .mapview-controls button { width: 40px; height: 40px; border-width: 2px; }
  .map-bar { gap: 8px; padding: 6px 8px; min-height: 58px; }
  .message { font-size: .85rem; line-height: 1.3; }
  .message .hint { display: none; }
  .btn { border-width: 2px; }
  .btn.primary { min-width: 96px; min-height: 46px; padding: 8px 12px; }

  /* Mujaffa over meldingslinjen, så han ikke skjuler resultatet */
  .popup { left: calc(8px + 20vw); padding: 4px; border-width: 3px; border-radius: 13px; --popup-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .popup img { height: min(24vh, 190px); }

  .overlay { padding: 8px; align-items: flex-end; }
  .dialog { padding: 18px 14px; max-height: calc(100dvh - 16px); }
  .dialog h2 { font-size: 1.6rem; }
  .total { font-size: 2.4rem; }
  .summary { font-size: .85rem; }
  .summary th, .summary td { padding: 6px 3px; }
  .menu { padding: 10px; }
  .menu-card { padding: 20px 16px; }

  .editor-layout .map-panel { order: -1; flex: 0 0 55%; }
  .editor-layout .sidebar { flex: 1; }
}

/* Smale telefoner: tittelen tar for mye plass under spillet */
@media (max-width: 480px) {
  body.game:not(.in-menu) .topbar h1 { display: none; }
  body.game:not(.in-menu) .stats { flex: 1; justify-content: space-between; }
  .stats .long { display: none; }
  .stats { font-size: .9rem; }
}

/* Telefon på tvers: bilde og kart side om side, slank topplinje */
@media (max-width: 950px) and (max-height: 500px) and (orientation: landscape) {
  .topbar { padding-top: 4px; padding-bottom: 4px; }
  .topbar h1 { font-size: 1rem; }
  .layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); }
  .photo-panel, .map-panel { flex: none; }
  .map-bar { min-height: 50px; }
  .popup { --popup-bottom: calc(60px + env(safe-area-inset-bottom)); }
  .popup img { height: 34vh; }
  .overlay { align-items: center; }
  .editor-layout { grid-template-columns: 260px minmax(0, 1fr); }
  .editor-layout .map-panel { order: 0; }
}

/* Store telefoner og nettbrett på høykant: også bilde over kart */
@media (min-width: 801px) and (max-width: 1100px) and (orientation: portrait) {
  .layout:not(.editor-layout) { display: flex; flex-direction: column; }
  .layout:not(.editor-layout) .photo-panel { flex: 0 0 36%; }
  .layout:not(.editor-layout) .map-panel { flex: 1; }
}

/* Sluttskjerm på bred skjerm: resultater og toppliste side om side */
@media (min-width: 801px) {
  .dialog:has(> .end-body > .leaderboard:not([hidden])) { width: min(980px, 100%); }
  .dialog > .end-body { flex-direction: row; align-items: stretch; gap: 24px; }
  .end-results, .end-body > .leaderboard { flex: 1 1 0; min-width: 0; min-height: 0; }
}
