/* ========================================
   TACTICAL SKIRMISH - Vertical Layout
   Board center, controls above, panels below
======================================== */

:root {
    --bg-dark: #0a0e17;
    --bg-gradient: linear-gradient(135deg, #0a0e17 0%, #1a1f35 50%, #0d1525 100%);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);

    --primary: #00d4ff;
    --primary-glow: rgba(0, 212, 255, 0.3);
    --secondary: #7b2fff;
    --accent: #ff2d7c;

    --player-color: #00d4ff;
    --player-glow: rgba(0, 212, 255, 0.5);
    --enemy-color: #ff4757;
    --enemy-glow: rgba(255, 71, 87, 0.5);

    --success: #00ff88;
    --warning: #ffbb00;
    --danger: #ff4757;

    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);

    --font-display: 'Orbitron', sans-serif;
    --font-body: 'Rajdhani', sans-serif;

    --cell-size: 48px;
}

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

html,
body {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
}

/* Background */
.bg-particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0.2;
    animation: float 20s infinite linear;
}

@keyframes float {
    0% {
        transform: translateY(100vh);
        opacity: 0;
    }

    10% {
        opacity: 0.2;
    }

    90% {
        opacity: 0.2;
    }

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

/* Glass Effect */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
}

/* Game Wrapper */
.game-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
    gap: 10px;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.game-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.turn-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
}

.turn-num {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
}

.turn-phase {
    font-weight: 600;
    padding: 2px 10px;
    background: var(--player-color);
    color: var(--bg-dark);
    border-radius: 12px;
    font-size: 0.8rem;
}

.turn-phase.enemy-turn {
    background: var(--enemy-color);
}

/* Controls - Above Board */
.controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.ctrl-btn {
    padding: 8px 16px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.ctrl-btn:hover {
    transform: translateY(-2px);
}

.ctrl-btn.hint:hover {
    border-color: var(--warning);
    box-shadow: 0 4px 15px rgba(255, 187, 0, 0.3);
}

.ctrl-btn.end:hover {
    border-color: var(--success);
    box-shadow: 0 4px 15px rgba(0, 255, 136, 0.3);
}

.ctrl-btn.new:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 15px rgba(255, 45, 124, 0.3);
}

/* Board Area */
.board-area {
    display: flex;
    justify-content: center;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(10, var(--cell-size));
    grid-template-rows: repeat(8, var(--cell-size));
    gap: 2px;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px;
    border-radius: 12px;
    border: 2px solid var(--glass-border);
    box-shadow: 0 0 40px rgba(0, 212, 255, 0.1);
}

.cell {
    width: var(--cell-size);
    height: var(--cell-size);
    background: rgba(30, 40, 60, 0.6);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
    border: 1px solid transparent;
}

.cell:hover {
    background: rgba(50, 70, 100, 0.8);
    border-color: var(--glass-border);
}

/* Terrain */
.cell.terrain-grass {
    background: linear-gradient(135deg, rgba(34, 87, 46, 0.6), rgba(22, 66, 32, 0.6));
}

.cell.terrain-forest {
    background: linear-gradient(135deg, rgba(20, 60, 25, 0.8), rgba(15, 45, 18, 0.8));
}

.cell.terrain-mountain {
    background: linear-gradient(135deg, rgba(80, 70, 60, 0.8), rgba(60, 50, 40, 0.8));
}

/* Cell States */
.cell.selected {
    border-color: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow), inset 0 0 8px var(--primary-glow);
}

.cell.move-range {
    background: rgba(0, 212, 255, 0.25) !important;
    border-color: var(--primary);
}

.cell.attack-range {
    background: rgba(255, 45, 124, 0.25) !important;
    border-color: var(--accent);
}

/* Units */
.unit {
    width: calc(var(--cell-size) - 10px);
    height: calc(var(--cell-size) - 10px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    position: relative;
    transition: all 0.2s;
    cursor: pointer;
}

.unit.player {
    background: linear-gradient(135deg, var(--player-color), #0099cc);
    border: 2px solid var(--player-color);
    box-shadow: 0 0 12px var(--player-glow);
}

.unit.enemy {
    background: linear-gradient(135deg, var(--enemy-color), #cc2233);
    border: 2px solid var(--enemy-color);
    box-shadow: 0 0 12px var(--enemy-glow);
}

.unit:hover {
    transform: scale(1.1);
}

.unit.selected {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 12px var(--player-glow);
    }

    50% {
        box-shadow: 0 0 25px var(--player-glow);
    }
}

.unit.acted {
    opacity: 0.5;
    filter: grayscale(50%);
}

.unit-hp-bar {
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 2px;
    overflow: hidden;
}

.unit-hp-fill {
    height: 100%;
    background: var(--success);
    transition: width 0.3s;
}

.unit-hp-fill.low {
    background: var(--danger);
}

/* Bottom Panels */
.bottom-panels {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 700px;
    flex-wrap: wrap;
}

.panel {
    flex: 1;
    min-width: 280px;
    padding: 12px;
}

.panel-head {
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 10px;
}

/* Unit Panel */
.empty-msg {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 10px;
}

.unit-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.unit-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.unit-avatar {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-glow), rgba(123, 47, 255, 0.3));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
    flex-shrink: 0;
}

.unit-avatar.enemy {
    border-color: var(--enemy-color);
    box-shadow: 0 0 15px var(--enemy-glow);
    background: linear-gradient(135deg, var(--enemy-glow), rgba(255, 45, 124, 0.3));
}

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

.unit-info-text {
    flex: 1;
}

.unit-name {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.hp-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hp-bar {
    flex: 1;
    height: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    overflow: hidden;
}

.hp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success), var(--primary));
    border-radius: 4px;
    transition: width 0.3s;
}

.hp-fill.low {
    background: linear-gradient(90deg, var(--danger), var(--warning));
}

.hp-txt {
    font-family: var(--font-display);
    font-size: 0.85rem;
    color: var(--primary);
    min-width: 30px;
}

.stat-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.stat {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.stat b {
    color: var(--primary);
    font-family: var(--font-display);
}

.action-row {
    display: flex;
    gap: 6px;
}

.act-btn {
    flex: 1;
    padding: 8px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.act-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.act-btn.move {
    background: linear-gradient(135deg, var(--primary), #0099cc);
    color: var(--bg-dark);
}

.act-btn.attack {
    background: linear-gradient(135deg, var(--accent), var(--danger));
    color: white;
}

.act-btn.wait {
    background: linear-gradient(135deg, #555, #333);
    color: white;
}

.act-btn:not(:disabled):hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
}

/* AI Panel */
.ai-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.ai-icon {
    font-size: 2rem;
    filter: drop-shadow(0 0 8px var(--enemy-glow));
}

.ai-diff .diff-val {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--enemy-color);
}

.ai-thinking {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: rgba(255, 71, 87, 0.1);
    border-radius: 8px;
    color: var(--enemy-color);
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.dots {
    display: flex;
    gap: 4px;
}

.dots span {
    width: 6px;
    height: 6px;
    background: var(--enemy-color);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

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

.ai-msg {
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border-left: 3px solid var(--enemy-color);
}

.ai-msg p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: 0;
}

.hint-msg {
    padding: 8px;
    background: rgba(255, 187, 0, 0.1);
    border-radius: 8px;
    border-left: 3px solid var(--warning);
    margin-top: 8px;
}

.hint-msg p {
    font-size: 0.85rem;
    color: var(--warning);
    line-height: 1.4;
    margin: 0;
}

/* Log Bar */
.log-bar {
    display: flex;
    gap: 15px;
    padding: 8px 15px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow-x: auto;
    max-width: 100%;
    white-space: nowrap;
}

.log-msg {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.log-msg.player-action {
    color: var(--player-color);
}

.log-msg.enemy-action {
    color: var(--enemy-color);
}

.log-msg.combat {
    color: var(--accent);
}

.log-msg.system {
    color: var(--warning);
}

/* Modals */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-box {
    padding: 30px 40px;
    text-align: center;
}

.modal-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.modal-box h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.modal-box.defeat h2 {
    color: var(--enemy-color);
}

.modal-box p {
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.modal-stats {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-bottom: 20px;
    color: var(--text-muted);
}

.modal-stats b {
    color: var(--primary);
    font-family: var(--font-display);
}

.modal-btn {
    padding: 10px 30px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px var(--primary-glow);
}

/* Damage Popup */
.damage-popup {
    position: absolute;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--danger);
    text-shadow: 0 0 8px var(--danger);
    pointer-events: none;
    animation: dmg-float 0.8s ease-out forwards;
    z-index: 100;
}

@keyframes dmg-float {
    0% {
        transform: translateY(0) scale(0.5);
        opacity: 1;
    }

    100% {
        transform: translateY(-30px) scale(1);
        opacity: 0;
    }
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 600px) {
    :root {
        --cell-size: 36px;
    }

    .game-title {
        font-size: 1.2rem;
    }

    .turn-num {
        font-size: 1rem;
    }

    .turn-phase {
        font-size: 0.7rem;
    }

    .ctrl-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .unit {
        font-size: 1.1rem;
    }

    .panel {
        min-width: 100%;
    }

    .bottom-panels {
        flex-direction: column;
    }
}

@media (max-width: 420px) {
    :root {
        --cell-size: 30px;
    }

    .game-wrapper {
        padding: 5px;
        gap: 8px;
    }

    .game-title {
        font-size: 1rem;
    }

    .ctrl-btn {
        padding: 5px 8px;
        font-size: 0.75rem;
    }

    .unit {
        font-size: 0.9rem;
    }

    .unit-hp-bar {
        width: 22px;
    }

    .panel {
        padding: 10px;
    }

    .unit-avatar {
        width: 40px;
        height: 40px;
    }

    .unit-icon {
        font-size: 1.2rem;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 2px;
}

/* Player Stats Badge */
.player-stats {
    font-size: 0.85rem;
    padding: 4px 12px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 15px;
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
}

.player-stats span {
    color: var(--primary);
    font-family: var(--font-display);
    font-weight: 600;
}

/* Help Button */
.ctrl-btn.help {
    border-color: rgba(255, 255, 255, 0.2);
}

.ctrl-btn.help:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 15px var(--primary-glow);
}

/* Undo Button */
.act-btn.undo {
    background: linear-gradient(135deg, var(--warning), #cc9900);
    color: var(--bg-dark);
}

/* Terrain Bonus */
.terrain-bonus {
    color: var(--success) !important;
    font-weight: 600;
}

/* Damage Preview Tooltip */
.damage-preview {
    position: absolute;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    pointer-events: none;
    z-index: 100;
    font-size: 0.9rem;
    box-shadow: 0 0 15px rgba(255, 45, 124, 0.3);
}

.dmg-value {
    color: var(--accent);
    font-family: var(--font-display);
    font-weight: 700;
}

/* Tutorial Modal */
.tutorial-box {
    max-width: 480px;
    width: 90%;
    padding: 0;
    overflow: hidden;
}

.tutorial-header {
    padding: 20px 25px;
    text-align: center;
    border-bottom: 1px solid var(--glass-border);
}

.tutorial-header h2 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    margin-bottom: 4px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.tutorial-tabs {
    display: flex;
    border-bottom: 1px solid var(--glass-border);
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tutorial-content {
    padding: 20px 25px;
    min-height: 220px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Welcome Tab */
.welcome-text p {
    margin-bottom: 12px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.welcome-text strong {
    color: var(--text-primary);
}

.quick-start {
    background: rgba(0, 212, 255, 0.08);
    padding: 12px 15px;
    border-radius: 8px;
    border-left: 3px solid var(--primary);
    margin-top: 15px;
}

.quick-start h4 {
    font-size: 0.85rem;
    color: var(--primary);
    margin-bottom: 8px;
}

.quick-start ol {
    margin-left: 18px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.quick-start li {
    margin-bottom: 4px;
}

.player-text {
    color: var(--player-color);
    font-weight: 600;
}

/* How to Play Tab */
.controls-guide,
.terrain-guide,
.combat-guide {
    margin-bottom: 15px;
}

.controls-guide h4,
.terrain-guide h4,
.combat-guide h4 {
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.key-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.key-item {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

kbd {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: var(--primary);
    margin-right: 6px;
}

.bonus {
    color: var(--success);
    font-weight: 600;
}

.terrain-guide p,
.combat-guide p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* Units Tab */
.unit-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.unit-info-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    text-align: center;
}

.card-icon {
    font-size: 1.4rem;
    margin-bottom: 4px;
}

.unit-info-card strong {
    font-size: 0.85rem;
    color: var(--text-primary);
}

.unit-info-card small {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Tutorial Footer */
.tutorial-footer {
    padding: 15px 25px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dont-show {
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dont-show input {
    cursor: pointer;
}

/* Resume Modal */
.resume-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
}

.modal-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Record Update */
.record-update {
    font-size: 0.85rem;
    color: var(--success);
    margin-bottom: 15px;
}

/* Responsive for Tutorial */
@media (max-width: 500px) {
    .tutorial-box {
        max-width: 100%;
        margin: 10px;
    }

    .tutorial-header {
        padding: 15px;
    }

    .tutorial-content {
        padding: 15px;
        min-height: auto;
    }

    .tutorial-footer {
        padding: 12px 15px;
        flex-direction: column;
        gap: 12px;
    }

    .key-list {
        grid-template-columns: 1fr;
    }

    .unit-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .unit-info-card {
        padding: 8px 6px;
    }

    .card-icon {
        font-size: 1.2rem;
    }
}

/* ========================================
   PHASE 1-3 NEW STYLES
======================================== */

/* Ability Button */
.act-btn.ability {
    background: linear-gradient(135deg, var(--secondary), #5518b0);
    color: white;
}

.act-btn.ability:not(:disabled):hover {
    box-shadow: 0 0 15px rgba(123, 47, 255, 0.5);
}

/* Sound Toggle */
.ctrl-btn.sound {
    min-width: 40px;
    padding: 8px;
}

/* Mode Selection */
.mode-select {
    max-width: 400px;
}

.mode-select h2 {
    margin-bottom: 20px;
}

.mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 20px;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
    font-family: var(--font-body);
}

.mode-btn:hover {
    border-color: var(--primary);
    background: rgba(0, 212, 255, 0.1);
    transform: translateY(-3px);
}

.mode-icon {
    font-size: 2.5rem;
}

.mode-name {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
}

.mode-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}

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

.modal-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Army Builder */
.army-modal {
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.army-builder h3 {
    font-family: var(--font-display);
    margin-bottom: 5px;
}

.army-info {
    color: var(--text-muted);
    margin-bottom: 15px;
}

.unit-roster {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.roster-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.roster-unit:hover {
    border-color: var(--primary);
    background: rgba(0, 212, 255, 0.1);
}

.roster-unit.selected {
    border-color: var(--success);
    background: rgba(0, 255, 136, 0.1);
}

.selected-check {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--success);
    color: var(--bg-dark);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0, 255, 136, 0.4);
}

.roster-icon {
    font-size: 1.8rem;
}

.roster-name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.9rem;
}

.roster-level {
    font-size: 0.75rem;
    color: var(--primary);
}

.roster-stats {
    display: flex;
    gap: 8px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.selected-army {
    margin-bottom: 20px;
}

.selected-army h4 {
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.army-slots {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.army-slot {
    width: 70px;
    height: 70px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--glass-bg);
    border: 2px dashed var(--glass-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.army-slot.filled {
    border-style: solid;
    border-color: var(--primary);
    background: rgba(0, 212, 255, 0.1);
}

.army-slot.filled:hover {
    background: rgba(255, 71, 87, 0.2);
    border-color: var(--danger);
}

.army-slot.empty {
    color: var(--text-muted);
    font-size: 1.5rem;
}

.slot-name {
    font-size: 0.65rem;
    color: var(--text-secondary);
}

.army-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Campaign */
.campaign-modal {
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.campaign-missions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
}

.mission-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.mission-card.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.mission-card.completed {
    border-color: var(--success);
}

.mission-card:not(.locked):hover {
    border-color: var(--primary);
    background: rgba(0, 212, 255, 0.1);
}

.mission-num {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    border-radius: 50%;
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--bg-dark);
}

.mission-card.completed .mission-num {
    background: var(--success);
}

.mission-card.locked .mission-num {
    background: var(--glass-border);
}

.mission-info {
    flex: 1;
}

.mission-name {
    font-family: var(--font-display);
    font-weight: 600;
}

.mission-map {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.mission-reward {
    color: var(--warning);
    font-size: 0.9rem;
}

/* Achievements */
.achievements-modal {
    max-width: 550px;
    max-height: 80vh;
    overflow-y: auto;
}

.achievements-progress {
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
}

.achievements-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.achievement-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 15px 10px;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: 10px;
    text-align: center;
}

.achievement-card.unlocked {
    border-color: var(--warning);
    background: rgba(255, 187, 0, 0.1);
}

.achievement-card.locked {
    opacity: 0.4;
}

.ach-card-icon {
    font-size: 2rem;
}

.ach-card-name {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
}

.ach-card-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Achievement Notification */
.achievement-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    background: linear-gradient(135deg, rgba(255, 187, 0, 0.9), rgba(255, 136, 0, 0.9));
    border-radius: 12px;
    box-shadow: 0 5px 30px rgba(255, 187, 0, 0.4);
    z-index: 2000;
    animation: slideInRight 0.4s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.ach-icon {
    font-size: 2rem;
}

.ach-info {
    display: flex;
    flex-direction: column;
}

.ach-label {
    font-size: 0.75rem;
    color: rgba(0, 0, 0, 0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ach-name {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--bg-dark);
}

/* Level Up Notification */
.levelup-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px 30px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.95), rgba(123, 47, 255, 0.95));
    border-radius: 15px;
    box-shadow: 0 10px 50px rgba(0, 212, 255, 0.5);
    z-index: 2000;
    animation: levelUpPop 0.5s ease-out;
}

@keyframes levelUpPop {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.levelup-icon {
    font-size: 2.5rem;
    animation: bounce-up 0.6s ease infinite;
}

@keyframes bounce-up {

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

    50% {
        transform: translateY(-10px);
    }
}

.levelup-info {
    display: flex;
    flex-direction: column;
}

.levelup-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.levelup-name {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
}

.levelup-level {
    color: var(--warning);
    font-family: var(--font-display);
    font-weight: 600;
}

/* Terrain Styles */
.cell.terrain-water {
    background: linear-gradient(135deg, rgba(0, 100, 200, 0.7), rgba(0, 60, 150, 0.7));
    cursor: not-allowed;
}

.cell.terrain-mountain {
    background: linear-gradient(135deg, rgba(100, 90, 80, 0.8), rgba(70, 60, 50, 0.8));
}

.cell.terrain-road {
    background: linear-gradient(135deg, rgba(80, 70, 60, 0.6), rgba(60, 50, 40, 0.6));
}

.cell.terrain-sand {
    background: linear-gradient(135deg, rgba(194, 178, 128, 0.6), rgba(160, 145, 100, 0.6));
}

.cell.terrain-swamp {
    background: linear-gradient(135deg, rgba(60, 80, 40, 0.7), rgba(40, 60, 30, 0.7));
}

.cell.terrain-bridge {
    background: linear-gradient(135deg, rgba(139, 90, 43, 0.7), rgba(100, 65, 30, 0.7));
}

/* Counter Attack Indicator */
.counter-indicator {
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 16px;
    height: 16px;
    background: var(--warning);
    border-radius: 50%;
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Damage Preview Enhancement */
.damage-preview .can-counter {
    color: var(--warning);
    font-size: 0.7rem;
}

.damage-preview .type-advantage {
    color: var(--success);
    font-size: 0.7rem;
}

/* ========================================
   PHASE 4-6 STYLES
======================================== */

/* Mode Selection Grid */
.mode-select .mode-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Hot-Seat Modal */
.hotseat-modal {
    max-width: 500px;
}

.hotseat-setup {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 20px 0;
}

.player-setup {
    flex: 1;
    text-align: center;
    padding: 15px;
    background: var(--glass-bg);
    border-radius: 10px;
}

.player-setup h4 {
    color: var(--primary);
    margin-bottom: 10px;
}

.vs-divider {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-muted);
}

.army-preview {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.map-select {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.map-select select {
    padding: 8px 15px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-body);
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Spectator Modal */
.spectator-modal {
    max-width: 500px;
}

.ai-select-row {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 20px 0;
}

.ai-select {
    flex: 1;
    text-align: center;
}

.ai-select label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.ai-select select {
    width: 100%;
    padding: 10px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-body);
}

.speed-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
}

.speed-control input[type="range"] {
    width: 150px;
    accent-color: var(--primary);
}

/* AI Commander Badge */
.ai-commander-badge {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 25px;
    z-index: 1000;
}

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

.commander-name {
    font-family: var(--font-display);
    font-weight: 600;
}

/* Turn Transition Overlay */
.turn-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2500;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.turn-text {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-primary);
    text-shadow: 0 0 30px var(--primary);
    animation: pulse-text 1s ease-out;
}

@keyframes pulse-text {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    50% {
        transform: scale(1.1);
    }

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

/* Replay Modal */
.replay-modal {
    max-width: 400px;
}

.replays-list {
    max-height: 300px;
    overflow-y: auto;
    margin: 15px 0;
}

.replay-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.replay-item:hover {
    border-color: var(--primary);
}

.replay-name {
    font-weight: 600;
}

.replay-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.replay-delete {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 1.2rem;
    cursor: pointer;
}

/* VFX Enhancements */
.vfx-particle {
    position: absolute;
    pointer-events: none;
}

/* Projectile Effects */
.projectile {
    position: absolute;
    pointer-events: none;
    z-index: 1500;
}

/* Magic Trail */
.magic-trail {
    position: absolute;
    width: 10px;
    height: 10px;
    background: radial-gradient(circle, var(--secondary), transparent);
    border-radius: 50%;
    pointer-events: none;
    animation: magic-fade 0.5s ease-out forwards;
}

@keyframes magic-fade {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Enhanced Unit Hover with Level */
.unit::after {
    content: attr(data-level);
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-dark);
    border: 2px solid var(--bg-dark);
}

/* Music Toggle Button */
.ctrl-btn.music {
    min-width: 40px;
    padding: 8px;
}

/* Hot-seat player indicator */
.hotseat-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 25px;
    background: var(--glass-bg);
    border: 2px solid var(--primary);
    border-radius: 25px;
    font-family: var(--font-display);
    font-weight: 600;
    z-index: 1000;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 10px var(--primary);
    }

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

/* Responsive Mode Selection */
@media (max-width: 480px) {
    .mode-select .mode-buttons {
        grid-template-columns: 1fr;
    }

    .hotseat-setup,
    .ai-select-row {
        flex-direction: column;
    }

    .vs-divider {
        font-size: 1rem;
    }
}

/* End Turn Reminder */
.end-turn-reminder {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(255, 165, 0, 0.2), rgba(255, 215, 0, 0.2));
    border: 2px solid #ffa500;
    border-radius: 10px;
    margin-top: 10px;
    animation: pulse-reminder 1.5s ease-in-out infinite;
}

.end-turn-reminder.hidden {
    display: none;
}

.reminder-icon {
    font-size: 1.5rem;
    animation: shake 0.5s ease-in-out infinite;
}

.reminder-text {
    color: #fff;
    font-size: 0.95rem;
}

.reminder-text strong {
    color: #ffd700;
}

@keyframes pulse-reminder {

    0%,
    100% {
        box-shadow: 0 0 5px rgba(255, 165, 0, 0.5);
    }

    50% {
        box-shadow: 0 0 20px rgba(255, 165, 0, 0.8);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(-10deg);
    }

    75% {
        transform: rotate(10deg);
    }
}

/* Highlight pulse for End Turn button */
.highlight-pulse {
    animation: button-pulse 1s ease-in-out infinite !important;
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.8), 0 0 40px rgba(0, 212, 255, 0.4) !important;
}

@keyframes button-pulse {

    0%,
    100% {
        box-shadow: 0 0 15px rgba(0, 212, 255, 0.6), 0 0 30px rgba(0, 212, 255, 0.3);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 30px rgba(0, 212, 255, 1), 0 0 60px rgba(0, 212, 255, 0.6);
        transform: scale(1.05);
    }
}

/* Game Footer */
.game-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    margin-top: 15px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.footer-link:hover {
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary-glow);
}

.footer-divider {
    color: var(--text-muted);
    font-size: 0.8rem;
}