:root {
  --night: #160d2e;
  --night2: #231546;
  --panel: #2c1b55;
  --panel2: #3a2570;
  --line: rgba(255, 220, 150, 0.16);
  --gold: #f4b942;
  --gold2: #ffd77a;
  --terra: #e0673d;
  --teal: #2fc1ac;
  --rose: #ef5d7a;
  --text: #fbf3e4;
  --muted: #c3b5dd;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(244, 185, 66, 0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(47, 193, 172, 0.14), transparent 60%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.018) 0 14px, transparent 14px 28px),
    var(--night);
  background-attachment: fixed;
}
h1, h2, h3 { margin: 0 0 0.4em; line-height: 1.15; }
.brand { font-family: Georgia, "Times New Roman", serif; letter-spacing: 0.08em; color: var(--gold); text-shadow: 0 3px 0 #7a3d12, 0 8px 24px rgba(244, 185, 66, 0.35); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.hidden { display: none !important; }

.card {
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }
.card h3 { font-size: 1.05rem; color: var(--gold2); display: flex; align-items: center; gap: 8px; }

button, .btn {
  font: inherit; font-weight: 700; border: 0; border-radius: 12px; padding: 12px 16px; cursor: pointer;
  background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #3b2005;
  box-shadow: 0 3px 0 #9a5d12; transition: transform 0.08s, filter 0.15s; touch-action: manipulation;
}
button:active { transform: translateY(2px); box-shadow: 0 1px 0 #9a5d12; }
button:disabled { filter: grayscale(0.9) brightness(0.6); cursor: not-allowed; }
button.ghost { background: rgba(255, 255, 255, 0.08); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
button.teal { background: linear-gradient(180deg, #5fe0cd, var(--teal)); color: #06302a; box-shadow: 0 3px 0 #17796b; }
button.red { background: linear-gradient(180deg, #ff8aa0, var(--rose)); color: #3d0613; box-shadow: 0 3px 0 #9b2440; }
button.big { width: 100%; padding: 16px; font-size: 1.1rem; }
button.sm { padding: 8px 12px; font-size: 0.9rem; border-radius: 10px; }
button.xs { padding: 6px 10px; font-size: 0.85rem; border-radius: 9px; box-shadow: 0 2px 0 #9a5d12; }

input, textarea, select {
  font: inherit; color: var(--text); background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; width: 100%; outline: none;
}
input:focus, textarea:focus { border-color: var(--gold); }
label { display: block; font-size: 0.85rem; color: var(--muted); margin: 10px 0 6px; }

.seg { display: flex; background: rgba(0, 0, 0, 0.25); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { flex: 1; background: transparent; color: var(--muted); box-shadow: none; padding: 10px; }
.seg button.on { background: var(--gold); color: #3b2005; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); font-weight: 700; font-size: 0.9rem; white-space: nowrap; }
.chip.ok { background: rgba(47, 193, 172, 0.22); color: #9ff3e5; }
.chip.miss { background: rgba(239, 93, 122, 0.2); color: #ffb3c1; }
.chip.gold { background: rgba(244, 185, 66, 0.2); color: var(--gold2); }

.avatar { font-size: 1.6rem; line-height: 1; }
.avatars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.avatars button { font-size: 1.7rem; padding: 8px 0; background: rgba(255, 255, 255, 0.06); box-shadow: none; }
.avatars button.on { background: var(--gold); }
.avatars button:disabled { opacity: 0.25; }

.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(84px + env(safe-area-inset-bottom)); display: grid; gap: 8px; justify-items: center; z-index: 50; pointer-events: none; padding: 0 12px; }
.toast { background: #120a26ee; border: 1px solid var(--gold); color: var(--text); padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow); max-width: 520px; animation: pop 0.25s ease-out; font-weight: 600; }
.toast.err { border-color: var(--rose); }
@keyframes pop { from { transform: translateY(-10px) scale(0.96); opacity: 0; } }
@keyframes pulse { 50% { transform: scale(1.06); } }
@keyframes shine { from { background-position: -200% 0; } to { background-position: 200% 0; } }

/* ───────── Startseite ───────── */
.start { max-width: 520px; margin: 0 auto; padding: 28px 16px 60px; }
.start .logo { font-size: 3.4rem; text-align: center; margin: 10px 0 0; }
.start .tag { text-align: center; color: var(--muted); margin-bottom: 24px; }
details.rules summary { cursor: pointer; font-weight: 700; color: var(--gold2); }
details.rules li { margin: 6px 0; color: var(--muted); }

/* ───────── Handy ───────── */
.phone { max-width: 560px; margin: 0 auto; padding: 0 12px 96px; }
.top { position: sticky; top: 0; z-index: 10; margin: 0 -12px 12px; padding: 10px 12px; background: #160d2ef2; backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top .me { font-weight: 800; }
.stat { display: flex; flex-direction: column; align-items: center; min-width: 54px; }
.stat b { font-size: 1.15rem; }
.stat span { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.phasebar { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 8px; }
.phase-name { font-weight: 800; color: var(--gold2); }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.1rem; padding: 3px 10px; border-radius: 10px; background: rgba(0, 0, 0, 0.3); }
.timer.low { color: #fff; background: var(--rose); animation: pulse 1s infinite; }
.progress { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); margin-top: 8px; overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--gold)); transition: width 1s linear; }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: #120a26f5; border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); z-index: 20; backdrop-filter: blur(8px); }
.tabs button { flex: 1; background: transparent; box-shadow: none; color: var(--muted); padding: 6px 2px; font-size: 0.75rem; display: flex; flex-direction: column; align-items: center; gap: 2px; position: relative; }
.tabs button .i { font-size: 1.45rem; }
.tabs button.on { color: var(--gold2); }
.tabs .badge { position: absolute; top: 2px; right: 22%; background: var(--rose); color: #fff; border-radius: 999px; font-size: 0.7rem; min-width: 18px; padding: 1px 5px; }

.goods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.good { background: rgba(0, 0, 0, 0.22); border-radius: 12px; padding: 10px 6px; text-align: center; border: 1px solid transparent; }
.good .i { font-size: 1.8rem; }
.good b { display: block; font-size: 1.2rem; }
.good span { font-size: 0.72rem; color: var(--muted); }
.good.zero { opacity: 0.4; }

.order { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: rgba(0, 0, 0, 0.2); margin-top: 8px; border: 1px solid transparent; }
.order.can { border-color: var(--teal); background: rgba(47, 193, 172, 0.12); }
.order .need { display: flex; gap: 5px; flex-wrap: wrap; flex: 1; }
.order .val { font-weight: 800; color: var(--gold2); white-space: nowrap; }

.playcard { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 12px; background: linear-gradient(135deg, rgba(224, 103, 61, 0.25), rgba(244, 185, 66, 0.12)); margin-top: 8px; }
.playcard .i { font-size: 1.8rem; }
.playcard .t { flex: 1; }
.playcard .t b { display: block; }
.playcard .t span { font-size: 0.82rem; color: var(--muted); }

.market { width: 100%; border-collapse: collapse; }
.market td { padding: 8px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.market tr:last-child td { border-bottom: 0; }
.market .gi { font-size: 1.5rem; width: 36px; }
.market .hot { color: var(--gold2); font-weight: 800; }
.price { font-weight: 800; font-variant-numeric: tabular-nums; }
.up { color: #ff9a7a; } .down { color: #7fe7d5; }

.event { text-align: center; background: radial-gradient(circle at 50% 0, rgba(244, 185, 66, 0.35), transparent 70%), linear-gradient(180deg, var(--panel2), var(--panel)); }
.event .i { font-size: 3rem; }
.event h2 { color: var(--gold2); font-family: Georgia, serif; }

.offer { padding: 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.22); margin-top: 10px; border: 1px solid var(--line); }
.offer.promise { border-color: var(--gold); border-style: dashed; }
.offer .sides { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; margin: 8px 0; }
.offer .side { display: flex; gap: 4px; flex-wrap: wrap; }
.offer .arrow { font-size: 1.3rem; color: var(--muted); }

.people { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.people button { background: rgba(255, 255, 255, 0.06); box-shadow: none; color: var(--text); padding: 10px 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 0.8rem; }
.people button .avatar { font-size: 1.8rem; }

.stepper { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.stepper:last-child { border-bottom: 0; }
.stepper .lbl { font-size: 1.5rem; }
.stepper .ctl { display: flex; align-items: center; gap: 6px; }
.stepper .ctl button { width: 40px; height: 40px; padding: 0; font-size: 1.2rem; border-radius: 10px; }
.stepper .ctl b { min-width: 22px; text-align: center; font-size: 1.1rem; }

.modal { position: fixed; inset: 0; background: rgba(5, 2, 15, 0.7); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.modal .sheet { background: var(--night2); border-top: 2px solid var(--gold); border-radius: 22px 22px 0 0; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); animation: up 0.2s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 12px; background: rgba(244, 185, 66, 0.1); margin-top: 12px; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--gold); flex: none; }

.feed { display: grid; gap: 6px; }
.feed div { padding: 8px 10px; border-radius: 10px; background: rgba(0, 0, 0, 0.2); font-size: 0.92rem; }
.feed .rumor { background: rgba(239, 93, 122, 0.16); font-style: italic; }
.feed .betrayal { background: rgba(239, 93, 122, 0.3); font-weight: 700; }
.feed .event { background: rgba(244, 185, 66, 0.15); text-align: left; }
.feed .auction { background: rgba(47, 193, 172, 0.16); }

.notice { padding: 10px 12px; border-radius: 12px; background: rgba(47, 193, 172, 0.14); margin-top: 8px; font-size: 0.92rem; }

.bidbox { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.bidbox .amt { font-size: 2.2rem; font-weight: 900; color: var(--gold2); min-width: 70px; text-align: center; }
input[type="range"] { padding: 0; accent-color: var(--gold); }

.waiting { text-align: center; padding: 40px 10px; }
.waiting .big { font-size: 4rem; animation: pulse 2s infinite; }

.rank { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: rgba(0, 0, 0, 0.22); margin-top: 8px; animation: pop 0.4s ease-out both; }
.rank.first { background: linear-gradient(90deg, rgba(244, 185, 66, 0.45), rgba(244, 185, 66, 0.1)); border: 1px solid var(--gold); }
.rank .pos { font-size: 1.4rem; font-weight: 900; width: 34px; text-align: center; color: var(--gold2); }
.rank .pts { margin-left: auto; font-weight: 900; font-size: 1.2rem; }
.award { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 14px; background: linear-gradient(135deg, rgba(224, 103, 61, 0.22), rgba(47, 193, 172, 0.12)); margin-top: 8px; animation: pop 0.4s ease-out both; }
.award .i { font-size: 2rem; }

/* ───────── TV ───────── */
.tv { height: 100vh; display: grid; grid-template-rows: auto 1fr auto; gap: 1.2vw; padding: 1.4vw 1.8vw; font-size: clamp(14px, 1.15vw, 26px); overflow: hidden; }
.tv .head { display: flex; align-items: center; gap: 2vw; }
.tv .head .brand { font-size: 2.6em; margin: 0; }
.tv .head .day { font-size: 1.3em; color: var(--muted); }
.tv .head .ph { font-size: 1.8em; font-weight: 900; color: var(--gold2); }
.tv .head .clock { margin-left: auto; font-size: 2.8em; font-weight: 900; font-variant-numeric: tabular-nums; padding: 0.1em 0.5em; border-radius: 0.4em; background: rgba(0, 0, 0, 0.3); }
.tv .head .clock.low { background: var(--rose); animation: pulse 1s infinite; }
.tv .main { display: grid; grid-template-columns: 1.05fr 1.3fr 1fr; gap: 1.2vw; min-height: 0; }
.tv .card { padding: 1.2vw; overflow: hidden; min-height: 0; }
.tv .card h3 { font-size: 1.15em; }
.tv .event .i { font-size: 5em; }
.tv .event h2 { font-size: 2.1em; }
.tv .event p { font-size: 1.3em; }
.tv .market td { padding: 0.45em 0.4em; font-size: 1.2em; }
.tv .market .gi { font-size: 1.7em; width: 1.8em; }
.tv .feed div { font-size: 1.05em; }
.tv .plist { display: flex; gap: 1vw; justify-content: center; flex-wrap: wrap; }
.tv .pl { background: rgba(0, 0, 0, 0.25); border-radius: 1em; padding: 0.5em 1em; display: flex; align-items: center; gap: 0.6em; border: 2px solid transparent; font-size: 1.1em; }
.tv .pl.ready { border-color: var(--teal); }
.tv .pl.off { opacity: 0.4; }
.tv .pl .avatar { font-size: 1.8em; }
.tv .lobby { display: grid; grid-template-columns: 1fr 1fr; gap: 3vw; align-items: center; height: 100%; }
.tv .lobby .code { font-size: 7em; font-weight: 900; letter-spacing: 0.12em; color: var(--gold2); font-family: Georgia, serif; line-height: 1; }
.tv .lobby img { width: 14em; height: 14em; border-radius: 1em; background: #fff; padding: 0.6em; }
.tv .lobby .players { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1em; }
.tv .lobby .pl { font-size: 1.5em; justify-content: flex-start; }
.tv .bids { display: grid; gap: 0.5em; margin-top: 0.8em; }
.tv .bids div { display: flex; justify-content: space-between; padding: 0.4em 0.8em; border-radius: 0.6em; background: rgba(0, 0, 0, 0.25); font-size: 1.2em; animation: pop 0.4s ease-out both; }
.tv .bids div.win { background: var(--gold); color: #3b2005; font-weight: 900; }
.tv .lot { font-size: 2.6em; text-align: center; font-weight: 900; margin: 0.4em 0; }
.tv .ende { display: grid; grid-template-columns: 1fr 1fr; gap: 2vw; min-height: 0; }
.tv .ende .rank { font-size: 1.3em; }
.tv .ende .award { font-size: 1.1em; }
.tv .hostbar { position: fixed; right: 1vw; bottom: 1vw; display: flex; gap: 0.6em; opacity: 0.35; transition: opacity 0.2s; }
.tv .hostbar:hover { opacity: 1; }

@media (max-width: 900px) {
  .tv { height: auto; overflow: visible; font-size: 15px; }
  .tv .main, .tv .lobby, .tv .ende { grid-template-columns: 1fr; }
}
