:root {
  --night: #0e1822; --night-2: #16232f; --night-3: #1d2f3e; --deep: #080e14;
  --marble: #ece6d6; --ink: #1a1f2b; --text: #e4dfd0; --muted: #94a2ae;
  --bronze: #b8935a; --bronze-dim: #7a6240; --danger: #e0645c; --good: #6fc08b;
  --warrior: #d94b4b; --paladin: #e6b830; --rogue: #a45bd6; --mage: #3f8fe0;
  --serif: 'Palatino Linotype', 'Book Antiqua', Palatino, 'URW Palladio L', Georgia, serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --meander: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='12' viewBox='0 0 24 12'%3E%3Cpath d='M0 11H2V1H22V9H9V5H16' fill='none' stroke='%23b8935a' stroke-width='1.6'/%3E%3C/svg%3E");
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--night); color: var(--text); font: 15px/1.5 var(--sans); }
body { min-height: 100vh; background: radial-gradient(1200px 600px at 20% -10%, #1c3042 0%, transparent 60%), var(--night); }
h1, h2, h3, .brand, .code { font-family: var(--serif); font-weight: 600; }
h3 { margin: 0 0 8px; font-size: 17px; letter-spacing: .02em; }
h3 small { font: 400 12.5px var(--sans); color: var(--muted); margin-left: 8px; letter-spacing: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--bronze); outline-offset: 2px; }
.muted { color: var(--muted); }
.fine { font-size: 13px; }
.warn { color: var(--danger); }
.sub { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.empty { color: var(--muted); margin: 8px 0; font-size: 14px; }

/* ---------- Schaltflächen ---------- */
.btn { background: var(--bronze); color: #1b1408; border: 0; border-radius: 3px; padding: 9px 16px; font-weight: 600; transition: filter .12s; }
.btn:hover:not(:disabled) { filter: brightness(1.1); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--bronze-dim); }
.btn.ghost[aria-pressed='true'] { border-color: var(--bronze); background: #b8935a22; }
.btn.tiny { padding: 3px 9px; font-size: 12.5px; }
.btn.big { padding: 12px 26px; font-size: 16px; }
.btn.wide { width: 100%; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }

/* ---------- Startseite ---------- */
.center { max-width: 520px; margin: 0 auto; padding: 8vh 20px 40px; text-align: center; }
.start .meander { height: 12px; background: var(--meander) repeat-x; margin-bottom: 26px; opacity: .9; }
.start h1 { font-size: clamp(44px, 9vw, 72px); margin: 0; letter-spacing: .12em; text-indent: .12em; }
.lead { color: var(--muted); max-width: 40ch; margin: 12px auto 28px; font-family: var(--serif); font-size: 17px; line-height: 1.55; }
.card-form { text-align: left; background: var(--night-2); border: 1px solid #ffffff14; padding: 22px; border-radius: 3px; }
.card-form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input { width: 100%; background: var(--deep); color: var(--text); border: 1px solid #ffffff22; border-radius: 3px; padding: 10px 12px; font: inherit; }
input::placeholder { color: #5d6d79; }
.or { text-align: center; color: var(--muted); font-size: 13px; margin: 18px 0 8px; }
.joinrow { display: flex; gap: 8px; }
.joinrow input { text-transform: uppercase; letter-spacing: .3em; text-align: center; font-family: var(--serif); font-size: 18px; }

/* ---------- Lobby ---------- */
.lobby { max-width: 980px; margin: 0 auto; padding: 28px 20px 60px; }
.lobby-head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-end; border-bottom: 12px solid transparent; border-image: var(--meander) 0 0 12 0 repeat; padding-bottom: 14px; margin-bottom: 22px; }
.lobby-head h2 { margin: 0; font-size: 30px; }
.codebox { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.code { font-size: 32px; letter-spacing: .25em; padding: 0 .2em 0 .45em; border: 1px solid var(--bronze-dim); background: var(--deep); }
.lobby-grid { display: grid; grid-template-columns: minmax(240px, 1fr) 2fr; gap: 28px; }
.plist { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.plist li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--night-2); padding: 8px 10px; border-left: 3px solid var(--bronze-dim); }
.plist li.away { opacity: .6; }
.plist .cls { color: var(--muted); font-size: 13px; margin-left: auto; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.tag { font-size: 12px; padding: 1px 7px; border: 1px solid var(--bronze-dim); color: var(--bronze); border-radius: 2px; }
.tag.warn { border-color: var(--danger); color: var(--danger); }
.classes { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.classbtn { text-align: left; background: var(--night-2); border: 1px solid #ffffff14; border-top: 4px solid var(--hc); padding: 12px; display: grid; gap: 4px; border-radius: 2px; }
.classbtn:hover:not(:disabled) { background: var(--night-3); }
.classbtn.on { background: var(--night-3); outline: 2px solid var(--hc); }
.classbtn:disabled { opacity: .45; cursor: not-allowed; }
.classbtn .suit { font-size: 26px; color: var(--hc); line-height: 1; }
.classbtn .cname { font: 600 18px var(--serif); }
.classbtn .weapon { color: var(--muted); font-size: 13px; font-style: italic; }
.classbtn .abil { font-size: 13.5px; }
.classbtn .by { color: var(--bronze); font-size: 13px; }
.lobby-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin: 26px 0; }
.lobby-chat { max-width: 560px; }

/* ---------- Spiel-Layout ---------- */
.game { display: grid; grid-template-columns: minmax(0, 1fr) 320px; grid-template-rows: auto minmax(0, 1fr); height: 100vh; height: 100dvh; }
.topbar { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 16px; background: var(--deep); border-bottom: 1px solid #ffffff12; }
.brand { font-size: 19px; letter-spacing: .08em; }
.brand small { font: 400 12px var(--sans); color: var(--bronze); letter-spacing: 0; margin-left: 6px; }
.phase-pill { padding: 3px 12px; border: 1px solid var(--bronze); color: var(--bronze); border-radius: 20px; font-size: 13.5px; }
.deckinfo { color: var(--muted); font-size: 13px; }
.spacer { flex: 1; }
.board { overflow: auto; padding: 16px 20px 28px; display: flex; flex-direction: column; gap: 20px; }

/* ---------- Karten ---------- */
.c-warrior { --hc: var(--warrior); } .c-paladin { --hc: var(--paladin); }
.c-rogue { --hc: var(--rogue); } .c-mage { --hc: var(--mage); }
.card { position: relative; width: 66px; height: 94px; flex: none; padding: 0; border-radius: 6px; background: var(--marble); color: var(--hc); border: 1px solid #c9c0a6; box-shadow: 0 2px 0 #0007; font-family: var(--serif); text-align: left; transition: transform .12s, outline-color .12s; }
.card .rk { position: absolute; top: 5px; left: 7px; font-size: 21px; font-weight: 700; line-height: 1; }
.card .st { position: absolute; top: 28px; left: 8px; font-size: 16px; line-height: 1; }
.card .ct { position: absolute; inset: 0; display: grid; place-items: center; font-size: 36px; opacity: .88; padding-top: 14px; }
.card.sm { width: 52px; height: 74px; } .card.sm .rk { font-size: 17px; } .card.sm .ct { font-size: 26px; } .card.sm .st { top: 22px; font-size: 13px; }
.card.wound { background: #35121a; color: #f09a9a; border-color: #6d2430; }
.card .wd { position: absolute; bottom: 6px; left: 0; right: 0; text-align: center; font-size: 11.5px; font-style: italic; }
.card.wound .rk { font-size: 28px; top: 14px; left: 0; right: 0; text-align: center; }
.card.sel { transform: translateY(-12px); outline: 3px solid var(--bronze); }
.card.dim { opacity: .42; }
.card .badge { position: absolute; left: 50%; bottom: -26px; transform: translateX(-50%); white-space: nowrap; font: 600 12px var(--sans); background: var(--bronze); color: #1b1408; padding: 2px 8px; border-radius: 2px; z-index: 2; }
.hand .card, .hand button.card { width: 74px; height: 106px; }
.hand .card .rk { font-size: 24px; } .hand .card .ct { font-size: 42px; } .hand .card .st { top: 32px; }
.hand .card.wound .rk { font-size: 32px; }

.monster { background: linear-gradient(180deg, #223545, #15222d); color: var(--hc); border: 2px solid var(--hc); width: 70px; height: 100px; box-shadow: 0 3px 0 #0009, 0 0 18px -6px var(--hc); }
.monster .ct { opacity: .5; }
.monster.boss { border-color: var(--bronze); box-shadow: inset 0 0 0 2px var(--hc), 0 3px 0 #0009; }
.monster .bossmark { position: absolute; bottom: 5px; left: 0; right: 0; text-align: center; font: 600 11.5px var(--sans); color: var(--bronze); }
.monster.valid { outline: 3px dashed #fff; outline-offset: 2px; transform: translateY(-4px); }
.monster.hl { outline: 3px solid var(--bronze); outline-offset: 2px; }
.monster.orphan { border-style: dashed; }
.monster.blocked { filter: brightness(.7); }
.monster .tgt, .monster .atk, .monster .blk { position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; font: 600 12px var(--sans); padding: 2px 8px; border-radius: 2px; }
.monster .tgt { top: calc(100% + 5px); background: var(--hc); color: #101010; max-width: 108px; overflow: hidden; text-overflow: ellipsis; }
.monster .atk { top: calc(100% + 29px); max-width: 108px; overflow: hidden; text-overflow: ellipsis; background: transparent; color: var(--hc); border: 1px solid var(--hc); }
.monster .blk { top: calc(100% + 53px); max-width: 108px; overflow: hidden; text-overflow: ellipsis; background: var(--bronze); color: #1b1408; }

/* ---------- Spielfeld ---------- */
.field { display: grid; gap: 18px; }
.lane, .zone { display: flex; flex-wrap: wrap; gap: 0 22px; min-height: 100px; padding-bottom: 6px; }
.lane .monster, .zone .monster { margin-bottom: 34px; }
.monster:has(.atk) { margin-bottom: 58px !important; }
.monster:has(.blk) { margin-bottom: 80px !important; }
.lane .empty, .zone .empty { align-self: center; }
.zone-wrap { position: relative; background: linear-gradient(180deg, #05090d, #0a131b); box-shadow: inset 0 10px 26px #000c; padding: 22px 14px 4px; border-radius: 2px; min-height: 100%; }
.zone-wrap::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 12px; background: var(--meander) repeat-x; opacity: .85; }
.zone-wrap h3 { color: #d3b78a; }
.lane-wrap h3 small, .zone-wrap h3 small { display: inline-block; }

/* ---------- Helden ---------- */
.heroes { display: grid; grid-template-columns: repeat(auto-fit, minmax(235px, 1fr)); gap: 12px; }
.hero { position: relative; background: var(--night-2); border: 1px solid #ffffff12; border-left: 5px solid var(--hc); padding: 10px 12px 10px; display: grid; gap: 5px; border-radius: 2px; }
.hero.me { background: var(--night-3); }
.hero.hl { outline: 2px solid var(--bronze); }
.hero.dead { opacity: .45; filter: grayscale(.8); }
.hero header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.hero .suit { color: var(--hc); font-size: 20px; line-height: 1; }
.hero .role { color: var(--muted); font-size: 13px; }
.hero .state { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.hero .state.rdy { color: var(--good); }
.hp { display: flex; gap: 2px; }
.hp i { flex: 1; height: 8px; background: #ffffff14; border-radius: 1px; }
.hp i.on { background: var(--hc); }
.counts { color: var(--muted); font-size: 12.5px; }
.intent { display: flex; flex-wrap: wrap; gap: 5px; }
.intent span { background: #b8935a22; border: 1px solid var(--bronze-dim); padding: 1px 7px; font-size: 12.5px; border-radius: 2px; }
.ability { font-size: 12.5px; color: var(--bronze); }

/* ---------- Aktionsbereich ---------- */
.me { display: grid; gap: 12px; }
.panel { background: var(--night-2); border: 1px solid var(--bronze-dim); padding: 12px 14px; border-radius: 2px; max-width: 760px; }
.panel p { margin: 0 0 4px; }
.hand { display: flex; flex-wrap: wrap; gap: 14px; padding: 12px 4px 34px; min-height: 120px; }
.choice { margin-bottom: 10px; }
.choice-row { display: grid; gap: 4px; margin: 8px 0; font-size: 14px; }
.mini { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Seitenleiste ---------- */
.side { grid-column: 2; display: flex; flex-direction: column; min-height: 0; background: var(--deep); border-left: 1px solid #ffffff12; }
.tabs { display: flex; border-bottom: 1px solid #ffffff12; }
.tab { flex: 1; background: transparent; border: 0; padding: 10px; color: var(--muted); border-bottom: 2px solid transparent; }
.tab.on { color: var(--text); border-bottom-color: var(--bronze); }
.feed { list-style: none; margin: 0; padding: 10px 14px; overflow-y: auto; flex: 1; font-size: 13.5px; display: grid; gap: 5px; align-content: start; }
.feed li { padding-left: 8px; border-left: 2px solid #ffffff18; }
.feed .log-round { border-color: var(--bronze); color: var(--bronze); font-family: var(--serif); margin-top: 8px; }
.feed .log-wound, .feed .log-death, .feed .log-lose { border-color: var(--danger); }
.feed .log-kill, .feed .log-win { border-color: var(--good); }
.feed .log-heal { border-color: #6aa7e0; } .feed .log-banish { border-color: #b08fd0; }
.feed .sys { color: var(--muted); font-style: italic; }
.chatform { display: flex; gap: 6px; padding: 8px; border-top: 1px solid #ffffff12; }

/* ---------- Overlays ---------- */
.overlay { position: fixed; inset: 0; background: #050a0fcc; display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--night-2); border: 1px solid var(--bronze); max-width: 560px; width: 100%; padding: 24px; max-height: 90vh; overflow: auto; position: relative; }
.modal::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 12px; background: var(--meander) repeat-x; transform: translateY(-50%); }
.modal h2 { margin: 6px 0 8px; font-size: 26px; }
.modal.result.win h2 { color: var(--good); } .modal.result.lose h2 { color: var(--danger); }
.rules h2, .rules h3 { margin-bottom: 4px; } .rules p, .rules li { max-width: 62ch; }

/* ---------- Meldungen und Pfeile ---------- */
#toasts { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); display: grid; gap: 6px; z-index: 80; width: min(92vw, 460px); }
.toast { background: #26180f; border: 1px solid var(--bronze); padding: 10px 14px; border-radius: 3px; box-shadow: 0 6px 20px #000a; }
#arrows { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 20; }

/* ---------- Schmale Bildschirme ---------- */
@media (min-width: 1100px) {
  .field { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; gap: 16px; }
  .board { gap: 14px; }
}
@media (max-width: 960px) {
  .game { display: block; height: auto; }
  .topbar { position: sticky; top: 0; z-index: 30; }
  .board { overflow: visible; padding: 14px 12px 40px; }
  .side { display: none; }
  .side.open { display: flex; position: fixed; inset: 52px 0 0 0; z-index: 45; }
  .lobby-grid { grid-template-columns: 1fr; }
  .deckinfo { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Akt II: Götter, Effekte, Übergang ---------- */
.monster.god { --hc: #e8dcb4; width: 92px; height: 124px; background: radial-gradient(circle at 50% 28%, #4a3f22 0%, #1d1a12 70%); border-color: #e8dcb4; box-shadow: 0 3px 0 #0009, 0 0 26px -4px #e8c86a; }
.monster.god.gc-warrior { box-shadow: 0 3px 0 #0009, 0 0 26px -4px var(--warrior), inset 0 0 0 2px var(--warrior); }
.monster.god.gc-paladin { box-shadow: 0 3px 0 #0009, 0 0 26px -4px var(--paladin), inset 0 0 0 2px var(--paladin); }
.monster.god.gc-rogue { box-shadow: 0 3px 0 #0009, 0 0 26px -4px var(--rogue), inset 0 0 0 2px var(--rogue); }
.monster.god.gc-mage { box-shadow: 0 3px 0 #0009, 0 0 26px -4px var(--mage), inset 0 0 0 2px var(--mage); }
.monster .gname { position: absolute; top: 38%; left: 0; right: 0; text-align: center; font: 600 15px var(--serif); letter-spacing: .03em; }
.monster.god .bossmark { color: #e8dcb4; }
.monster.frozen { filter: saturate(.5) brightness(1.1); box-shadow: 0 0 0 3px #9fd8ff, 0 0 16px 2px #9fd8ff88; }
.monster .mark { position: absolute; top: 3px; right: 4px; font: 700 14px var(--sans); }
.monster .mark.ice { color: #9fd8ff; }
.monster .mark.ares { color: #ff8a6a; left: 4px; right: auto; }
.monster.buffed { box-shadow: 0 0 0 2px #ff8a6a, 0 3px 0 #0009; }
.fxbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.fx { font-size: 13px; padding: 3px 10px; border: 1px solid; border-radius: 2px; }
.fx.winter { color: #9fd8ff; border-color: #9fd8ff66; background: #9fd8ff14; }
.fx.plague { color: #b9d86a; border-color: #b9d86a66; background: #b9d86a14; }
.fx.ares { color: #ff8a6a; border-color: #ff8a6a66; background: #ff8a6a14; }
.fx.blind { color: #d79bf0; border-color: #d79bf066; background: #d79bf014; }
.bubbles { display: grid; gap: 10px; margin: 0 0 14px; }
.bubble { position: relative; background: #f1ead6; color: var(--ink); padding: 12px 16px 12px 18px; border-left: 5px solid #b8935a; border-radius: 2px; max-width: 720px; }
.bubble b { font: 700 18px var(--serif); }
.bubble em { margin-left: 8px; color: #6b5a3a; font-size: 13.5px; }
.bubble q { display: block; margin: 4px 0; font: italic 16px/1.4 var(--serif); }
.bubble q::before, .bubble q::after { content: ''; }
.bubble small { display: block; color: #4a4636; font-size: 13px; }
.bubble.gb-warrior { border-left-color: var(--warrior); } .bubble.gb-paladin { border-left-color: var(--paladin); }
.bubble.gb-rogue { border-left-color: var(--rogue); } .bubble.gb-mage { border-left-color: var(--mage); }
.hero .ability.def { opacity: .85; border-style: dashed; }
.hero .hw { color: var(--danger); }
.hero .reveal { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.hero .rv { display: inline-block; margin-left: 4px; padding: 0 5px; border: 1px solid var(--bronze-dim); border-radius: 2px; color: var(--text); }
.hero .rv.w { border-color: var(--danger); color: var(--danger); }
.modal.interlude { max-width: 600px; }
.sumlist { margin: 8px 0; padding-left: 18px; color: var(--muted); }

/* ---------- Lobby: Spielmodus ---------- */
.options { margin: 22px 0 0; background: var(--night-2); border: 1px solid #ffffff14; padding: 12px 16px; }
.options summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; }
.options summary h3 { display: inline; margin: 0; }
.optgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px 18px; margin: 14px 0 8px; }
.opt { display: grid; gap: 3px; align-content: start; font-size: 13.5px; }
.opt > span { color: var(--text); font-weight: 600; }
.opt small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.opt input, .opt select { width: 100%; background: var(--deep); color: var(--text); border: 1px solid #ffffff22; border-radius: 3px; padding: 7px 9px; font: inherit; }
.opt input:disabled, .opt select:disabled { opacity: .7; }
.abil.def { display: block; margin-top: 4px; opacity: .85; }
