:root {
  --fire: #d32f2f; --water: #0288d1; --earth: #388e3c;
  --air: #80deea; --light: #fbc02d; --shadow: #7b1fa2;
  --gold: #c5a059; --dark-bg: #050505;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }

body {
  background: #000; /* Kein Bild, keine Farbe, nur Dunkelheit */
  font-family: 'Lato', sans-serif; 
  color: #e0e0e0;
  height: 100%; 
  margin: 0; 
  overflow: hidden; 
}

/* 2. LOBBY: Undurchsichtig und edel */
#lobby {
    position: fixed; inset: 0;
    
    /* WICHTIG: Kein 'rgba' mehr! Volle Deckkraft (#111 ist sehr dunkles Grau) */
    background: radial-gradient(circle at center, #1a1a1a 0%, #000 100%);
    
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lobby-container {
    background: linear-gradient(145deg, rgba(30,30,30,0.9), rgba(10,10,10,0.95));
    border: 2px solid var(--gold);
    border-radius: 15px;
    box-shadow: 0 0 50px rgba(0,0,0,0.8), 0 0 20px rgba(197, 160, 89, 0.2);
    padding: 40px;
    width: 800px;
    max-width: 95vw;
    text-align: center;
    position: relative;
}

.lobby-title {
    font-family: 'Cinzel', serif;
    font-size: 4rem;
    color: var(--gold);
    text-shadow: 0 4px 10px #000;
    margin: 0 0 30px 0;
    letter-spacing: 2px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 20px;
}

.user-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80px;
    margin-bottom: 30px;
}

.menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; 
    gap: 30px;
    margin-bottom: 30px;
}

.menu-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.section-header {
    font-family: 'Cinzel', serif;
    color: #aaa;
    font-size: 1.2rem;
    text-transform: uppercase;
    border-bottom: 1px solid #444;
    padding-bottom: 5px;
    margin-bottom: 10px;
    text-align: left;
}

.lobby-footer {
    display: flex;
    justify-content: center;
    gap: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 20px;
}

.lobby-btn {
    background: linear-gradient(180deg, #333, #222);
    border: 1px solid #555;
    color: #ddd;
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    padding: 15px;
    cursor: pointer;
    border-radius: 6px;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.lobby-btn:hover {
    background: #444;
    border-color: var(--gold);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

#btn-earth:hover { border-color: var(--earth); box-shadow: 0 0 15px var(--earth); }
#btn-fire:hover { border-color: var(--fire); box-shadow: 0 0 15px var(--fire); }
#btn-online { 
    background: linear-gradient(180deg, #2e1a47, #1a0d2e); 
    border-color: #8a4fff; 
    height: 100%; 
    font-size: 1.5rem;
}
#btn-online:hover { box-shadow: 0 0 20px #8a4fff; }


/* =========================================
   LAYOUT
   ========================================= */
#game-scene { display: flex !important; flex-direction: row !important; width: 100vw; height: 100vh; overflow: hidden; }
.column { height: 100%; display: flex; flex-direction: column; position: relative; }

.left-col { width: 300px; min-width: 300px; flex-shrink: 0; background: linear-gradient(90deg, rgba(0,0,0,0.8), transparent); border-right: 1px solid rgba(255,255,255,0.1); padding: 20px; gap: 10px; z-index: 100; position: relative; pointer-events: auto; overflow: visible; }
#log-container { flex-grow: 1; display: flex; flex-direction: column; justify-content: flex-end; position: relative; pointer-events: auto; overflow: visible; }
#log-resizer { height: 18px !important; min-height: 18px !important; width: 100%; flex-shrink: 0; background: #333; border: 1px solid #555; border-bottom: none; border-radius: 6px 6px 0 0; cursor: ns-resize; pointer-events: auto; z-index: 50; display: flex; align-items: center; justify-content: center; }
#log-resizer:hover { background: #444; border-color: var(--gold); }
.handle-icon { width: 40px; height: 4px; border-top: 2px solid #888; border-bottom: 2px solid #888; }
#log { width: 100%; height: 300px; min-height: 100px; max-height: 80vh; background: rgba(0,0,0,0.9); border: 1px solid #444; border-top: none; border-radius: 0 0 6px 6px; padding: 10px; overflow-y: auto; pointer-events: auto; flex-grow: 0; flex-shrink: 0; }
#chat-box { display: none; }

.center-col {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /* WICHTIG: Damit die absoluten Kinder (Stats) relativ hierzu sind, falls nötig */
    position: relative; 
    min-width: 0;
    overflow: visible;
}
.stats-bar {
    width: 100%;
    display: flex;
    justify-content: center; /* Zentriert die Symbole horizontal */
    align-items: center;     /* Zentriert vertikal */
    gap: 20px;
    padding: 5px 0;
    z-index: 50;
    
    /* Damit sie sicher über dem Board liegen */
    background: linear-gradient(90deg, transparent, rgba(0,0,0,0.6), transparent);
}
/* Fein-Tuning der Abstände */
.opponent-stats {
    margin-bottom: -20px; /* Zieht sie näher an die gegnerische Hand */
    z-index: 40;
}

.player-stats {
    margin-top: -20px; /* Zieht sie näher an deine Hand */
    z-index: 40;
}
.hand-area { height: 180px; width: 100%; display: flex; justify-content: center; align-items: center; z-index: 50; position: relative; }
.hand-area.top { padding-top: 10px; align-items: flex-start; }
.hand-area.bottom { padding-bottom: 10px; align-items: flex-end; height: 260px; }
.board-area { flex-grow: 1; display: flex; flex-direction: column; justify-content: center; position: relative; width: 100%; }
.field-row { width: 100%; min-height: 240px; display: flex; justify-content: center; align-items: center; gap: 15px; }
#opp-field { align-items: flex-end; padding-bottom: 10px; }
#player-field { align-items: flex-start; padding-top: 10px; }
.spacer { height: 20px; }

/* Rechts: Decks & Friedhöfe */
.right-col {
  width: 480px; 
  min-width: 450px; 
  flex-shrink: 0;
  background: linear-gradient(-90deg, rgba(0,0,0,0.8), transparent);
  border-left: 1px solid rgba(255,255,255,0.1);
  padding: 20px 30px; 
  justify-content: space-between;
  z-index: 100; 
  position: relative; 
}
.stats-row { display: flex; align-items: center; justify-content: space-between; height: 190px; position: relative; width: 100%; }
.status-group { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 80px; }
.deck-group { display: flex; gap: 15px; align-items: center; }

#opp-hp, #player-hp { width: 70px; height: 70px; background: url('../images/heart.png') center/contain no-repeat; display: flex; align-items: center; justify-content: center; filter: drop-shadow(0 3px 5px rgba(0,0,0,0.8)); animation: heartbeat 3s infinite ease-in-out; }
@keyframes heartbeat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
.hp-text span { font-size: 1.5rem; font-family: 'Cinzel', serif; font-weight: 900; color: #fff; text-shadow: 0 2px 3px #000; display: block; margin-top: -3px; }

.mana-orb-small { width: 75px; height: 75px; background: url('../images/mana.png') center/contain no-repeat; display: flex; align-items: center; justify-content: center; filter: drop-shadow(0 2px 5px rgba(0,0,0,0.8)); }
.mana-orb-small span { font-size: 1.4rem; font-family: 'Cinzel', serif; font-weight: 900; color: #fff; text-shadow: 0 2px 3px #000; }

.deck, .graveyard, .opponent-card-back { width: 150px; height: 180px; background-position: center; background-size: 100% 100%; border-radius: 8px; transition: 0.3s; }
.deck { background-color: #1a1008; background-image: url('../images/cardback.jpg'); border: 2px solid #3e2723; box-shadow: 3px 3px 0 #2d1b0e, 0 10px 20px rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; }
.deck-count { font-size: 2rem; font-family: 'Cinzel', serif; font-weight: 900; color: #fff; text-shadow: 0 2px 4px #000; z-index: 10; }

.graveyard { background-color: rgba(50, 50, 50, 0.5); border: 2px dashed #777; background-repeat: no-repeat; display: flex; align-items: center; justify-content: center; font-family: 'Cinzel', serif; font-size: 1.5rem; color: #aaa; cursor: pointer; position: relative; z-index: 101; }
.graveyard:hover { border-color: #fff; color: #fff; box-shadow: 0 0 15px rgba(255,255,255,0.2); }
.graveyard-count { font-size: 2rem; font-family: 'Cinzel', serif; font-weight: 900; color: #fff; text-shadow: 0 2px 4px #000; z-index: 10; pointer-events: none; position: relative; z-index: 200; }

.opponent-card-back { background-image: url('../images/cardback.jpg'); background-repeat: no-repeat; border: 1px solid #111; box-shadow: 0 5px 10px #000; }
.opponent-card-back:hover { transform: translateY(40px) scale(1.4); border-color: var(--gold); z-index: 100; }

#next-turn { width: 100%; padding: 25px; margin-top: 15px; font-family: 'Cinzel', serif; font-size: 1.6rem; font-weight: 900; color: #fff; background: linear-gradient(#5d4037, #3e2723); border: 2px solid var(--gold); border-radius: 8px; cursor: pointer; text-transform: uppercase; box-shadow: 0 5px 15px rgba(0,0,0,0.5); }
#next-turn:hover:not(:disabled) { box-shadow: 0 0 20px var(--gold); border-color: #fff; }
#next-turn:disabled { filter: grayscale(1); opacity: 0.6; }

/* Hand */
.hand { 
    display: flex !important; 
    flex-direction: row !important; 
    justify-content: center; 
    align-items: flex-end; 
    gap: 0; /* JS macht Squeeze */
    height: 100%; 
    width: 100%; 
    pointer-events: none; 
}
.hand .card { pointer-events: auto; }
#opponent-hand { display: flex; flex-direction: row; justify-content: center; gap: 5px; margin-top: -20px; width: 100%; }

/* =========================================
   KARTEN DESIGN (CLEAN FULL ART)
   ========================================= */
.card {
  width: 185px; 
  height: 250px; 
  border-radius: 12px;
  background-color: #1a1a1a; 
  background-size: 100% 100%; 
  background-position: center;
  border: 2px solid #444; 
  box-shadow: 0 5px 15px rgba(0,0,0,0.8);
  position: relative; 
  cursor: pointer;
  overflow: hidden; 
  transition: 0.2s ease-out; 
  transform-style: preserve-3d; 
  backface-visibility: hidden; 
  transform: perspective(1000px) translateY(var(--ty, 0)) scale(var(--s, 1)) rotateX(var(--rx, 0)) rotateY(var(--ry, 0));
}

/* Hover Effects */
.hand .card:hover { --ty: -90px; --s: 1.4; z-index: 1000; filter: brightness(1.2); box-shadow: 0 20px 50px rgba(0,0,0,0.9); border-color: #888 !important; }
.field-row .card:hover { --s: 1.6; z-index: 1000; border-color: #888 !important; box-shadow: 0 30px 60px rgba(0,0,0,0.8); }

/* Rahmen */
.card[data-elem] { border-color: #444 !important; box-shadow: 0 5px 15px rgba(0,0,0,0.8) !important; }
.card.spell { border-color: #444 !important; box-shadow: 0 5px 15px rgba(0,0,0,0.8) !important; }

/* Mana Kosten */
.cost {
    position: absolute;
    top: 5px; left: 5px; 
    width: 40px; height: 40px;
    border-radius: 50%;
    background: #000; 
    border: 2px solid var(--gold); 
    color: var(--gold); 
    display: flex; align-items: center; justify-content: center; 
    font-weight: bold; font-family: 'Cinzel', serif; font-size: 1.5rem; 
    z-index: 20;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.8);
}

.mode-icon { position: absolute; top: 5px; right: 5px; font-size: 1.8rem; z-index: 5; filter: drop-shadow(0 2px 0 #000); }
.card.atk .mode-icon::before { content: "⚔️"; } .card.def .mode-icon::before { content: "🛡️"; }
.card.spell .mode-icon::before { content: "✨"; filter: drop-shadow(0 0 5px #fff); }
.hand .card.spell .mode-icon { display: none; }

.card-content {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 95px; 
  padding: 20px 8px 8px 8px; 
  background: linear-gradient(to top, rgba(0,0,0,0.95) 10%, rgba(0,0,0,0.5) 80%, transparent 100%);
  border-top: none;
  text-align: center;
  display: flex; flex-direction: column; justify-content: flex-end; 
  z-index: 2;
}

.card-name { font-family: 'Cinzel', serif; font-size: 0.9rem; color: #fff; text-shadow: 0 2px 4px #000, 0 0 5px #000; margin-bottom: 2px; line-height: 1.1; }
.card-desc { font-family: 'Lato', sans-serif; font-size: 0.7rem; color: #ddd; font-weight: bold; text-shadow: 0 1px 3px #000; margin-bottom: auto; }

.card-stats {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid rgba(255,255,255,0.2); 
  padding-top: 4px; margin-top: 2px;
  min-height: 25px; 
}
.atk-val { color: #ff5252; font-weight: 900; font-size: 1rem; text-shadow: 0 2px 2px #000; }
.def-val { color: #448aff; font-weight: 900; font-size: 1rem; text-shadow: 0 2px 2px #000; }

/* Overlays */
#action-overlay { position: fixed; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; background: rgba(0,0,0,0.85); z-index: 3000; backdrop-filter: blur(5px); }
.overlay-content { text-align: center; }
#action-overlay h2 { font-family: 'Cinzel', serif; color: var(--gold); font-size: 3rem; margin-bottom: 20px; }
.mode-buttons { display: flex; gap: 20px; justify-content: center; }
.action-btn { background: rgba(0,0,0,0.5); border: 1px solid #777; padding: 20px 40px; font-family: 'Cinzel', serif; font-size: 1.5rem; color: #fff; cursor: pointer; transition: 0.2s; }
.action-btn:hover { background: #fff; color: #000; transform: scale(1.05); }
.cancel-btn { margin-top: 20px; background: transparent; border: none; color: #aaa; cursor: pointer; font-size: 1rem; text-decoration: underline; }

#card-tooltip { position: fixed; z-index: 9999; pointer-events: none; width: 280px; background: rgba(15, 15, 20, 0.98); border: 2px solid var(--gold); border-radius: 8px; padding: 15px; box-shadow: 0 10px 30px #000; text-align: left; }
#tooltip-title { margin: 0 0 10px 0; font-family: 'Cinzel', serif; color: #fff; font-size: 1.3rem; border-bottom: 1px solid #444; padding-bottom: 5px; }
#tooltip-text { margin: 0; font-family: 'Lato', sans-serif; color: #ccc; font-size: 1rem; line-height: 1.4; }
#tooltip-flavor { margin-top: 10px; font-size: 0.9rem; color: var(--gold); font-style: italic; text-transform: uppercase; letter-spacing: 1px; }

#graveyard-overlay { position: fixed; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; background: rgba(0,0,0,0.95); z-index: 4000; pointer-events: auto; }
.card-list { display: flex; flex-wrap: wrap; gap: 25px; justify-content: center; max-width: 90vw; max-height: 80vh; padding: 60px; overflow-y: auto; border: 1px solid #444; border-radius: 8px; background: rgba(0,0,0,0.85); }
#graveyard-list .card { position: relative; --s: 0.85; transform: perspective(1000px) scale(var(--s)) rotateX(var(--rx, 0)) rotateY(var(--ry, 0)); margin: 0; pointer-events: auto !important; cursor: pointer; box-shadow: 0 5px 15px rgba(0,0,0,0.5); transition: transform 0.1s ease-out, box-shadow 0.2s; }
#graveyard-list .card:hover { --s: 1.1; z-index: 5000; box-shadow: 0 20px 50px rgba(0,0,0,1); border-color: var(--gold); }
.card.selectable-revive { border: 2px solid #ffd700 !important; box-shadow: 0 0 15px #ffd700, inset 0 0 20px rgba(255,215,0,0.5) !important; cursor: pointer !important; animation: pulse-gold 1.5s infinite; transform: scale(0.85); }
@keyframes pulse-gold { 0% { box-shadow: 0 0 10px #ffd700; } 50% { box-shadow: 0 0 25px #ffea00; border-color: #fff; } 100% { box-shadow: 0 0 10px #ffd700; } }
#graveyard-return-btn { position: absolute; top: 50%; right: 20px; transform: translateY(-50%); z-index: 5000; padding: 20px 40px; font-family: 'Cinzel', serif; font-size: 1.5rem; color: #fff; background: rgba(0,0,0,0.9); border: 2px solid var(--gold); border-radius: 8px; cursor: pointer; box-shadow: 0 0 50px rgba(0,0,0,0.8); }
#graveyard-return-btn:hover { background: #222; border-color: #fff; }

/* SCROLLBARS */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.5); border-left: 1px solid #333; }
::-webkit-scrollbar-thumb { background: #444; border: 1px solid #222; border-radius: 4px; transition: background 0.2s; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); border-color: #fff; cursor: pointer; }

/* ANIMATIONEN */
.card.face-down { width: 185px !important; height: 250px !important; background-image: url('../images/cardback.jpg') !important; background-size: 100% 100% !important; background-position: center; border: 2px solid #333; box-shadow: 0 5px 15px rgba(0,0,0,0.8); transform: perspective(1000px) scale(var(--s, 1)) rotateX(var(--rx, 0)) rotateY(var(--ry, 0)); transform-style: preserve-3d; transition: transform 0.1s ease-out; margin: 0; }
.card.face-down .card-content, .card.face-down .cost, .card.face-down .card-stats, .card.face-down .mode-icon { display: none !important; }
.card.face-down:hover { --s: 1.1; border-color: var(--gold); box-shadow: 0 0 25px var(--gold); z-index: 100; cursor: help; }
.card.face-down .mode-icon { display: block !important; opacity: 0.7; }
.reveal-flip-out { animation: flipOut 0.4s forwards ease-in; }
.reveal-flip-in { animation: flipIn 0.4s forwards ease-out; }
@keyframes flipOut { 0% { transform: perspective(1000px) rotateY(0deg); } 100% { transform: perspective(1000px) rotateY(90deg); } }
@keyframes flipIn { 0% { transform: perspective(1000px) rotateY(-90deg); } 100% { transform: perspective(1000px) rotateY(0deg); } }
@keyframes fatigue-flash { 0% { box-shadow: inset 0 0 0 0 rgba(255, 0, 0, 0); } 50% { box-shadow: inset 0 0 50px 20px rgba(255, 0, 0, 0.5); } 100% { box-shadow: inset 0 0 0 0 rgba(255, 0, 0, 0); } }
.fatigue-hit { animation: fatigue-flash 0.5s ease-in-out; }
@keyframes cast-fade { 0% { transform: scale(1) translateY(0); box-shadow: 0 0 15px var(--gold); opacity: 1; } 50% { transform: scale(1.15) translateY(-20px); box-shadow: 0 0 50px #fff; opacity: 1; border-color: #fff; } 100% { transform: scale(0.1); opacity: 0; } }
.casting { animation: cast-fade 0.8s forwards ease-in-out; z-index: 2000 !important; }
@keyframes lunge-up { 0% { transform: translateY(0) scale(1); } 40% { transform: translateY(20px) scale(0.9); } 60% { transform: translateY(-150px) scale(1.2); box-shadow: 0 0 30px #fff; } 100% { transform: translateY(0) scale(1); } }
@keyframes lunge-down { 0% { transform: translateY(0) scale(1); } 40% { transform: translateY(-20px) scale(0.9); } 60% { transform: translateY(150px) scale(1.2); box-shadow: 0 0 30px #fff; } 100% { transform: translateY(0) scale(1); } }
.attack-up { animation: lunge-up 0.6s ease-in-out; z-index: 1000 !important; }
.attack-down { animation: lunge-down 0.6s ease-in-out; z-index: 1000 !important; }
@keyframes shake-red { 0%, 100% { transform: translateX(0); filter: none; } 25% { transform: translateX(-5px); filter: sepia(1) saturate(5) hue-rotate(-50deg); } 50% { transform: translateX(5px); } 75% { transform: translateX(-5px); } }
.hit-shake { animation: shake-red 0.4s ease-in-out; }

/* --- OPTIONS & BUTTONS --- */
#btn-options { position: fixed; top: 20px; left: 20px; z-index: 6000; padding: 10px 20px; font-family: 'Cinzel', serif; font-size: 1rem; font-weight: 900; color: #fff; background: linear-gradient(#5d4037, #3e2723); border: 2px solid var(--gold); border-radius: 8px; cursor: pointer; text-transform: uppercase; box-shadow: 0 5px 15px rgba(0,0,0,0.5); transition: 0.2s; }
#btn-options:hover { box-shadow: 0 0 15px var(--gold); border-color: #fff; transform: scale(1.05); }
#options-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.9); z-index: 7000; display: none; flex-direction: column; align-items: center; justify-content: center; backdrop-filter: blur(5px); }
.options-content { background: linear-gradient(135deg, #222, #111); border: 2px solid var(--gold); padding: 40px; border-radius: 12px; width: 400px; box-shadow: 0 0 50px rgba(0,0,0,0.8); }
.slider-group { margin: 20px 0; text-align: left; }
.slider-group label { display: block; font-family: 'Cinzel', serif; color: var(--gold); margin-bottom: 10px; font-size: 1.2rem; }
input[type=range] { -webkit-appearance: none; width: 100%; background: transparent; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; height: 20px; width: 20px; border-radius: 50%; background: var(--gold); border: 2px solid #fff; cursor: pointer; margin-top: -8px; box-shadow: 0 0 10px var(--gold); }
input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 4px; cursor: pointer; background: #444; border-radius: 2px; }
.menu-btn { background: linear-gradient(#5d4037, #3e2723); border: 2px solid var(--gold); color: #fff; font-family: 'Cinzel', serif; font-size: 1.2rem; font-weight: 900; text-transform: uppercase; padding: 15px 30px; border-radius: 8px; cursor: pointer; margin-top: 20px; width: 100%; box-shadow: 0 5px 15px rgba(0,0,0,0.5); transition: 0.2s; }
.menu-btn:hover { background: linear-gradient(#6d5047, #4e3733); box-shadow: 0 0 20px var(--gold); border-color: #fff; transform: scale(1.02); }

/* --- DECK BUILDER --- */
#deckbuilder-screen { position: fixed; inset: 0; background: var(--dark-bg); background-image: radial-gradient(circle, #1a1a1a 0%, #000 100%); z-index: 3000; display: none; flex-direction: column; }
.db-header { height: 120px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 50px; background: rgba(0,0,0,0.9); border-bottom: 2px solid var(--gold); box-shadow: 0 5px 20px rgba(0,0,0,0.8); }
.db-controls { display: flex; align-items: center; gap: 30px; }
.db-header h1 { font-size: 3rem; margin-right: 40px; text-shadow: 0 2px 10px rgba(197, 160, 89, 0.3); }
.fantasy-input, .fantasy-select { background: rgba(0, 0, 0, 0.7); border: 1px solid #555; color: #fff; font-family: 'Cinzel', serif; padding: 12px 20px; font-size: 1.1rem; border-radius: 4px; outline: none; transition: 0.2s; }
.fantasy-input:focus, .fantasy-select:focus { border-color: var(--gold); box-shadow: 0 0 10px rgba(197, 160, 89, 0.3); background: rgba(0, 0, 0, 0.9); }
.fantasy-select option { background: #222; color: #fff; }
.db-content { flex-grow: 1; display: flex; overflow: hidden; }
.db-collection-area { flex-grow: 1; display: flex; flex-direction: column; padding: 20px; overflow-y: auto; background: radial-gradient(circle, #222, #000); }
.db-filter-bar { display: flex; gap: 10px; margin-bottom: 20px; justify-content: center; }
.filter-btn { background: #333; color: #fff; border: 1px solid #555; padding: 8px 20px; cursor: pointer; font-family: 'Cinzel'; }
.filter-btn.active { border-color: var(--gold); background: #444; font-weight: bold; box-shadow: 0 0 15px var(--gold); }
.card-grid { display: flex; flex-wrap: wrap; gap: 15px; justify-content: center; }
.card-grid .card { transform: scale(0.75); margin: -30px -20px; }
.db-deck-area { width: 450px; min-width: 450px; flex-shrink: 0; background: rgba(0,0,0,0.6); border-left: 1px solid #444; padding: 20px; display: flex; flex-direction: column; overflow-y: auto; }
.deck-entry { display: flex; justify-content: space-between; align-items: center; background: linear-gradient(90deg, #222, #111); border: 1px solid #444; padding: 8px; margin-bottom: 5px; cursor: pointer; font-family: 'Lato'; font-size: 0.9rem; color: #ccc; }
.deck-entry:hover { border-color: #aaa; background: #333; }
.deck-entry .mana-cost { background: #00aaff; color: #fff; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 0.8rem; margin-right: 10px; }
.gold-btn { background: linear-gradient(180deg, #3e2723, #251612); border: 1px solid var(--gold); color: var(--gold); font-family: 'Cinzel', serif; font-weight: bold; font-size: 1rem; padding: 10px 20px; cursor: pointer; text-transform: uppercase; border-radius: 4px; transition: all 0.2s ease; box-shadow: 0 4px 0 #1a1008; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.gold-btn:hover { background: linear-gradient(180deg, #5d4037, #3e2723); color: #fff; border-color: #fff; transform: translateY(-2px); box-shadow: 0 6px 0 #1a1008, 0 0 15px var(--gold); }
.gold-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #1a1008; }
.red-btn { background: linear-gradient(180deg, #550000, #330000); border: 1px solid #ff4444; color: #ffcccc; box-shadow: 0 4px 0 #220000; }
.red-btn:hover { background: linear-gradient(180deg, #880000, #550000); color: #fff; box-shadow: 0 6px 0 #220000, 0 0 15px #ff0000; }
.icon-btn { background: none; border: 1px solid #555; color: #ccc; padding: 10px 20px; cursor: pointer; font-family: 'Cinzel'; }
.icon-btn:hover { border-color: #fff; color: #fff; }
#deckbuilder-screen .mode-icon { display: none !important; }
/* HIER WAR DER FEHLER: DIE KLAMMER } HAT GEFEHLT */

/* =========================================
   LOADING SCREEN (Fixed Size & Style)
   ========================================= */

#loading-screen {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--gold);
}

.loader-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loader-content h2 {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    margin: 0;
    animation: pulse 1.5s infinite ease-in-out;
    text-shadow: 0 2px 10px rgba(197, 160, 89, 0.4);
}

/* Der Rahmen für das Bild - Sieht jetzt aus wie eine große Karte */
.loading-image-container {
    width: 240px;  /* Feste Breite (etwas größer als Spielkarten) */
    height: 330px; /* Passendes Hochformat */
    
    border: 2px solid var(--gold);
    border-radius: 15px;
    padding: 5px; /* Kleiner Abstand zwischen Rahmen und Bild */
    background: rgba(20, 20, 20, 0.8);
    box-shadow: 0 0 30px rgba(197, 160, 89, 0.2);
    
    display: flex;
    align-items: center;
    justify-content: center;
}

#loading-art {
    width: 100%;
    height: 100%;
    object-fit: cover; /* WICHTIG: Füllt den Rahmen perfekt aus, ohne Verzerren */
    border-radius: 10px;
    filter: sepia(0.2) brightness(0.9);
}

/* Der Spinner unten */
.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #333;
    border-top: 4px solid var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-top: 10px;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* --- DECKBUILDER COUNTERS --- */
.card-counter-badge {
    position: absolute;
    bottom: 12px; /* Zieht den Badge NACH OBEN in die Karte rein */
    left: 50%;
    transform: translateX(-50%);
    
    /* Etwas kompakteres Design */
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid var(--gold);
    color: #fff;
    font-family: 'Cinzel', serif;
    font-weight: bold;
    font-size: 0.8rem; /* Schrift etwas kleiner */
    padding: 2px 10px;
    border-radius: 10px;
    
    box-shadow: 0 2px 5px rgba(0,0,0,0.9);
    z-index: 50; /* Muss hoch genug sein */
    pointer-events: none;
    white-space: nowrap;
}

/* Optional: Die Karten im Grid brauchen kein Margin mehr für den Badge */
.card-grid .card {
    margin: 0 !important; 
    transform: scale(0.85); /* Grid-Karten etwas kleiner lassen */
}

.card-locked {
    filter: grayscale(1) brightness(0.5);
    cursor: not-allowed !important;
    border-color: #333 !important;
    box-shadow: none !important;
}

/* Anpassung für das Grid, damit Platz für den Badge ist */
.card-grid .card {
    /* Dein existierender Style */
    margin-bottom: 20px !important; /* Mehr Platz unten für Badge */
}

/* --- CAMPAIGN & STORY STYLES --- */

.fullscreen-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 5000;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(5px);
}

.campaign-menu-content {
    width: 900px; max-width: 95vw;
    height: 80vh;
    display: flex; flex-direction: column; align-items: center;
}

.campaign-main-title {
    font-family: 'Cinzel', serif; font-size: 3rem; color: var(--gold);
    text-shadow: 0 0 20px rgba(197, 160, 89, 0.4);
    margin-bottom: 30px;
}

.campaign-list {
    display: flex; flex-wrap: wrap; gap: 20px;
    justify-content: center;
    overflow-y: auto; width: 100%; padding: 20px;
}

.level-card {
    width: 280px; height: 180px;
    background: linear-gradient(145deg, #222, #111);
    border: 1px solid #444; border-radius: 8px;
    padding: 20px;
    cursor: pointer; transition: 0.3s;
    display: flex; flex-direction: column;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.level-active:hover {
    border-color: var(--gold);
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(197, 160, 89, 0.15);
}

.level-locked {
    opacity: 0.5; cursor: not-allowed; filter: grayscale(1);
}

.level-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px; border-bottom: 1px solid #333; padding-bottom: 5px;
}

.level-number { font-family: 'Cinzel'; color: #888; font-size: 0.9rem; }
.level-title { font-family: 'Cinzel'; color: #fff; font-size: 1.2rem; font-weight: bold; margin-bottom: 5px; }
.level-desc { font-size: 0.8rem; color: #aaa; line-height: 1.3; flex-grow: 1; }

/* STORY MODAL (Zwischensequenz) */
.story-modal-content {
    background: url('../images/bg.jpeg') center/cover;
    width: 700px; max-width: 90vw;
    border: 2px solid var(--gold);
    border-radius: 12px;
    box-shadow: 0 0 100px rgba(0,0,0,0.8);
    padding: 50px;
    text-align: center;
    position: relative;
}

.story-modal-content > * { position: relative; z-index: 1; }

.modal-overlay-darken {
    position: absolute; 
    inset: 0;
    background: rgba(0, 0, 0, 0.6); /* 60% Schwarz über dem Bild */
    border-radius: 12px; /* Muss zum Radius der Box passen */
    z-index: 1;
}

.story-title { font-family: 'Cinzel'; font-size: 2.5rem; color: var(--gold); margin: 0; }
.story-subtitle { font-family: 'Lato'; font-size: 1.2rem; color: #aaa; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 30px; }

.story-text-box {
    text-align: left;
    font-family: 'Lato'; font-size: 1.1rem; line-height: 1.6; color: #ddd;
    background: rgba(0,0,0,0.5); border: 1px solid #444;
    padding: 20px; border-radius: 8px; margin-bottom: 30px;
}

.tutorial-tip-box {
    background: rgba(197, 160, 89, 0.1);
    border: 1px dashed var(--gold);
    color: #ffecb3;
    padding: 10px; margin-bottom: 20px;
    font-size: 0.9rem;
}

.story-controls { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; }

#game-modal {
    position: fixed; /* Fixiert über dem Bildschirm */
    inset: 0;        /* Vollbild */
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;   /* WICHTIG: Höher als alles andere (Lobby ist 2000) */
    display: flex; 
    align-items: center; 
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-box {
    background: linear-gradient(145deg, #1a1a1a, #0d0d0d);
    border: 2px solid var(--gold);
    border-radius: 12px;
    padding: 30px;
    width: 500px; max-width: 90vw;
    text-align: center;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
    position: relative;
}

#modal-title {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    font-size: 1.8rem;
    margin: 0 0 15px 0;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

#modal-text {
    font-family: 'Lato', sans-serif;
    color: #ddd;
    font-size: 1.1rem;
    margin-bottom: 30px;
    white-space: pre-line;
}

.modal-btn-group {
    display: flex; justify-content: center; gap: 20px;
}
/* Animationen */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { to { transform: scale(1); } }

/* --- CAMPAIGN MAP STYLES --- */

/* --- CAMPAIGN MAP FIXED --- */

/* Der schwarze Hintergrund für den ganzen Screen */
.fullscreen-overlay {
    position: fixed; inset: 0;
    background: #000;
    z-index: 5000;
    display: flex; align-items: center; justify-content: center;
}

.campaign-map-wrapper {
    width: 100vw; height: 100vh;
    display: flex; flex-direction: column; 
    align-items: center; justify-content: center;
    background: #050505; /* Fallback Farbe */
}

/* Der Kasten, der kollabiert ist -> Jetzt mit erzwungener Höhe */
.campaign-map-container {
    position: relative;
    
    /* 1. Breite festlegen: 90% des Bildschirms */
    width: 90vw;
    
    /* 2. Höhe mathematisch erzwingen (16:9 Verhältnis von 90vw) */
    /* 90 * 9 / 16 = 50.625 */
    height: 50.625vw;
    
    /* 3. Aber niemals höher als 85% des Bildschirms (damit man nicht scrollen muss) */
    max-height: 85vh;
    /* Entsprechend die Breite begrenzen, wenn die Höhe greift */
    max-width: 151vh; 
    
    /* Design */
    background: #222 url('../images/bg.jpeg') center/cover no-repeat;
    border: 3px solid var(--gold);
    border-radius: 12px;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
    overflow: hidden; 
    margin: auto; /* Zentrieren */
}

/* Dunkler Schleier über dem Bild */
.campaign-map-container::before {
    content: ''; position: absolute; inset: 0;
    background: rgba(0, 0, 0, 0.4); 
    pointer-events: none;
}

.campaign-map-title {
    font-family: 'Cinzel', serif; font-size: 2.5rem; color: var(--gold);
    text-shadow: 0 4px 10px #000; margin-bottom: 20px; z-index: 20;
}

/* --- SVG PFADE --- */
.map-paths {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1; pointer-events: none;
}

/* --- NODES (PUNKTE) --- */
.map-node {
    position: absolute;
    width: 50px; height: 50px; /* Feste Größe für den Klickbereich */
    transform: translate(-50%, -50%); /* Zentriert den Punkt exakt auf die Koordinate */
    cursor: pointer; z-index: 10;
    display: flex; align-items: center; justify-content: center;
}

/* Der sichtbare Kreis */
.node-inner {
    width: 20px; height: 20px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: #222;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 0 10px rgba(0,0,0,0.8);
}

/* Hover Effekt: Kreis wird größer */
.map-node:hover .node-inner {
    transform: scale(2);
    border-color: var(--gold);
}

/* STATUS FARBEN */
.node-locked .node-inner { background: #444; border-color: #666; width: 15px; height: 15px; }
.node-completed .node-inner { background: var(--earth); border-color: #fff; box-shadow: 0 0 15px var(--earth); }

/* Das aktuelle Level: Pulsierend und größer */
.node-active .node-inner { 
    background: var(--fire); 
    border-color: var(--gold); 
    width: 25px; height: 25px;
    box-shadow: 0 0 20px var(--fire);
    animation: pulse-node 2s infinite;
}

@keyframes pulse-node {
    0% { box-shadow: 0 0 0 0 rgba(255, 80, 0, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(255, 80, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 80, 0, 0); }
}

/* LABEL (Text unter dem Punkt) */
.node-label {
    position: absolute; 
    top: 40px; 
    white-space: nowrap;
    background: rgba(0,0,0,0.9);
    border: 1px solid var(--gold);
    padding: 5px 10px;
    border-radius: 4px;
    color: #fff; font-family: 'Cinzel', serif; font-size: 0.8rem;
    opacity: 0; 
    transition: 0.2s;
    pointer-events: none;
    z-index: 100;
}

/* Label zeigen beim Hover oder wenn es das aktuelle Level ist */
.map-node:hover .node-label,
.node-active .node-label { 
    opacity: 1; top: 55px; 
}

/* STORY POPUP INNERHALB DER KARTE */
.story-popup-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    z-index: 100;
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.3s;
}
/* --- CAMPAIGN TABS (ORDNER) --- */
.chapter-tabs {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
    max-width: 800px;
    justify-content: center;
}

.chapter-tab {
    flex: 1;
    background: linear-gradient(145deg, #222, #111);
    border: 2px solid #444;
    border-radius: 10px 10px 0 0; /* Oben rund, unten eckig wie Reiter */
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    opacity: 0.7;
}

.chapter-tab:hover {
    opacity: 1;
    transform: translateY(-5px);
}

/* Das aktive Kapitel */
.chapter-tab.tab-active {
    opacity: 1;
    border-color: var(--gold);
    background: linear-gradient(145deg, #3e2723, #251612);
    box-shadow: 0 -5px 20px rgba(197, 160, 89, 0.2);
    z-index: 10;
}

/* Das inaktive Kapitel */
.chapter-tab.tab-inactive {
    border-bottom: none; /* Verbindet sich nicht mit dem Content */
    filter: grayscale(0.8);
}

.tab-title {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    color: #fff;
    font-weight: bold;
}

.tab-sub {
    font-family: 'Lato', sans-serif;
    font-size: 0.9rem;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 5px;
}

.tab-active .tab-title { color: var(--gold); }

.card-flying {
    position: fixed !important;
    z-index: 9999 !important;
    pointer-events: none;
    box-shadow: 0 30px 60px rgba(0,0,0,0.6);
    /* Eine sanfte Kurve für den Flug */
    transition: all 0.7s cubic-bezier(0.19, 1, 0.22, 1); 
    transform-origin: center center;
}

/* Stoppt ALLE Bewegungen im Container (wichtig für exakte Berechnung) */
.no-transition * {
    transition: none !important;
}

/* Unsichtbar aber nimmt Platz ein */
.invisible-placeholder {
    opacity: 0 !important;
    visibility: hidden !important; /* Doppelter Schutz */
    pointer-events: none;
}

@keyframes die-anim {
    0% { transform: scale(1) rotate(0deg); filter: grayscale(0) brightness(1); opacity: 1; }
    30% { transform: scale(1.1); filter: grayscale(1) brightness(2) sepia(1) hue-rotate(-50deg); } /* Aufblitzen in Rot */
    100% { transform: scale(0) rotate(20deg); filter: grayscale(1) brightness(0); opacity: 0; }
}

/* 3. SPAWN ANIMATION (Wenn Karte auf Board landet) */
.card-spawned {
    animation: spawn-drop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes spawn-drop {
    from { transform: scale(1.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.card-dying {
    /* 'forwards' sorgt dafür, dass der Endzustand (unsichtbar) beibehalten wird */
    animation: death-burn 0.7s cubic-bezier(0.55, 0.055, 0.675, 0.19) forwards;
    pointer-events: none; /* Verhindert Klicks während des Sterbens */
    z-index: 99 !important; /* Über anderen Karten sterben */
}

@keyframes death-burn {
    0% {
        opacity: 1;
        transform: scale(1);
        filter: brightness(1) sepia(0) saturate(1);
    }
    30% {
        /* Kurzes Aufleuchten vor dem Tod */
        filter: brightness(1.5) sepia(0.3) saturate(1.5) hue-rotate(-10deg);
    }
    100% {
        opacity: 0;
        transform: scale(0.9) translateY(20px); /* Leichtes Schrumpfen und Absacken */
        /* Verbrennungs-Look: Dunkel, Sepia, rötlich, übersättigt */
        filter: brightness(0) sepia(1) hue-rotate(-50deg) saturate(5) blur(2px);
    }
}


/* Shop Pack Style */
.booster-pack {
    width: 240px; height: 320px;
    background: linear-gradient(135deg, #3e2723, #1a1008);
    border: 3px solid #c5a059;
    border-radius: 15px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Cinzel', serif; font-size: 2rem; color: #c5a059;
    cursor: pointer;
    box-shadow: 0 0 30px rgba(197, 160, 89, 0.4);
    transition: transform 0.3s;
    text-align: center;
}
.booster-pack:hover {
    transform: scale(1.05) rotate(2deg);
    box-shadow: 0 0 50px #c5a059;
    color: #fff; border-color: #fff;
}

#booster-overlay .mode-icon {
    display: none !important;
}

/* 2. Kartengröße erzwingen */
/* Wir stellen sicher, dass Wrapper und Karte exakt deckungsgleich sind */
.booster-cards-container > div {
    /* Der Wrapper in shop.js */
    width: 185px !important;
    height: 250px !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

#booster-overlay .card {
    /* Die Karte selbst */
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important; /* Wichtig: Kein Margin, das verfälscht die Größe */
    box-sizing: border-box !important; /* Rahmen zählt zur Größe dazu */
    
    /* Falls die Rückseite (face-down) Probleme macht */
    max-width: 185px;
    max-height: 250px;
}
