/* Spaß an der Freude IQ – 16-Bit-Kneipe */
@font-face {
  font-family: 'Press Start 2P';
  src: url('/fonts/press-start-2p-latin-400-normal.woff2') format('woff2');
  font-display: swap;
}
:root {
  --bg: #1a0f0a; --wood: #2b1810; --wood2: #3a2216; --line: #f4a340; --cream: #f6e7c1; --dim: #b89b7a;
  --rot: #e4572e; --blau: #3fa7d6; --gruen: #76b041; --gelb: #ffc914; --pink: #ff5d8f; --ink: #1a0f0a;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 12px; }
body {
  margin: 0; min-height: 100dvh; color: var(--cream); font-family: 'Press Start 2P', monospace; line-height: 1.7;
  background-color: var(--bg);
  /* Backsteinwand */
  background-image:
    linear-gradient(rgba(26, 15, 10, .55), rgba(26, 15, 10, .92)),
    linear-gradient(90deg, #120a06 2px, transparent 2px),
    linear-gradient(90deg, #120a06 2px, transparent 2px),
    linear-gradient(#120a06 2px, #4a2618 2px);
  background-size: 100% 100%, 48px 32px, 48px 32px, 48px 16px;
  background-position: 0 0, 0 0, 24px 16px, 0 0;
  background-attachment: fixed;
  image-rendering: pixelated; touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
#app { max-width: 520px; margin: 0 auto; padding: 10px 12px 24px; display: flex; flex-direction: column; gap: 12px; }
main { display: flex; flex-direction: column; gap: 12px; }
.home { display: flex; flex-direction: column; gap: 12px; }
footer { text-align: center; font-size: .7rem; padding: 8px 8px 20px; }
footer a, .link { color: var(--dim); }
h1, h2, p { margin: 0; }
h2 { font-size: 1.25rem; line-height: 1.6; color: var(--gelb); }
.dim { color: var(--dim); } .small { font-size: .75rem; word-break: break-all; } .center { text-align: center; }
div.center { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.pix { display: block; flex: none; }
.blink { animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }

/* Logo mit Neon-Schild */
.logo { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 0 6px; text-align: center; }
.logo h1 { font-size: 1.5rem; line-height: 1.9; text-shadow: 3px 3px 0 #000; }
.logo .a { color: var(--gelb); text-shadow: 0 0 12px rgba(255, 201, 20, .7), 3px 3px 0 #000; }
.logo .b { color: var(--pink); text-shadow: 0 0 12px rgba(255, 93, 143, .7), 3px 3px 0 #000; }
.logo .iq { display: inline-block; background: var(--blau); color: var(--ink); padding: 2px 8px; text-shadow: none; box-shadow: 3px 3px 0 #000; }

/* Holz-Paneele mit Pixelrand */
.panel {
  background: repeating-linear-gradient(0deg, var(--wood) 0 14px, var(--wood2) 14px 16px);
  border: 4px solid var(--line); box-shadow: 0 0 0 4px #000, 6px 8px 0 4px rgba(0, 0, 0, .5);
  padding: 14px; margin: 4px; display: flex; flex-direction: column; gap: 10px;
}
label { color: var(--line); font-size: .8rem; }
input {
  font: inherit; font-size: 16px; width: 100%; min-height: 52px; padding: 10px 12px; color: var(--ink); background: var(--cream);
  border: 4px solid #000; border-radius: 0; outline: none; text-transform: none; user-select: text; -webkit-user-select: text;
}
#code { text-transform: uppercase; letter-spacing: 6px; text-align: center; }
input:focus { border-color: var(--blau); }
.row { display: flex; gap: 8px; } .row > * { flex: 1; } .row > .btn { flex: 0 0 auto; }
.seg > .btn { flex: 1; }

.btn {
  font: inherit; color: var(--ink); background: var(--line); border: 4px solid #000; border-radius: 0; cursor: pointer;
  min-height: 52px; padding: 10px 16px; box-shadow: inset -4px -4px 0 rgba(0, 0, 0, .25), inset 4px 4px 0 rgba(255, 255, 255, .3);
}
.btn:active { transform: translateY(3px); box-shadow: inset 4px 4px 0 rgba(0, 0, 0, .25); }
.btn.big { width: 100%; min-height: 64px; font-size: 1.05rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
main > .btn.big { margin: 4px; width: auto; }
.btn small { font-size: .65rem; opacity: .8; }
.btn.green { background: var(--gruen); } .btn.pink { background: var(--pink); }
.btn.ghost { background: transparent; color: var(--cream); border-color: var(--dim); box-shadow: none; }
.btn:disabled { filter: grayscale(1); opacity: .55; cursor: default; }
.link { font: inherit; font-size: .7rem; background: none; border: 0; text-decoration: underline; padding: 10px 0 0; cursor: pointer; text-align: left; }

.err, .note, .toast { border: 4px solid #000; padding: 12px; text-align: center; margin: 4px; }
.err { background: var(--rot); color: #fff; } .note { background: var(--wood2); color: var(--gelb); }
.toast { position: fixed; left: 12px; right: 12px; bottom: 16px; background: var(--blau); color: var(--ink); z-index: 30; word-break: break-all; }
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .8); display: flex; align-items: center; justify-content: center; padding: 12px; z-index: 20; }
.modal { max-width: 460px; }

/* Kopfzeile */
.bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.bar .sp { flex: 1; }
.chip { font: inherit; font-size: .7rem; color: var(--cream); background: #000; border: 2px solid var(--dim); padding: 8px; min-height: 36px; cursor: pointer; }
span.chip { cursor: default; display: inline-flex; align-items: center; }

/* Lobby */
.code { font-size: 3rem; letter-spacing: 8px; color: var(--gelb); text-shadow: 4px 4px 0 #000, 0 0 18px rgba(255, 201, 20, .5); }
.badge { display: inline-block; padding: 6px 10px; color: var(--ink); font-size: .75rem; border: 3px solid #000; }
.badge.party { background: var(--pink); } .badge.komp { background: var(--gruen); }
.plist, .rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.plist li, .rows li { display: flex; align-items: center; gap: 10px; background: rgba(0, 0, 0, .35); padding: 8px; border-left: 4px solid transparent; }
li.me { border-left-color: var(--gelb); } li.off { opacity: .45; }
.pn { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pn em { font-style: normal; font-size: .6rem; color: var(--ink); background: var(--line); padding: 2px 4px; margin-left: 4px; }
.rows b { color: var(--gelb); } .rows b.neg { color: var(--rot); } .rk { width: 2.2em; color: var(--dim); }

/* Intro */
.intro p { font-size: .85rem; }
.big-num { font-size: 4rem; color: var(--pink); text-shadow: 4px 4px 0 #000; }

/* Zeitbalken */
.tbar { height: 14px; background: #000; border: 3px solid #000; margin: 0 4px; }
.tbar i { display: block; height: 100%; width: 100%; background: var(--gelb); transition: width .1s linear; }

/* Farb-Reaktion */
.c-rot { background: var(--rot); } .c-blau { background: var(--blau); } .c-gruen { background: var(--gruen); } .c-gelb { background: var(--gelb); }
.stage { height: 150px; margin: 4px; border: 4px solid #000; box-shadow: 0 0 0 4px var(--line); display: flex; align-items: center; justify-content: center;
  font-size: 3rem; color: var(--cream); text-shadow: 4px 4px 0 #000; }
.stage:not([class*='c-']) { background: #000; }
.pads { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px; }
.pad { font: inherit; font-size: 1.1rem; height: 104px; color: var(--ink); border: 4px solid #000; border-radius: 0;
  box-shadow: inset -6px -6px 0 rgba(0, 0, 0, .25), inset 6px 6px 0 rgba(255, 255, 255, .3); }
.pad:disabled { opacity: .45; }

/* Quiz */
.question h2 { font-size: 1rem; color: var(--cream); text-align: center; line-height: 1.8; }
.opts { display: flex; flex-direction: column; gap: 10px; margin: 4px; }
.opt { font: inherit; font-size: .85rem; line-height: 1.6; text-align: left; color: var(--ink); background: var(--cream); border: 4px solid #000; border-radius: 0;
  min-height: 60px; padding: 8px 10px; display: flex; align-items: center; gap: 10px; box-shadow: inset -4px -4px 0 rgba(0, 0, 0, .2); }
.opt i { font-style: normal; background: var(--ink); color: var(--gelb); padding: 6px 8px; flex: none; }
.opt > span:nth-child(2) { flex: 1; } .who { display: flex; gap: 2px; }
.opt.sel { background: var(--blau); } .opt.right { background: var(--gruen); } .opt.wrong { background: var(--rot); color: #fff; }
.opt.fade { opacity: .5; } .opt:disabled { cursor: default; }

/* Memory */
.board { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 4px; }
.card { aspect-ratio: 1; font-size: 1.9rem; line-height: 1; padding: 0; border: 3px solid #000; border-radius: 0;
  background: repeating-linear-gradient(45deg, var(--rot) 0 6px, #b3331e 6px 12px); }
.card.up { background: var(--cream); } .card.hit { background: var(--gruen); opacity: .75; }
.prog .pn { flex: 0 1 9em; }
.pbar { flex: 1; height: 12px; background: #000; } .pbar i { display: block; height: 100%; background: var(--gruen); }

/* Ergebnis */
.drink { margin: 4px; padding: 18px 10px; text-align: center; background: var(--pink); color: var(--ink); border: 4px solid #000;
  box-shadow: 0 0 0 4px var(--gelb); font-size: 1rem; animation: blink 1.2s steps(2) 3; }
.drink b { font-size: 1.8rem; line-height: 2; }
.panel.party { border-color: var(--pink); }
.winner h2 { font-size: 1.6rem; }

/* TV-/Stream-Ansicht */
@media (min-width: 900px) {
  body.tv { zoom: 1.5; }
  body.tv #app { max-width: 720px; }
}
