/* =========================================================================
   EdgeChase Game – Styling
   Design-Werte stammen von der EdgeChase-Website (Archivo, Tinte/Papier, Rot #ed1c24,
   Pillen-Buttons mit roter Füll-Animation, Glas-Karte über Vollbild-Foto, feine Körnung).
   Mobil-first, füllt den iframe/Viewport vollständig aus.
   ========================================================================= */

/* Archivo (Variable, OFL-Lizenz) – lokal eingebunden, kein Google-Fonts-Aufruf */
@font-face {
  font-family: "Archivo Variable";
  font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 62% 125%;
  src: url("../assets/fonts/archivo-latin-ext-wdth-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Archivo Variable";
  font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 62% 125%;
  src: url("../assets/fonts/archivo-latin-wdth-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #0b0b0c;                 /* Tinte */
  --bg-soft: #161618;
  --ink: #f4f3ef;               /* Weiß der Website */
  --ink-dim: #a3a19a;
  --line: rgba(255, 255, 255, .16);
  --accent: #ed1c24;            /* EdgeChase-Rot */
  --gold: #ffcf4a;              /* Hauptpreis / Jackpot */
  --radius: 999px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --font: "Archivo Variable", "Archivo", Impact, "Arial Narrow Bold", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }   /* schlägt display-Regeln von .modal/.countdown etc. */
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  user-select: none;
}
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app { position: relative; width: 100%; height: 100dvh; min-height: 100%; overflow: hidden; }

/* ---------- Screens ---------- */
.screen {
  position: absolute; inset: 0;
  display: none; align-items: center; justify-content: center;
  padding: 24px;
}
.screen--active { display: flex; }

/* ---------- Bausteine der Website ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-dim);
}
.pulse { display: inline-block; width: 8px; height: 8px; background: var(--accent); transform: rotate(45deg); flex: none; }

/* Pillen-Button mit roter Füll-Animation (wie auf der Website) */
.btn {
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; min-height: 52px; padding: 0 26px;
  border: 2px solid var(--ink); border-radius: var(--radius);
  font-family: inherit; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  cursor: pointer;
  transition: transform .4s var(--ease), color .35s, border-color .35s, background .3s;
}
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--accent);
  transform: translateY(101%); border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  transition: transform .5s var(--ease), border-radius .5s var(--ease);
}
.btn:hover:not(:disabled)::before { transform: none; border-radius: 0; }
.btn:hover:not(:disabled) { border-color: var(--accent); color: #fff; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--primary { background: var(--ink); color: var(--bg); margin-top: 4px; }
.btn--ghost { background: transparent; color: var(--ink); border-color: rgba(255, 255, 255, .35); }
.btn--ghost:hover:not(:disabled) { border-color: var(--accent); }
.btn--arrow::after { content: "\2197"; font-weight: 400; transition: transform .4s var(--ease); }
.btn--arrow:hover:not(:disabled)::after { transform: translateX(6px); }

/* ---------- Start (Foto + Glas-Karte wie die Coming-soon-Seite) ---------- */
.screen--intro { padding: 16px; overflow: hidden; background: var(--bg); }
.pre-media { position: absolute; inset: 0; z-index: 0; }
.pre-media img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; animation: kb 24s ease-out both; }
.pre-shade { position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, rgba(11, 11, 12, .55), rgba(11, 11, 12, .5) 50%, rgba(11, 11, 12, .8)); }
.grain {
  position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: .12; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .8 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.intro {
  position: relative; z-index: 3;
  width: min(460px, 100%); max-height: calc(100dvh - 32px); overflow: auto;
  display: grid; justify-items: center; gap: 14px; text-align: center;
  padding: clamp(24px, 5vw, 40px) clamp(20px, 4vw, 36px);
  border-radius: 22px;
  background: rgba(11, 11, 12, .62);
  border: 1px solid rgba(255, 255, 255, .16);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  animation: preIn .7s var(--ease) both;
  scrollbar-width: none;
}
.intro::-webkit-scrollbar { display: none; }
.intro__logo { width: min(200px, 52vw); height: auto; margin-bottom: 4px; }
.intro__title {
  margin: 0; font-weight: 800; text-transform: uppercase; letter-spacing: .01em; line-height: 1.02;
  font-size: clamp(26px, 5.4vw, 38px); text-wrap: balance;
}
.intro__tag { margin: 0; max-width: 420px; font-size: clamp(15px, 2vw, 17px); line-height: 1.45; opacity: .92; }

/* ---------- Formular (Pillen-Felder wie auf der Website) ---------- */
.form { width: 100%; display: grid; gap: 10px; text-align: left; margin-top: 4px; }
.field { display: block; }
.field input {
  width: 100%; height: 48px; padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .08);
  color: #fff; font-family: inherit; font-size: 16px; font-weight: 500;   /* >=16px: verhindert iOS-Zoom */
  outline: none; transition: border-color .2s, background .2s;
}
.field input::placeholder { color: rgba(255, 255, 255, .55); }
.field input:focus { border-color: #fff; background: rgba(255, 255, 255, .12); }

.form-note {
  margin: 0; padding: 0 4px; font-size: 12px; color: var(--ink-dim); line-height: 1.45; font-weight: 500; text-align: center;
}

.error { color: #ff6b70; font-size: 13px; font-weight: 600; margin: 2px 0 0; }

.link-how {
  background: none; border: none; padding: 4px; margin-top: -2px;
  color: var(--ink-dim); font-family: inherit; font-size: 12px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.link-how:hover { color: var(--ink); }

/* ---------- Spiel / HUD ---------- */
#screen-game { padding: 0; align-items: stretch; justify-content: stretch; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 14px 16px calc(14px + env(safe-area-inset-top, 0px));
  pointer-events: none;
}
.hud__label { display: block; font-size: 10px; font-weight: 700; letter-spacing: .18em; color: var(--ink-dim); margin-bottom: 3px; }
.hud__score { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; font-style: italic; }
.hud__discount { text-align: center; }
.hud__discount-val {
  display: block; font-size: 32px; font-weight: 800; font-style: italic; line-height: 1;
  color: var(--accent); font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgba(237, 28, 36, .35); transform-origin: center;
}
.hud__discount-val--bump { animation: bump .45s ease; }
.hud__threat { width: 34%; max-width: 160px; text-align: right; }
.threat { height: 10px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.threat__fill { height: 100%; width: 0%; background: linear-gradient(90deg, #7a1014, var(--accent)); transition: width .12s linear; }

.countdown {
  position: absolute; inset: 0; z-index: 4;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(80px, 30vw, 180px); font-weight: 800; font-style: italic; color: #fff;
  text-shadow: 0 0 40px rgba(237, 28, 36, .5); pointer-events: none;
}

.controls-hint {
  position: absolute; left: 0; right: 0; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 3;
  text-align: center; font-size: 12px; font-weight: 600; color: var(--ink-dim);
  pointer-events: none; transition: opacity .4s;
}
.controls-hint--hidden { opacity: 0; }
.controls-hint__desktop { display: none; }
@media (hover: hover) and (pointer: fine) {
  .controls-hint__mobile { display: none; }
  .controls-hint__desktop { display: inline; }
}

/* ---------- Ergebnis ---------- */
.result { width: 100%; max-width: 380px; text-align: center; }
.result__loading { display: grid; gap: 16px; justify-items: center; color: var(--ink-dim); }
.spinner { width: 42px; height: 42px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.result__content { animation: rise .45s ease both; display: grid; gap: 0; }
.result__eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .16em; color: var(--ink-dim); margin: 0 0 6px; }
.result__eyebrow span { color: var(--ink); font-weight: 800; }
.result__headline {
  font-size: clamp(26px, 8vw, 38px); font-weight: 800; font-style: italic; text-transform: uppercase;
  margin: 0 0 18px; line-height: 1;
}

.prize {
  border: 1px solid var(--line); border-radius: 18px; padding: 22px; margin-bottom: 18px;
  background: radial-gradient(120% 120% at 50% 0%, rgba(237, 28, 36, .14), transparent 70%);
}
.prize__value { font-size: clamp(52px, 18vw, 84px); font-weight: 800; font-style: italic; line-height: .9; }
.prize__label { font-size: 12px; font-weight: 700; letter-spacing: .2em; color: var(--ink-dim); margin-top: 6px; }
.prize--jackpot .prize__value { color: var(--gold); text-shadow: 0 0 40px rgba(255, 207, 74, .4); }
.prize--none .prize__value { color: var(--ink-dim); }

.code { border: 1px dashed rgba(255, 255, 255, .28); border-radius: 18px; padding: 16px; margin-bottom: 16px; }
.code__label { font-size: 11px; font-weight: 700; letter-spacing: .16em; color: var(--ink-dim); }
.code__row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.code__row code {
  flex: 1; font-size: 22px; font-weight: 800; letter-spacing: .06em;
  padding: 10px 12px; background: var(--bg-soft); border-radius: 12px;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; overflow-x: auto;
}
.code__row .btn { width: auto; min-height: 44px; padding: 0 18px; white-space: nowrap; }
.code__meta { font-size: 12px; font-weight: 600; color: var(--ink-dim); margin: 10px 0 0; }
.result__note { font-size: 13px; font-weight: 500; color: var(--ink-dim); margin: 0 0 16px; line-height: 1.45; min-height: 1em; }
.result .btn + .btn { margin-top: 10px; }
.result__limit { justify-content: center; margin: -4px 0 16px; text-align: left; line-height: 1.5; text-transform: none; letter-spacing: .02em; font-size: 12px; color: var(--ink); }

/* ---------- Modal ---------- */
.modal {
  position: absolute; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(0, 0, 0, .7); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.modal__box { width: 100%; max-width: 340px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 22px; padding: 24px; }
.modal__box h3 { margin: 0 0 12px; font-weight: 800; font-style: italic; text-transform: uppercase; }
.modal__box ul { margin: 0 0 18px; padding-left: 18px; color: var(--ink-dim); font-size: 14px; line-height: 1.5; font-weight: 500; }
.modal__box li { margin-bottom: 8px; }

/* ---------- Animationen ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes preIn { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes kb { from { transform: scale(1.12); } to { transform: scale(1.02); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.4); } 100% { transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  .spinner, .pre-media img { animation: none; }
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
