/* ---------- Schriften (selbst gehostet) ---------- */
@font-face {
  font-family: "Bebas Neue";
  src: url("./fonts/BebasNeue-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("./fonts/Inter-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("./fonts/Inter-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

/* ---------- Style-Schema: Schwarz / Rot, düster ---------- */
:root {
  --bg: #070607;
  --surface: #141012;
  --line: #2a1d20;
  --primary: #c4161c;
  --primary-hi: #e3262d;
  --primary-glow: rgb(196 22 28 / 0.45);
  --text: #ece6e6;
  --muted: #8c8184;

  --font-display: "Bebas Neue", Impact, "Arial Narrow", sans-serif;
  --font-text: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  color-scheme: dark;
}

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

body {
  min-height: 100%;
  margin: 0;
}

html {
  /* dunkelrotes Glimmen von unten (auf html, damit es die ganze Fläche füllt) */
  background:
    radial-gradient(120% 60% at 50% 115%, rgb(120 10 16 / 0.55) 0%, transparent 70%),
    var(--bg);
  height: 100%;
}

body {
  background: transparent;
  color: var(--text);
  font-family: var(--font-text);
  font-size: 1rem;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 400;
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible {
  outline: 2px solid var(--primary-hi);
  outline-offset: 4px;
}

[hidden] {
  display: none !important;
}

/* ---------- Layout: ein Bildschirm, Safe-Area-Abstände ---------- */
#app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: calc(env(safe-area-inset-top) + 1rem);
  padding-right: calc(env(safe-area-inset-right) + 1.25rem);
  padding-bottom: calc(env(safe-area-inset-bottom) + 1.5rem);
  padding-left: calc(env(safe-area-inset-left) + 1.25rem);
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Bedienelemente im unteren Daumenbereich */
.screen-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1.25rem;
}

.screen-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  padding-top: 1rem;
}

/* ---------- Buttons ---------- */
.btn {
  min-height: 3.4rem;
  padding: 0 2rem;
  border-radius: 0.6rem;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: transform 0.08s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.btn:active {
  transform: scale(0.97);
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  min-height: 4.25rem;
  width: min(100%, 22rem);
  box-shadow: 0 0.75rem 2.5rem -0.75rem var(--primary-glow);
}
.btn-primary:active {
  background: var(--primary-hi);
}
.btn-secondary {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  width: min(100%, 22rem);
}
.btn-secondary:active {
  border-color: var(--primary);
  color: var(--text);
}
.btn:disabled {
  opacity: 0.35;
}

/* ---------- Titel / Texte ---------- */
.app-title {
  font-size: clamp(3.5rem, 18vw, 6rem);
  line-height: 0.9;
  letter-spacing: 0.14em;
  padding-left: 0.14em; /* gleicht das Letter-Spacing optisch aus */
  color: var(--primary);
}
.tagline {
  color: var(--muted);
  max-width: 24rem;
  margin: 0;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}
.notice {
  margin: 0;
  padding: 0.85rem 1.1rem;
  border-left: 2px solid var(--primary);
  border-radius: 0 0.5rem 0.5rem 0;
  background: var(--surface);
  color: var(--text);
  max-width: 24rem;
  text-align: left;
}

/* ---------- Player ---------- */
/* Bühne: YouTube-Player liegt unter einem undurchsichtigen Overlay */
.stage {
  position: relative;
  width: min(100%, 22rem);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg);
}
.stage-video,
.stage-overlay {
  position: absolute;
  inset: 0;
}
.stage-video iframe {
  width: 100%;
  height: 100%;
  border: 0;
}
.stage-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(closest-side, #1a0b0d 0%, var(--bg) 100%);
}

/* Pegel: schmale rote Linien, bewegen sich nur, solange Musik läuft */
.eq {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  height: 60%;
}
.eq span {
  width: 3px;
  height: 100%;
  border-radius: 2px;
  background: var(--primary);
  box-shadow: 0 0 0.6rem var(--primary-glow);
  transform: scaleY(0.06);
  opacity: 0.55;
}
.is-playing .eq span {
  opacity: 1;
  animation: eq 0.9s ease-in-out infinite alternate;
}
.is-playing .eq span:nth-child(2) { animation-duration: 0.7s; animation-delay: -0.2s; }
.is-playing .eq span:nth-child(3) { animation-duration: 1.1s; animation-delay: -0.5s; }
.is-playing .eq span:nth-child(4) { animation-duration: 0.8s; animation-delay: -0.1s; }
.is-playing .eq span:nth-child(5) { animation-duration: 1s; animation-delay: -0.7s; }
.is-playing .eq span:nth-child(6) { animation-duration: 0.75s; animation-delay: -0.3s; }
.is-playing .eq span:nth-child(7) { animation-duration: 1.2s; animation-delay: -0.6s; }
@keyframes eq {
  from { transform: scaleY(0.08); }
  to { transform: scaleY(1); }
}
@media (prefers-reduced-motion: reduce) {
  .is-playing .eq span { animation: none; transform: scaleY(0.5); }
}

/* ---------- Play/Pause ---------- */
.btn-round {
  position: relative;
  width: 6rem;
  height: 6rem;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 0 3rem -0.5rem var(--primary-glow);
  transition: transform 0.08s ease;
}
.btn-round:active {
  transform: scale(0.95);
}
.btn-round svg {
  width: 2.6rem;
  height: 2.6rem;
  fill: currentColor;
}
/* Ring pulsiert, solange Musik läuft */
.btn-round::after {
  content: "";
  position: absolute;
  inset: -0.5rem;
  border-radius: 50%;
  border: 1px solid var(--primary);
  opacity: 0;
}
.is-playing .btn-round::after {
  animation: ring 1.8s ease-out infinite;
}
@keyframes ring {
  from { transform: scale(0.9); opacity: 0.8; }
  to { transform: scale(1.35); opacity: 0; }
}
.btn-round .icon-pause { display: none; }
.is-playing .btn-round .icon-play { display: none; }
.is-playing .btn-round .icon-pause { display: block; }
.btn-round:disabled {
  opacity: 0.3;
  box-shadow: none;
}

/* ---------- Scanner ---------- */
.reader-frame {
  position: relative;
  width: min(100%, 22rem);
  aspect-ratio: 1 / 1;
}
.reader {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--surface);
}
.reader video {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}
/* Sucher-Ecken in Rot */
.reader-frame::after {
  --c: var(--primary);
  --l: 2.25rem;
  --w: 3px;
  content: "";
  position: absolute;
  inset: -0.6rem;
  pointer-events: none;
  background:
    linear-gradient(var(--c), var(--c)) top left / var(--l) var(--w),
    linear-gradient(var(--c), var(--c)) top left / var(--w) var(--l),
    linear-gradient(var(--c), var(--c)) top right / var(--l) var(--w),
    linear-gradient(var(--c), var(--c)) top right / var(--w) var(--l),
    linear-gradient(var(--c), var(--c)) bottom left / var(--l) var(--w),
    linear-gradient(var(--c), var(--c)) bottom left / var(--w) var(--l),
    linear-gradient(var(--c), var(--c)) bottom right / var(--l) var(--w),
    linear-gradient(var(--c), var(--c)) bottom right / var(--w) var(--l);
  background-repeat: no-repeat;
}

/* Hinweis, wenn iOS das automatische Abspielen blockiert */
#play-hint {
  color: var(--primary-hi);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.8rem;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  50% { opacity: 0.35; }
}
