/* Sekundenkleber
   Layout: one-screen game in a single centred column. Before the round the stage shows the day's number
   and the start button; afterwards your time, a nine-tile scale and the rankings. Below: facts, the
   paper-coloured inner-clock card, the Live-Moment panel and the rules. Two typefaces only.
   Single deliberate look: ultramarine ground, paper ink, one marigold accent. */

@font-face { font-family: "Big Shoulders Display"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/big-shoulders-display-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Big Shoulders Display"; font-style: normal; font-weight: 900; font-display: swap; src: url("/fonts/big-shoulders-display-latin-900-normal.woff2") format("woff2"); }
@font-face { font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/schibsted-grotesk-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/schibsted-grotesk-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 700; font-display: swap; src: url("/fonts/schibsted-grotesk-latin-700-normal.woff2") format("woff2"); }

:root {
  --blue: #1D27C9;
  --blue-deep: #141B96;
  --blue-line: #3E49DE;
  --paper: #F4F2EA;
  --paper-dim: #BCC0F3;
  --ink-dim: #4A52C4;
  --marigold: #FFC93C;
  --night: #04051A;
  --font-display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --font-body: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--blue);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: inherit; text-underline-offset: 3px; }
button { font: inherit; }

.app {
  max-width: 440px;
  margin: 0 auto;
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(40px + 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));
  display: flex;
  flex-direction: column;
  gap: 36px;
}

/* Header */
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.wordmark {
  display: flex; align-items: center; gap: 8px; margin: 0;
  font-family: var(--font-display); font-weight: 900; font-size: 1.75rem; line-height: 1;
  letter-spacing: 0.02em; text-transform: uppercase;
}
.tube { width: 40px; height: 20px; flex: none; margin-top: 2px; }
.tube .t-body { fill: var(--paper); }
.tube .t-band { fill: var(--marigold); }
.tube .t-crimp, .tube .t-cap { fill: var(--paper-dim); }
.tube .t-rib { fill: none; stroke: var(--blue); stroke-width: 0.7; }
.tube .t-drop { fill: var(--marigold); }
.nr { font-size: 0.8125rem; font-weight: 500; color: var(--paper-dim); }

/* Live banner */
.banner {
  display: flex; align-items: center; gap: 10px;
  background: var(--marigold); color: var(--blue-deep);
  border-radius: 14px; padding: 12px 14px;
  font-weight: 700; line-height: 1.3;
  margin-bottom: -16px;
}
.banner-bolt { font-size: 1.5rem; line-height: 1; }

/* Stage */
.stage { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px; }
.stage > * { max-width: 100%; }
.figure { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.eyebrow { font-size: 0.8125rem; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--paper-dim); }
.number {
  font-family: var(--font-display); font-weight: 900;
  font-size: clamp(7.5rem, 44vw, 13rem); line-height: 0.82;
  font-variant-numeric: tabular-nums; margin-top: 6px; margin-bottom: 0.1em;
}
.unit { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; letter-spacing: 0.22em; text-transform: uppercase; }
.mod { margin: 0; color: var(--marigold); font-size: 0.875rem; font-weight: 500; max-width: 32ch; text-wrap: balance; }
.start {
  width: 9.5rem; height: 9.5rem; border-radius: 50%; border: 0;
  background: var(--marigold); color: var(--blue-deep);
  font-family: var(--font-display); font-weight: 900; font-size: 2.25rem; letter-spacing: 0.04em; text-transform: uppercase;
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  box-shadow: 0 0 0 10px rgba(255, 201, 60, 0.16);
  transition: transform 0.12s ease;
}
.start:active { transform: scale(0.97); }
.instr { margin: 0; max-width: 30ch; color: var(--paper-dim); font-size: 0.875rem; text-wrap: balance; }
.count-line { margin: 0; font-size: 0.8125rem; color: var(--paper-dim); }
.notice { margin: 0; max-width: 34ch; border: 1px dashed var(--paper-dim); border-radius: 10px; padding: 10px 14px; font-size: 0.875rem; }

/* Result */
.you { font-family: var(--font-display); font-weight: 900; font-size: clamp(4rem, 22vw, 6.5rem); line-height: 0.9; font-variant-numeric: tabular-nums; margin-top: 6px; }
.off { font-size: 1.125rem; font-weight: 700; color: var(--marigold); }
.scale { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 8px; }
.tiles { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 6px; }
.tile { aspect-ratio: 1; max-width: 100%; border-radius: 6px; background: var(--blue-deep); border: 2px solid var(--blue-line); }
.tile.target { background: radial-gradient(circle, var(--paper) 0 16%, transparent 17% 35%, var(--paper) 36% 50%, transparent 51%), var(--blue-deep); border-color: var(--paper-dim); }
.tile.you { background: var(--marigold); border-color: var(--marigold); }
.tile.target.you { background: radial-gradient(circle, var(--blue-deep) 0 16%, transparent 17% 35%, var(--blue-deep) 36% 50%, transparent 51%), var(--marigold); border-color: var(--marigold); }
.tiles.reveal .tile { animation: tile-in 0.32s ease both; animation-delay: calc(var(--d, 0) * 55ms); }
@keyframes tile-in { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
.scale-legend { display: grid; grid-template-columns: 1fr auto 1fr; font-size: 0.75rem; color: var(--paper-dim); }
.scale-legend span:first-child { text-align: left; }
.scale-legend span:last-child { text-align: right; }
.joke { margin: 0; font-weight: 500; max-width: 30ch; text-wrap: balance; }
.next { margin: 0; font-size: 0.8125rem; color: var(--paper-dim); }
.share-fallback {
  width: 100%; font: inherit; font-size: 0.8125rem;
  background: var(--blue-deep); color: var(--paper);
  border: 1px solid var(--blue-line); border-radius: 8px; padding: 10px; resize: none;
}

/* Buttons and fields */
.btn {
  font-weight: 700; border-radius: 999px; padding: 12px 24px; cursor: pointer;
  border: 2px solid var(--paper); background: var(--paper); color: var(--blue-deep);
  touch-action: manipulation;
}
.btn.small { padding: 9px 16px; font-size: 0.9375rem; }
.btn.ghost { background: transparent; color: var(--paper); }
.btn:disabled { opacity: 0.5; cursor: default; }
.linkbtn {
  font-size: 0.875rem; background: none; border: 0; color: var(--paper);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 4px;
}
.field {
  flex: 1 1 auto; min-width: 0; width: 100%;
  font: inherit; font-size: 1rem;
  background: var(--blue-deep); color: var(--paper);
  border: 1.5px solid var(--blue-line); border-radius: 12px; padding: 10px 12px;
}
.field::placeholder { color: var(--paper-dim); opacity: 0.8; }
.field.code { text-transform: uppercase; letter-spacing: 0.12em; }
.start:focus-visible, .btn:focus-visible, .linkbtn:focus-visible, .chip:focus-visible, .seg button:focus-visible,
.field:focus-visible, .rules summary:focus-visible, .groups summary:focus-visible, .foot a:focus-visible {
  outline: 3px solid var(--marigold); outline-offset: 3px;
}
.row-form { display: flex; gap: 8px; align-items: center; }
.stack-form { display: flex; flex-direction: column; gap: 6px; }
.stack-form label { font-size: 0.8125rem; font-weight: 500; color: var(--paper-dim); }

/* Panels (name, Live-Moment) */
.panel { background: var(--blue-deep); border: 1px solid var(--blue-line); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.panel-title { margin: 0; font-family: var(--font-display); font-weight: 900; font-size: 1.5rem; line-height: 1.05; text-transform: uppercase; letter-spacing: 0.02em; text-wrap: balance; }
.panel-text { margin: 0; font-size: 0.9375rem; color: var(--paper-dim); }
.push-area { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.push-area p { margin: 0; font-size: 0.9375rem; }
.push-actions { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.status-on { color: var(--marigold); font-weight: 700; }

/* Board */
.board { display: flex; flex-direction: column; gap: 14px; }
.section-title { margin: 0; font-family: var(--font-display); font-weight: 900; font-size: 1.75rem; line-height: 1; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; font-size: 0.875rem; font-weight: 700; cursor: pointer;
  border: 1.5px solid var(--paper-dim); background: transparent; color: var(--paper);
  border-radius: 999px; padding: 6px 14px; max-width: 70vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip[aria-selected="true"] { background: var(--paper); border-color: var(--paper); color: var(--blue-deep); }
.seg { display: inline-flex; border: 1.5px solid var(--blue-line); border-radius: 999px; padding: 3px; gap: 2px; align-self: flex-start; }
.seg button { border: 0; background: transparent; color: var(--paper); font-size: 0.8125rem; font-weight: 700; padding: 5px 12px; border-radius: 999px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--blue-line); }
.board-body { display: flex; flex-direction: column; gap: 12px; }
.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.row {
  display: grid; grid-template-columns: 1.75rem minmax(0, 1fr) auto; gap: 2px 10px; align-items: baseline;
  padding: 10px 12px; border-radius: 12px; background: transparent;
}
.row.is-you { background: var(--blue-deep); }
.row-rank { font-family: var(--font-display); font-weight: 900; font-size: 1.25rem; color: var(--paper-dim); font-variant-numeric: tabular-nums; }
.row-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-val { font-size: 0.875rem; font-weight: 700; text-align: right; white-space: nowrap; }
.row-sub { grid-column: 2 / 4; font-size: 0.8125rem; color: var(--paper-dim); }
.mini { grid-column: 2 / 4; align-self: start; display: grid; grid-template-columns: repeat(9, 12px); align-items: start; gap: 3px; margin-top: 4px; }
.mini i { display: block; width: 12px; height: 12px; border-radius: 3px; background: var(--blue-line); }
.mini i.target { background: var(--paper-dim); }
.mini i.you { background: var(--marigold); }
.waiting, .board-note { margin: 0; font-size: 0.875rem; color: var(--paper-dim); }
.board-actions { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }

/* Histogram for "Alle" */
.hist { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 6px; align-items: end; }
.hist-col { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.hist-count { font-size: 0.75rem; color: var(--paper-dim); font-variant-numeric: tabular-nums; min-height: 1.1em; }
.hist-bar { width: 100%; height: 72px; display: flex; align-items: flex-end; }
.hist-bar span { display: block; width: 100%; border-radius: 4px 4px 0 0; background: var(--blue-line); }
.hist-col.you .hist-bar span { background: var(--marigold); }
.hist-col .tile { width: 100%; }

/* Groups */
.groups { border: 1px solid var(--blue-line); border-radius: 14px; padding: 12px 16px; }
.groups summary, .rules summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.groups summary::-webkit-details-marker, .rules summary::-webkit-details-marker { display: none; }
.groups summary::after, .rules summary::after { content: "+"; font-size: 1.25rem; line-height: 1; }
.groups[open] summary::after, .rules[open] summary::after { content: "–"; }
.groups-body { display: flex; flex-direction: column; gap: 16px; margin-top: 14px; }
.group-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.group-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; padding-bottom: 8px; border-bottom: 1px solid var(--blue-line); }
.group-name { font-weight: 700; }
.group-meta { font-size: 0.8125rem; color: var(--paper-dim); }
.group-actions { display: flex; gap: 10px; }

/* Facts */
.facts { display: flex; flex-direction: column; gap: 18px; }
.fact { display: flex; flex-direction: column; gap: 4px; }
.fact-label { font-size: 0.75rem; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--paper-dim); }
.fact-text { margin: 0; font-size: 1.125rem; font-weight: 500; line-height: 1.4; max-width: 36ch; text-wrap: pretty; }
.fact-text strong { color: var(--marigold); font-weight: 700; }

/* Inner clock card */
.clock-card { background: var(--paper); color: var(--blue-deep); border-radius: 18px; padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 12px; }
.card-head { display: flex; align-items: center; gap: 8px; }
.card-head h2 { margin: 0; font-family: var(--font-display); font-weight: 900; font-size: 1.5rem; line-height: 1; text-transform: uppercase; letter-spacing: 0.02em; }
.clock-ico { width: 20px; height: 20px; flex: none; }
.clock-ico circle, .clock-ico path { fill: none; stroke: var(--blue-deep); stroke-width: 2; stroke-linecap: round; }
.me { display: flex; flex-direction: column; gap: 2px; padding-bottom: 12px; border-bottom: 1px solid rgba(20, 27, 150, 0.18); }
.me-line { margin: 0; font-size: 1.25rem; font-weight: 700; line-height: 1.25; }
.me-sub { margin: 0; font-size: 0.8125rem; color: var(--ink-dim); }
.clock-fact { margin: 0; font-size: 1rem; line-height: 1.5; max-width: 40ch; }
.cardbtn {
  align-self: flex-start; font-size: 0.875rem; font-weight: 700; color: var(--blue-deep);
  background: transparent; border: 2px solid var(--blue-deep); border-radius: 999px; padding: 6px 14px; cursor: pointer;
}
.cardbtn:focus-visible { outline: 3px solid var(--blue-deep); outline-offset: 3px; }

/* Rules */
.rules { border: 1px solid var(--blue-line); border-radius: 14px; padding: 12px 16px; }
.rules ul { margin: 14px 0 0; padding-left: 1.1em; display: flex; flex-direction: column; gap: 8px; font-size: 0.9375rem; }
.rules-lead { margin: 14px 0 0 !important; }
.rules-sub { margin: 18px 0 6px; font-size: 0.75rem; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--paper-dim); }
.rules p { margin: 0 0 8px; font-size: 0.9375rem; }
.rules .bins { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-variant-numeric: tabular-nums; }
.bins li { display: flex; justify-content: space-between; gap: 12px; }
.bins span:last-child { color: var(--paper-dim); text-align: right; }

.foot { display: flex; justify-content: center; gap: 10px; font-size: 0.8125rem; color: var(--paper-dim); }

/* Runner overlay */
.runner {
  position: fixed; inset: 0; z-index: 50;
  background: var(--blue-deep); color: var(--paper);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center;
  padding: calc(24px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  cursor: pointer; overflow: hidden; outline: none;
}
.run-target { position: relative; z-index: 2; color: var(--paper-dim); }
.run-call { position: relative; z-index: 2; font-family: var(--font-display); font-weight: 900; font-size: clamp(3rem, 16vw, 4.5rem); line-height: 0.95; text-wrap: balance; }
.run-hint { position: relative; z-index: 2; font-size: 0.8125rem; color: var(--paper-dim); }
.ring { position: absolute; width: 70vmin; height: 70vmin; border-radius: 50%; border: 3px solid var(--marigold); opacity: 0; z-index: 1; }
.runner.takt .ring { animation: wrongbeat 0.87s ease-out infinite; }
@keyframes wrongbeat { 0% { opacity: 0.55; transform: scale(0.86); } 100% { opacity: 0; transform: scale(1.06); } }
.salat-num { position: absolute; z-index: 1; font-family: var(--font-display); font-weight: 900; color: var(--marigold); opacity: 0.85; pointer-events: none; }
.runner.blind { background: var(--night); }
.runner.blind .run-target, .runner.blind .run-call, .runner.blind .run-hint { transition: opacity 0.6s ease 1.2s; }
.runner.blind.fade .run-target, .runner.blind.fade .run-call, .runner.blind.fade .run-hint { opacity: 0; }

/* Dialog */
.dialog {
  width: min(400px, calc(100vw - 32px)); border: 1px solid var(--blue-line); border-radius: 18px; padding: 20px;
  background: var(--blue-deep); color: var(--paper);
}
.dialog::backdrop { background: rgba(4, 5, 26, 0.6); }
.dialog form { display: flex; flex-direction: column; gap: 14px; }
.dialog-actions { display: flex; gap: 12px; align-items: center; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  z-index: 60; max-width: calc(100% - 32px);
  background: var(--paper); color: var(--blue-deep); font-weight: 700; font-size: 0.875rem;
  padding: 10px 16px; border-radius: 999px; text-align: center;
  opacity: 0; transition: opacity 0.2s ease; pointer-events: none;
}
.toast.show { opacity: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .start, .toast { transition: none; }
  .tiles.reveal .tile { animation: none; }
  @keyframes wrongbeat { 0% { opacity: 0.5; } 100% { opacity: 0; } }
}

/* Impressum and Datenschutz */
.legal { gap: 20px; }
.legal p, .legal ul { margin: 0; max-width: 62ch; color: var(--paper); }
.legal ul { padding-left: 1.1em; display: flex; flex-direction: column; gap: 4px; }
.legal section { display: flex; flex-direction: column; gap: 8px; }
.legal h2 { margin: 0; font-size: 1rem; font-weight: 700; }
