/*
  Design: "Ermittlungsakte" — Bingo als Beweisprotokoll.
  Passend zum Heldendumm-Thema (Geschichte/True Crime), aber eigenständig
  vom taktischen HUD-Look der anderen Besiuk-Projekte: hier warmes
  Aktenpapier statt kaltes Radar-Display, weil das Bingo ein Spiel für
  die Hörerschaft ist, kein Operations-Tool.

  Farben:
    --paper:      #ece5d3   (vergilbtes Papier)
    --ink:        #221d17   (Fülltinte, fast schwarz)
    --stamp-red:  #9c2b1f   (Aktenstempel-Rot)
    --folder:     #b8a074   (Manila-Ordner-Beige)
    --verified:   #3c5e3a   (Bestätigt-Grün, gedeckt)
    --line:       #c9bd9e   (Trennlinien)

  Typo:
    Display: 'Special Elite' (Schreibmaschine) für Überschriften/Stempel
    Body: 'Source Serif 4' für Fließtext
    Data: 'JetBrains Mono' für Timestamps/Zahlen
  (alle self-hosted einbinden, siehe /assets/fonts/ — hier Systemfallback)
*/

@font-face {
  font-family: 'Special Elite';
  src: local('Special Elite');
  font-display: swap;
}

:root {
  --paper: #ece5d3;
  --paper-dark: #ddd3b8;
  --ink: #221d17;
  --ink-soft: #4a4136;
  --stamp-red: #9c2b1f;
  --folder: #b8a074;
  --verified: #3c5e3a;
  --line: #c9bd9e;
  --radius: 3px;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--paper);
  background-image:
    radial-gradient(ellipse at top left, rgba(0,0,0,0.04), transparent 60%),
    radial-gradient(ellipse at bottom right, rgba(0,0,0,0.05), transparent 60%);
  color: var(--ink);
  font-family: 'Source Serif 4', Georgia, serif;
  line-height: 1.5;
}

h1, h2, .case-stamp, .brand {
  font-family: 'Special Elite', 'Courier New', monospace;
  letter-spacing: 0.03em;
}

/* --- Nav --- */
.topnav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 2px solid var(--ink);
  background: var(--paper-dark);
}
.brand { font-size: 1.1rem; color: var(--ink); text-decoration: none; }
.brand span { color: var(--stamp-red); }
.nav-links { display: flex; gap: 1.2rem; align-items: center; font-size: 0.9rem; }
.nav-links a { color: var(--ink-soft); text-decoration: none; }
.nav-links a:hover { text-decoration: underline; }
.nav-user { font-weight: 600; }

/* --- Case stamp (Signature-Element) --- */
.case-stamp {
  display: inline-block;
  border: 3px solid var(--stamp-red);
  color: var(--stamp-red);
  padding: 0.2rem 0.7rem;
  font-size: 0.75rem;
  transform: rotate(-3deg);
  border-radius: var(--radius);
  margin-bottom: 0.8rem;
}

/* --- Auth --- */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; }
.auth-card {
  background: var(--paper-dark);
  border: 1px solid var(--line);
  box-shadow: 4px 4px 0 rgba(34,29,23,0.15);
  padding: 2rem;
  max-width: 380px;
  width: 100%;
}
.auth-card h1 { margin: 0 0 0.3rem; font-size: 1.4rem; }
.sub { color: var(--ink-soft); font-size: 0.9rem; margin-bottom: 1.5rem; }
.oauth-list { display: flex; flex-direction: column; gap: 0.6rem; }
.oauth-btn {
  display: block; text-align: center; padding: 0.7rem; border-radius: var(--radius);
  text-decoration: none; color: #fff; font-family: inherit; font-weight: 600;
}
.oauth-spotify { background: #1DB954; }
.oauth-google { background: #4285F4; }
.oauth-discord { background: #5865F2; }
.divider { text-align: center; margin: 1.2rem 0; color: var(--ink-soft); font-size: 0.85rem; position: relative; }
.divider::before, .divider::after { content:''; position:absolute; top:50%; width:40%; border-top:1px solid var(--line); }
.divider::before { left:0; } .divider::after { right:0; }
.mail-form { display: flex; flex-direction: column; gap: 0.5rem; }
.mail-form input { padding: 0.6rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); font-family: inherit; }
.mail-form button {
  padding: 0.6rem; background: var(--ink); color: var(--paper); border: none;
  border-radius: var(--radius); cursor: pointer; font-family: inherit;
}
.hint { font-size: 0.8rem; color: var(--ink-soft); min-height: 1em; }
.fineprint { font-size: 0.75rem; color: var(--ink-soft); margin-top: 1.2rem; }
.fineprint a { color: var(--stamp-red); }

/* --- Episode / Bingo Grid --- */
.episode-page { max-width: 640px; margin: 0 auto; padding: 1.5rem; }
.episode-header h1 { font-size: 1.4rem; margin: 0.2rem 0 1rem; }
.pre-release-box {
  border: 1px dashed var(--folder); padding: 1.2rem; border-radius: var(--radius);
  background: var(--paper-dark);
}
.pre-release-box button, #genCardBtn {
  margin-top: 0.8rem; padding: 0.6rem 1.2rem; background: var(--ink); color: var(--paper);
  border: none; border-radius: var(--radius); cursor: pointer; font-family: inherit;
}

.bingo-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  width: 100%;
}
.bingo-field {
  aspect-ratio: 1;
  border: 1px solid var(--ink);
  background: var(--paper-dark);
  font-family: 'Source Serif 4', serif;
  font-size: 0.62rem;
  line-height: 1.15;
  padding: 0.3rem;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
  word-break: break-word;
  hyphens: auto;
  transition: transform 0.1s ease;
}
.bingo-field:active { transform: scale(0.96); }
.bingo-field.free { background: var(--folder); font-family: 'Special Elite', monospace; color: var(--paper); }
.bingo-field.pending { border-color: var(--stamp-red); box-shadow: inset 0 0 0 1px var(--stamp-red); }
.bingo-field.matched { background: var(--verified); color: var(--paper); border-color: var(--verified); }
.claim-time {
  font-family: 'JetBrains Mono', monospace; font-size: 0.6rem; margin-top: 0.25rem; opacity: 0.85;
}

dialog#claimModal {
  border: 1px solid var(--ink); border-radius: var(--radius); padding: 1.2rem;
  max-width: 420px; width: 90%; background: var(--paper);
}
.transcript-box {
  background: var(--paper-dark); border-left: 3px solid var(--stamp-red);
  padding: 0.8rem; margin: 0.8rem 0; font-family: 'JetBrains Mono', monospace; font-size: 0.85rem;
  max-height: 200px; overflow-y: auto; white-space: pre-wrap;
}
.modal-actions { display: flex; gap: 0.6rem; }
.modal-actions button { padding: 0.6rem 1rem; border-radius: var(--radius); border: none; cursor: pointer; font-family: inherit; }
#confirmClaimBtn { background: var(--verified); color: var(--paper); }
#cancelClaimBtn.secondary { background: transparent; border: 1px solid var(--line); }

/* --- Leaderboard --- */
.leaderboard-page { max-width: 640px; margin: 0 auto; padding: 1.5rem; }
.scope-tabs { display: flex; gap: 0.6rem; margin-bottom: 1rem; flex-wrap: wrap; }
.scope-tabs a { padding: 0.4rem 0.8rem; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.scope-tabs a.active { background: var(--ink); color: var(--paper); }
.scope-tabs select { padding: 0.4rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--paper); }
.leaderboard-table { width: 100%; border-collapse: collapse; }
.leaderboard-table th, .leaderboard-table td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); text-align: left; }
.leaderboard-table tr.me { background: var(--paper-dark); font-weight: 700; }
.leaderboard-table td.empty { text-align: center; color: var(--ink-soft); padding: 2rem 0; }

@media (max-width: 420px) {
  .bingo-field { font-size: 0.6rem; }
}
