/* Selvhostede fonte (fra @fontsource, serveres af Express under /fonts).
   Samme fonte som programmet: Fraunces til overskrifter, Jost til brødtekst. */
@font-face { font-family: 'Fraunces'; font-weight: 500; font-display: swap; src: url('/fonts/fraunces/fraunces-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Fraunces'; font-weight: 600; font-display: swap; src: url('/fonts/fraunces/fraunces-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Jost'; font-weight: 400; font-display: swap; src: url('/fonts/jost/jost-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Jost'; font-weight: 500; font-display: swap; src: url('/fonts/jost/jost-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Jost'; font-weight: 600; font-display: swap; src: url('/fonts/jost/jost-latin-600-normal.woff2') format('woff2'); }

:root {
  --navy-900: #071630;
  --navy-700: #0E2A52;
  --nebula: #2C5C8F;
  --card: rgba(5, 16, 36, 0.55);
  --card-border: rgba(255, 255, 255, 0.16);
  --text: #FFFFFF;
  --muted: #D3DDEC;          /* ≈ 12:1 mod navy */
  --gold: #EBC56A;
  --gold-light: #F7DE95;
  --gold-dark: #C99A3A;
  --accent: var(--gold);
  --accent-ink: #0B1A33;     /* navy på guld: ≈ 9:1 */
  --error-bg: rgba(255, 120, 100, 0.16);
  --error: #FFC9BE;
  --radius: 14px;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Jost', 'Futura', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; background: var(--navy-900); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.55;
}

/* Stjernehimmel som i programmet: blå tåge + tætte små stjerner + enkelte guldglimt. Ingen billeder. */
.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 45% at 75% 18%, rgba(70, 130, 190, .35), transparent 70%),
    radial-gradient(ellipse 60% 40% at 15% 60%, rgba(60, 115, 170, .28), transparent 70%),
    radial-gradient(ellipse 80% 50% at 60% 95%, rgba(40, 90, 150, .30), transparent 70%),
    linear-gradient(170deg, var(--navy-900) 0%, var(--navy-700) 55%, #0B2347 100%);
}
.sky::before,
.sky::after {
  content: '';
  position: absolute;
  inset: 0;
}
/* Små hvide stjerner i to fliselag med forskellig størrelse, så mønsteret ikke ses */
.sky::before {
  background-image:
    radial-gradient(1px 1px at 23px 41px, rgba(255,255,255,.75), transparent 70%),
    radial-gradient(1px 1px at 97px 13px, rgba(255,255,255,.55), transparent 70%),
    radial-gradient(1px 1px at 151px 87px, rgba(255,255,255,.6), transparent 70%),
    radial-gradient(1px 1px at 61px 123px, rgba(255,255,255,.45), transparent 70%),
    radial-gradient(1.4px 1.4px at 131px 151px, rgba(255,255,255,.8), transparent 70%),
    radial-gradient(1px 1px at 9px 169px, rgba(255,255,255,.5), transparent 70%),
    radial-gradient(1px 1px at 177px 37px, rgba(255,255,255,.4), transparent 70%);
  background-size: 190px 190px;
}
.sky::after {
  background-image:
    radial-gradient(1px 1px at 47px 71px, rgba(255,255,255,.5), transparent 70%),
    radial-gradient(1.6px 1.6px at 211px 29px, rgba(255,255,255,.85), transparent 70%),
    radial-gradient(1px 1px at 283px 197px, rgba(255,255,255,.45), transparent 70%),
    radial-gradient(1px 1px at 131px 263px, rgba(255,255,255,.55), transparent 70%),
    radial-gradient(2px 2px at 251px 131px, rgba(247,222,149,.9), transparent 70%),
    radial-gradient(1px 1px at 17px 241px, rgba(255,255,255,.4), transparent 70%),
    radial-gradient(1.8px 1.8px at 89px 179px, rgba(247,222,149,.7), transparent 70%);
  background-size: 313px 313px;
}

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 18px max(48px, env(safe-area-inset-bottom));
}

.brand { margin: 0 0 28px; }
.logo {
  display: block;
  width: min(78%, 320px);
  height: auto;
  aspect-ratio: 1621 / 979;
  margin: 0 auto 10px;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, .35));
}

.overline {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .16em;
  text-align: center;
  text-transform: uppercase;
  color: var(--gold);
}

h1, h2 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: .01em;
  margin: 0 0 16px;
  text-wrap: balance;
}
h1 { font-size: clamp(30px, 8.6vw, 44px); }
h2 { font-size: 23px; }

.intro, .lead { margin: 0 0 24px; color: var(--muted); }
.lead { font-size: 19px; color: var(--text); }
.muted { color: var(--muted); }

/* Kort / fieldsets */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px 16px 16px;
  margin: 0 0 16px;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
fieldset.card { min-width: 0; }
legend { padding: 0; float: left; width: 100%; margin-bottom: 12px; }
legend + * { clear: both; }
.qnum {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 4px;
}
.qtext { display: block; font-weight: 500; font-size: 19px; line-height: 1.4; }

/* Svarmuligheder: store touch-flader */
.options { display: grid; gap: 10px; }
.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 14px;
  border: 1.5px solid var(--card-border);
  border-radius: 12px;
  background: rgba(255,255,255,.03);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .15s, background-color .15s;
}
.option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.letter {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.5);
  font-weight: 600;
  font-size: 15px;
}
.option:hover { border-color: rgba(255,255,255,.35); }
.option:has(input:checked) {
  border-color: var(--accent);
  background: rgba(235,197,106,.14);
}
.option:has(input:checked) .letter { background: var(--gold); border-color: var(--gold); color: var(--accent-ink); }
.option:has(input:focus-visible) { outline: 3px solid var(--gold); outline-offset: 2px; }

/* Formularfelter */
.field { display: block; margin-bottom: 16px; }
.label { display: block; font-weight: 600; margin-bottom: 6px; }
input[type="text"], input[type="email"] {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  font: inherit;
  font-size: 17px; /* ≥16px undgår auto-zoom i iOS Safari */
  color: var(--text);
  background: rgba(0,0,0,.25);
  border: 1.5px solid var(--card-border);
  border-radius: 10px;
  -webkit-appearance: none;
  appearance: none;
}
input[type="text"]:focus, input[type="email"]:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(235,197,106,.25); }
.help { display: block; margin-top: 6px; font-size: 14px; color: var(--muted); }

.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; padding: 6px 0; min-height: 48px; }
.check input { flex: none; width: 24px; height: 24px; margin: 2px 0 0; accent-color: var(--accent); }
.check span { font-size: 15px; color: var(--muted); }

/* Honeypot – skjult for mennesker */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.terms { font-size: 13px; line-height: 1.5; color: var(--muted); margin: 8px 0 18px; }

.error {
  background: var(--error-bg);
  color: var(--error);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0 0 14px;
  font-weight: 500;
}

.progress { min-height: 1.4em; margin: 10px 0 0; text-align: center; font-size: 14px; color: var(--muted); }

/* Knapper */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 14px 20px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: .02em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .15s, transform .1s, opacity .15s;
}
.btn-primary {
  background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 45%, var(--gold-dark) 100%);
  color: var(--accent-ink);
  box-shadow: 0 6px 24px rgba(235,197,106,.22), inset 0 1px 0 rgba(255,255,255,.45);
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { transform: scale(.98); }
.btn-secondary { background: transparent; color: var(--text); border: 1.5px solid var(--card-border); }
.btn:focus-visible { outline: 3px solid #FFFFFF; outline-offset: 3px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.busy:disabled { opacity: .8; cursor: progress; }

.spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(11,26,51,.3);
  border-top-color: var(--accent-ink);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn.busy .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Resultat */
.score { font-size: clamp(36px, 10.5vw, 52px); margin-top: 12px; color: var(--gold-light); }
.patreon { margin-top: 28px; padding: 24px 18px 20px; border-color: rgba(235,197,106,.45); background: rgba(5,16,36,.6); }
.patreon h2 { color: var(--gold); }
.patreon p { margin: 0 0 20px; }

/* Rabatkode */
.discount {
  margin: 0 0 20px;
  padding-top: 18px;
  border-top: 1px solid rgba(235,197,106,.25);
}
.patreon .discount p { margin: 0 0 12px; }
.discount-overline {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold);
}
.discount-code-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  margin: 0 0 12px;
}
.discount-code {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 56px;
  padding: 8px 12px;
  border: 2px dashed var(--gold);
  border-radius: 12px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 28px;
  letter-spacing: .12em;
  color: var(--gold-light);
  -webkit-user-select: all;
  user-select: all;
}
.discount-copy {
  width: auto;
  flex: none;
  min-width: 128px;
  font-size: 16px;
  border-radius: 12px;
}
.patreon .discount .discount-note { margin: 0; font-size: 14px; color: var(--muted); }

section:focus { outline: none; }
[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: 2s !important; }
  .btn-primary:active { transform: none; }
}

/* Statistik-siden (/stats) */
.stats .overline { text-align: left; }
.stats-meta { font-size: 14px; margin: -6px 0 22px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 16px; }
.tile {
  display: flex;
  flex-direction: column;
  padding: 14px 12px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
}
.tile-value { font-family: var(--serif); font-weight: 600; font-size: 34px; line-height: 1.1; color: var(--gold-light); font-variant-numeric: tabular-nums; }
.tile-label { font-size: 14px; line-height: 1.3; color: var(--muted); }
.tile-sub { font-size: 14px; font-weight: 600; color: var(--gold); margin-top: 2px; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bars li { display: grid; grid-template-columns: 7.5em 1fr 2.5em; align-items: center; gap: 10px; font-size: 15px; }
.bar-label { color: var(--muted); white-space: nowrap; }
.bar-track { height: 12px; border-radius: 6px; background: rgba(255,255,255,.07); overflow: hidden; }
.bar { display: block; height: 100%; min-width: 2px; border-radius: 6px; background: linear-gradient(90deg, var(--gold-dark), var(--gold)); }
.bar-count { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.stats-line { margin: 0; }
.stats-warn { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--error-bg); color: var(--error); font-size: 15px; }
.stats-warn code { word-break: break-all; }
.stats-foot { font-size: 13px; text-align: center; }
@media (max-width: 380px) {
  .tile-value { font-size: 28px; }
  .bars li { grid-template-columns: 6.8em 1fr 2.2em; font-size: 14px; }
}
