/* Drachen & Elemente - Handy zuerst (375 px), auf großen Bildschirmen eine Spalte in der Mitte */
:root {
  --bg: #0b0f1a; --ink: #e9e3cf; --muted: #9fb0cc; --gold: #e4c46a; --gold-d: #b8902a;
  --good: #5fe08a; --bad: #ff6b5e; --panel: #141c2e; --line: #2c3a58;
  --serif: Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overscroll-behavior: none; }
body { -webkit-user-select: none; user-select: none; touch-action: manipulation; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { cursor: default; opacity: .5; }
#app { max-width: 480px; margin: 0 auto; min-height: 100%; }
.loading { padding: 40px 16px; text-align: center; color: var(--muted); }
img { -webkit-user-drag: none; }

/* ---------- Knöpfe ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 20px; border-radius: 12px; font-weight: 700; font-size: 16px; border: 2px solid transparent; }
.btn.primary { background: linear-gradient(180deg, #ffe28a, #c4921f); color: #3a2a05; border-color: #fff3c0; box-shadow: 0 2px 10px #0008; }
.btn.ghost { background: #ffffff10; border-color: var(--line); color: var(--ink); }
.btn.danger { background: #5a1d1d; border-color: #a33; color: #ffd6d0; }
.btn.big { width: 100%; min-height: 54px; font-size: 19px; }

/* ---------- Menü ---------- */
.menu-screen { padding: calc(env(safe-area-inset-top) + 18px) 16px 28px; display: flex; flex-direction: column; gap: 16px; min-height: 100dvh; background: radial-gradient(ellipse at 50% 0%, #22304f 0%, var(--bg) 62%); }
.menu-screen h1 { font-family: var(--serif); font-size: 34px; text-align: center; color: var(--gold); letter-spacing: .02em; text-shadow: 0 2px 10px #000a; }
.menu-screen h1 span { color: var(--ink); font-size: .8em; }
.menu-screen header p { text-align: center; color: var(--muted); font-size: 14px; margin-top: 4px; }
.menu-screen h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 8px; }
.heroes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hero-card { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px; border-radius: 14px; background: var(--panel); border: 2px solid var(--line); text-align: center; }
.hero-card.sel { border-color: var(--gold); box-shadow: 0 0 0 2px #e4c46a55, 0 4px 16px #000a; background: #1a2540; }
.hc-name { font-weight: 700; margin-top: 6px; }
.hc-el { font-size: 12px; color: var(--l); }
.hc-txt { font-size: 12px; color: var(--muted); line-height: 1.25; margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chip { padding: 8px 14px; border-radius: 999px; background: var(--panel); border: 2px solid var(--line); font-size: 14px; min-height: 38px; }
.chip.sel { border-color: var(--gold); color: var(--gold); background: #1a2540; }
.menu-screen footer { margin-top: auto; padding-top: 12px; font-size: 12px; color: var(--muted); line-height: 1.4; }
.menu-screen footer a { color: var(--gold); }
.menu-screen footer p { margin-top: 8px; }

/* ---------- Helden ---------- */
.avatar { position: relative; width: 52px; height: 52px; flex: none; border-radius: 50%; border: 3px solid var(--l, var(--gold)); background: radial-gradient(circle at 50% 35%, var(--c), #10131a 90%); box-shadow: 0 3px 8px #000a; display: grid; place-items: center; }
.avatar.big { width: 96px; height: 96px; margin: 0 auto 8px; }
.av-in { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; display: grid; place-items: center; color: var(--l); }
.av-in svg { width: 55%; height: 55%; }
.av-in img { width: 100%; height: 100%; object-fit: cover; }
.av-hp { position: absolute; right: -8px; bottom: -6px; min-width: 26px; height: 26px; padding: 0 3px; border-radius: 13px; background: radial-gradient(circle at 35% 25%, #ff9a8a, #c4261c 60%, #6e0f0a); border: 2px solid #f5e6b0; color: #fff; font: 700 15px/22px var(--serif); text-align: center; }
.av-armor { position: absolute; left: -8px; bottom: -6px; min-width: 26px; height: 22px; padding: 0 4px; border-radius: 11px; background: #3a4a6a; border: 2px solid #cfd8ea; font-size: 12px; line-height: 18px; text-align: center; }
.avatar.is-target, .slot.is-target .card { outline: 3px solid #ffd24a; outline-offset: 2px; animation: pulse 0.9s ease-in-out infinite; }
@keyframes pulse { 50% { outline-color: #ff6b5e; box-shadow: 0 0 14px #ff6b5e; } }

/* ---------- Spielbildschirm ---------- */
.game { position: relative; display: flex; flex-direction: column; height: 100dvh; overflow: hidden; background: radial-gradient(ellipse at 50% 35%, #26365a 0%, #131b2e 55%, #080c15 100%); padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
.herobar { display: flex; align-items: center; gap: 12px; height: 66px; padding: 6px 12px; }
.herobar.me { flex: 1; min-width: 0; }
.hinfo { flex: 1; min-width: 0; }
.hname { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.small { font-size: 11px; color: var(--muted); }
.crystals { display: flex; align-items: center; gap: 2px; margin: 3px 0; }
.crystals i { width: 9px; height: 14px; background: #243455; border: 1px solid #5a73a8; transform: skewX(-8deg); border-radius: 2px; }
.crystals i.on { background: linear-gradient(180deg, #9ad0ff, #2a6fe0); box-shadow: 0 0 5px #4aa0ff; }
.crystals span { margin-left: 6px; font-size: 11px; color: #cfe3ff; }
.backs { display: flex; padding-left: 14px; }
.card-back { width: 24px; height: 36px; margin-left: -14px; border-radius: 4px; background: linear-gradient(160deg, #1b2b52, #0b1226); border: 2px solid #c9a24a; box-shadow: 0 2px 4px #000a; }
.board { flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px; padding: 0 8px; min-height: 0; }
.empty { color: #ffffff30; font-size: 13px; }
.mid { position: relative; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px; background: linear-gradient(90deg, #0000, #ffffff12, #0000); }
.turn { flex: 1; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #cfe3ff; }
.turn.mine { color: var(--gold); }
.menu-btn { width: 36px; height: 36px; border-radius: 10px; background: #ffffff14; font-size: 18px; }
.endturn { height: 36px; padding: 0 16px; border-radius: 18px; background: linear-gradient(180deg, #ffe28a, #c4921f); border: 2px solid #fff3c0; color: #3a2a05; font-weight: 700; font-size: 14px; box-shadow: 0 2px 8px #000a; }
.endturn.glow { animation: glow 1.2s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 16px 3px #ffe28a; } }
.mebar { display: flex; align-items: center; padding-right: 12px; }
.power { position: relative; flex: none; width: 48px; height: 48px; border-radius: 50%; color: var(--l); background: radial-gradient(circle at 35% 30%, var(--c), #10131a 95%); border: 3px solid #6b7690; opacity: .65; display: grid; place-items: center; }
.power svg { width: 55%; height: 55%; }
.power.ready { opacity: 1; border-color: #fff3c0; box-shadow: 0 0 12px var(--c); }
.power.selected { outline: 3px solid #ffd24a; }
.power .cost { position: absolute; right: -6px; bottom: -6px; width: 22px; height: 22px; border-radius: 50%; background: #1c4fb0; border: 2px solid #9ad0ff; font: 700 13px/18px var(--serif); text-align: center; color: #fff; }
.power .used { position: absolute; left: -4px; top: -4px; width: 18px; height: 18px; border-radius: 50%; background: #3a8a50; font-size: 11px; line-height: 18px; text-align: center; }
.hand { position: relative; flex: none; margin-top: 2px; }
.hc { position: absolute; bottom: 12px; width: var(--hw); transform-origin: 50% 120%; transition: left .2s; }
.hc .card { transition: transform .15s; }
.hc.selected .card { transform: translateY(-14px); }

.slot { position: relative; width: var(--cw); flex: none; transition: transform .15s; }
.slot.ready .card { outline: 2px solid var(--good); outline-offset: 1px; box-shadow: 0 0 10px var(--good); }
.slot.selected { transform: translateY(-6px); }
.slot.selected .card { outline: 3px solid #ffd24a; }
.slot.striking { z-index: 5; animation: lunge .45s ease-in; }
.slot.struck { animation: shake .45s; }
@keyframes lunge { 50% { transform: translateY(-14px) scale(1.12); } }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

.banner { position: absolute; left: 50%; top: calc(env(safe-area-inset-top) + 74px); transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: #0b1226f2; border: 1px solid var(--gold); color: #ffe9a6; font-size: 13px; white-space: nowrap; }
.banner button { padding: 4px 10px; border-radius: 8px; background: #ffffff18; border: 1px solid var(--line); font-size: 12px; }
.toast { position: absolute; left: 50%; bottom: 42%; transform: translateX(-50%); z-index: 45; padding: 10px 16px; border-radius: 12px; background: #0b1226f2; border: 1px solid var(--line); font-size: 14px; animation: fade 1.9s forwards; pointer-events: none; text-align: center; max-width: 90%; }
@keyframes fade { 0% { opacity: 0; } 12%, 80% { opacity: 1; } 100% { opacity: 0; } }
.cast { position: absolute; left: 50%; top: 14%; width: min(210px, 52vw); transform: translateX(-50%); z-index: 40; pointer-events: none; animation: pop 1.15s forwards; filter: drop-shadow(0 8px 24px #000c); }
@keyframes pop { 0% { opacity: 0; transform: translateX(-50%) scale(.6); } 15%, 80% { opacity: 1; transform: translateX(-50%) scale(1); } 100% { opacity: 0; } }
.float { position: absolute; left: 50%; top: 20%; z-index: 20; transform: translateX(-50%); font: 700 24px var(--serif); pointer-events: none; text-shadow: 0 2px 4px #000, 0 0 8px #000; animation: floatUp 1.1s ease-out forwards; }
.float.dmg { color: #ff6b5e; } .float.heal { color: #6ef09a; } .float.arm { color: #9ad0ff; } .float.ice { color: #d9f3ff; }
@keyframes floatUp { from { opacity: 1; margin-top: 0; } to { opacity: 0; margin-top: -48px; } }

/* ---------- Fenster ---------- */
.overlay { position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 12px; background: #050810c4; backdrop-filter: blur(2px); }
.overlay.over { background: #050810e6; }
.pv { width: min(320px, 90vw); max-height: 94dvh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.pv.help, .pv.menu, .pv.hero-info, .pv.result { padding: 18px 16px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); width: min(380px, 92vw); }
.pv h3, .pv h2 { font-family: var(--serif); text-align: center; color: var(--gold); }
.pv.help p, .pv.help li { font-size: 14px; line-height: 1.4; }
.pv.help ul { padding-left: 18px; display: flex; flex-direction: column; gap: 3px; }
.pv.hero-info p { text-align: center; font-size: 14px; line-height: 1.4; }
.pv.result { text-align: center; }
.pv.result .big { font-size: 56px; }
.pv.result.win h2 { color: #6ef09a; } .pv.result.lose h2 { color: #ff8f84; }
.pv .status { font-size: 13px; text-align: center; color: #cfe3ff; }
.kw { list-style: none; font-size: 12px; line-height: 1.35; color: var(--muted); background: #ffffff0c; border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 3px; }
.kw b { color: var(--ink); }
.pv-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.pv-btns.col { flex-direction: column; }
.pv-btns .btn { flex: 1; min-width: 120px; }
.why { width: 100%; text-align: center; font-size: 13px; color: #ffb4a8; }

/* ---------- Mulligan ---------- */
.mullig { height: 100dvh; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 16px 8px; text-align: center; }
.mullig h2 { font-family: var(--serif); color: var(--gold); }
.mullig p { font-size: 14px; color: var(--muted); line-height: 1.4; }
.mc-row { display: flex; justify-content: center; gap: 8px; }
.mc-slot { position: relative; width: var(--hw); flex: none; }
.mc-slot.swap .card { filter: grayscale(.8) brightness(.6); }
.swap-mark { position: absolute; inset: auto 0 38% 0; display: none; font-weight: 700; font-size: 13px; color: #ffe9a6; text-shadow: 0 1px 3px #000; }
.mc-slot.swap .swap-mark { display: block; }

/* ---------- Karten ---------- */
.card { position: relative; width: 100%; aspect-ratio: 2 / 3; container-type: inline-size; font-family: var(--serif); color: #1b1b1b; border-radius: 4.5cqw; }
.card > * { position: absolute; }
.card .art { left: 5.47%; top: 11.85%; width: 89.06%; height: 43.1%; object-fit: cover; border-radius: 3cqw; z-index: 1; }
.card .art.ph { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3cqw; background: radial-gradient(circle at 50% 40%, var(--c), #10131a 85%); color: var(--l); }
.card .art.ph svg { width: 38%; height: 38%; opacity: .9; flex: none; }
.card .phname { padding: 0 6cqw; text-align: center; font: 700 6cqw/1.15 var(--serif); color: var(--l); opacity: .85; text-shadow: 0 .4cqw 1cqw #000; }
.card.board .phname { font-size: 11cqw; padding: 0 3cqw; }
.card.board .art.ph svg { width: 34%; height: 34%; }
.card.hand .phname { font-size: 10cqw; padding: 0 4cqw; }
.card.hand .art.ph svg { width: 36%; height: 36%; }
.card .frame { inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }
.card > :not(.art):not(.frame) { z-index: 3; }
.card .num { transform: translate(-50%, -50%); color: #fff; font-weight: 700; line-height: 1; text-shadow: 0 .6cqw 1cqw #000, 0 0 2cqw #000; }
.card .mana { font-size: 12cqw; }
.card .atk, .card .hp { font-size: 15cqw; }
.card .num.up { color: #8dff9b; } .card .num.down { color: #ff9a8f; }
.card .title { left: 21%; top: 3.6%; width: 70.3%; height: 7.5%; display: grid; place-items: center; overflow: hidden; }
.card .title span { font-weight: 700; font-size: 6.6cqw; white-space: nowrap; }
.card .title.lg span { font-size: 5.4cqw; } .card .title.xl span { font-size: 4.5cqw; }
.card .type { left: 12.2%; top: 56%; width: 75.6%; height: 4.2%; display: flex; align-items: center; justify-content: center; gap: 1.4cqw; font: 700 3.9cqw/1 var(--serif); color: #1b2430; }
.card .type svg { width: 4cqw; height: 4cqw; color: var(--c); }
.el-FEU .type svg { color: #d4501e; } .el-WAS .type svg { color: #1f8fa8; } .el-ERD .type svg { color: #4f8a35; } .el-STU .type svg { color: #7a5fd0; } .el-NEU .type svg { color: #b08a2e; }
.card .text { left: 5.1%; top: 61.2%; width: 89.8%; height: 30.6%; display: flex; align-items: center; justify-content: center; text-align: center; padding: 1cqw 14cqw 1cqw; }
.card .rules { font-size: 5.3cqw; line-height: 1.22; }
.card .gem { left: 50%; top: 92%; width: 3.6cqw; height: 3.6cqw; transform: translate(-50%, -50%) rotate(45deg); border: .5cqw solid #fff8; background: #aab2bc; }
.card .gem.r-Selten { background: #3b8fe0; box-shadow: 0 0 2cqw #3b8fe0; } .card .gem.r-Episch { background: #a55be0; box-shadow: 0 0 2cqw #a55be0; } .card .gem.r-Legendär { background: #ffc933; box-shadow: 0 0 3cqw #ffc933; }
.card .foot { left: 22%; width: 56%; top: 94.4%; text-align: center; font: 2.7cqw/1 system-ui, sans-serif; color: #c5cde0; letter-spacing: .05em; }
.card .badges { right: 6%; top: 13%; display: flex; flex-direction: column; gap: 1cqw; }
.card .b { font-style: normal; font-size: 12cqw; line-height: 1; padding: 1cqw 2cqw; border-radius: 3cqw; background: #0b1226cc; border: .5cqw solid #ffffff55; color: #fff; }
.card.legendary { filter: drop-shadow(0 0 2.4cqw #ffc933aa); }
.card.shielded .art { box-shadow: inset 0 0 6cqw 2cqw #7fd0ff; }
.card.shielded::before { content: ""; position: absolute; inset: 9% 3% 40%; z-index: 4; border-radius: 40%; border: .8cqw solid #bfe9ffcc; background: radial-gradient(circle at 35% 25%, #ffffff55, #7fd0ff22 60%, #0000); }
.card.is-frozen .art { filter: saturate(.55) brightness(1.15) hue-rotate(150deg); }
.card.is-frozen::after { content: ""; position: absolute; inset: 0; z-index: 4; border-radius: 4.5cqw; background: linear-gradient(160deg, #cfeeff66, #7ec8ff22); pointer-events: none; }
.card.guard { box-shadow: 0 0 0 .8cqw #dfe6f5, 0 0 3cqw #dfe6f588; }
.card.dim { filter: brightness(.55) saturate(.7); }
.card.playable { box-shadow: 0 0 3cqw 1cqw var(--good); }

/* Kleine Ansichten: nur Wert und Bild */
.card.board .title, .card.board .type, .card.board .text, .card.board .foot, .card.board .gem, .card.board .mana { display: none; }
.card.board .atk, .card.board .hp { font-size: 22cqw; }
.card.board .badges { top: 12%; right: 5%; } .card.board .b { font-size: 17cqw; }
.card.hand .title, .card.hand .type, .card.hand .text, .card.hand .foot, .card.hand .gem { display: none; }
.card.hand .mana { font-size: 19cqw; }
.card.hand .atk, .card.hand .hp { font-size: 19cqw; }
.card.spell .atk { color: #ffe9a6; }

/* Große Ansicht in den Fenstern */
.pv .card.full { width: 100%; filter: drop-shadow(0 10px 30px #000c); }
.pv .card.legendary.full { filter: drop-shadow(0 0 16px #ffc933aa) drop-shadow(0 10px 30px #000c); }
