/* ==========================================================================
   Report – the printable keepsake (verslag.html).
   On screen: an options bar above A4 sheets. In print: only the sheets,
   edge to edge, backgrounds kept (they are the Questivo look).
   ========================================================================== */

@page { size: A4; margin: 0; }

html { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
body.report { background: var(--q-ink); color: var(--text); }

.px { display: inline-block; line-height: 0; }
.px > svg { width: calc(var(--sw) * var(--u, 3px)); height: calc(var(--sh) * var(--u, 3px)); }

/* ---- Options bar --------------------------------------------------------------- */

.report-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  gap: 14px;
  padding: 14px var(--gutter) 16px;
  background: rgba(2, 7, 22, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.report-bar__top { display: flex; align-items: center; gap: 14px; }
.report-bar__title { font: 0.75rem var(--font-pixel); letter-spacing: 0.08em; text-transform: uppercase; color: var(--q-blue-200); }
.report-bar__back { margin-left: auto; font-size: 0.875rem; font-weight: 600; color: var(--q-blue-200); text-decoration: none; }
.report-bar__back:hover { color: var(--q-white); }
.report-bar__options { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 18px; }
.report-bar__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.report-bar__actions .is-disabled { opacity: 0.45; cursor: not-allowed; }
.report-bar__tip { flex-basis: 100%; font-size: 0.8125rem; color: var(--text-muted); }
.report-bar__tip b { color: var(--q-white); }

.report-field { display: grid; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.report-field > span,
.report-field > legend {
  padding: 0;
  font: 0.625rem var(--font-pixel);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--q-blue-200);
}
.report-field select {
  height: 40px;
  max-width: 100%;
  padding: 0 12px;
  font: 500 0.9375rem var(--font-sans);
  color: var(--text);
  background: rgba(4, 12, 38, 0.85);
  border: 0;
  box-shadow: inset 0 0 0 2px rgba(141, 180, 255, 0.2);
}
.report-seg { display: flex; flex-wrap: wrap; gap: 0; }
.report-seg legend { margin-bottom: 6px; }
.report-seg label { position: relative; cursor: pointer; }
.report-seg input { position: absolute; opacity: 0; }
.report-seg span {
  display: grid;
  place-items: center;
  height: 40px;
  padding: 0 14px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(4, 12, 38, 0.85);
  box-shadow: inset 0 0 0 2px rgba(141, 180, 255, 0.2);
}
.report-seg input:checked + span { color: var(--q-white); background: var(--q-blue-500); box-shadow: inset 0 -3px 0 rgba(10, 26, 74, 0.45); }
.report-seg input:focus-visible + span { outline: 2px solid var(--q-white); outline-offset: 2px; }

.report-msg, .report-empty { padding: 60px 20px; text-align: center; color: var(--text-muted); }
.report-msg a { color: var(--q-blue-300); }

/* ---- Sheets ---------------------------------------------------------------------- */

.report-doc { display: grid; justify-content: center; gap: 28px; padding: 28px 16px 80px; }

.sheet {
  --pad: 16mm;
  position: relative;
  width: 210mm;
  max-width: 100%;
  min-height: 297mm;
  padding: var(--pad);
  overflow: hidden;
  color: var(--text);
  background: var(--q-navy-950);
  box-shadow: 0 0 0 1px var(--line-strong), 0 24px 60px rgba(0, 0, 0, 0.5);
  /* A sheet that runs over several pages gets its padding on each of them. */
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.sheet__head { margin-bottom: 9mm; }
.sheet h2 { font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.kicker {
  margin-bottom: 8px;
  font: 0.6875rem var(--font-pixel);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--q-blue-300);
}

/* ---- Cover ------------------------------------------------------------------------ */

.cover {
  display: flex;
  flex-direction: column;
  height: 297mm;
  padding: 18mm 18mm 0;
  background:
    radial-gradient(120% 60% at 50% 110%, rgba(47, 107, 255, 0.45), transparent 60%),
    linear-gradient(180deg, var(--q-ink) 0%, var(--q-navy-900) 55%, var(--q-navy-800) 100%);
}
.cover__sky { position: absolute; inset: 0; pointer-events: none; }
.cover__sky i {
  position: absolute;
  width: calc(var(--s) * 2px);
  height: calc(var(--s) * 2px);
  background: var(--q-blue-100);
  opacity: calc(0.25 + var(--s) * 0.18);
}
.cover__brand { position: relative; display: flex; align-items: center; gap: 12px; }
.cover__mark svg { width: 34px; height: 34px; }
.cover__word { font: 1.25rem var(--font-pixel); letter-spacing: 0.22em; color: var(--q-white); }
.cover__main { position: relative; margin-top: 42mm; }
.cover__main .kicker { font-size: 0.8125rem; }
.cover__title {
  font-size: 3.75rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.045em;
  color: var(--q-white);
  text-wrap: balance;
}
.cover__sub { margin-top: 14px; font-size: 1.125rem; color: var(--q-blue-100); }
.cover__members { margin-top: 8px; font-size: 0.9375rem; color: var(--text-muted); }
.cover__stats {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 14mm;
}
.cover__stats div {
  --n: 3px;
  padding: 12px 14px;
  background: rgba(20, 42, 118, 0.45);
  box-shadow: inset 0 0 0 2px rgba(141, 180, 255, 0.22);
  clip-path: polygon(0 var(--n), var(--n) var(--n), var(--n) 0, calc(100% - var(--n)) 0, calc(100% - var(--n)) var(--n), 100% var(--n), 100% calc(100% - var(--n)), calc(100% - var(--n)) calc(100% - var(--n)), calc(100% - var(--n)) 100%, var(--n) 100%, var(--n) calc(100% - var(--n)), 0 calc(100% - var(--n)));
}
.cover__stats dt { font: 0.5625rem var(--font-pixel); letter-spacing: 0.08em; text-transform: uppercase; color: var(--q-blue-200); }
.cover__stats dd { margin: 6px 0 0; }
.cover__stats b { display: block; font-size: 1.75rem; font-weight: 700; letter-spacing: -0.03em; color: var(--q-white); }
.cover__stats span { font-size: 0.75rem; color: var(--text-muted); }
.cover__skyline {
  --u: 4px;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  margin: auto -18mm 0;
  padding: 0 10mm;
  border-bottom: 8px solid var(--q-blue-500);
  box-shadow: 0 8px 0 var(--q-navy-700);
}
.cover__skyline .is-big { --u: 5px; }
.cover__foot {
  position: relative;
  display: flex;
  justify-content: space-between;
  margin: 0 -18mm;
  padding: 7mm 18mm;
  font: 0.625rem var(--font-pixel);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--q-blue-100);
  background: var(--q-navy-700);
}

/* ---- Standings ------------------------------------------------------------------- */

.podium {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: end;
  gap: 10px;
  max-width: 150mm;
  margin: 0 auto 12mm;
}
.podium__col { display: grid; justify-items: center; gap: 4px; text-align: center; }
.podium__col.is-2 { grid-column: 1; }
.podium__col.is-1 { grid-column: 2; }
.podium__col.is-3 { grid-column: 3; }
.podium__trophy { --u: 4px; margin-bottom: 6px; }
.podium__name { max-width: 100%; font-size: 1.0625rem; line-height: 1.2; overflow-wrap: anywhere; }
.podium__pts { font-size: 0.8125rem; color: var(--text-muted); }
.podium__block {
  --n: 4px;
  display: grid;
  place-items: start center;
  width: 100%;
  margin-top: 8px;
  padding-top: 10px;
  font: 2rem var(--font-pixel);
  color: var(--q-white);
  background: linear-gradient(180deg, var(--q-blue-400), var(--q-blue-600));
  box-shadow: inset 0 -5px 0 rgba(10, 26, 74, 0.4), inset 0 3px 0 rgba(255, 255, 255, 0.3);
  clip-path: polygon(0 var(--n), var(--n) var(--n), var(--n) 0, calc(100% - var(--n)) 0, calc(100% - var(--n)) var(--n), 100% var(--n), 100% 100%, 0 100%);
}
.is-1 .podium__block { height: 48mm; background: linear-gradient(180deg, var(--q-blue-300), var(--q-blue-500)); }
.is-2 .podium__block { height: 34mm; }
.is-3 .podium__block { height: 24mm; background: linear-gradient(180deg, var(--q-blue-600), var(--q-blue-700)); }

.rank-table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.rank-table th {
  padding: 0 10px 8px;
  font: 0.5625rem var(--font-pixel);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
  color: var(--q-blue-200);
  border-bottom: 2px solid var(--line-strong);
}
.rank-table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.rank-table tr { break-inside: avoid; }
.rank-table td small { display: block; margin-top: 2px; font-size: 0.75rem; color: var(--text-muted); }
.rank-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rank-table tbody tr:first-child td { background: rgba(47, 107, 255, 0.14); }

/* ---- Team pages ---------------------------------------------------------------------- */

.team__head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6mm 8mm;
  align-items: center;
  margin-bottom: 8mm;
  padding-bottom: 7mm;
  border-bottom: 2px solid var(--line-strong);
}
.team__rank {
  --n: 4px;
  display: grid;
  place-items: center;
  width: 25mm;
  height: 25mm;
  font: 1.625rem var(--font-pixel);
  color: var(--q-white);
  background: var(--q-blue-500);
  box-shadow: inset 0 -5px 0 rgba(10, 26, 74, 0.4), inset 0 3px 0 rgba(255, 255, 255, 0.3);
  clip-path: polygon(0 var(--n), var(--n) var(--n), var(--n) 0, calc(100% - var(--n)) 0, calc(100% - var(--n)) var(--n), 100% var(--n), 100% calc(100% - var(--n)), calc(100% - var(--n)) calc(100% - var(--n)), calc(100% - var(--n)) 100%, var(--n) 100%, var(--n) calc(100% - var(--n)), 0 calc(100% - var(--n)));
}
.team__who h2 { overflow-wrap: anywhere; }
.team__who p:last-child { margin-top: 6px; font-size: 0.875rem; color: var(--text-muted); }
.team__stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.team__stats div { padding: 10px 12px; background: rgba(20, 42, 118, 0.35); box-shadow: inset 0 0 0 1px var(--line-strong); }
.team__stats dt { font: 0.5625rem var(--font-pixel); letter-spacing: 0.08em; text-transform: uppercase; color: var(--q-blue-200); }
.team__stats dd { margin: 4px 0 0; font-size: 1.375rem; font-weight: 700; color: var(--q-white); }

.answers { display: grid; gap: 5mm; }
.ans {
  display: grid;
  gap: 8px;
  padding: 5mm;
  background: rgba(22, 48, 128, 0.18);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  break-inside: avoid;
}
.ans.is-correct { box-shadow: inset 3px 0 0 var(--q-blue-400), inset 0 0 0 1px var(--line-strong); }
.ans__head { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.ans__no, .wall__head .ans__no {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  font: 0.8125rem var(--font-pixel);
  color: var(--q-white);
  background: var(--q-navy-700);
  box-shadow: inset 0 0 0 2px rgba(141, 180, 255, 0.3);
}
.ans__head b { display: block; font-size: 1rem; }
.ans__head span:not(.ans__no):not(.badge) { font-size: 0.75rem; color: var(--text-muted); }
.ans__prompt { font-size: 0.875rem; line-height: 1.45; color: var(--q-blue-100); white-space: pre-line; }
.ans__quote {
  padding: 10px 14px;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--q-white);
  background: rgba(2, 7, 22, 0.6);
  border-left: 3px solid var(--q-blue-400);
}
.ans__note, .ans__by { font-size: 0.75rem; color: var(--text-muted); }
.ans__none { font-size: 0.875rem; font-style: italic; color: var(--text-dim); }
.ans.is-empty { opacity: 0.7; }

.badge {
  padding: 5px 8px;
  font: 0.5625rem var(--font-pixel);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--q-blue-100);
  background: rgba(141, 180, 255, 0.14);
}
.badge--correct { color: var(--q-white); background: var(--q-blue-500); }
.badge--incorrect { color: #ffc2c7; background: rgba(255, 154, 162, 0.16); }

/* ---- Photos & video stills ------------------------------------------------------------- */

.media { position: relative; margin: 0; break-inside: avoid; }
.media img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 110mm;
  margin: 0 auto;
}
.media__loading { aspect-ratio: 16 / 9; background: rgba(2, 7, 22, 0.8); }
.media__play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16mm;
  height: 16mm;
  translate: -50% -50%;
  background: rgba(47, 107, 255, 0.92);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.85);
  clip-path: polygon(0 3px, 3px 3px, 3px 0, calc(100% - 3px) 0, calc(100% - 3px) 3px, 100% 3px, 100% calc(100% - 3px), calc(100% - 3px) calc(100% - 3px), calc(100% - 3px) 100%, 3px 100%, 3px calc(100% - 3px), 0 calc(100% - 3px));
}
.media__play::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0;
  height: 0;
  translate: 2px 0;
  border-style: solid;
  border-width: 3.5mm 0 3.5mm 6mm;
  border-color: transparent transparent transparent var(--q-white);
}
.media figcaption { padding-top: 6px; font-size: 0.8125rem; color: var(--text-muted); }
.media figcaption b { color: var(--q-white); }
.media__missing {
  --u: 3px;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 10mm 6mm;
  font-size: 0.8125rem;
  text-align: center;
  color: var(--text-muted);
  border: 2px dashed rgba(141, 180, 255, 0.3);
}

/* ---- Photo wall ---------------------------------------------------------------------------- */

.wall__stop + .wall__stop { margin-top: 10mm; }
.wall__head { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; margin-bottom: 5mm; break-after: avoid; }
.wall__head b { font-size: 1.125rem; }
.wall__head p { margin-top: 2px; font-size: 0.8125rem; color: var(--text-muted); white-space: pre-line; }
.wall__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6mm 5mm; }
.wall__grid.is-single { grid-template-columns: 1fr; }
.wall__grid .media img { max-height: 85mm; }
.wall__grid:not(.is-single) .media { display: grid; align-content: start; }

/* ---- Small screens: preview scales down, print stays A4 ----------------------------------- */

@media screen and (max-width: 820px) {
  .report-bar { position: static; }
  .report-doc { padding-inline: 8px; }
  .sheet { --pad: 20px; width: 100%; min-height: 0; }
  .cover { height: auto; min-height: 150vw; padding: 24px 20px 0; }
  .cover__main { margin-top: 48px; }
  .cover__title { font-size: 2.5rem; }
  .cover__stats { grid-template-columns: repeat(2, 1fr); margin-bottom: 32px; }
  .cover__skyline { --u: 2.5px; margin-inline: -20px; }
  .cover__skyline .is-big { --u: 3px; }
  .cover__foot { margin-inline: -20px; padding: 16px 20px; }
  .wall__grid { grid-template-columns: 1fr; }
  .report-bar__actions { margin-left: 0; }
}

/* ---- Print ----------------------------------------------------------------------------------- */

@media print {
  html, body.report { background: var(--q-navy-950); }
  .report-bar { display: none; }
  .report-doc { display: block; padding: 0; }
  .sheet { width: auto; max-width: none; min-height: 297mm; box-shadow: none; break-before: page; overflow: visible; }
  .sheet:first-child { break-before: auto; }
  .cover { overflow: hidden; }
}
