body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    text-align: center;
    background-color: #2c2f33;
    color: #ffffff;
    margin: 0;
    padding: 20px;
    height: 100vh;
    box-sizing: border-box;
    overflow: hidden; /* Prevent body scrollbars */
}

.screen { 
    display: none; 
    max-width: 1000px; 
    margin: auto; 
}
.screen.active { display: block; }

#game-screen.active {
    display: flex;
    flex-direction: column;
    height: 95vh;
    max-width: 90vw; 
    width: 1600px;
}

.hidden { display: none !important; }

button { background-color: #7289da; color: white; border: none; padding: 10px 20px; margin: 5px; border-radius: 5px; cursor: pointer; font-size: 16px; transition: background-color 0.2s; }
button:hover { background-color: #5b6eae; }
button:disabled { background-color: #555; cursor: not-allowed; }

input, select { padding: 10px; margin: 5px; border-radius: 5px; border: 1px solid #444; background-color: #40444b; color: #fff; font-size: 16px; }
hr { border-color: #444; }

#main-menu #deck-selection-container, #multiplayer-lobby #lobby-deck-selection-container { margin: 20px 0; }
#player-list p { margin: 5px 0; }
#deck-details, #lobby-deck-details { padding: 15px; margin-top: 10px; background-color: #23272a; border-radius: 5px; text-align: left; }


/* --- MAP STYLING (FOR PAN AND ZOOM) --- */
#game-screen h2, #game-screen #voting-status, #party-stats-container {
    flex-shrink: 0;
}

#map-container {
    border: 1px solid #444;
    border-radius: 8px;
    flex-grow: 1;
    min-height: 0;
    overflow: hidden; 
    position: relative;
    cursor: grab;
}

#map-container:active {
    cursor: grabbing;
}

#map-nodes {
    position: absolute;
    width: 1600px; 
    height: 1600px; 
    background-color: #23272a;
    transform-origin: 0 0; 
    transition: transform 0.1s ease-out;
}

.node {
    width: 100px; height: 100px; border: 3px solid #7289da;
    background-color: #40444b; border-radius: 50%; position: absolute;
    display: flex; justify-content: center; align-items: center;
    flex-direction: column; font-size: 14px;
    transition: all 0.2s ease-in-out; transform: translate(-50%, -50%);
    z-index: 1;
}

.node.current { border-color: #fdd835; box-shadow: 0 0 15px #fdd835; }
.node.cleared { border-color: #666; background-color: #222; color: #888; }
.node.votable { border-color: #43b581; cursor: pointer; box-shadow: 0 0 15px #43b581; }
.node.votable:hover { transform: translate(-50%, -50%) scale(1.1); }

.node-line {
    position: absolute; height: 3px; background-color: #60646b;
    transform-origin: 0 50%; z-index: 0;
}


/* --- PARTY STATS ON MAP SCREEN --- */
#party-stats-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 10px;
    background-color: #23272a;
    border-radius: 8px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.party-member-card {
    background-color: #40444b;
    padding: 5px 15px;
    border-radius: 5px;
}

.party-member-card h4 { margin: 5px 0; }
.party-member-card p { margin: 5px 0; font-size: 18px; font-weight: bold; color: #43b581; }


/* --- BATTLE STYLING --- */
#battle-container { display: flex; flex-direction: column; gap: 20px; }
.battle-header { display: flex; justify-content: space-around; align-items: center; background-color: #23272a; padding: 10px; border-radius: 8px; }
#phase-indicator { color: #fdd835; }
#player-battle-area { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; }
.player-battle-info { background-color: #40444b; padding: 10px; border-radius: 8px; border-left: 5px solid #7289da; }
.player-battle-info.is-self { border-left-color: #43b581; }
.player-battle-info.dead { background-color: #2c2f33; opacity: 0.6; border-left-color: #992d22; }
.player-battle-info p { margin: 4px 0; }
#player-action-area { background-color: #23272a; padding: 15px; border-radius: 8px; }
#player-hand-container { display: flex; justify-content: center; gap: 10px; min-height: 150px; margin-bottom: 10px; padding: 10px; background-color: #2c2f33; border-radius: 5px; }
#game-controls button { padding: 12px 24px; }

/* Card appearance (responsive & wrapping for text cards) */
.card {
    width: 90px;
    height: 140px;
    background-color: white;
    color: black;
    border: 1px solid #333;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 8px;
    box-sizing: border-box;
    /* Default font size scales but stays reasonable for labels */
    font-size: clamp(16px, 3.5vw, 28px);
    font-weight: 700;
    line-height: 1.05;
    word-wrap: break-word;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 3px 3px 8px rgba(0,0,0,0.3);
    position: relative;
}

/* Small corner stamps (value repeats) */
.card::before, .card::after {
    content: attr(data-value);
    position: absolute;
    font-size: 11px;
    font-weight: 600;
    color: rgba(0,0,0,0.85);
    pointer-events: none;
}

.card::before { top: 6px; left: 8px; }
.card::after { bottom: 6px; right: 8px; transform: rotate(180deg); }

/* Make textual/special cards slightly smaller so multi-word text fits */
.card[data-value^="+"],
.card[data-value*="mana"],
.card[data-value*="gold"],
.card[data-value*="hp"],
.card[data-value*="draw"],
.card[data-value*="card"] {
    font-size: clamp(12px, 2.8vw, 18px);
    padding: 6px;
}

/* Optional: slightly larger styling for short numeric cards (single or two char numbers) */
.card.numeric {
    font-size: clamp(28px, 6vw, 48px);
}

#end-of-battle-screen { padding: 40px; background-color: #23272a; border-radius: 8px; }
#end-of-battle-screen h2 { font-size: 3em; }

#game-log-container { background-color: #23272a; border-radius: 8px; padding: 10px 15px; margin-top: 10px; }
#game-log { height: 100px; overflow-y: auto; text-align: left; font-family: 'Courier New', Courier, monospace; font-size: 14px; padding: 5px; background-color: #2c2f33; border-radius: 4px; }
#game-log p { margin: 0 0 5px 0; padding-bottom: 5px; border-bottom: 1px solid #40444b; }

#monster-area { display: flex; justify-content: center; align-items: center; gap: 15px; flex-grow: 1; }
.monster-card { background-color: #40444b; border: 2px solid #992d22; border-radius: 8px; padding: 10px; min-width: 150px; transition: all 0.2s ease-in-out; }
.monster-card.dead { opacity: 0.5; border-color: #555; background-color: #2c2f33; }
/* --- NEW STYLE FOR REVIVE BUTTON --- */
.revive-btn {
    background-color: #43b581; /* Green */
    margin-top: 5px;
    width: 100%;
    padding: 5px;
    font-size: 14px;
}
.revive-btn:hover {
    background-color: #3aa070;
}
.revive-btn:disabled {
    background-color: #555;
    color: #999;
}
.result-log {
    min-height: 100px;
    max-height: 200px;
    overflow-y: auto;
    text-align: left;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    padding: 10px;
    margin: 10px 0;
    background-color: #2c2f33;
    border-radius: 4px;
    border: 1px solid #40444b;
}

/* --- NEW BATTLE STYLING --- */
#battle-container {
    display: flex;
    flex-direction: column;
    position: relative; /* For positioning children */
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    padding: 10px;
    box-sizing: border-box;
}

#party-info-header {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    gap: 20px;
    background: rgba(0, 0, 0, 0.6);
    padding: 10px;
    border-radius: 8px;
    z-index: 10;
}

.party-info-player {
    color: white;
}
.party-info-player h4 {
    margin: 0 0 5px 0;
    color: #fdd835;
}
.party-info-player p { margin: 2px 0; }
.party-info-player ul { list-style: none; padding-left: 10px; margin-top: 5px; }


#active-debuff-display {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(153, 45, 34, 0.8);
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    font-weight: bold;
    z-index: 10;
    max-width: 250px;
}

#battle-scene {
    flex-grow: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5%;
}

#player-side, #enemy-side {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 30px;
    width: 40%;
    height: 100%;
}

.character-container, .enemy-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    color: white;
    text-shadow: 2px 2px 4px black;
}

.sprite {
    max-width: 150px;
    max-height: 150px;
    object-fit: contain;
    filter: drop-shadow(3px 5px 2px #000);
    transition: transform 0.2s ease-out;
}
#enemy-side .sprite {
    transform: scaleX(1); /* Flip enemies to face players */
}

.sprite.attacking {
    /* Animation applied via JS */
}

.health-bar-container {
    width: 120px;
    height: 20px;
    background-color: #333;
    border: 2px solid #111;
    border-radius: 5px;
    margin-top: 5px;
    position: relative;
}

.health-bar-fill {
    height: 100%;
    background-color: #c73424;
    border-radius: 3px;
    transition: width 0.3s ease-in-out;
}

.health-value {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    font-weight: bold;
    color: white;
}

#turn-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -150%);
    font-size: 4em;
    font-weight: bold;
    color: #fdd835;
    text-shadow: 3px 3px 5px #000;
    z-index: 20;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

#turn-indicator.visible {
    opacity: 1;
}


#battle-hud {
    flex-shrink: 0;
    height: 220px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 10px;
    gap: 20px;
}

#game-log-container {
    width: 250px;
    height: 100%;
    background-color: rgba(35, 39, 42, 0.8);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
}
#game-log {
    flex-grow: 1;
    overflow-y: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    color: #ddd;
}
#game-log p { margin: 0 0 5px 0; border-bottom: 1px solid #40444b; }


.hud-center-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}
#game-controls { margin-bottom: 10px; }
#player-hand-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-grow: 1;
    min-height: 150px;
}

.hud-right-area {
    display: flex;
    align-items: center;
    gap: 20px;
    height: 100%;
}
#mana-display {
    width: 100px;
    height: 100px;
    background-image: url('assets/gem.png'); /* You will need to add a gem asset */
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2em;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px #000;
}
#player-stats-display {
    background-color: rgba(35, 39, 42, 0.8);
    padding: 10px 20px;
    border-radius: 8px;
    text-align: right;
}
#player-stats-display p { margin: 5px 0; font-size: 1.1em; }
.sprite {
    max-width: 350px; /* Changed from 150px */
    max-height: 350px; /* Changed from 150px */
    object-fit: contain;
    filter: drop-shadow(3px 5px 2px #000);
    transition: transform 0.2s ease-out;
}

.health-bar-container {
    width: 250px; /* Changed from 120px */
    height: 25px; /* Changed from 20px */
    background-color: #333;
    border: 2px solid #111;
    border-radius: 5px;
    margin-top: 5px;
    position: relative;
}

