:root {
    /* Colors */
    --bg-dark: #0a0b10;
    --bg-surface: #12141d;
    --accent-primary: #00f2ff;
    /* Energy Cyan */
    --accent-secondary: #ffd700;
    /* Gold */
    --accent-red: #ff3e3e;
    /* HP Red */
    --accent-green: #39ff14;
    /* Ready Green */
    --accent-purple: #bd00ff;
    /* Special */

    --text-main: #e2e8f0;
    --text-dim: #94a3b8;

    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-blur: blur(12px);

    /* Spacing & Radii */
    --radius-lg: 16px;
    --radius-md: 8px;
    --radius-sm: 4px;
    --shadow-glow: 0 0 20px rgba(0, 242, 255, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

@media (hover: hover) and (pointer: fine) {
    * {
        cursor: none !important;
    }
}

@media (hover: none), (pointer: coarse) {
    #custom-cursor {
        display: none !important;
    }
}

button {
    /* cursor removed */
    user-select: none;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

#custom-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 28px;
    height: 28px;
    background-image: url('assets/UI/cursor.svg');
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 100000;
    will-change: transform;
    opacity: 0;
    transition: opacity 0.2s;
}

#custom-cursor.active {
    opacity: 1;
}

#custom-cursor.holding {
    background-image: url('assets/UI/cursor-pointer.svg') !important;
}

body, button, .unit-card, .ai-choice, .shop-list-item {
    user-select: none;
}

.dark-theme::before {
    content: '';
    position: absolute;
    top: 57px;
    left: 0;
    right: 0;
    bottom: 89px;
    background: url('assets/UI/battlefield_bg.jpg');
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1;
}

/* Removed bg-wave keyframes */

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    opacity: 1;
    transition: opacity 0.5s ease;
}

#app.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Header Styling */
.game-header {
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: var(--glass-blur);
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    user-select: none;
}

.game-logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--text-main);
}

.game-logo .lite {
    color: var(--accent-primary);
    font-weight: 300;
}

.game-info {
    display: flex;
    gap: 1rem;
}

.stat-badge {
    padding: 0.4rem 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-badge.phase span {
    color: var(--accent-primary);
}

.icon-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    /* cursor removed */
    transition: all 0.2s;
    font-size: 1.2rem;
}

.icon-btn:hover {
    background: var(--accent-primary);
    color: black;
    transform: scale(1.05);
}

/* Board Layout */
.game-board {
    flex: 1;
    display: flex;
    flex-direction: row;
    padding: 1.5rem;
    gap: 1.5rem;
    padding: 1.5rem;
    gap: 1.5rem;
    padding: 1.5rem;
    gap: 1.5rem;
    overflow: hidden;
    align-items: stretch;
    position: relative; /* for absolute turn banner */
}

/* Turn Banner Overlay */
#turn-banner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5000;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.85);
    padding: 2rem 4rem;
    border: 2px solid var(--accent-primary);
    border-radius: var(--radius-lg);
    box-shadow: 0 0 50px rgba(0, 242, 255, 0.3);
    text-align: center;
    backdrop-filter: var(--glass-blur);
    animation: bannerIn 2s ease-in-out forwards;
}

#turn-banner.hidden {
    display: none;
    animation: none;
}

#turn-banner h1 {
    font-size: 3rem;
    letter-spacing: 5px;
    margin: 0;
    background: linear-gradient(135deg, #fff, var(--accent-primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
}

@keyframes bannerIn {
    0% { opacity: 0; transform: translate(-50%, -40%) scale(0.9); }
    15% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
    30% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    90% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
    100% { opacity: 0; transform: translate(-50%, -60%) scale(0.9); }
}

.resource span {
    display: inline-block;
}

.player-area {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
    align-items: stretch;
}

.player-area.opponent {
    /* Opponent is the right column */
    order: 3;
}

.player-area.player {
    /* Player is the left column */
    order: 1;
}

.player-stats-bar {
    width: 100%;
    height: auto;
    padding: 0.8rem 1.2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.player-separator {
    width: 60px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding-top: 1.5rem;
    /* Align approximately with stat bars */
    flex-shrink: 0;
    order: 2;
}

.player-separator::before {
    content: '';
    position: absolute;
    top: 60px;
    /* Start line below icon */
    bottom: 2rem;
    width: 2px;
    background: linear-gradient(to bottom, var(--glass-border), transparent);
    z-index: 0;
}

.central-attack {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a093a !important;
    border: 2px solid var(--accent-red);
    box-shadow: 0 0 15px rgb(149, 160, 212);
    z-index: 10;
    color: white;
    font-weight: 800;
    font-size: 1.2rem;
    position: relative;
    user-select: none;
    transition: box-shadow 0.3s, border-color 0.3s;
    gap: 0.3rem;
}

.central-attack.danger {
    animation: danger-pulse 1.2s ease-in-out infinite;
}

@keyframes danger-pulse {
    0% {
        box-shadow: 0 0 10px rgba(255, 60, 60, 0.4);
        border-color: #ff3c3c;
    }

    50% {
        box-shadow: 0 0 30px rgba(255, 60, 60, 0.9);
        border-color: #ff8080;
    }

    100% {
        box-shadow: 0 0 10px rgba(255, 60, 60, 0.4);
        border-color: #ff3c3c;
    }
}

.central-attack .icon {
    font-size: 1.2rem;
}

.central-attack #central-atk {
    font-size: 1.4rem;
}

.player-area.opponent .player-stats-bar {
    flex-direction: row-reverse;
    /* Flip icons for opponent */
    text-align: right;
}

.player-stats-bar .glass {
    min-height: 0;
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
}

.player-stats-bar.active-player {
    background: linear-gradient(135deg, rgba(0, 242, 255, 0.15), rgba(0, 242, 255, 0.05));
    border: 2px solid var(--accent-primary);
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.4);
}

.player-identity {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    flex-shrink: 0;
}

.player-identity .name {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    user-select: none;
}

/* Hide resource row if stats bar gets too small */
/* Use container query logic or media query if container queries not available broadly, but simple flex overflow handling works mostly */
.resource-row {
    display: flex;
    flex-direction: row;
    /* Horizontal resources */
    gap: 1.5rem;
    align-items: center;
    min-width: 0;
}

/* Specific fix: If height is less than ~150px, hide resources */
@media (max-height: 500px) {
    /* This is viewport based, might not be enough if combat log expands. 
      However, we can force the player-stats-bar to not shrink too much, or prioritize unit grid shrinking. 
      But user asked to hide it if it doesn't fit.
   */
}

/* Better approach: Let flexbox hide it? No, flex items overflow. */
/* We can use a min-height on player-stats-bar but let it shrink? */

.player-area {
    /* ... */
    overflow: hidden;
    /* Ensure stats bar doesn't poke out */
}

.resource {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    font-size: 1.5rem;
    font-weight: 700;
    /* cursor removed */
    user-select: none;
}

.resource .icon {
    font-size: 1.5rem;
    opacity: 0.9;
}

.resource span[id^="p1-"], .resource span[id^="p2-"], .central-attack span[id="central-atk"] {
    display: inline-block;
    min-width: 25px; /* Enough for 2 digits */
    text-align: center;
}

.resource.hp {
    color: var(--accent-red);
}

.resource.gold {
    color: var(--accent-secondary);
}

.resource.energy {
    color: #30e043;
}

.resource.attack {
    color: var(--accent-red);
}

.resource.block {
    color: #887fff;
}

/* Unit Grid - Auto-wrapping into 2 rows */
.unit-grid {
    flex: 1;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    /* Allow wrapping */
    align-content: flex-start;
    /* Start from top */
    gap: 1rem 1.5rem;
    /* Vertical and horizontal gap */
    padding: 1.2rem;
    height: 100%;
    min-width: 0;
    overflow-y: auto;
    /* Scroll vertically if many rows */
    overflow-x: hidden;
    align-items: stretch;
}

#p1-units {
    flex-direction: row-reverse;
}

/* Unit Column - Each column holds units of one type */
.unit-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 120px;
    position: relative;
    flex-shrink: 0;
    transition: all 0.3s ease;
    padding: 10px 5px;
    border-radius: var(--radius-md);
}

/* Remove column-active glow */
.unit-column.column-active {
    background: transparent;
    box-shadow: none;
}


/* Card Styling - Poker Size (2.5:3.5 ratio) */
.unit-card {
    width: 110px;
    height: 154px;
    flex: 0 0 110px;
    background: #1a1d2e;
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-md);
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 0;
    /* cursor removed */
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s, border-color 0.3s;
    overflow: hidden;
    z-index: 1;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    /* Let the column handle clicks mostly, but we re-enable for preview */
}

/* Re-enable for hover triggers inside the column if needed, 
   but for the 'block' feel we want the column to be the boss */
.unit-column .unit-card {
    pointer-events: auto;
    /* cursor removed */
}

/* Cards within column stack with overlap */
.unit-column .unit-card {
    margin-top: -80px;
    /* Overlap cards like solitaire */
}

.unit-column .unit-card:first-child {
    margin-top: 0;
    /* First card has no overlap */
}

.unit-card:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 10px 30px rgba(0, 242, 255, 0.3);
}

/* Only disable opponent hover in AI mode, not HOTSEAT */
/* CSS Check */
/* Removed AI-mode specific hover suppression for symmetry */

.opponent .unit-card.exhausted:hover {
    transform: rotate(90deg) !important;
}

.unit-card.exhausted {
    transform: rotate(90deg) !important;
    transform-origin: center center !important;
    opacity: 1;
    filter: grayscale(1) brightness(0.7);
    /* CRITICAL: Kill any transition from hover triggers */
    transition: none !important;
    /* Remove hover lift and old margins */
    box-shadow: none !important;
    border-color: var(--glass-border) !important;
    margin-top: -60px;
    /* Kept to account for rotation taking vertical space */
}

/* Subtle feedback on exhausted hover */
.unit-card.exhausted:hover {
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

.unit-card.exhausted.attacking {
    filter: grayscale(0.6) sepia(0.6) hue-rotate(-50deg) saturate(2.5) brightness(0.85);
    border-color: rgba(255, 62, 62, 0.6);
}

.unit-card.interactive {
    box-shadow: 0 0 5px var(--accent-green);
    border-color: var(--accent-green);
}

.unit-card.lethal-target {
    box-shadow: 0 0 15px var(--accent-red) !important;
    border-color: var(--accent-red) !important;
}

.unit-card.lethal-target:hover,
.unit-card.lethal-target.column-focus {
    box-shadow: 0 0 30px var(--accent-red) !important;
    border-color: var(--accent-red) !important;
}

.unit-column.lethal-target-column {
    filter: drop-shadow(0 0 10px rgba(255, 60, 60, 0.4));
    transition: transform 0.2s ease, filter 0.2s ease;
}

.unit-column.lethal-target-column:hover {
    filter: drop-shadow(0 0 20px rgba(255, 60, 60, 0.8));
}

.unit-card.exhausted.lethal-target {
    filter: sepia(1) saturate(5) hue-rotate(-50deg) brightness(1.2) !important;
}

/* Handled later in file */

.unit-card.exhausted:hover {
    transform: rotate(90deg) scale(1.05);
}

/* Card Slot (Square container) */
.unit-slot {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}


/* Card Styling - Poker Size (2.5:3.5 ratio) */
.unit-card {
    height: 100%;
    /* Fill parent height */
    width: auto;
    /* Auto width to maintain aspect ratio */
    aspect-ratio: 2.5 / 3.5;
    background: rgba(20, 22, 30, 0.95);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-md);
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 0;
    /* cursor removed */
    /* Explicitly NO transition on transform to make rotation snappy */
    transition: box-shadow 0.2s, border-color 0.2s;
    overflow: hidden;
    z-index: 1;
}

/* Card Animation Classes - Removed for snappiness */
.unit-card.exhausting-animation {
    pointer-events: none;
}

/* No individual card hover effects anymore - handled by column */

.unit-card.column-focus {
    /* Lift removed for snappiness */
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 20px var(--accent-primary) !important;
    z-index: 100 !important;
}

/* No pop-out/lift for opponent units on hover */
/* Removed AI-mode specific focus suppression for symmetry */

/* Removed confusing animation class */

.unit-card.interactive {
    box-shadow: 0 0 5px var(--accent-green);
    border-color: var(--accent-green);
}

.unit-card.blocking {
    border-color: #1e62d0;
    box-shadow: 0 0 15px rgba(30, 98, 208, 0.6);
}

/* removed empty ruleset */

.unit-card[onclick]:hover {
    animation: glow-pulse 1.5s infinite;
}

@keyframes glow-pulse {
    0% {
        box-shadow: 0 0 5px var(--accent-primary);
    }

    50% {
        box-shadow: 0 0 20px var(--accent-primary);
    }

    100% {
        box-shadow: 0 0 5px var(--accent-primary);
    }
}

.unit-card .unit-name {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    font-size: 0;
    opacity: 0;
    pointer-events: none;
}

.unit-card .unit-art {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    background-size: cover;
    background-position: center;
    border-radius: 0;
    margin: 0;
    position: relative;
    overflow: hidden;
}

/* Unit Preview Overlay */
.unit-preview {
    position: fixed;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    width: 250px;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 2px solid var(--accent-primary);
    box-shadow: 0 0 40px rgba(0, 242, 255, 0.2);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 1000;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
}

.unit-preview.hidden {
    opacity: 0;
    transform: translateY(-50%) translateX(50px);
}

.unit-preview.left-side {
    right: auto;
    left: 30px;
}

.unit-preview.left-side.hidden {
    transform: translateY(-50%) translateX(-50px);
}

.preview-art {
    width: 100%;
    aspect-ratio: 2.5/3.5;
    background-size: cover;
    background-position: center;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
}

.preview-name {
    font-size: 1.5rem;
    letter-spacing: 1px;
    color: var(--accent-primary);
    text-align: center;
}

.preview-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    width: 100%;
}

.preview-stats .stat {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.preview-desc {
    font-size: 0.9rem;
    color: var(--text-dim);
    line-height: 1.4;
    text-align: center;
}

.unit-card .count-badge {
    display: none;
    /* Removed as requested */
}

.unit-card .stat-line {
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px;
    display: flex;
    justify-content: space-between;
    font-size: 0;
    opacity: 0;
    pointer-events: none;
}

.unit-card .hp-val {
    color: var(--accent-red);
}

.unit-card .atk-val {
    color: #ffa500;
}

.unit-card .blk-val {
    color: #887fff;
}

/* Combat Log in Action Bar */
.combat-log-container {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex: 1;
    min-width: 0;
    position: relative;
    /* Maintain height to avoid "bump" when log is absolute */
    height: 44px;
}

.combat-log-wrapper {
    flex: 1;
    min-width: 0;
    height: 28px;
    position: relative;
}

.combat-log {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 28px;
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    overflow: hidden;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    background: rgba(0, 0, 0, 0.4);
    transition: all 0.15s ease-out;
    /* Slightly faster for snappiness */
    white-space: nowrap;
    text-overflow: ellipsis;
    z-index: 10;
    user-select: text; /* Allow selection of log text */
    pointer-events: auto; /* Ensure events reach it for selection */
}

.combat-log.expanded {
    height: 120px;
    overflow-y: auto;
    white-space: normal;
    background: rgba(10, 11, 16, 0.98);
    border: 1px solid var(--accent-primary);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
    padding: 8px 12px;
    z-index: 1100;
}

.log-toggle-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    font-size: 1.2rem;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    /* cursor removed */
    transition: all 0.2s;
    z-index: 1001;
    /* Stay above the expanded log */
}

.log-toggle-btn:hover {
    background: var(--accent-primary);
    color: black;
}


.log-entry {
    margin-bottom: 0.3rem;
    color: var(--text-dim);
}

.log-entry.player1 {
    color: var(--accent-primary);
}

.log-entry.player2 {
    color: var(--accent-secondary);
}

.log-entry.important {
    color: var(--accent-red);
    font-weight: 700;
}

/* Action Bar */
.action-bar {
    padding: 1rem 2rem;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: var(--glass-blur);
}

.action-group {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 2rem;
}

.combat-log-container {
    flex: 1;
    /* 1/3 of space */
}

.main-buttons {
    display: flex;
    gap: 1rem;
    flex: 2;
    /* 2/3 of space */
    justify-content: flex-end;
}

.action-btn {
    padding: 1rem 2.5rem;
    font-size: 1rem;
    font-weight: 800;
    border-radius: var(--radius-lg);
    border: none;
    /* cursor removed */
    transition: filter 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.action-btn.primary {
    background: linear-gradient(135deg, var(--accent-primary), #00a2ff);
    color: black;
}

.action-btn.secondary {
    background: var(--glass-bg);
    color: white;
    border: 1px solid var(--glass-border);
}

.action-btn.shop-btn {
    background: linear-gradient(135deg, #114220, #1b6631);
    color: #ffe600;
    border: 1px solid rgba(255, 230, 0, 0.4);
    box-shadow: 0 0 10px rgba(255, 230, 0, 0.1);
}

.action-btn.shop-btn:hover {
    background: linear-gradient(135deg, #185c2c, #248740);
    border-color: #ffe600;
    box-shadow: 0 0 20px rgba(255, 230, 0, 0.3);
}

.action-btn.accent {
    background: linear-gradient(135deg, #0055cc, #0077dd);
    color: white;
    margin-left: 1rem;
}

.action-btn.danger {
    background: rgba(255, 62, 62, 0.1);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
}

.action-btn.danger:hover {
    background: var(--accent-red);
    color: white;
}

.action-btn:hover {
    filter: brightness(1.2);
}

.action-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.4), transparent);
    transform: skewX(-20deg);
}

.action-btn:hover::after {
    animation: btn-shine 0.3s ease-out forwards;
}

@keyframes btn-shine {
    100% {
        left: 200%;
    }
}

.action-btn:disabled,
.action-btn.accent:disabled {
    background: #2a2d3d;
    color: #6a6f87;
    /* cursor removed */
    filter: none;
    transform: none;
    box-shadow: none;
}

/* Loading Overlay */
#loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loader {
    text-align: center;
}

.loading-logo {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: 4px;
    color: var(--accent-primary);
    margin: 0 0 2rem 0;
    animation: loader-pulse 2s infinite ease-in-out;
}

@keyframes loader-pulse {
    0% {
        opacity: 0.6;
        transform: scale(0.98);
    }

    50% {
        opacity: 1;
        transform: scale(1.02);
        text-shadow: 0 0 20px rgba(0, 242, 255, 0.4);
    }

    100% {
        opacity: 0.6;
        transform: scale(0.98);
    }
}

.loading-bar-container {
    width: 300px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin: 0 auto;
}

.loading-bar {
    width: 0%;
    height: 100%;
    background: var(--accent-primary);
    box-shadow: 0 0 10px var(--accent-primary);
    transition: width 0.3s ease-out;
}

.zero-resource {
    opacity: 0.4;
    filter: grayscale(1);
}

.resource-bump {
    animation: bump-anim 0.3s ease-out;
    color: var(--accent-green) !important;
}

@keyframes bump-anim {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

/* Modal Styling */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* Settings modal must layer above menu screens (z-index 500) */
#settings-modal {
    z-index: 600;
}

.modal.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal-content {
    width: 600px;
    max-width: 90vw;
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
    position: relative;
    z-index: 10;
}

.modal-header h2 {
    margin: 0;
}

.modal-header .close-btn {
    position: absolute;
    right: 0;
    top: -5px;
}

.close-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    /* cursor removed */
    transition: all 0.2s;
    line-height: 1;
}

.close-btn:hover {
    background: var(--accent-red);
    color: white;
    border-color: var(--accent-red);
    transform: rotate(90deg);
}

.shop-modal-open-anim {
    animation: shop-slide-down 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes shop-slide-down {
    0% {
        transform: translateY(-80px);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.shop-modal-close-anim {
    animation: shop-slide-up 0.3s cubic-bezier(0.55, 0.085, 0.68, 0.53) forwards;
}

@keyframes shop-slide-up {
    0% {
        transform: translateY(0);
        opacity: 1;
    }

    100% {
        transform: translateY(-50px);
        opacity: 0;
    }
}

.shop-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.shop-header-btns {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.shop-buy-btn {
    padding: 0.5rem 1.5rem !important;
    font-size: 0.85rem !important;
    margin-left: 0 !important;
}

/* Shop preview card - hidden on desktop, shown on mobile */
.shop-preview-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem;
    background: rgba(0, 242, 255, 0.05);
    border: 1px solid var(--accent-primary);
    border-radius: var(--radius-md);
    margin-top: 1rem;
}

.shop-preview-card.hidden {
    display: none !important;
}

.shop-preview-art {
    width: 80px;
    height: 112px;
    background-size: cover;
    background-position: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.shop-preview-info {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1;
}

.shop-preview-name {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.shop-preview-cost {
    font-size: 1rem;
    font-weight: 700;
    color: var(--accent-secondary);
}

.shop-preview-desc {
    font-size: 0.85rem;
    color: var(--text-dim);
    line-height: 1.4;
}

.shop-list-item.selected {
    background: rgba(0, 242, 255, 0.12);
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.3);
}

/* Hidden by default, shown only on mobile */
.shop-scroll-arrow {
    display: none;
}

.shop-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    /* cursor removed */
    transition: all 0.2s;
    font-weight: 700;
    height: 50px;
    width: 100%;
    box-sizing: border-box;
}

.shop-list-item:hover {
    background: var(--accent-primary);
    color: black;
    transform: translateX(10px);
}

.shop-list-item.disabled .shop-item-info,
.shop-list-item.disabled .shop-preview img {
    filter: grayscale(1);
}

.shop-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
}

.shop-item-main {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.unit-cost {
    white-space: nowrap;
}

.shop-item-desc {
    display: none !important;
}

.penalty {
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    margin-left: 4px;
}

.shop-list-item:hover .shop-item-desc {
    color: rgba(0, 0, 0, 0.7);
}

.unit-xs-reason {
    font-size: 0.7em;
    color: #ff5555;
    margin-left: auto;
}

.shop-preview {
    position: absolute;
    left: calc(100% + 20px);
    top: 50%;
    transform: translateY(-50%);
    width: 200px;
    height: 250px;
    background: #1a1c26;
    border: 2px solid var(--accent-primary);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 1000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shop-list-item:hover .shop-preview {
    opacity: 1;
}

.shop-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.shop-item-progress-bar {
    display: flex;
    gap: 3px;
    margin-left: auto;
    opacity: 0;
    transition: opacity 0.2s ease;
    background: rgba(0, 0, 0, 0.6);
    padding: 6px 8px;
    border-radius: 6px;
    align-items: center;
}

.shop-list-item:hover .shop-item-progress-bar {
    opacity: 1;
}

.progress-segment {
    width: 6px;
    height: 14px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.progress-segment.filled {
    background: #0077ff;
    box-shadow: 0 0 5px #0077ff;
}

/* Menu Screens */
.menu-screen {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, #1b1e2b 0%, #0a0b10 100%);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 500;
    transition: opacity 0.5s ease;
    overflow: hidden;
}

/* Parallax card sprites injected by JS */
.menu-parallax-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.menu-parallax-bg .p-card {
    position: absolute;
    border-radius: 8px;
    opacity: 0.08;
    filter: blur(0.3px);
    will-change: transform;
    transform-origin: center;
}

@keyframes card-drift {
    0% {
        transform: translate(0px, 0px) rotate(var(--r0));
    }

    50% {
        transform: translate(var(--dx), var(--dy)) rotate(var(--r1));
    }

    100% {
        transform: translate(0px, 0px) rotate(var(--r0));
    }
}

.menu-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.menu-container {
    position: relative;
    z-index: 1;
    max-width: 700px;
    width: 90%;
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 2px solid var(--glass-border);
    text-align: center;
    margin: auto;
}

.game-title h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 4px;
    margin-bottom: 0.3rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-title h2 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 0.4rem;
    color: var(--text-main);
}

.game-title .tagline {
    font-size: 0.95rem;
    color: var(--text-dim);
    margin-bottom: 1rem;
    font-weight: 300;
}

.game-description {
    margin: 1rem 0;
    line-height: 1.6;
    color: var(--text-dim);
}

.game-description p {
    margin-bottom: 0.5rem;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 1.5rem;
}

.menu-btn {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 800;
    border: 2px solid transparent;
    /* cursor removed */
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
}

.menu-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.4), transparent);
    transform: skewX(-20deg);
}

.menu-btn:hover::after {
    animation: btn-shine 0.3s ease-out forwards;
}

.menu-btn.primary {
    background: linear-gradient(135deg, var(--accent-primary), #00a2ff);
    color: black;
    border-color: var(--accent-primary);
}

.menu-btn.primary:hover {
    transform: translateY(-4px);
    box-shadow: 0 0 40px rgba(0, 242, 255, 0.5);
}

.menu-btn.secondary {
    background: var(--glass-bg);
    color: white;
    border-color: var(--glass-border);
}

.menu-btn.secondary:hover {
    background: var(--glass-border);
    border-color: var(--text-dim);
}

.menu-btn.disabled {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-dim);
    border-color: rgba(255, 255, 255, 0.05);
    /* cursor removed */
    opacity: 0.5;
}

.menu-btn .coming-soon {
    display: block;
    font-size: 0.7rem;
    margin-top: 0.5rem;
    font-weight: 400;
    letter-spacing: 1px;
}

/* Online Lobby */
.lobby-section {
    margin-top: 2rem;
}

.lobby-section.hidden {
    display: none;
}

.lobby-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    margin-top: 1.5rem;
    font-size: 0.95rem;
    color: var(--text-dim);
}

.lobby-status.hidden {
    display: none;
}

.lobby-status .status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-dim);
    transition: background 0.3s;
}

.lobby-status.connecting .status-dot {
    background: #ffaa00;
    animation: pulse-dot 1s ease-in-out infinite;
}

.lobby-status.waiting .status-dot {
    background: #00ccff;
    animation: pulse-dot 1.5s ease-in-out infinite;
}

.lobby-status.connected .status-dot {
    background: var(--accent-green);
}

.lobby-status.error .status-dot {
    background: var(--accent-red);
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

.room-code-display {
    text-align: center;
    margin-top: 1rem;
}

.room-code-label {
    font-size: 0.85rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 1rem;
}

.room-code-box {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 2rem;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid var(--accent-primary);
    border-radius: var(--radius-md);
    font-family: 'JetBrains Mono', monospace;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-primary);
    letter-spacing: 6px;
    user-select: all;
}

.copy-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    font-size: 1.3rem;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    /* cursor removed */
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-btn:hover {
    background: var(--accent-primary);
    color: black;
}

.room-code-hint {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-top: 1rem;
    opacity: 0.7;
}

.join-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.join-label {
    font-size: 0.85rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.join-input-row {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.join-input {
    padding: 1rem 1.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: 4px;
    text-transform: uppercase;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    outline: none;
    width: 220px;
    transition: border-color 0.2s;
}

.join-input:focus {
    border-color: var(--accent-primary);
}

.join-input::placeholder {
    color: var(--text-dim);
    opacity: 0.4;
    letter-spacing: 3px;
}

/* AI Selection Grid */
.ai-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.ai-choice {
    padding: 2rem 1rem;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-md);
    /* cursor removed */
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
}

.ai-choice:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-primary);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 242, 255, 0.3);
}

.ai-icon {
    font-size: 3rem;
}

.ai-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ai-desc {
    font-size: 0.85rem;
    color: var(--text-dim);
    line-height: 1.4;
    text-align: center;
}

/* Settings Modal Specifics */
.settings-content {
    width: 400px !important;
}

.settings-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1rem;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-item label {
    font-size: 0.9rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.setting-item input[type="range"] {
    accent-color: var(--accent-primary);
    /* cursor removed */
}

.settings-actions {
    margin-top: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    align-items: stretch;
}

.settings-actions .menu-btn {
    width: 100%;
}

.menu-btn.danger {
    background: rgba(255, 62, 62, 0.1);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
}

.menu-btn.danger:hover {
    background: var(--accent-red);
    color: white;
}

/* Animations */
@keyframes resourceBump {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.5);
        color: var(--accent-green);
    }

    100% {
        transform: scale(1);
    }
}

.resource-bump {
    animation: resourceBump 0.6s ease-out;
}

@keyframes resourceDrop {
    0% {
        transform: scale(1) translateY(0);
        color: inherit;
    }

    40% {
        transform: scale(1.1) translateY(-2px);
        color: inherit;
    }

    80% {
        transform: scale(0.88) translateY(2px);
        color: var(--accent-red);
    }

    100% {
        transform: scale(1) translateY(0);
        color: var(--accent-red);
    }
}

.resource-drop {
    animation: resourceDrop 0.6s ease-out;
}

@keyframes shakeError {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

.shake-animation {
    animation: shakeError 0.4s cubic-bezier(.36, .07, .19, .97) both;
    border-color: var(--accent-red) !important;
    box-shadow: 0 0 15px var(--accent-red) !important;
}

@keyframes errorBump {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
        color: var(--accent-red);
        text-shadow: 0 0 10px var(--accent-red);
    }

    100% {
        transform: scale(1);
    }
}

.error-bump {
    animation: errorBump 0.6s ease-out;
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
    body {
        /* Keep game locked in view, don't let it scroll */
        overflow: hidden;
        height: 100vh;
        height: 100dvh;
    }

    .dark-theme::before {
        background-size: cover;
        top: 0;
        bottom: 0;
    }

    #app {
        height: 100vh;
        height: 100dvh;
    }

    /* 1. Hide action-bar over main menu */
    #app.hidden {
        display: none !important;
    }

    /* Hide entire header on mobile - turn/phase/settings move to separator */
    .game-header {
        display: none;
    }

    /* 2. Stacked Board explicitly dividing 50/50 */
    .game-board {
        flex-direction: column;
        padding: 0.5rem;
        gap: 0;
        overflow: hidden;
    }

    .player-area {
        flex: 1 1 0;
        min-height: 0;
        height: auto;
        display: flex;
        flex-direction: column;
    }

    .player-area.opponent {
        order: 1;
    }

    /* Opponent's stats bar should be visually below their units but above the separator */
    .player-area.opponent .player-stats-bar {
        order: 2;
        /* Move it to the bottom of the opponent's area flex container */
        z-index: 10;
    }

    .player-area.opponent .unit-grid {
        order: 1;
        /* Units above stats bar */
    }

    .player-separator {
        order: 2;
        width: 100%;
        height: auto;
        padding: 0.3rem 0.5rem;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        flex: 0 0 auto;
        gap: 0.5rem;
        position: relative;
    }

    .sep-left,
    .sep-right {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .player-separator::before {
        display: none;
        /* Hide vertical line */
    }

    /* Turn/Phase badges inside separator */
    .player-separator .stat-badge {
        padding: 0.2rem 0.5rem;
        font-size: 0.7rem;
        background: var(--glass-bg);
        border: 1px solid var(--glass-border);
        border-radius: var(--radius-sm);
        font-weight: 600;
        display: flex;
        align-items: center;
        justify-content: center;
        white-space: nowrap;
    }

    .player-separator .stat-badge.phase span {
        color: var(--accent-primary);
    }

    .player-separator .icon-btn {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
        background: var(--glass-bg);
        border: 1px solid var(--glass-border);
        border-radius: var(--radius-sm);
        color: var(--text-main);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .central-attack {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
        z-index: 5;
    }

    .central-attack #central-atk {
        font-size: 1rem;
    }

    .player-area.player {
        order: 3;
    }

    /* Unit Grid with internal scrolling */
    .unit-grid {
        padding: 0.5rem;
        gap: 0.5rem;
        overflow-y: auto;
        overflow-x: hidden;
        justify-content: center;
        flex: 1 1 0;
        min-height: 0;
    }

    .unit-column {
        min-width: 80px;
        padding: 5px;
    }

    /* Smaller Cards */
    .unit-card {
        width: 80px;
        height: 112px;
        flex: 0 0 80px;
    }

    .unit-column .unit-card {
        margin-top: -60px;
    }

    /* Compact Stats Bar */
    .player-stats-bar {
        padding: 0.5rem 0.8rem;
        border-radius: var(--radius-md);
    }

    .player-identity .name {
        font-size: 0.7rem;
    }

    .resource-row {
        gap: 1rem;
    }

    .resource {
        font-size: 0.85rem;
    }

    .resource .icon {
        font-size: 0.85rem;
    }

    /* Action Bar Adjustments */
    .action-bar {
        position: sticky;
        bottom: 0;
        padding: 0.8rem;
        z-index: 400;
    }

    /* Hide combat log entirely on mobile */
    .combat-log-container {
        display: none;
    }

    /* Disable card hover/focus blue glow on mobile */
    .unit-card:hover {
        border-color: var(--glass-border);
        box-shadow: none;
    }

    .unit-card.column-focus {
        transform: none;
        border-color: var(--glass-border) !important;
        box-shadow: none !important;
        z-index: 1 !important;
    }

    .unit-card.interactive:hover {
        border-color: var(--accent-green);
        box-shadow: 0 0 5px var(--accent-green);
    }

    /* Modals */
    .modal-content {
        width: 95% !important;
        padding: 1rem;
    }

    .settings-content {
        width: 95% !important;
    }

    /* 3. Shop: external preview, single column, scroll arrow */
    #shop-modal {
        align-items: flex-end;
        /* Push shop toward bottom above the action bar */
        padding-bottom: 75px;
        /* Action bar height roughly + margin */
    }

    #shop-modal .modal-content {
        margin-top: 35vh;
        /* Starts underneath the 30vh preview card + padding */
        max-height: calc(100vh - 35vh - 75px - 2vh);
        display: flex;
        flex-direction: column;
    }

    .shop-grid {
        grid-template-columns: 1fr;
        max-height: 100%;
        /* Instead of fixed 4-items, flex fill and scroll */
        flex: 1;
        overflow-y: auto;
    }

    /* Hide the in-header buy button on mobile (we put Buy in the action bar) */
    .shop-buy-btn {
        display: none !important;
    }

    /* Shop preview card: OUTSIDE the modal (fixed at top) with reserved space */
    .shop-preview-card {
        position: fixed;
        top: 2vh;
        left: 5%;
        right: 5%;
        width: 90%;
        height: 30vh;
        /* Takes up about 30% of height of the screen */
        z-index: 3000;
        background: rgba(10, 12, 20, 0.97);
        border: 2px solid var(--accent-primary);
        border-radius: var(--radius-md);
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
        backdrop-filter: blur(12px);
    }

    .shop-preview-card.hidden {
        display: flex !important;
        /* Override global display:none */
        opacity: 0;
        pointer-events: none;
    }

    .shop-preview-art {
        width: 50% !important;
        height: 100% !important;
        background-size: contain !important;
        background-repeat: no-repeat !important;
        flex: 1 !important;
        border: none !important;
    }

    .shop-preview-info {
        flex: 1 !important;
        text-align: center !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .shop-preview-card.disabled-preview .shop-preview-art {
        filter: grayscale(0.8) brightness(0.5);
    }

    .shop-preview-card.disabled-preview .shop-preview-name {
        color: var(--text-dim);
    }

    /* Scroll arrow button */
    .shop-scroll-arrow {
        display: block;
        width: 100%;
        padding: 0.4rem 0;
        margin-top: 0.3rem;
        background: none;
        border: 1px solid var(--glass-border);
        border-radius: var(--radius-sm);
        color: var(--accent-primary);
        font-size: 1.2rem;
        text-align: center;
        /* cursor removed */
    }

    .shop-scroll-arrow:active {
        background: rgba(0, 242, 255, 0.1);
    }

    .shop-scroll-arrow.arrow-hidden {
        opacity: 0.3;
        pointer-events: none;
        /* cursor removed */
    }

    /* 4. Unit Preview Mobile - Show only card image, no description */
    .unit-preview {
        position: fixed;
        left: 5% !important;
        right: 5% !important;
        width: 90%;
        height: auto;
        max-height: 45vh;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        padding: 0;
        z-index: 2000;
        background: rgba(15, 17, 26, 0.98);
        border: 2px solid var(--accent-primary);
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.9);
        backdrop-filter: blur(10px);
        transform: none !important;
        /* Override desktop translates */
        transition: opacity 0.2s ease;
        overflow: hidden;
    }

    .unit-preview.mobile-top {
        top: 10px !important;
        bottom: auto !important;
    }

    .unit-preview.mobile-bottom {
        bottom: 80px !important;
        top: auto !important;
    }

    .unit-preview.hidden {
        opacity: 0;
        pointer-events: none;
    }

    .unit-preview .preview-art {
        width: 100%;
        height: 100%;
        aspect-ratio: 2.5 / 3.5;
        max-height: 45vh;
        flex-shrink: 0;
        margin: 0;
        padding: 0;
        border: none;
        border-radius: 0;
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
        box-shadow: none;
    }

    /* Hide all text info in unit preview on mobile - just show the card */
    .unit-preview .preview-info {
        display: none;
    }

    /* Menu Screens Mobile */
    .menu-screen {
        align-items: flex-start;
        padding: 1rem 0;
    }

    .menu-container {
        width: 95%;
        padding: 0.8rem;
        margin: auto;
        max-height: 100vh;
        max-height: 100dvh;
        overflow-y: auto;
    }

    .game-title h1 {
        font-size: 1.8rem;
    }

    .game-title .tagline {
        font-size: 0.8rem;
        margin-bottom: 0.4rem;
    }

    .game-description {
        font-size: 0.8rem;
        margin: 0.4rem 0;
    }

    .menu-buttons {
        margin-top: 0.5rem;
        gap: 0.4rem;
    }

    .menu-btn {
        width: 100%;
        margin-bottom: 0;
        padding: 0.7rem 1rem;
        font-size: 0.95rem;
    }

    .menu-btn.secondary {
        margin-top: 0;
    }

    .ai-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        margin-top: 0.5rem;
    }

    .ai-choice {
        padding: 0.5rem;
        gap: 0.2rem;
    }

    .ai-icon {
        font-size: 1.5rem;
    }

    .ai-name {
        font-size: 0.9rem;
    }

    .ai-desc {
        font-size: 0.7rem;
    }
}