@font-face { font-family: 'Fell SC'; src: url(../fonts/im-fell-english-sc-latin-400-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Fell'; src: url(../fonts/im-fell-english-latin-400-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Fell'; font-style: italic; src: url(../fonts/im-fell-english-latin-400-italic.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Garamond'; src: url(../fonts/eb-garamond-latin-400-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Garamond'; font-weight: 600; src: url(../fonts/eb-garamond-latin-600-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Garamond'; font-style: italic; src: url(../fonts/eb-garamond-latin-400-italic.woff2) format('woff2'); font-display: swap; }

:root {
  --night-1: #070b1d;
  --night-2: #16204a;
  --night-3: #2a3a74;
  --parch: #f1e4c6;
  --parch-2: #e4d1a6;
  --ink: #2e2014;
  --ink-soft: #6b5235;
  --gold: #d4a94e;
  --gold-soft: #a5803a;
  --blood: #8e1f1f;
  --blood-2: #b52b25;
  --moon: #f4ecd2;
  --ok: #3f6b3a;
  --radius: 14px;
  --font-title: 'Fell SC', 'Fell', Georgia, serif;
  --font-text: 'Garamond', Georgia, 'Times New Roman', serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--night-1);
  color: var(--parch);
  font-family: var(--font-text);
  font-size: 18px;
  line-height: 1.4;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-text-size-adjust: 100%;
}
input, select, textarea { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- Himmel ---------- */
.sky {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
  background: linear-gradient(180deg, var(--night-1) 0%, var(--night-2) 55%, var(--night-3) 100%);
  transition: background 2.5s ease;
}
.sky::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, #6fa6d6 0%, #f3c98b 60%, #f0a868 100%);
  opacity: 0; transition: opacity 3s ease;
}
body.day .sky::after { opacity: 1; }
.stars {
  position: absolute; inset: 0; z-index: 1; transition: opacity 3s ease;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 28% 8%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 44% 22%, #ffe 50%, transparent 51%),
    radial-gradient(1px 1px at 61% 12%, #fff 50%, transparent 51%),
    radial-gradient(1.6px 1.6px at 83% 26%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 92% 6%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 6% 40%, #fff 50%, transparent 51%),
    radial-gradient(1.3px 1.3px at 35% 36%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 70% 40%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 52% 50%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 18% 58%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 52%, #fff 50%, transparent 51%);
  animation: twinkle 6s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: 0.6; } to { opacity: 1; } }
.moon {
  position: absolute; z-index: 1; top: max(4vh, 30px); right: 9vw; width: 92px; height: 92px; border-radius: 50%;
  background: radial-gradient(circle at 38% 38%, #fffbea 0%, var(--moon) 45%, #d8cba3 100%);
  box-shadow: 0 0 40px 12px rgba(244, 236, 210, 0.25), 0 0 120px 40px rgba(160, 180, 255, 0.12);
  transition: transform 3s ease, opacity 2.5s ease;
}
.moon::before, .moon::after { content: ''; position: absolute; border-radius: 50%; background: rgba(170, 155, 115, 0.35); }
.moon::before { width: 18px; height: 18px; top: 26px; left: 22px; }
.moon::after { width: 11px; height: 11px; top: 56px; left: 52px; }
.sun {
  position: absolute; z-index: 1; top: max(5vh, 34px); left: 10vw; width: 90px; height: 90px; border-radius: 50%;
  background: radial-gradient(circle, #fff6d0 0%, #ffd56b 55%, #f2a43a 100%);
  box-shadow: 0 0 60px 25px rgba(255, 200, 90, 0.45);
  opacity: 0; transform: translateY(120px); transition: transform 3s ease, opacity 3s ease;
}
body.ingame .moon { opacity: .45; transform: scale(.7) translate(30px, 40px); }
body.day .stars { opacity: 0; animation: none; }
body.day .moon { opacity: 0; transform: translateY(-120px); }
body.day .sun { opacity: 1; transform: none; }
.trees {
  position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; height: 30vh;
  background: url(../img/trees.svg) bottom center / cover no-repeat;
  opacity: 0.95; transition: filter 3s ease;
}
body.day .trees { filter: brightness(2.4) saturate(0.6) hue-rotate(-10deg); }

/* ---------- Grundlayout ---------- */
#app {
  position: relative; z-index: 3;
  min-height: 100%;
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 0 0;
}
.screen { flex: 1; display: flex; flex-direction: column; max-width: 560px; width: 100%; margin: 0 auto; }
.content { flex: 1; padding: 12px 16px 24px; }
.footer {
  position: sticky; bottom: 0; z-index: 5;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(7, 11, 29, 0) 0%, rgba(7, 11, 29, 0.85) 35%);
  display: flex; gap: 10px;
}
body.day .footer { background: linear-gradient(180deg, rgba(60, 30, 10, 0) 0%, rgba(60, 30, 10, 0.55) 35%); }

h1, h2, h3 { font-family: var(--font-title); font-weight: 400; margin: 0; letter-spacing: 0.02em; }
h1 { font-size: 30px; line-height: 1.1; }
h2 { font-size: 22px; }

.bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px 4px;
}
.bar .phase { flex: 1; text-align: center; font-family: var(--font-title); font-size: 20px; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(212, 169, 78, 0.5);
  background: rgba(7, 11, 29, 0.55);
  font-size: 20px; display: grid; place-items: center;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.icon-btn:disabled { opacity: 0.35; }

/* ---------- Pergament ---------- */
.parch {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255,255,255,.35), transparent 60%),
    radial-gradient(ellipse at 100% 100%, rgba(120, 80, 30, .18), transparent 60%),
    var(--parch);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45), inset 0 0 0 1px rgba(110, 80, 40, .35), inset 0 0 24px rgba(120, 80, 30, .25);
  position: relative;
}
.parch + .parch, .parch + .block, .block + .parch, .block + .block { margin-top: 12px; }
.label {
  font-family: var(--font-title); font-size: 13px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--blood); margin-bottom: 6px; display: flex; align-items: center; gap: 6px;
}
.read p { margin: 0; font-family: 'Fell', var(--font-text); font-size: 22px; line-height: 1.35; }
.read.after { padding: 10px 18px; }
.read.after p { font-size: 19px; }
.hint {
  margin: 12px 2px 0; font-size: 17px; color: rgba(241, 228, 198, .92);
  text-shadow: 0 1px 4px rgba(0,0,0,.7);
}
.hint b, .read b { font-weight: 600; }
body.day .hint { color: #fff8e6; text-shadow: 0 1px 6px rgba(60,25,0,.85); }

/* ---------- Kopf eines Schritts ---------- */
.step-head { display: flex; align-items: center; gap: 14px; margin: 6px 0 14px; }
.step-head h1 { text-shadow: 0 2px 10px rgba(0,0,0,.7); }
.step-head .sub { font-size: 15px; opacity: .8; margin-top: 2px; }
.big-icon {
  width: 74px; height: 98px; flex: none; display: grid; place-items: center; font-size: 46px;
  border-radius: 10px; background: radial-gradient(circle at 50% 35%, #2b3870, #0d1433);
  border: 2px solid var(--gold-soft);
  box-shadow: 0 6px 18px rgba(0,0,0,.5);
}
body.day .big-icon { background: radial-gradient(circle at 50% 35%, #fff2cf, #e2b46c); }

/* ---------- Karten ---------- */
.card {
  position: relative; flex: none;
  width: 74px; aspect-ratio: 5 / 7; border-radius: 10px; overflow: hidden;
  background: radial-gradient(circle at 50% 30%, #34417a 0%, #141c42 70%);
  border: 2px solid var(--gold-soft);
  box-shadow: 0 6px 18px rgba(0,0,0,.5), inset 0 0 0 2px rgba(0,0,0,.4);
}
.card.lg { width: 150px; }
.card.sm { width: 46px; border-width: 1px; border-radius: 6px; }
.card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 2; }
.card .glyph { position: absolute; inset: 0 0 22% 0; display: grid; place-items: center; font-size: 2.4em; }
.card.lg .glyph { font-size: 4.4em; }
.card.sm .glyph { font-size: 1.35em; inset: 0; }
.card .cname { z-index: 3;
  position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 2px 4px;
  background: linear-gradient(180deg, #8e1f1f, #5f1212); color: var(--parch);
  font-family: var(--font-title); font-size: 10px; text-align: center; line-height: 1.1;
  border-top: 1px solid var(--gold-soft);
}
.card.lg .cname { font-size: 16px; padding: 6px 4px 7px; }
.card.sm .cname { display: none; }
.card.wolf { background: radial-gradient(circle at 50% 30%, #6a2020 0%, #2a0b0b 70%); }

/* ---------- Spielerauswahl ---------- */
.pick-label { margin: 16px 2px 8px; font-family: var(--font-title); font-size: 17px; text-shadow: 0 1px 4px rgba(0,0,0,.7); }
.players { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.chip {
  min-height: 54px; padding: 8px 10px; border-radius: 12px;
  display: flex; align-items: center; gap: 8px; text-align: left;
  background: rgba(241, 228, 198, .92); color: var(--ink);
  border: 2px solid transparent;
  box-shadow: 0 3px 10px rgba(0,0,0,.35);
  transition: transform .08s ease, background .15s ease;
}
.chip:active { transform: scale(.97); }
.chip .nm { flex: 1; font-weight: 600; font-size: 17px; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; }
.chip .tag { font-size: 12px; color: var(--ink-soft); display: block; font-weight: 400; }
.chip .ic { font-size: 22px; width: 26px; text-align: center; }
.chip.sel { background: var(--blood); color: var(--parch); border-color: var(--gold); }
.chip.sel .tag { color: rgba(241, 228, 198, .8); }
.chip:disabled { opacity: .38; }
.chip.wide { grid-column: span 2; justify-content: center; text-align: center; }
.chip.dead { opacity: .5; text-decoration: line-through; }

.choices { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.choices .chip { grid-column: auto; }

.result { display: flex; gap: 14px; align-items: center; }
.result p { margin: 0; font-size: 19px; }
.deadlist { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.deadlist .who { text-align: center; font-weight: 600; font-size: 16px; }
.deadlist .who .card { margin: 0 auto 6px; }

/* ---------- Buttons ---------- */
.btn {
  flex: 1; min-height: 58px; padding: 12px 18px; border-radius: 14px; border: none;
  font-family: var(--font-title); font-size: 22px; letter-spacing: .03em;
  background: linear-gradient(180deg, #b32a25 0%, #7c1717 100%);
  color: var(--parch);
  box-shadow: 0 6px 18px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.25), inset 0 0 0 1px rgba(212,169,78,.6);
  transition: transform .08s ease, opacity .2s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .4; }
.btn.secondary {
  background: rgba(241, 228, 198, .9); color: var(--ink);
  box-shadow: 0 4px 14px rgba(0,0,0,.35), inset 0 0 0 1px rgba(110,80,40,.4);
}
.btn.small { flex: none; min-height: 44px; font-size: 17px; padding: 8px 14px; }
.btn.gold { background: linear-gradient(180deg, #e2bb63, #a5803a); color: #2a1a08; }
.link { background: none; border: none; color: var(--gold); text-decoration: underline; padding: 6px; font-size: 16px; }

/* ---------- Startseite ---------- */
.home { justify-content: center; text-align: center; padding: 0 20px; }
.home .title { margin-top: 18vh; }
.home h1 { font-size: 44px; text-shadow: 0 4px 20px rgba(0,0,0,.8); }
.home .kicker { font-family: var(--font-title); color: var(--gold); letter-spacing: .25em; font-size: 14px; }
.home .tagline { font-family: 'Fell'; font-style: italic; font-size: 19px; opacity: .9; margin: 10px 0 0; }
.home .actions { display: flex; flex-direction: column; gap: 12px; margin: 34px auto 0; max-width: 360px; }
.home .tips { margin: 28px auto 0; max-width: 380px; font-size: 15px; opacity: .85; text-align: left; }
.home .tips li { margin-bottom: 4px; }

/* ---------- Setup ---------- */
.setup h1 { margin: 6px 0 4px; text-shadow: 0 2px 10px rgba(0,0,0,.7); }
.setup .lead { margin: 0 0 14px; opacity: .9; font-size: 16px; }
.name-row { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.name-row .num { width: 26px; text-align: right; font-family: var(--font-title); color: var(--gold); }
.name-row input {
  flex: 1; min-width: 0; height: 48px; border-radius: 10px; border: 1px solid rgba(110,80,40,.4);
  background: var(--parch); color: var(--ink); font: inherit; font-size: 18px; padding: 0 12px;
}
.name-row .icon-btn { width: 40px; height: 40px; font-size: 16px; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.switch { position: relative; width: 54px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0; border-radius: 16px; background: #8f7c5d; transition: background .2s;
}
.switch span::before {
  content: ''; position: absolute; width: 26px; height: 26px; left: 3px; top: 3px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); transition: transform .2s;
}
.switch input:checked + span { background: var(--blood); }
.switch input:checked + span::before { transform: translateX(22px); }

.role-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid rgba(110,80,40,.2); }
.role-row:last-child { border-bottom: none; }
.role-row .info { flex: 1; min-width: 0; }
.role-row .info b { font-size: 18px; }
.role-row .info small { display: block; font-size: 14px; color: var(--ink-soft); line-height: 1.25; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(110,80,40,.5);
  background: #fff8e8; color: var(--ink); font-size: 22px; line-height: 1;
}
.stepper button:disabled { opacity: .3; }
.stepper .n { width: 24px; text-align: center; font-weight: 600; font-size: 20px; }
.section-title { font-family: var(--font-title); color: var(--blood); font-size: 15px; letter-spacing: .1em; text-transform: uppercase; margin: 12px 0 2px; }
.count-badge { font-family: var(--font-title); font-size: 18px; }
.count-badge.bad { color: #ffb4a8; }

.assign-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid rgba(110,80,40,.2); }
.assign-row:last-child { border-bottom: none; }
.assign-row .nm { flex: 1; font-weight: 600; }
.assign-row select {
  max-width: 55%; height: 42px; border-radius: 10px; border: 1px solid rgba(110,80,40,.5);
  background: #fff8e8; color: var(--ink); font: inherit; font-size: 16px; padding: 0 8px;
}
.mode-switch { display: flex; gap: 8px; margin-bottom: 12px; }
.mode-switch .btn { font-size: 18px; min-height: 48px; }
.mode-switch .btn.active { background: linear-gradient(180deg, #e2bb63, #a5803a); color: #2a1a08; }

/* ---------- Menü ---------- */
#overlay {
  position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.55);
  display: flex; align-items: flex-end; justify-content: center;
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
#overlay[hidden] { display: none; }
.sheet {
  width: 100%; max-width: 560px; max-height: 88vh; overflow: auto;
  border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  animation: up .25s ease;
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet h2 { color: var(--blood); margin: 4px 0 8px; }
.sheet .row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid rgba(110,80,40,.2); }
.sheet .row .nm { flex: 1; }
.sheet .row .nm small { display: block; color: var(--ink-soft); font-size: 14px; }
.sheet .row.dead .nm { text-decoration: line-through; opacity: .6; }
.sheet .vol { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.sheet .vol span { width: 80px; }
.sheet .vol input { flex: 1; accent-color: var(--blood); }
.soundboard { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.soundboard button {
  min-height: 52px; border-radius: 12px; border: 1px solid rgba(110,80,40,.4); background: #fff8e8; color: var(--ink);
  font-size: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.soundboard button span { font-size: 20px; }
.sheet .close { margin-top: 14px; width: 100%; }
.mini { font-size: 13px; padding: 6px 10px; border-radius: 8px; border: 1px solid rgba(110,80,40,.5); background: #fff8e8; color: var(--ink); }

.fade-in { animation: fade .45s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (min-width: 700px) {
  .content { padding-top: 24px; }
}

/* Startseite: Optionen, Anmeldung */
.home-opts { margin: 22px auto 0; max-width: 380px; text-align: left; }
.home-opts small { color: var(--ink-soft); font-size: 13px; }
.login { margin: 30px auto 0; max-width: 340px; width: 100%; text-align: left; display: flex; flex-direction: column; gap: 10px; }
.login label { font-family: var(--font-title); color: var(--blood); letter-spacing: .1em; text-transform: uppercase; font-size: 14px; }
.login input {
  font: inherit; font-size: 28px; letter-spacing: .35em; text-align: center; padding: 10px 12px;
  border: 2px solid var(--gold-soft); border-radius: 10px; background: #fff8e8; color: var(--ink);
}
.login-msg { min-height: 1.3em; margin: 0; color: var(--blood); font-weight: 600; font-size: 15px; }
.login .btn { flex: none; }
.mini { background: none; border: 1px solid var(--gold-soft); border-radius: 8px; color: var(--ink-soft); font-size: 13px; padding: 3px 9px; text-transform: none; letter-spacing: 0; font-family: var(--font-text); }
.small-note { margin: 10px 0 0; font-size: 14px; color: var(--ink-soft); }

/* Bekannte Spieler */
.roster { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rchip { border: 1px solid var(--gold-soft); background: #fff6e0; color: var(--ink); border-radius: 999px; padding: 7px 13px; font-size: 16px; font-weight: 600; }
.rchip:active { transform: scale(.96); }
.rchip.edit { background: #f6d6cf; border-color: var(--blood); color: var(--blood); }

/* Rollen aufdecken per Handy-Weitergabe */
.reveal-start .btn { width: 100%; }
.reveal { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; }
.reveal .lead { margin: 0; }
.reveal .big-icon { margin-bottom: 10px; }
.pass-icon { font-size: 64px; animation: wiggle 2.4s ease-in-out infinite; }
.pass-name { font-size: 42px; color: var(--gold); text-shadow: 0 3px 16px rgba(0,0,0,.8); margin: 4px 0 8px; }
@keyframes wiggle { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }
.hold {
  position: relative; width: min(300px, 86vw); min-height: 380px; border: none; padding: 0; background: none;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: none;
}
.hold-back, .hold-front {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  border-radius: 18px; padding: 18px; transition: opacity .12s;
}
.hold-back { background: rgba(10, 14, 36, .72); border: 2px dashed var(--gold-soft); font-size: 18px; line-height: 1.35; }
.hold-front { opacity: 0; pointer-events: none; background: var(--parch); color: var(--ink); border: 3px solid var(--gold); box-shadow: 0 10px 40px rgba(0,0,0,.6); }
.hold-front p { margin: 0; font-size: 16px; line-height: 1.35; }
.hold-front p b { font-family: var(--font-title); font-weight: 400; font-size: 24px; color: var(--blood); }
.hold.on .hold-front { opacity: 1; }
.hold.on .hold-back { opacity: 0; }
.card-back {
  width: 110px; aspect-ratio: 5 / 7; border-radius: 10px; border: 3px solid var(--gold);
  background:
    radial-gradient(circle at 50% 42%, rgba(212,169,78,.55) 0 18%, transparent 19%),
    repeating-linear-gradient(45deg, #1b2350 0 8px, #141a3d 8px 16px);
  box-shadow: 0 6px 18px rgba(0,0,0,.5);
}

/* Verbindung verloren */
body.offline::before {
  content: 'Keine Verbindung zum Server … versuche es erneut';
  position: fixed; top: env(safe-area-inset-top, 0); left: 0; right: 0; z-index: 50;
  background: var(--blood); color: var(--parch); text-align: center; font-size: 14px; padding: 6px;
}

/* Mit Originalbild braucht die Karte kein Symbol mehr */
.card img ~ .glyph { display: none; }
.card img { object-position: 50% 42%; }
.card .cname { z-index: 3; background: linear-gradient(180deg, rgba(10,14,36,0), rgba(10,14,36,.88) 45%); }
.mode-switch.village { margin: 8px 0 6px; }
.mode-switch.village .btn { flex: 1; }
