:root {
  --b03:#002b36; --b02:#073642; --b01:#586e75; --b00:#657b83; --b0:#839496; --b1:#93a1a1; --b2:#eee8d5; --b3:#fdf6e3;
  --yellow:#b58900; --orange:#cb4b16; --red:#dc322f; --magenta:#d33682; --violet:#6c71c4; --blue:#268bd2; --cyan:#2aa198; --green:#859900;
  --font: 'Source Code Pro', ui-monospace, Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2,.8,.2,1);
  --sky-t: 2.4s;
  /* Tag (Solarized Light) */
  --bg: var(--b3); --panel: rgba(238,232,213,.86); --panel-2: var(--b3); --line: rgba(88,110,117,.22);
  --text: var(--b00); --strong: var(--b02); --muted: var(--b1); --accent: var(--yellow);
  --btn-bg: var(--b02); --btn-fg: var(--b3);
}
body.is-night {
  --bg: var(--b03); --panel: rgba(7,54,66,.78); --panel-2: rgba(0,43,54,.7); --line: rgba(147,161,161,.16);
  --text: var(--b0); --strong: var(--b2); --muted: var(--b01); --accent: var(--violet);
  --btn-bg: var(--b2); --btn-fg: var(--b03);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font); color: var(--text); background: var(--bg);
  transition: background-color var(--sky-t) ease, color var(--sky-t) ease;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  font-size: 15px; line-height: 1.5;
}
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { color: var(--strong); margin: 0; line-height: 1.15; letter-spacing: -.01em; }

/* ------------------------------------------------------------ Himmel */
#sky { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  background: linear-gradient(180deg, #8fc7d9 0%, #e9efd9 55%, var(--b3) 100%);
  transition: opacity var(--sky-t) ease; }
#sky::before { content: ''; position: absolute; inset: 0; opacity: 0; transition: opacity var(--sky-t) ease;
  background: radial-gradient(120% 80% at 70% 10%, #0b4555 0%, #002b36 55%, #00161c 100%); }
body.is-night #sky::before { opacity: 1; }
body.is-dawn #sky { background: linear-gradient(180deg, #2b5f73 0%, #cb7a4b 58%, #f3cf9a 100%); }
body.is-blood #sky::before { background: radial-gradient(120% 80% at 70% 10%, #4a0e0e 0%, #1c0505 60%, #0a0202 100%); }
.stars { position: absolute; inset: 0 0 30% 0; opacity: 0; transition: opacity var(--sky-t) ease; }
body.is-night .stars { opacity: 1; }
.star { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: var(--b3); animation: twinkle 4s ease-in-out infinite; }
@keyframes twinkle { 0%,100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.2); } }
.celestial { position: absolute; right: 9vw; top: 0; width: 110px; height: 110px; }
.moon, .sun { position: absolute; inset: 0; border-radius: 50%; transition: transform var(--sky-t) var(--ease), opacity var(--sky-t) ease; }
.moon { background: radial-gradient(circle at 38% 35%, #fffbea, #eee8d5 55%, #cfc8b0);
  box-shadow: 0 0 60px 18px rgba(253,246,227,.18), inset -14px -10px 0 rgba(0,0,0,.06);
  transform: translateY(70px); opacity: 1; }
.moon::after { content:''; position:absolute; width:18px; height:18px; border-radius:50%; background:rgba(0,0,0,.06); left:58%; top:52%; box-shadow:-34px -22px 0 -4px rgba(0,0,0,.05), -14px 18px 0 -6px rgba(0,0,0,.05); }
.sun { background: radial-gradient(circle, #fff3b0, #f4c542 60%, #e9a92a); box-shadow: 0 0 80px 30px rgba(244,197,66,.35); transform: translateY(380px); opacity: 0; }
body:not(.is-night) .moon { transform: translateY(380px); opacity: 0; }
body:not(.is-night) .sun { transform: translateY(60px); opacity: 1; }
body.is-blood .moon { background: radial-gradient(circle at 38% 35%, #ff8f7a, #dc322f 60%, #7d1311); box-shadow: 0 0 80px 24px rgba(220,50,47,.35); }
.fog { position: absolute; left: -50%; width: 200%; height: 140px; bottom: 60px; opacity: .0; transition: opacity var(--sky-t);
  background: radial-gradient(closest-side, rgba(147,161,161,.22), transparent); filter: blur(8px); animation: drift 38s linear infinite; }
.fog-2 { bottom: 20px; animation-duration: 55s; animation-direction: reverse; }
body.is-night .fog { opacity: 1; }
@keyframes drift { from { transform: translateX(-12%); } to { transform: translateX(12%); } }
.skyline { position: absolute; left: 0; right: 0; bottom: 0; height: 22vh; min-height: 120px; }
.skyline svg { width: 100%; height: 100%; display: block; }
.skyline .hill-back, .skyline .trees-back { fill: #9fb59a; transition: fill var(--sky-t); }
.skyline .hill-front, .skyline .trees-front, .skyline .houses { fill: #6f8a6a; transition: fill var(--sky-t); }
.skyline .lights { fill: #fdf6e3; opacity: .0; transition: opacity var(--sky-t); }
body.is-night .skyline .hill-back, body.is-night .skyline .trees-back { fill: #04323d; }
body.is-night .skyline .hill-front, body.is-night .skyline .trees-front, body.is-night .skyline .houses { fill: #001e26; }
body.is-night .skyline .lights { fill: var(--yellow); opacity: .9; animation: flicker 5s infinite; }
@keyframes flicker { 0%,100% { opacity: .9 } 47% { opacity: .9 } 50% { opacity: .5 } 53% { opacity: .85 } }

/* ------------------------------------------------------------ Layout */
#app { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) 14px calc(124px + env(safe-area-inset-bottom)); min-height: 100vh; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 18px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 40px rgba(0,0,0,.12); transition: background-color var(--sky-t), border-color var(--sky-t); }
.panel + .panel { margin-top: 14px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.eyebrow { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.enter { animation: rise .6s var(--ease) both; }
.enter > * { animation: rise .6s var(--ease) both; }
.enter > *:nth-child(2) { animation-delay: .07s } .enter > *:nth-child(3) { animation-delay: .14s } .enter > *:nth-child(4) { animation-delay: .21s }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------ Buttons & Inputs */
.btn { appearance: none; border: 0; border-radius: 12px; padding: 13px 18px; font-weight: 700; cursor: pointer; letter-spacing: .01em;
  background: var(--btn-bg); color: var(--btn-fg); transition: transform .15s var(--ease), opacity .2s, background .3s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.red { background: var(--red); color: #fff; }
.btn.wolf { background: var(--red); color: #fff; box-shadow: 0 0 30px rgba(220,50,47,.35); }
.btn.violet { background: var(--violet); color: #fff; }
.btn.cyan { background: var(--cyan); color: #fff; }
.btn.magenta { background: var(--magenta); color: #fff; }
.btn.green { background: var(--green); color: #fff; }
.btn.orange { background: var(--orange); color: #fff; }
.btn.small { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.icon-btn { appearance: none; border: 1px solid var(--line); background: var(--panel); border-radius: 12px; width: 40px; height: 40px; cursor: pointer; display: grid; place-items: center; font-size: 17px; }
.input { width: 100%; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); color: var(--strong); outline: none; transition: border-color .2s; }
.input:focus { border-color: var(--accent); }
.input.code { text-transform: uppercase; letter-spacing: .4em; font-weight: 900; text-align: center; font-size: 20px; }
label.field { display: block; font-size: 12px; color: var(--muted); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
label.field .input { margin-top: 6px; text-transform: none; letter-spacing: normal; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 16px 0; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ------------------------------------------------------------ Home */
.hero { text-align: center; padding: 26px 0 18px; }
.hero h1 { font-size: clamp(28px, 7vw, 44px); font-weight: 900; letter-spacing: -.03em; color: var(--b2); text-shadow: 0 2px 30px rgba(0,0,0,.4); }
.hero h1 span { color: var(--red); }
.hero p { color: var(--b1); margin: 8px 0 0; }
.hero-cards { display: flex; justify-content: center; margin: 22px 0 6px; height: 190px; }
.hero-cards .card { width: 116px; margin: 0 -18px; transform-origin: 50% 120%; animation: fan 1.2s var(--ease) both; }
.hero-cards .card:nth-child(1) { --r: -16deg; animation-delay: .1s } .hero-cards .card:nth-child(2) { --r: -6deg; animation-delay: .2s; z-index: 1 }
.hero-cards .card:nth-child(3) { --r: 6deg; animation-delay: .3s; z-index: 2 } .hero-cards .card:nth-child(4) { --r: 16deg; animation-delay: .4s }
@keyframes fan { from { opacity: 0; transform: translateY(40px) rotate(0); } to { opacity: 1; transform: rotate(var(--r)); } }

/* ------------------------------------------------------------ Kopfzeile */
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: 12.5px; font-weight: 700; color: var(--strong); backdrop-filter: blur(8px); }
.chip.code { letter-spacing: .25em; }
.topbar .grow { flex: 1; min-width: 0; }
.phase-title { font-size: 12px; text-transform: uppercase; letter-spacing: .16em; color: var(--muted); font-weight: 700; }
.timer { position: relative; width: 44px; height: 44px; flex: none; }
.timer svg { transform: rotate(-90deg); width: 44px; height: 44px; }
.timer circle { fill: none; stroke-width: 4; }
.timer .track { stroke: var(--line); }
.timer .bar { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .25s linear, stroke .3s; }
.timer.low .bar { stroke: var(--red); }
.timer span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 900; color: var(--strong); }

/* ------------------------------------------------------------ Erzähler */
.narration { position: relative; padding: 18px 20px 18px 54px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); margin-bottom: 14px; backdrop-filter: blur(10px); }
.narration::before { content: '“'; position: absolute; left: 16px; top: 2px; font-size: 54px; font-weight: 900; color: var(--accent); opacity: .7; }
.narration p { margin: 0; font-size: 16.5px; color: var(--strong); font-weight: 500; min-height: 1.5em; }
.narration .caret { display: inline-block; width: .55em; height: 1.05em; background: var(--accent); vertical-align: -.15em; margin-left: 2px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.narration.k-werwolf, .narration.k-verdict { border-color: rgba(220,50,47,.45); }
.narration.k-werwolf::before, .narration.k-verdict::before { color: var(--red); }
.narration.k-end { border-color: var(--yellow); }

/* ------------------------------------------------------------ Karten */
.card { position: relative; aspect-ratio: 200 / 280; perspective: 1200px; }
.card .flip { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .9s var(--ease); }
.card.flipped .flip { transform: rotateY(180deg); }
.card .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 6%; overflow: hidden; box-shadow: 0 18px 40px rgba(0,0,0,.35); }
.card .face.front { transform: rotateY(180deg); }
.card-svg { width: 100%; height: 100%; display: block; }
.card.single .face { position: relative; }
.card-svg .halo { transform-origin: 100px 125px; animation: spin 40s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.card-svg .wolf-eyes { animation: eyes 3.2s ease-in-out infinite; }
@keyframes eyes { 0%, 86%, 100% { opacity: 1 } 90% { opacity: .1 } }
.card-svg .sparkles { animation: twinkle 2.6s ease-in-out infinite; transform-origin: center; }
.card-svg .pupil { animation: look 5s ease-in-out infinite; }
@keyframes look { 0%,100% { transform: translateX(0) } 30% { transform: translateX(-5px) } 60% { transform: translateX(5px) } }
.card-svg .heart { animation: beat 1.4s ease-in-out infinite; transform-origin: 100px 140px; }
@keyframes beat { 0%,100% { transform: scale(1) } 15% { transform: scale(1.08) } 30% { transform: scale(.98) } 45% { transform: scale(1.05) } }
.card-svg .bubbles circle { animation: bubble 2.4s ease-in infinite; }
.card-svg .bubbles circle:nth-child(2) { animation-delay: .6s } .card-svg .bubbles circle:nth-child(3) { animation-delay: 1.2s } .card-svg .bubbles circle:nth-child(4) { animation-delay: 1.8s }
@keyframes bubble { 0% { transform: translateY(18px); opacity: 0 } 30% { opacity: 1 } 100% { transform: translateY(-26px); opacity: 0 } }
.card-svg .flames { animation: flame .5s ease-in-out infinite alternate; transform-origin: 100px 214px; }
@keyframes flame { to { transform: scaleY(1.15) scaleX(.96); } }
.card-svg .lid { animation: peek 4s ease-in-out infinite; transform-origin: 100px 130px; }
@keyframes peek { 0%,100% { transform: scaleY(1) } 45%,60% { transform: scaleY(.45) } }
.card-svg .scope { animation: aim 4s ease-in-out infinite; transform-origin: 100px 140px; }
@keyframes aim { 0%,100% { transform: translate(0,0) } 30% { transform: translate(-4px,3px) } 65% { transform: translate(4px,-2px) } }
.card-svg .mask-eye { animation: eyes 3.8s ease-in-out infinite; }
.card-svg .windows rect { animation: flicker 6s infinite; }
.card.dead::after { content: '✝'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 64px; color: rgba(253,246,227,.92); background: rgba(0,0,0,.45); border-radius: 6%; text-shadow: 0 4px 20px #000; animation: rise .8s var(--ease) both; }

.role-reveal { display: grid; justify-items: center; text-align: center; gap: 14px; }
.role-reveal .card { width: min(210px, 50vw); cursor: pointer; }
.role-reveal .card:not(.flipped) .flip { animation: wobble 2.6s ease-in-out infinite; }
@keyframes wobble { 0%,100% { transform: rotateY(0) rotateZ(0) } 25% { transform: rotateY(-8deg) rotateZ(-1deg) } 75% { transform: rotateY(8deg) rotateZ(1deg) } }
.role-name { font-size: 28px; font-weight: 900; letter-spacing: -.02em; }
.role-team { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; color: #fff; }
.role-text { max-width: 420px; margin: 0 auto; }

/* ------------------------------------------------------------ Spieler */
.players { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.player { position: relative; appearance: none; border: 1.5px solid var(--line); background: var(--panel-2); border-radius: 16px; padding: 12px 6px 10px; text-align: center; cursor: default; transition: transform .2s var(--ease), border-color .2s, background .2s, opacity .4s; color: var(--text); }
.player.selectable { cursor: pointer; }
.player.selectable:hover { border-color: var(--accent); }
.player.selectable:active { transform: scale(.96); }
.player.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, transparent); transform: translateY(-2px); box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 30%, transparent); }
.player.dead { opacity: .5; }
.player.dead .avatar { filter: grayscale(1); }
.player.disabled { opacity: .35; cursor: not-allowed; }
.avatar { width: 46px; height: 46px; margin: 0 auto 6px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 17px; color: #fff; position: relative; }
.avatar .mini { position: absolute; inset: -3px; border-radius: 50%; overflow: hidden; }
.avatar .mini svg { width: 100%; height: 140%; margin-top: -18%; }
.pname { font-size: 12.5px; font-weight: 700; color: var(--strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prole { font-size: 10.5px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badges { position: absolute; top: 4px; right: 6px; display: flex; gap: 2px; font-size: 13px; }
.badges-l { position: absolute; top: 4px; left: 6px; display: flex; gap: 2px; font-size: 12px; }
.offline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--b01); display: inline-block; margin-top: 4px; }
.vote-count { position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); background: var(--red); color: #fff; font-size: 11px; font-weight: 900; border-radius: 999px; padding: 1px 8px; }
.paws { position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%); display: flex; gap: 2px; }
.paws span { background: var(--red); color: #fff; font-size: 10px; border-radius: 999px; padding: 1px 6px; font-weight: 700; white-space: nowrap; animation: rise .3s both; }
.kick { position: absolute; top: 2px; right: 4px; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 14px; }

/* ------------------------------------------------------------ Lobby */
.code-big { font-size: 46px; font-weight: 900; letter-spacing: .3em; color: var(--strong); text-align: center; padding-left: .3em; }
.roles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 10px; }
.role-toggle { appearance: none; border: 1.5px solid var(--line); background: var(--panel-2); border-radius: 14px; padding: 8px; cursor: pointer; text-align: center; transition: all .2s var(--ease); }
.role-toggle .card { width: 62px; margin: 0 auto 6px; }
.role-toggle .card .face { box-shadow: 0 6px 14px rgba(0,0,0,.25); }
.role-toggle.off { opacity: .42; filter: grayscale(.8); }
.role-toggle.on { border-color: var(--accent); }
.role-toggle .t { font-size: 12px; font-weight: 700; color: var(--strong); }
.role-toggle[disabled] { cursor: default; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.stepper button { appearance: none; border: 0; background: transparent; width: 38px; height: 38px; cursor: pointer; font-size: 18px; font-weight: 700; }
.stepper span { min-width: 64px; text-align: center; font-weight: 900; color: var(--strong); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.switch input { display: none; }
.switch .knob { width: 42px; height: 24px; border-radius: 999px; background: var(--line); position: relative; transition: background .2s; flex: none; }
.switch .knob::after { content: ''; position: absolute; width: 18px; height: 18px; top: 3px; left: 3px; border-radius: 50%; background: #fff; transition: transform .25s var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + .knob { background: var(--green); }
.switch input:checked + .knob::after { transform: translateX(18px); }
.composition { display: flex; flex-wrap: wrap; gap: 6px; }
.composition .chip { font-size: 12px; }

/* ------------------------------------------------------------ Nacht */
.sleep { text-align: center; padding: 26px 10px; }
.sleep .eyes { font-size: 56px; display: inline-block; animation: breathe 4s ease-in-out infinite; }
@keyframes breathe { 0%,100% { transform: scale(1); opacity: .9 } 50% { transform: scale(1.06); opacity: .6 } }
.zzz { display: inline-block; font-weight: 900; color: var(--muted); animation: zz 3s ease-in-out infinite; }
@keyframes zz { 0% { transform: translate(0,0); opacity: 0 } 30% { opacity: 1 } 100% { transform: translate(20px,-30px); opacity: 0 } }
.action-head { display: flex; gap: 14px; align-items: center; }
.action-head .card { width: 64px; flex: none; }
.notice { padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 14%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); color: var(--strong); }
.notice.red { --accent: var(--red); } .notice.green { --accent: var(--green); } .notice.magenta { --accent: var(--magenta); } .notice.cyan { --accent: var(--cyan); }
.thief-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.thief-cards button { appearance: none; border: 2px solid transparent; background: none; padding: 4px; border-radius: 14px; cursor: pointer; transition: all .2s; text-align: center; }
.thief-cards button.selected { border-color: var(--accent); transform: translateY(-4px); }
.seer-result { display: grid; justify-items: center; gap: 8px; text-align: center; }
.seer-result .card { width: 170px; }

/* ------------------------------------------------------------ Morgen / Urteil */
.deaths { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; }
.death { text-align: center; width: 132px; animation: rise .8s var(--ease) both; }
.death:nth-child(2) { animation-delay: .5s } .death:nth-child(3) { animation-delay: 1s }
.death .card { width: 132px; }
.death .cause { font-size: 12px; color: var(--muted); margin-top: 4px; }
.death .n { font-weight: 900; color: var(--strong); margin-top: 8px; }
.peace { text-align: center; font-size: 44px; animation: breathe 3s ease-in-out infinite; }
.votes-list { display: grid; gap: 6px; }
.vote-line { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.vote-line .bar { height: 8px; border-radius: 99px; background: var(--red); transition: width .8s var(--ease); }
.badge-anim { display: grid; justify-items: center; gap: 10px; text-align: center; }
.badge-anim .card { width: 150px; animation: medal 1.4s var(--ease) both; }
@keyframes medal { 0% { transform: translateY(-120px) rotate(-20deg); opacity: 0 } 60% { transform: translateY(8px) rotate(4deg); opacity: 1 } 100% { transform: none } }
.shot-flash { position: fixed; inset: 0; background: #fff; pointer-events: none; z-index: 50; animation: flash .7s ease-out both; }
@keyframes flash { from { opacity: .85 } to { opacity: 0 } }
.shake { animation: shake .5s both; }
@keyframes shake { 10%,90% { transform: translateX(-2px) } 20%,80% { transform: translateX(4px) } 30%,50%,70% { transform: translateX(-6px) } 40%,60% { transform: translateX(6px) } }

/* ------------------------------------------------------------ Ende */
.win { text-align: center; padding: 10px 0; }
.win h2 { font-size: clamp(28px, 7vw, 40px); font-weight: 900; margin-top: 8px; }
.win .icon { font-size: 70px; animation: medal 1.4s var(--ease) both; display: inline-block; }
.reveal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 12px; }
.reveal-grid .item { text-align: center; animation: rise .6s var(--ease) both; }
.reveal-grid .card { width: 100%; }
.reveal-grid .n { font-weight: 700; color: var(--strong); font-size: 13px; margin-top: 6px; }
.confetti { position: fixed; top: -20px; width: 8px; height: 14px; z-index: 40; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ------------------------------------------------------------ Desktop */
.vlist { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; margin-top: 10px; }
.vrow { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 10px; transition: opacity .4s, background .2s; }
.vrow:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.vrow.dead { opacity: .5; }
.vrow .avatar.sm { width: 32px; height: 32px; margin: 0; font-size: 12px; flex: none; }
.vrow .vmeta { flex: 1; min-width: 0; overflow: hidden; }
.side > * { min-width: 0; }
.vrow .pname { font-size: 13px; text-align: left; }
.vrow .prole { font-size: 11px; text-align: left; }
.vrow .vbadges { font-size: 13px; display: flex; gap: 3px; color: var(--muted); }
.vrow .tick { color: var(--green); font-weight: 900; }
.role-name.sm { font-size: 20px; }
.side-role .card { width: 76px; flex: none; }
.side-log .log { margin-top: 10px; max-height: 220px; overflow: auto; font-size: 12.5px; }
.notes { margin: 6px 0 0; padding-left: 18px; }
@media (min-width: 1000px) {
  #app { max-width: 1240px; padding: 22px 28px 60px; }
  #app:not(.desk) { max-width: 1100px; }
  .layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
  .side { position: sticky; top: 22px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; overflow-x: hidden; max-height: calc(100vh - 44px); overflow: auto; scrollbar-width: thin; padding-bottom: 4px; }
  .side .panel + .panel { margin-top: 0; }
  .narration p { font-size: 18px; }
  .players { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
  .avatar { width: 54px; height: 54px; font-size: 19px; }
  .pname { font-size: 13.5px; }
  .panel { padding: 22px; }
  .sleep { padding: 70px 20px; }
  .sleep .eyes { font-size: 80px; }
  .role-reveal .card { width: 230px; }
  .death, .death .card { width: 160px; }
  .seer-result .card { width: 200px; }
  .action-head .card { width: 78px; }
  .thief-cards { max-width: 460px; margin: 0 auto; }
  .reveal-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .hero { padding-top: 40px; }
  .hero-cards { height: 250px; } .hero-cards .card { width: 150px; margin: 0 -22px; }
  #app:not(.desk) > .enter:has(.hero) { max-width: 520px; margin: 0 auto; }
  .lobby-grid { display: grid; grid-template-columns: 380px minmax(0, 1fr); grid-template-areas: "code roles" "players roles" "start roles" ". roles"; gap: 18px; align-items: start; }
  .lobby-grid .panel + .panel { margin-top: 0; }
  .l-code { grid-area: code; } .l-players { grid-area: players; } .l-roles { grid-area: roles; } .l-start { grid-area: start; }
  .lobby-grid .players { grid-template-columns: repeat(3, 1fr); }
  .roles-grid { grid-template-columns: repeat(6, 1fr); }
  .role-toggle .card { width: 72px; }
  .sheet { top: 50%; bottom: auto; border-radius: 22px; transform: translate(-50%, -50%); animation: pop .3s var(--ease) both; max-height: 84vh; }
  .sheet .grab { display: none; }
  .btn:not(:disabled):hover { filter: brightness(1.06); transform: translateY(-1px); }
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, -46%) scale(.97); } to { opacity: 1; transform: translate(-50%, -50%); } }

/* ------------------------------------------------------------ Bottom bar & Sheets */
.dock { position: fixed; z-index: 20; left: 50%; transform: translateX(-50%); bottom: max(12px, env(safe-area-inset-bottom)); display: flex; gap: 8px; padding: 8px; border-radius: 20px;
  background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.dock button { appearance: none; border: 0; background: transparent; padding: 8px 12px; border-radius: 13px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; font-weight: 700; color: var(--text); min-width: 64px; }
.dock button .i { font-size: 19px; line-height: 1; }
.dock button.on { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--strong); }
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 30; animation: fadein .25s both; }
@keyframes fadein { from { opacity: 0 } }
.sheet { position: fixed; z-index: 31; left: 50%; bottom: 0; width: min(560px, 100%); transform: translateX(-50%); max-height: 86vh; overflow: auto;
  background: var(--bg); color: var(--text); border-radius: 22px 22px 0 0; padding: 22px 18px calc(24px + env(safe-area-inset-bottom)); animation: up .35s var(--ease) both; border: 1px solid var(--line); }
@keyframes up { from { transform: translate(-50%, 100%) } to { transform: translate(-50%, 0) } }
.sheet .grab { width: 44px; height: 5px; border-radius: 9px; background: var(--line); margin: -8px auto 14px; }
.log { font-size: 13px; display: grid; gap: 6px; }
.log div { padding-left: 12px; border-left: 2px solid var(--line); }
.notes li { margin: 4px 0; }

#toast { position: fixed; left: 50%; top: 16px; transform: translate(-50%, -80px); z-index: 60; background: var(--b02); color: var(--b2); padding: 10px 16px; border-radius: 12px; font-size: 13.5px; font-weight: 700; transition: transform .35s var(--ease); box-shadow: 0 10px 30px rgba(0,0,0,.3); max-width: 90vw; }
#toast.show { transform: translate(-50%, 0); }

@media (max-width: 420px) {
  .players { grid-template-columns: repeat(3, 1fr); }
  .reveal-grid { grid-template-columns: repeat(3, 1fr); }
  .narration p { font-size: 15.5px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
