/* --- CORE STYLES --- */
body {
    background-color: #0f0f0f;
    color: #e0e0e0;
    font-family: 'Segoe UI', sans-serif;
    margin: 0;
    height: 100vh;
    overflow: hidden;
    display: flex;
}
/* --- CARD FRAME (Dynamic Image Loading) --- */
.card-frame {
    position: relative;
    width: 300px; height: 420px;
    border-radius: 14px;
    font-family: 'Segoe UI', sans-serif;
    color: white;
    overflow: hidden;
    box-shadow: 2px 2px 10px rgba(0,0,0,0.5);
    flex-shrink: 0;
    background-color: #000;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    border: 2px solid #111;
    display: flex; flex-direction: column;
}
/* DYNAMIC COLORS */
.cf-header-bar, .cf-footer-bar {
    background-color: var(--faction-color-alpha, rgba(30,30,30,0.85));
    z-index: 2;
}
.cf-text-box {
    background-color: var(--faction-color-solid, #222);
    z-index: 2;
}
/* 1. HEADER */
.cf-header-bar {
    height: 40px; width: 100%;
    display: flex; align-items: center;
    padding-left: 5px; position: relative;
    border-bottom: 2px solid rgba(0,0,0,0.5);
}
.cf-cost {
    width: 32px; height: 32px;
    background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.4);
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    font-size: 20px; font-weight: bold; margin-right: 10px;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.5);
}
.cf-name {
    font-size: 16px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
    text-shadow: 1px 1px 2px black;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    flex: 1; text-align: center; margin-right: 40px;
}
/* Token Input Styling */
.cf-name input, .cf-text-box textarea, .cf-stats-box input {
    /* Reset base input styles for in-card editing */
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #555;
    color: white;
    font-size: 14px;
    padding: 2px;
    box-sizing: border-box;
    text-align: center;
    margin: 0;
    line-height: normal;
}
.cf-name input { font-size: 16px; font-weight: 700; background: none; border: none; text-shadow: 1px 1px 2px black; }
.cf-text-box textarea { height: 80px; font-size: 11px; text-shadow: none; resize: none; background: #111; }
/* 2. TYPE BAR */
.cf-type-bar {
    position: absolute; top: 38px; left: 50%; transform: translateX(-50%);
    width: 90%; height: 20px;
    background: #222;
    border: 1px solid #555; border-top: none;
    border-bottom-left-radius: 8px; border-bottom-right-radius: 8px;
    display: flex; justify-content: center; align-items: center; gap: 5px;
    font-size: 10px; font-weight: bold; text-transform: uppercase; color: #ccc;
    z-index: 5;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
.cf-type-separator { color: #555; }
/* 3. ART AREA */
.cf-art-area {
    flex: 1;
    background-size: cover; background-position: center; background-repeat: no-repeat;
    position: relative;
}
/* 4. TEXT BOX */
.cf-text-box {
    min-height: 130px;
    border-top: 2px solid rgba(0,0,0,0.8);
    padding: 15px 10px 5px 10px;
    font-size: 12px; line-height: 1.3;
    display: flex; flex-direction: column; justify-content: flex-start;
    text-shadow: 0 1px 2px black;
    position: relative;
}
.cf-flavor { font-style: italic; font-size: 10px; margin-top: auto; opacity: 0.7; padding-top: 5px; border-top: 1px solid rgba(255,255,255,0.2); }
/* 5. FOOTER */
.cf-footer-bar {
    height: 30px; width: 100%;
    border-top: 1px solid rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 5px; box-sizing: border-box;
    z-index: 2;
}
.cf-transmute-box {
    width: 30px; height: 30px;
    background: #222; border: 2px solid #555;
    transform: rotate(45deg);
    display: flex; justify-content: center; align-items: center;
    margin-left: 10px; margin-bottom: 10px;
    box-shadow: 2px 2px 5px black;
    z-index: 10;
}
.cf-transmute-val { transform: rotate(-45deg); font-weight: bold; font-size: 14px; color: #fff; }
.cf-align-text { font-size: 10px; text-transform: uppercase; font-weight: bold; flex: 1; text-align: center; }
.cf-stats-box {
    background: #111; border: 1px solid #555;
    border-radius: 4px;
    padding: 2px 8px;
    display: flex; gap: 8px; align-items: center;
    font-size: 16px; font-weight: bold;
    box-shadow: inset 0 0 5px black;
}
.cf-stat-sep { color: #555; font-size: 14px; }
/* --- UI & LAYOUT --- */
#main-menu { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: #111; z-index: 5000; display: flex; flex-direction: column; align-items: center; padding-top: 20px; }
#drop-zone {
    /* New: Give it a clear structure and visual identity */
    width: 600px;
    padding: 30px;
    margin: 20px 0;
    text-align: center;
    cursor: pointer;
    border: 3px dashed #555; /* Re-added Border for visibility */
    border-radius: 12px;
    background: #1a1a1a; /* Explicit background color */
    color: #aaa;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    transition: all 0.2s;
}
#drop-zone:hover {
    border-color: #0f0;
    background: #2a2a2a;
    color: #0f0;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
}
#builder-container {
    display: none;
    width: 95%;
    max-height: calc(100vh - 180px); /* Fit within viewport */
    gap: 15px;
    overflow: hidden; /* Prevent container overflow */
}
.db-col { flex: 3; background: #1a1a1a; border: 1px solid #333; border-radius: 8px; display: flex; flex-direction: column; padding: 10px; }
.deck-col {
    flex: 1;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    padding: 10px;
    max-width: 300px;
    overflow-y: auto; /* Make deck list scrollable */
    max-height: calc(100vh - 200px); /* Prevent overflow */
}
#faction-tabs { display: flex; gap: 5px; margin-bottom: 10px; overflow-x: auto; padding-bottom: 5px; }
.tab-btn { padding: 8px 15px; background: #333; border: 1px solid #555; color: #aaa; cursor: pointer; border-radius: 4px; font-size: 12px; white-space: nowrap; }
.tab-btn:hover { background: #444; color: white; }
.tab-btn.active { background: #004444; border-color: #0ff; color: #0ff; font-weight: bold; }
#db-search { width: 100%; padding: 8px; background: #222; border: 1px solid #555; color: white; margin-bottom: 10px; box-sizing: border-box; }
.card-gallery {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    padding: 5px 5px 20px 5px; /* Extra bottom padding */
    max-height: calc(100vh - 280px); /* Prevent it from pushing content off screen */
}
.card-frame.gallery-view {
    transform: scale(0.45); transform-origin: top left;
    margin-bottom: -230px; margin-right: -160px;
    cursor: pointer;
}
.card-frame.gallery-view:hover { transform: scale(0.45); border: 2px solid white; z-index: 10; }
/* --- DECK STATS Reworked Styles --- */
.deck-summary-box { background: #222; padding: 8px; border-radius: 4px; margin-bottom: 10px; font-size: 12px; }
.deck-summary-box h4 { margin: 0 0 5px 0; color: #fff; border-bottom: 1px solid #444; padding-bottom: 3px; font-size: 13px; }
.deck-summary-box .stats-section-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 8px;
    border-bottom: 1px dashed #444;
    padding-bottom: 5px;
}
.deck-summary-box .stats-section-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
}
.deck-summary-box div.stat-pair {
    display: flex;
    justify-content: space-between;
    width: 48%;
    margin-bottom: 2px;
}
.deck-summary-box .highlight { color: #0ff; font-weight: bold; }
/* FIX: Ensure stats box is clear and easy to read (Deck Editor specific) */
#editor-deck-stats.deck-summary-box {
    padding: 15px;
    font-size: 14px;
}
#editor-deck-stats .highlight { font-size: 16px; }
/* --- END DECK STATS Reworked Styles --- */
.deck-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 20px; /* Extra space at bottom */
}
.deck-list-group-header { font-weight: bold; padding: 4px 6px; background: #333; margin-top: 8px; font-size: 13px; color: #fff; }
.deck-entry { display: flex; justify-content: space-between; align-items: center; background: #2a2a2a; padding: 6px; font-size: 12px; border-bottom: 1px solid #444; }
.deck-entry-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 5px; }
.deck-entry-count { font-weight: bold; color: #0ff; }
/* V23.1 FIX: Added styling for the new +/- buttons and contained controls */
.deck-entry-controls { display: flex; gap: 5px; align-items: center; }
.deck-entry-controls button {
    width: 20px;
    height: 20px;
    padding: 0;
    margin: 0;
    font-size: 14px;
    line-height: 1;
    border-radius: 2px;
    flex-shrink: 0;
}
.deck-remove {
    color: #ff4444;
    cursor: pointer;
    font-weight: bold;
    margin-left: 10px;
}
.menu-btn.deck-editor-btn { background: #1e88e5; margin-top: 10px; }
.menu-btn.deck-editor-btn:hover { background: #42a5f5; }
/* V24.1: Enlarged Preview CSS Update */
#preview-overlay {
    /* Increased width for a larger preview area */
    position: absolute; right: 0; top: 0; bottom: 0; width: 500px;
    /* CRITICAL FIX: Default to none, only enable for token editing */
    pointer-events: none;
    z-index: 5000; display: none;
    background: linear-gradient(to left, #000 50%, transparent);
    padding-right: 20px; box-sizing: border-box;
    align-items: center; justify-content: flex-end;
}
/* Added transform scale to physically enlarge the card inside the overlay */
#preview-overlay .card-frame {
    transform: scale(1.2);
    transform-origin: center right; /* Anchor the scaling to the right side */
    /* If this card is a token, allow clicking on the input fields */
    pointer-events: all;
}
/* END V24.1: Enlarged Preview CSS Update */
/* --- DEDICATED DECK EDITOR MODAL (FIXED) --- */
#deck-editor-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.95); z-index: 6000; display: none;
    padding: 10px;
    box-sizing: border-box;
    align-items: flex-start; justify-content: center;
}
.editor-content-area {
    flex: 1; max-width: 98%;
    height: 100%;
    display: flex; gap: 15px;
}
.editor-card-viewer {
    flex: 4;
    background: #1a1a1a;
    padding: 15px;
    border-radius: 8px;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding-left: 30px;
    justify-content: flex-start;
    align-content: flex-start;
}
.editor-sidebar {
    flex: 1; max-width: 300px; display: flex; flex-direction: column;
    gap: 15px;
    overflow-y: auto;
}
/* Card elements inside the editor */
.editor-card-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 175px;
    margin-bottom: 20px;
}
.editor-card-controls {
    display: flex; width: 100%; margin-top: 5px; gap: 5px;
    background: #333; padding: 5px; border-radius: 4px;
}
.editor-card-controls button { width: 30%; padding: 4px; font-size: 10px; }
.editor-card-count {
    width: 40%; text-align: center; font-size: 16px;
    font-weight: bold; line-height: 22px;
    color: #0ff;
}
.editor-card-frame {
    position: relative;
    transform: scale(0.60);
    left: -2.5px;
    margin-bottom: -168px;
    transform-origin: center;
}
.editor-card-group-header {
    width: 100%; background: #333; color: white; padding: 8px 10px;
    margin: 5px 0 15px 0;
    border-radius: 4px; font-weight: bold;
}
.editor-card-row {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    margin-bottom: 20px;
    border-bottom: 1px solid #444;
    padding-bottom: 10px;
}
/* --- INTERACTION MODAL & ACTION MENU STYLES --- */
#interaction-modal {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: #1a1a1a; border: 2px solid #555; box-shadow: 0 0 20px rgba(0,0,0,0.8);
    width: 900px; max-height: 85vh;
    display: none; flex-direction: column; z-index: 6000;
    padding: 0; overflow: hidden; border-radius: 8px;
}
#modal-header {
    background: #111; padding: 10px 15px; border-bottom: 1px solid #333;
    display: flex; justify-content: space-between; align-items: center;
}
#modal-body {
    padding: 15px; overflow-y: auto; flex: 1; display: flex; flex-direction: column;
}
/* Grid for viewing cards */
#modal-cards {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px; padding-bottom: 20px;
}
/* The new Action Menu Container */
#modal-actions {
    display: none; /* Hidden by default */
    flex-direction: column; align-items: center; gap: 15px; width: 100%; height: 100%;
}
.action-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; max-width: 600px;
}
.action-btn {
    background: #333; color: white; border: 1px solid #555; padding: 15px;
    font-size: 14px; font-weight: bold; cursor: pointer; border-radius: 6px;
    transition: background 0.2s;
}
.action-btn:hover { background: #555; border-color: #fff; }
.action-btn.danger { background: #5a1a1a; border-color: #844; }
.action-btn.danger:hover { background: #800; }

/* COUNTER BADGES */
.badge {
    position: absolute; color: white; border-radius: 50%; width: 24px; height: 24px;
    display: flex; justify-content: center; align-items: center;
    font-size: 12px; font-weight: bold; border: 2px solid white;
    box-shadow: 1px 1px 3px black; pointer-events: none; z-index: 20;
}
.badge-power { background: #ff8c00; top: -10px; right: -10px; } /* Orange */
.badge-shield { background: #0066cc; top: -10px; left: -10px; } /* Blue */
.badge-damage { background: #cc0000; bottom: 30px; right: -10px; } /* Red */
.badge-charge { background: #ffd700; color: black; bottom: 30px; left: -10px; } /* Gold */
.card-stats-mini { position: absolute; bottom: 2px; left: 2px; right: 2px; display: flex; justify-content: space-between; pointer-events: none; font-weight: bold; font-size: 12px; text-shadow: 1px 1px 2px black; }
.card-stats-mini span { padding: 1px 4px; border-radius: 3px; }
.card-power-val { background-color: rgba(255, 140, 0, 0.9); color: black; }
.card-def-val { background-color: rgba(0, 150, 200, 0.9); color: white; }
.resource-row .slot { background-color: #303030; border: 2px dashed #666; }
.resource-row .card { border: 1px solid #777; }
#game-container { display: flex; width: 100%; height: 100%; }
#left-sidebar { width: 220px; background: #1a1a1a; border-right: 1px solid #333; padding: 10px; display: flex; flex-direction: column; gap: 10px; font-size: 12px; overflow-y: auto; z-index: 200; flex-shrink: 0; }
#main-stage { flex: 1; display: flex; flex-direction: column; align-items: center; position: relative; width: 100%; }
.player-zone { flex: 1; width: 100%; display: flex; flex-direction: column; position: relative; }
#opponent-area { background-color: #0d0d0d; border-bottom: 1px solid #333; justify-content: flex-end; padding-bottom: 10px; }
#opponent-area .field-container { transform: rotate(180deg); margin-bottom: 10px; }
#opponent-area .pile-count { transform: rotate(180deg); }
#player-area { background-color: #121212; justify-content: flex-start; padding-top: 10px; }
#player-area .field-container { margin-top: 10px; }
#opp-status-overlay { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(200, 0, 0, 0.8); color: white; padding: 10px 20px; font-size: 14px; font-weight: bold; border-radius: 5px; border: 2px solid red; display: none; z-index: 1000; animation: pulse 1.5s infinite; }
#stack-zone { height: 100px; width: 660px; background: #181818; border: 2px dashed #333; border-radius: 8px; display: flex; justify-content: center; align-items: center; gap: 10px; position: relative; z-index: 10; margin: 5px 0; flex-shrink: 0; }
.stack-label { position: absolute; top: 2px; left: 5px; font-size: 10px; font-weight: bold; color: #444; pointer-events: none; }
.field-container { display: flex; gap: 20px; align-items: flex-start; justify-content: center; }
.card-grid { display: flex; flex-direction: column; gap: 8px; }
.board-row { display: flex; gap: 8px; }
.board-row.unit-row {
    display: flex !important;
    gap: 8px;
}
.board-row.unit-row .slot {
    display: flex !important;
    width: 85px;
    height: 116px;
}
.side-stack { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 8px; width: 178px; }
.side-stack .slot { height: 108px; }
.life-wrapper { width: 80px; height: 224px; display: flex; flex-direction: column; justify-content: center; align-items: center; background: #111; border: 1px solid #333; border-radius: 6px; gap: 5px; }
.life-display { font-size: 42px; font-weight: bold; color: #4f4; text-shadow: 0 0 10px rgba(0,255,0,0.3); }
.life-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; width: 100%; padding: 0 5px; box-sizing: border-box; }
.life-btn { background: #333; border: 1px solid #555; color: white; cursor: pointer; padding: 5px 0; font-size: 10px; }
.life-btn:hover { background: #555; }
.slot { background-color: #262626; border: 1px solid #3a3a3a; border-radius: 6px; display: flex; justify-content: center; align-items: center; font-size: 11px; color: #555; position: relative; width: 85px; transition: border 0.1s, background 0.1s; }
.slot:hover { border-color: #aaa; cursor: pointer; background: #333; }
.slot.targeting {
    border-color: #00ff00 !important;
    background: #1a331a !important;
    cursor: crosshair !important;
    z-index: 3000 !important; /* Ensure slots appear above overlay background */
    pointer-events: auto !important; /* Ensure slots are clickable */
}
.pile-count { position: absolute; top: 0; right: 0; background: rgba(0,0,0,0.7); color: #fff; font-size: 20px; padding: 2px 6px; border-bottom-left-radius: 6px; z-index: 20; pointer-events: none; font-weight: bold; text-shadow: 1px 1px 2px black; }
/* HAND OVERHAUL: Position hands fixed to top/bottom edges */
.hand-wrapper { position: fixed; width: 100%; display: flex; justify-content: center; left: 0; pointer-events: none; z-index: 1000; }
#opponent-area .hand-wrapper { top: 0; transform: translateY(0); padding-top: 5px; }
#player-area .hand-wrapper { bottom: 0; transform: translateY(0); padding-bottom: 5px; }
.hand-container { height: 130px; width: 700px; background-color: rgba(26,26,26,0.95); border: 1px solid #333; border-radius: 12px; display: flex; justify-content: center; align-items: center; gap: 5px; padding: 10px; transition: height 0.3s; z-index: 100; pointer-events: auto; position: relative; }
.toggle-hand-btn { position: absolute; top: -20px; right: 10px; background: #333; color: white; border: none; padding: 2px 8px; cursor: pointer; font-size: 10px; }
#opponent-area .toggle-hand-btn { top: auto; bottom: -20px; transform: rotate(180deg); }
.hand-container.collapsed { height: 40px; align-items: flex-start; }
.hand-count-display { position: absolute; right: -60px; bottom: 10px; font-size: 18px; font-weight: bold; color: #888; background: #111; padding: 5px 10px; border: 1px solid #333; border-radius: 5px; }
#opponent-area .hand-count-display { top: 10px; bottom: auto; transform: rotate(180deg); }
.card { width: 80px; height: 110px; background-color: #000; border: 1px solid #000; border-radius: 5px; background-size: cover; cursor: grab; position: relative; font-size: 10px; color: white; text-align: center; }
.selected { border: 3px solid #00ff00; box-shadow: 0 0 15px #00ff00; z-index: 200; }
.badge { position: absolute; color: white; border-radius: 50%; width: 20px; height: 20px; display: flex; justify-content: center; align-items: center; font-size: 10px; font-weight: bold; border: 1px solid white; box-shadow: 1px 1px 2px black; pointer-events: none; }
.badge-power { background: #ff8c00; top: -8px; right: -8px; } .badge-shield { background: #0066cc; top: -8px; left: -8px; }
.badge-charge { background: #ffd700; color: black; bottom: -8px; left: -8px; } .badge-damage { background: #ff0000; bottom: -8px; right: -8px; }
.token-marker { position: absolute; top: 40%; width: 100%; text-align: center; color: rgba(255,255,255,0.7); font-size: 12px; pointer-events: none; text-shadow: 1px 1px 2px black; font-weight: bold; }
.card-name-mini { position: absolute; top: 2px; left: 2px; width: 95%; text-align: left; font-size: 9px; font-weight: bold; text-shadow: 1px 1px 2px black; pointer-events: none; }
.card-cost-mini { position: absolute; top: 2px; right: 2px; color: #0ff; font-weight: bold; text-shadow: 1px 1px 2px black; font-size: 10px; pointer-events: none; }
h3 { margin: 10px 0 5px 0; color: #fff; border-bottom: 1px solid #444; font-size: 13px; }
.control-group { background: #222; padding: 8px; border-radius: 5px; margin-bottom: 5px; }
button { background: #444; color: white; border: 1px solid #555; padding: 6px; cursor: pointer; width: 100%; margin-bottom: 4px; border-radius: 3px; font-size: 11px; }
button:hover { background: #555; }
.red-btn { background: #5a2e2e; border-color: #844; } .red-btn:hover { background: #844; }
.green-btn { background: #2e5a2e; border-color: #484; } .green-btn:hover { background: #484; }
.game-control-btn { /* Style for the new Leave Game button */
    background: #4A148C;
    border-color: #6A1B9A;
}
.game-control-btn:hover {
    background: #6A1B9A;
}
select { width: 100%; background: #333; color: white; border: 1px solid #555; padding: 4px; margin-bottom: 5px; }
.shortcut-list div { display: flex; justify-content: space-between; margin-bottom: 4px; color: #aaa; }
.shortcut-key { background: #333; padding: 0 4px; border-radius: 3px; color: white; font-family: monospace; }
#interaction-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #222;
    border: 2px solid #555;
    padding: 20px;
    z-index: 3000;
    display: none;
    flex-direction: column;
    gap: 10px;
    width: 800px; /* Increased modal width for better display */
    max-height: 80vh;
}
#modal-header { display: flex; justify-content: space-between; align-items: center; }
#modal-title { font-weight: bold; color: white; font-size: 16px; }
#modal-search { width: 100%; padding: 8px; background: #333; color: white; border: 1px solid #555; font-size: 14px; margin-bottom: 10px; }
#modal-close { background: #555; margin-top: 10px; }
#modal-actions { display: none; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.action-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.action-btn { padding: 12px; background: #2a2a2a; border: 1px solid #444; color: #ddd; cursor: pointer; border-radius: 4px; font-size: 12px; text-align: center; }
.action-btn:hover { background: #444; border-color: #fff; color: white; }
.steal-btn { background: #5a2e2e; border: 1px solid #844; color: #ffcccc; font-weight: bold; }
.steal-btn:hover { background: #844; color: white; }
#targeting-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 2500;
    display: none;
    justify-content: center;
    align-items: center;
    pointer-events: none; /* Let clicks pass through to slots */
}
/* Message box and cancel button are clickable */
#targeting-overlay > div {
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.95);
    padding: 30px;
    border-radius: 8px;
}
#targeting-msg {
    pointer-events: none; /* Message is not clickable */
}
/* Ensure targeting slots are clickable */
.slot.targeting {
    border-color: #00ff00 !important;
    background: #1a331a !important;
    cursor: crosshair !important;
    position: relative !important;
    z-index: 2600 !important; /* Above overlay background */
    pointer-events: auto !important;
}
#targeting-overlay > div {
    pointer-events: auto; /* Enable clicks on the message box and cancel button */
}
#targeting-msg { background: #000; color: #0f0; border: 2px solid #0f0; padding: 20px; font-size: 24px; font-weight: bold; text-align: center; }
/* CARD BACK */
#opp-hand .card { background-image: url('images/templates/Cardback.png') !important; }
/* V24.6 NEW: Lobby Code Display */
#lobby-display-wrapper {
    background: #000;
    border: 1px solid #444;
    padding: 10px;
    border-radius: 4px;
    font-size: 12px;
    margin-top: auto; /* Push to bottom of sidebar */
}
#lobby-code-display {
    font-size: 16px;
    font-weight: bold;
    color: #0ff;
    cursor: pointer;
    word-break: break-all;
}
#lobby-link-tip a {
    color: #0ff;
    text-decoration: none;
}
#lobby-link-tip a:hover {
    text-decoration: underline;
}
/* V24.6 NEW: Token Creator Button Styling */
.token-creator-btn {
    background: #8e24aa;
    border-color: #ab47bc;
    font-weight: bold;
}
.token-creator-btn:hover {
    background: #ab47bc;
}
/* NEW CONNECT CONTROLS STYLES */
#connect-controls { width: 600px; display: none; margin-bottom: 20px; background: #222; padding: 20px; border-radius: 8px; }
.connect-btn { flex: 1; padding: 15px; font-size: 18px; font-weight: bold; cursor: pointer; border: 2px solid #444; background: #007bff; color: white; border-radius: 8px; transition: 0.2s; }
.connect-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.connect-btn.p2 { background: #28a745; }
#player-id-display { font-size: 16px; font-weight: bold; color: #ff8c00; }
#opponent-status-indicator { margin-top: 5px; color: white; }