:root {
  --bg: #0b0b0f;
  --bg2: #16161d;
  --card: #1e1e27;
  --text: #f5f5f7;
  --muted: #9a9aa8;
  --accent: #6ee7b7;
  --accent2: #f9a8d4;
  --danger: #ef4444;
  --radius: 22px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px; line-height: 1.35;
  overscroll-behavior: none; -webkit-user-select: none; user-select: none;
  height: 100%;
}
body { min-height: 100dvh; }
#app { min-height: 100dvh; display: flex; flex-direction: column; }
button { font: inherit; color: inherit; }
input, select { font: inherit; }

/* ------- Layout ------- */
.screen {
  flex: 1; display: flex; flex-direction: column;
  padding: calc(var(--safe-top) + 14px) 16px calc(var(--safe-bottom) + 20px);
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: none; } }
.screen.gradient { background: linear-gradient(170deg, var(--g1, #3b82f6), var(--g2, #ef4444)); }
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; min-height: 44px; }
.topbar h1 { font-size: 24px; margin: 0; font-weight: 800; letter-spacing: -0.5px; flex: 1; }
.topbar .title { flex: 1; text-align: center; font-weight: 600; }
.iconbtn {
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.12); color: #fff; font-size: 20px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  backdrop-filter: blur(10px);
}
.iconbtn:active { transform: scale(.94); }
.spacer { flex: 1; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
h2 { font-size: 22px; margin: 18px 0 10px; font-weight: 800; }
h3 { font-size: 17px; margin: 14px 0 8px; font-weight: 700; }

/* ------- Buttons ------- */
.btn {
  display: block; width: 100%; border: none; border-radius: 999px;
  padding: 16px 20px; font-size: 19px; font-weight: 700; cursor: pointer;
  background: var(--accent); color: #062a1e; box-shadow: 0 0 30px rgba(110,231,183,.35);
  margin-top: 10px; transition: transform .08s;
}
.btn:active { transform: scale(.97); }
.btn.dark { background: #15151c; color: #fff; box-shadow: none; }
.btn.ghost { background: rgba(255,255,255,.14); color: #fff; box-shadow: none; backdrop-filter: blur(8px); }
.btn.danger { background: var(--danger); color: #fff; box-shadow: none; }
.btn.secondary { background: #2a2a36; color: #fff; box-shadow: none; }
.btn:disabled { opacity: .45; }
.row { display: flex; gap: 10px; }
.row .btn { flex: 1; }
.sticky-bottom { position: sticky; bottom: calc(var(--safe-bottom) + 8px); margin-top: auto; padding-top: 16px; }

/* ------- Home ------- */
.hero {
  border-radius: 28px; padding: 26px 20px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(160deg, #1e3a8a, #ec4899); min-height: 150px; display: flex; flex-direction: column; justify-content: flex-end;
}
.hero .tag { display: inline-block; background: rgba(255,255,255,.2); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 700; letter-spacing: .5px; }
.hero h2 { font-size: 34px; margin: 8px 0 4px; line-height: 1.05; }
.hero p { margin: 0 0 12px; opacity: .9; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 10px; }
.section-head h2 { margin: 0; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gamecard {
  aspect-ratio: 1/1; border-radius: 24px; border: none; padding: 14px; position: relative;
  color: #fff; text-align: left; cursor: pointer; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end;
  background: linear-gradient(160deg, var(--c1), var(--c2)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
  transition: transform .08s;
}
.gamecard:active { transform: scale(.96); }
.gamecard .emoji { position: absolute; top: 12px; left: 12px; font-size: 36px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.35)); }
.gamecard .badge { position: absolute; top: 12px; right: 12px; background: #000; color: #fde047; font-size: 11px; font-weight: 800; padding: 3px 7px; border-radius: 8px; }
.gamecard .sub { font-size: 12px; text-transform: uppercase; letter-spacing: .8px; opacity: .85; font-weight: 700; }
.gamecard .name { font-size: 21px; font-weight: 900; line-height: 1.05; text-shadow: 0 2px 6px rgba(0,0,0,.4); }
.gamecard.soon { opacity: .55; }
.gamecard.soon .badge { color: #fff; }

/* ------- Lists / settings rows ------- */
.panel { background: rgba(0,0,0,.55); border-radius: 22px; padding: 4px 16px; backdrop-filter: blur(10px); }
.rowitem {
  display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid rgba(255,255,255,.08); cursor: pointer;
}
.rowitem:last-child { border-bottom: none; }
.rowitem .ico { font-size: 26px; width: 36px; text-align: center; }
.rowitem .label { flex: 1; font-weight: 600; }
.rowitem .label .desc { display: block; font-weight: 400; font-size: 14px; color: var(--muted); margin-top: 2px; }
.rowitem .value { color: var(--muted); }
.rowitem .check { width: 26px; text-align: center; font-size: 20px; color: var(--danger); }
.chip { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.14); border-radius: 999px; padding: 8px 14px; margin: 4px 4px 0 0; font-weight: 600; }
.chip.on { background: var(--accent); color: #062a1e; }
.chip button { background: none; border: none; font-size: 16px; padding: 0; cursor: pointer; opacity: .7; }
.stepper { display: flex; align-items: center; gap: 14px; }
.stepper button { width: 40px; height: 40px; border-radius: 50%; border: none; background: rgba(255,255,255,.18); color: #fff; font-size: 22px; font-weight: 800; }
.stepper span { font-size: 22px; font-weight: 800; min-width: 40px; text-align: center; }

input.text {
  width: 100%; padding: 14px 16px; border-radius: 16px; border: none; background: rgba(255,255,255,.12); color: #fff; outline: none;
}
input.text::placeholder { color: rgba(255,255,255,.5); }
.avatars { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.avatars button { width: 46px; height: 46px; border-radius: 50%; border: 2px solid transparent; background: rgba(255,255,255,.1); font-size: 24px; }
.avatars button.on { border-color: var(--accent); background: rgba(110,231,183,.25); }

/* ------- Game play ------- */
.bigcard {
  background: rgba(0,0,0,.6); border-radius: 28px; padding: 28px 22px; text-align: center; backdrop-filter: blur(12px);
  flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; min-height: 40vh;
}
.bigcard .q { font-size: 26px; font-weight: 800; line-height: 1.25; }
.bigcard .huge { font-size: 46px; font-weight: 900; line-height: 1.05; word-break: break-word; }
.bigcard .hint { color: var(--muted); font-size: 15px; }
.bigcard .kicker { font-size: 13px; letter-spacing: 1px; text-transform: uppercase; opacity: .7; font-weight: 700; }
.or { font-size: 14px; letter-spacing: 2px; opacity: .6; font-weight: 800; }
.choice { background: rgba(255,255,255,.1); border-radius: 20px; padding: 20px 16px; font-size: 22px; font-weight: 800; border: none; color: #fff; width: 100%; }
.choice.a { background: rgba(59,130,246,.55); }
.choice.b { background: rgba(239,68,68,.55); }
.choice.voted { outline: 3px solid #fff; }
.timer { font-size: 70px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; }
.timer.warn { color: #fde047; }
.timer.crit { color: #ef4444; animation: pulse .5s infinite alternate; }
@keyframes pulse { from { transform: scale(1);} to { transform: scale(1.12);} }
.progress { height: 6px; background: rgba(255,255,255,.15); border-radius: 3px; overflow: hidden; margin: 12px 0; }
.progress i { display: block; height: 100%; background: #fff; width: 0; transition: width .5s linear; }
.taboo { list-style: none; padding: 0; margin: 10px 0 0; }
.taboo li { background: rgba(239,68,68,.25); border: 1px solid rgba(239,68,68,.6); border-radius: 12px; padding: 10px; margin: 6px 0; font-weight: 700; text-decoration: line-through; text-decoration-color: rgba(255,255,255,.4); }
.score { display: flex; justify-content: space-around; margin: 12px 0; }
.score div { text-align: center; }
.score b { display: block; font-size: 34px; }
.playerlist { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 10px 0; }
.playerlist .p { background: rgba(255,255,255,.12); border-radius: 999px; padding: 8px 14px; font-weight: 600; }
.playerlist .p.off { opacity: .4; }
.playerlist .p.sel { background: var(--accent); color: #062a1e; }
.vote { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vote button { border: none; border-radius: 16px; padding: 16px 10px; background: rgba(255,255,255,.12); color: #fff; font-weight: 700; font-size: 17px; }
.vote button.sel { background: var(--accent); color: #062a1e; }
.vote button.out { opacity: .35; }
.code { font-size: 52px; font-weight: 900; letter-spacing: 10px; font-variant-numeric: tabular-nums; }
.bomb { font-size: 120px; line-height: 1; transition: transform .1s; }
.bomb.shake { animation: shake .15s infinite; }
@keyframes shake { 0% { transform: rotate(-6deg);} 100% { transform: rotate(6deg);} }
.explode { background: radial-gradient(circle, #fde047, #f97316 40%, #7f1d1d 75%) !important; }
.wheel { width: min(320px, 80vw); height: min(320px, 80vw); margin: 10px auto; border-radius: 50%; position: relative; transition: transform 4s cubic-bezier(.17,.67,.12,1); border: 6px solid #fff; }
.wheel span { position: absolute; left: 50%; top: 50%; transform-origin: 0 0; font-weight: 800; font-size: 16px; white-space: nowrap; }
.pointer { width: 0; height: 0; border-left: 14px solid transparent; border-right: 14px solid transparent; border-top: 26px solid #fff; margin: 0 auto -8px; position: relative; z-index: 2; }
.touchpad { flex: 1; min-height: 55vh; border-radius: 28px; background: rgba(0,0,0,.45); position: relative; overflow: hidden; touch-action: none; }
.touchpad .dot { position: absolute; width: 90px; height: 90px; margin: -45px 0 0 -45px; border-radius: 50%; border: 5px solid #fff; background: rgba(255,255,255,.2); }
.touchpad .dot.win { background: var(--accent); transform: scale(1.4); box-shadow: 0 0 40px var(--accent); }
.arrow { font-size: 140px; display: inline-block; transition: transform 3s cubic-bezier(.17,.67,.12,1); }
.card-face { background: rgba(255,255,255,.1); border-radius: 18px; padding: 14px; margin: 8px 0; font-weight: 700; }
.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); background: #222; color: #fff; padding: 12px 18px; border-radius: 999px; z-index: 50; }
.fab { position: fixed; right: 16px; bottom: calc(var(--safe-bottom) + 16px); border-radius: 999px; padding: 12px 18px; border: none; background: linear-gradient(90deg,#a855f7,#ec4899); color: #fff; font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.roles li { background: rgba(255,255,255,.1); border-radius: 14px; padding: 10px 14px; margin: 6px 0; list-style: none; display: flex; justify-content: space-between; }

/* ------- Dialog ------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(6px); display: flex; align-items: flex-end; justify-content: center; z-index: 100; padding: 16px; padding-bottom: calc(var(--safe-bottom) + 16px); animation: fade .15s ease; }
.dialog { background: #1c1c25; color: #fff; border-radius: 26px; padding: 22px 20px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,.5); animation: up .2s ease; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.dialog h3 { margin: 0 0 6px; font-size: 21px; }
.dialog p { margin: 0 0 14px; color: var(--muted); }
.dialog-buttons { display: flex; gap: 10px; }
.dialog-buttons .btn { flex: 1; margin: 0; padding: 14px; font-size: 17px; }
.tilt-hint { display: flex; justify-content: center; gap: 18px; font-size: 14px; opacity: .8; margin-top: 6px; }
.flash-ok { background: linear-gradient(170deg, #16a34a, #065f46) !important; }
.flash-skip { background: linear-gradient(170deg, #dc2626, #7f1d1d) !important; }

/* ------- Querformat (Handy gedreht, z.B. Scharade an der Stirn) ------- */
@media (orientation: landscape) and (max-height: 520px) {
  .screen { padding: 8px 20px calc(var(--safe-bottom) + 10px); }
  .topbar { margin-bottom: 6px; min-height: 36px; }
  .topbar .title { font-size: 15px; }
  .iconbtn { width: 36px; height: 36px; font-size: 16px; }
  .bigcard { min-height: 0; padding: 12px 18px; gap: 6px; }
  .bigcard .huge { font-size: clamp(34px, 9vh, 64px); }
  .bigcard .q { font-size: 20px; }
  .timer { font-size: 40px; }
  .progress { margin: 6px 0; }
  .tilt-hint { margin-top: 4px; font-size: 12px; flex-direction: column; gap: 2px; }
  .sticky-bottom { padding-top: 8px; position: static; }
  .btn { padding: 12px 18px; font-size: 17px; margin-top: 8px; }
  .row { margin-top: 8px !important; }
  .choice { padding: 12px; font-size: 18px; }
  .grid { grid-template-columns: repeat(4, 1fr); }
  .gamecard { aspect-ratio: 1/1; }
  .hero { min-height: 0; padding: 16px 20px; }
  .hero h2 { font-size: 24px; }
  .wheel { width: min(220px, 40vh); height: min(220px, 40vh); }
  .bomb { font-size: 70px; }
  .code { font-size: 40px; }
  .taboo li { padding: 6px; margin: 4px 0; }
  .avatars button { width: 38px; height: 38px; font-size: 20px; }
}
/* Scharade im Querformat: Wort groß in der Mitte, Timer klein, Tipp-Flächen links/rechts */
@media (orientation: landscape) and (max-height: 520px) {
  .scharade-play .bigcard { flex-direction: row; align-items: center; justify-content: space-between; text-align: left; }
  .scharade-play .bigcard .wordbox { flex: 1; text-align: center; }
  .scharade-play .bigcard .timerbox { width: 110px; text-align: center; }
}

/* ------- QR-Code ------- */
.qr { background: #fff; border-radius: 16px; padding: 10px; width: min(220px, 55vw); margin: 4px auto; line-height: 0; }
.qr svg { width: 100%; height: auto; display: block; }
@media (orientation: landscape) and (max-height: 520px) { .qr { width: min(150px, 30vh); } }
