/* „Mondnacht“ – Farben und Rahmen aus dem Stream-Paket */
:root {
  --night-1: #1a0809;
  --night-2: #0d0506;
  --night-3: #050202;
  --text: #f3e3c0;
  --gold: #d9a441;
  --gold-light: #f6e6b4;
  --gold-line: #e8c262;
  --red: #e0303a;
  --frame: linear-gradient(135deg, #f6dc8a, #8a6420 38%, #e8c262 62%, #7a5a1c) 1;
  --display: 'Cinzel', Georgia, serif;
  --body: 'Cormorant Garamond', Georgia, serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--night-3); }
body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--night-1) 0%, var(--night-2) 55%, var(--night-3) 100%) fixed;
  color: var(--text);
  font: 600 1.2rem/1.35 var(--body);
}

main { position: relative; z-index: 1; width: min(100% - 32px, 760px); margin: 0 auto 64px; display: grid; gap: 28px; }
main > *, #panel > * { min-width: 0; }
#panel { display: grid; gap: 28px; }

header { position: relative; z-index: 1; text-align: center; padding: 28px 16px 24px; }
header svg { display: block; margin: 0 auto; }
.logo, .gold {
  font-family: var(--body);
  background: linear-gradient(180deg, #fff0b8 0%, #e6c15e 48%, #a07a22 72%, #f3dc92 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.logo { margin: 0; font-size: clamp(3rem, 14vw, 5.5rem); line-height: 1; }
.tagline { margin: 6px 0 0; font-family: var(--display); letter-spacing: 0.4em; color: var(--gold); font-size: 0.95rem; }

h2 { margin: 0 0 14px; font: 700 1.15rem/1.3 var(--display); letter-spacing: 0.2em; color: var(--gold-light); text-align: center; }

.frame {
  position: relative;
  border: 3px solid;
  border-image: var(--frame);
  background: rgba(224, 48, 58, 0.07);
  box-shadow: inset 0 0 0 5px var(--night-2), inset 0 0 0 6px rgba(232, 194, 98, 0.4), 0 0 24px rgba(224, 48, 58, 0.14);
  padding: 24px 20px;
}
.frame::before, .frame::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  background: var(--red);
  border: 2px solid var(--gold-light);
  transform: rotate(45deg);
  box-shadow: 0 0 12px var(--red);
}
.frame::before { left: -8px; }
.frame::after { right: -8px; }

form { display: grid; gap: 12px; justify-items: center; }
input, textarea {
  width: min(100%, 360px);
  padding: 12px 14px;
  background: var(--night-3);
  color: var(--text);
  border: 1px solid var(--gold-line);
  font: 600 1.25rem var(--body);
}
textarea { width: 100%; min-height: 320px; resize: vertical; font-size: 1.1rem; }

button {
  min-height: 44px;
  padding: 10px 22px;
  cursor: pointer;
  border: 2px solid;
  border-image: var(--frame);
  background: linear-gradient(180deg, rgba(224, 48, 58, 0.28), rgba(224, 48, 58, 0.08));
  color: var(--gold-light);
  font: 700 0.95rem var(--display);
  letter-spacing: 0.12em;
}
button:hover:not(:disabled) { background: rgba(224, 48, 58, 0.45); }
button:disabled { opacity: 0.45; cursor: default; }
:focus-visible { outline: 3px solid #fff0b8; outline-offset: 3px; }

.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 18px; }
.hint { text-align: center; margin: 12px 0 0; opacity: 0.85; font-size: 1.05rem; }
#message { position: fixed; z-index: 10; left: 50%; bottom: 16px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); margin: 0; padding: 10px 18px; background: #3a0c10; border: 1px solid var(--gold-line); }
#message:empty { display: none; }

.status { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 20px; margin-bottom: 14px; font-family: var(--display); color: var(--gold); }
.status strong { color: var(--gold-light); overflow-wrap: anywhere; }
.banner { margin: 0 0 14px; text-align: center; font-size: 2.6rem; font-weight: 700; letter-spacing: 0.2em; font-family: var(--display); color: #ffd27a; text-shadow: 0 0 22px var(--red); }

/* Bingo-Karte */
.card { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: clamp(5px, 1.4vw, 12px); margin: 0; padding: 0; list-style: none; }
.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(84px, 22vw, 165px);
  padding: clamp(4px, 1.2vw, 12px);
  border: 2px solid;
  border-image: var(--frame);
  background: rgba(224, 48, 58, 0.07);
  box-shadow: inset 0 0 0 3px var(--night-2), inset 0 0 0 4px rgba(232, 194, 98, 0.3);
  color: var(--gold-light);
  text-align: center;
  font-size: clamp(0.78rem, 2.7vw, 1.25rem);
  line-height: 1.15;
  hyphens: auto;
  overflow-wrap: anywhere;
  position: relative;
}
.cell.hit {
  background: radial-gradient(circle, rgba(224, 48, 58, 0.85), rgba(120, 18, 26, 0.75));
  color: #fff8e0;
  box-shadow: inset 0 0 0 3px var(--night-2), 0 0 18px var(--red);
}
.cell.hit::after { content: '◆'; position: absolute; right: 6px; bottom: 3px; color: #ffd27a; font-size: 0.9em; }
.cell.line { background: linear-gradient(135deg, #f6dc8a, #c8952c 55%, #e8c262); color: #1a0809; box-shadow: inset 0 0 0 3px var(--night-2), 0 0 22px #ffd27a; }
.cell.line::after { color: #7a0f18; }
.cell.dead { opacity: 0.5; text-decoration: line-through; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th, td { padding: 8px 6px; border-bottom: 1px solid rgba(232, 194, 98, 0.25); text-align: right; overflow-wrap: anywhere; }
th { font: 600 0.75rem var(--display); letter-spacing: 0.1em; color: var(--gold); }
th:first-child, td:first-child { width: 3em; text-align: left; }
th:nth-child(2), td:nth-child(2) { width: auto; text-align: left; }
th:nth-child(n+3) { width: 6em; }
@media (max-width: 480px) {
  th { letter-spacing: 0; }
  th:first-child, td:first-child { width: 2em; }
  th:nth-child(n+3) { width: 4.8em; }
  .frame { padding-inline: 14px; }
}
tr.me td { background: rgba(224, 48, 58, 0.25); color: #fff8e0; }

/* Admin */
.terms { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.terms button { font: 600 1.15rem/1.2 var(--body); letter-spacing: 0; }
.terms button[aria-pressed='true'] { background: linear-gradient(135deg, #f6dc8a, #c8952c); color: #1a0809; }
.terms button[aria-pressed='true']::before { content: '✔ '; }
.rows { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.rows li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; border-bottom: 1px solid rgba(232, 194, 98, 0.25); padding-bottom: 8px; }
.rows span { overflow-wrap: anywhere; min-width: 0; }
.badge { margin-left: 8px; padding: 1px 8px; background: var(--red); color: #fff; font: 700 0.75rem var(--display); }
code { overflow-wrap: anywhere; color: #ffd27a; }

/* Mond und Funken */
.moon { position: fixed; left: 4vw; top: 40px; width: 150px; height: 150px; border-radius: 50%; background: radial-gradient(circle at 38% 34%, #fff3d0, #e6c37a 58%, #b0802e); box-shadow: 0 0 110px 34px rgba(224, 48, 58, 0.32); }
@media (max-width: 900px) { .moon { display: none; } }
.sparks { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.spark { position: absolute; border-radius: 50%; background: #ffd27a; box-shadow: 0 0 10px 2px var(--red); opacity: 0; animation: rise linear infinite; }
@keyframes rise { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 0.9; } 100% { transform: translateY(-260px); opacity: 0; } }

/* OBS-Einblendung: Seite bleibt transparent, Maße skalieren mit 1920×1080 */
html.overlay, .overlay body { background: transparent; overflow: hidden; }
.overlay body { --u: min(0.0520833vw, 0.0925926vh); height: 100vh; min-height: 0; display: grid; place-items: center; }
.overlay .stage {
  position: relative;
  width: calc(var(--u) * 940);
  padding: calc(var(--u) * 30) calc(var(--u) * 50) calc(var(--u) * 44);
  text-align: center;
  background: linear-gradient(180deg, rgba(26, 8, 9, 0.97), rgba(5, 2, 2, 0.97));
  border: calc(var(--u) * 5) solid;
  border-image: var(--frame);
  box-shadow: 0 0 calc(var(--u) * 120) rgba(224, 48, 58, 0.65);
  animation: pop 0.7s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.overlay h1 { margin: 0; font: 700 calc(var(--u) * 130)/1.1 var(--display); letter-spacing: 0.08em; }
.overlay .who { margin: 0 0 calc(var(--u) * 24); font: italic 600 calc(var(--u) * 66)/1.15 var(--body); color: var(--gold-light); overflow-wrap: anywhere; }
.overlay .card { gap: calc(var(--u) * 10); }
.overlay .cell { min-height: calc(var(--u) * 112); padding: calc(var(--u) * 8); font-size: calc(var(--u) * 24); }
.overlay .sparks { position: absolute; }
.overlay .content { position: relative; }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* OBS-Leaderboard: Maße skalieren mit 480×720 */
.overlay.board body { --u: min(0.208333vw, 0.138889vh); place-items: start center; font-size: calc(var(--u) * 28); }
.board .panel {
  width: calc(var(--u) * 464);
  margin-top: calc(var(--u) * 8);
  padding: calc(var(--u) * 22) calc(var(--u) * 20);
  background: linear-gradient(180deg, rgba(26, 8, 9, 0.94), rgba(5, 2, 2, 0.94));
  border: calc(var(--u) * 4) solid;
  border-image: var(--frame);
}
.board h2 { margin-bottom: calc(var(--u) * 12); font-size: calc(var(--u) * 30); }
.board th, .board td { padding: calc(var(--u) * 6) calc(var(--u) * 4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board th { font-size: calc(var(--u) * 13); letter-spacing: 0; }
.board th:first-child, .board td:first-child { width: calc(var(--u) * 40); }
.board th:nth-child(n+3), .board td:nth-child(n+3) { width: calc(var(--u) * 76); }
.board tbody tr:first-child td { background: rgba(224, 48, 58, 0.25); color: #ffd27a; }
.board .hint { font-size: inherit; }

@media (prefers-reduced-motion: reduce) {
  html:not(.overlay) .spark { display: none; }
}
