/* Xenovoid - Cyberpunk Roguelike Styles */

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

body {
    background: #0a0a12;
    color: #00ff88;
    font-family: 'Courier New', 'Consolas', monospace;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
}

h1 {
    color: #ff00ff;
    text-shadow: 0 0 10px #ff00ff, 0 0 20px #ff00ff;
    margin-bottom: 10px;
    font-size: 28px;
    letter-spacing: 4px;
}

.subtitle {
    color: #666;
    font-size: 12px;
    margin-bottom: 15px;
}

.game-container {
    display: flex;
    gap: 15px;
    max-width: 1200px;
    width: 100%;
}

.main-view {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.side-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 250px;
}

.panel {
    background: #0f0f1a;
    border: 1px solid #1a1a2e;
    border-radius: 4px;
    padding: 10px;
}

.panel h2 {
    color: #00ffff;
    font-size: 12px;
    margin-bottom: 8px;
    border-bottom: 1px solid #1a1a2e;
    padding-bottom: 4px;
}

.entity-row {
    padding: 3px 0;
    font-size: 12px;
    border-bottom: 1px solid #111;
}

#entity-list {
    max-height: 120px;
    overflow-y: auto;
}

#ascii-view {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.15;
    white-space: pre;
    background: #000;
    padding: 15px;
    border-radius: 4px;
    overflow: auto;
    min-height: 400px;
    border: 1px solid #1a1a2e;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 12px;
}

.stat-label { color: #666; }
.stat-value { color: #00ff88; }

.speedrun-timer {
    background: linear-gradient(90deg, rgba(255, 0, 102, 0.1), rgba(255, 0, 255, 0.1));
    border: 1px solid #ff0066;
    border-radius: 3px;
    padding: 4px 8px;
    margin: 4px 0;
}

.speedrun-timer .stat-label {
    color: #ff0066;
}

.speedrun-timer .stat-value {
    color: #ff00ff;
    font-weight: bold;
    font-size: 14px;
    text-shadow: 0 0 5px #ff00ff;
}

.health-bar {
    height: 14px;
    background: #1a1a2e;
    border-radius: 2px;
    margin-bottom: 8px;
    overflow: hidden;
    position: relative;
}

.health-bar .fill {
    height: 100%;
    background: linear-gradient(90deg, #ff0066, #ff00ff);
    transition: width 0.3s;
    position: absolute;
    left: 0;
    top: 0;
}

.health-bar .shield-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ccff, #00ffff);
    transition: width 0.3s;
    position: absolute;
    top: 0;
    opacity: 0.8;
}

@keyframes health-flash {
    0%, 100% { background: linear-gradient(90deg, #ff0066, #ff00ff); }
    50% { background: #ff0000; box-shadow: 0 0 10px #ff0000; }
}

.health-bar .fill.damaged {
    animation: health-flash 0.3s ease-out;
}

#message-log {
    max-height: 180px;
    overflow-y: auto;
    font-size: 11px;
}

#message-log .msg {
    padding: 3px 0;
    border-bottom: 1px solid #1a1a2e;
    color: #888;
}

#message-log .msg:last-child {
    color: #00ff88;
}

#controls-help {
    font-size: 10px;
    color: #444;
    line-height: 1.6;
}

#controls-help kbd {
    background: #1a1a2e;
    padding: 2px 6px;
    border-radius: 2px;
    color: #00ffff;
}

/* Game Over Overlay */
.game-over-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.game-over-box {
    text-align: center;
    padding: 40px;
}

.game-over-box h2 {
    font-size: 36px;
    margin-bottom: 20px;
    text-shadow: 0 0 20px currentColor;
}

.game-over-box.victory h2 { color: #00ff88; }
.game-over-box.defeat h2 { color: #ff0066; }

.game-over-box button {
    padding: 12px 24px;
    font-size: 14px;
    background: transparent;
    border: 1px solid #00ffff;
    color: #00ffff;
    cursor: pointer;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.2s;
}

.game-over-box button:hover {
    background: #00ffff;
    color: #000;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    margin: 20px auto;
    border: 3px solid rgba(0, 255, 255, 0.2);
    border-top-color: #00ffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Key Moments / Pivot Points */
#key-moments {
    margin: 20px 0;
    text-align: left;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.no-pivots {
    color: #666;
    font-style: italic;
    text-align: center;
}

.pivots-title {
    color: #00ffff;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 12px;
    border-bottom: 1px solid #333;
    padding-bottom: 8px;
}

.pivots-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pivot-item {
    background: rgba(0, 255, 255, 0.05);
    border: 1px solid #333;
    border-radius: 4px;
    padding: 10px;
}

.pivot-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.pivot-type {
    color: #00ffff;
    font-weight: bold;
}

.pivot-turn {
    color: #666;
    font-size: 12px;
}

.pivot-desc {
    color: #aaa;
    font-size: 12px;
    margin-bottom: 8px;
}

.pivot-sig {
    height: 4px;
    background: #222;
    border-radius: 2px;
    overflow: hidden;
}

.sig-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.pivot-sig.high .sig-bar { background: #ff0066; }
.pivot-sig.medium .sig-bar { background: #ffaa00; }
.pivot-sig.low .sig-bar { background: #00ff88; }

/* Level Picker */
.level-picker-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.95);
    justify-content: center;
    align-items: center;
    z-index: 300;
}

.level-picker-box {
    text-align: center;
    padding: 30px;
    max-width: 600px;
    width: 90%;
}

.level-picker-box h2 {
    color: #ff00ff;
    font-size: 28px;
    margin-bottom: 10px;
    text-shadow: 0 0 20px #ff00ff;
}

.level-picker-box .picker-subtitle {
    color: #666;
    font-size: 12px;
    margin-bottom: 15px;
}

/* Collection tabs */
.collection-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
}

.collection-tab {
    background: transparent;
    border: 1px solid #333;
    color: #666;
    padding: 6px 12px;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 3px;
}

.collection-tab:hover {
    border-color: #555;
    color: #999;
}

.collection-tab.active {
    border-color: #00ffff;
    color: #00ffff;
    background: rgba(0, 255, 255, 0.1);
}

.collection-tab .tab-icon {
    margin-right: 4px;
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.level-card {
    background: #0f0f1a;
    border: 1px solid #1a1a2e;
    border-radius: 4px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.level-card:hover {
    border-color: #00ffff;
    background: #1a1a2e;
}

.level-card .level-name {
    color: #00ffff;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 4px;
}

.level-card .level-desc {
    color: #666;
    font-size: 11px;
    margin-bottom: 6px;
}

.level-card .level-meta {
    font-size: 10px;
    color: #444;
}

.level-card .level-meta .difficulty-easy { color: #00ff88; }
.level-card .level-meta .difficulty-medium { color: #ffff00; }
.level-card .level-meta .difficulty-hard { color: #ff0066; }

.level-card .level-notes {
    font-size: 9px;
    color: #666;
    font-style: italic;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid #222;
}

.level-card.random-card {
    border-color: #ff00ff;
    background: linear-gradient(135deg, #1a0a1a 0%, #0a1a1a 100%);
}

.level-card.random-card:hover {
    border-color: #ff00ff;
    box-shadow: 0 0 15px rgba(255,0,255,0.3);
}

.level-card.random-card .level-name {
    color: #ff00ff;
}

.level-card.infinite-card {
    border-color: #ff6600;
    background: linear-gradient(135deg, #1a0f0a 0%, #0a0a1a 100%);
}

.level-card.infinite-card:hover {
    border-color: #ff6600;
    box-shadow: 0 0 15px rgba(255,102,0,0.3);
}

.level-card.infinite-card .level-name {
    color: #ff6600;
}

/* Stats Modal */
.stats-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.95);
    justify-content: center;
    align-items: center;
    z-index: 400;
}

.stats-modal-box {
    text-align: center;
    padding: 30px;
    max-width: 550px;
    max-height: 90vh;
    overflow-y: auto;
    width: 90%;
    background: #0a0a12;
    border: 1px solid #00ffff;
    border-radius: 8px;
}

.stats-modal-box h2 {
    color: #00ffff;
    font-size: 24px;
    margin-bottom: 20px;
    text-shadow: 0 0 10px rgba(0,255,255,0.3);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    text-align: left;
    margin-bottom: 20px;
}

.stat-item {
    background: #0f0f1a;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #1a1a2e;
}

.stat-item .stat-name {
    color: #666;
    font-size: 11px;
    text-transform: uppercase;
}

.stat-item .stat-val {
    color: #00ffff;
    font-size: 18px;
    font-weight: bold;
}

.stats-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

.stats-btn {
    background: transparent;
    border: 1px solid #666;
    color: #666;
    padding: 8px 16px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    transition: all 0.2s;
}

.stats-btn:hover {
    border-color: #00ffff;
    color: #00ffff;
}

.stats-btn.primary {
    border-color: #00ffff;
    color: #00ffff;
}

/* Stats Modal Sections */
.stats-section {
    margin-bottom: 20px;
    text-align: left;
}

.stats-section h3 {
    color: #888;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #1a1a2e;
}
.stats-badge {
    font-size: 9px;
    background: #0ff3;
    color: #0ff;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 8px;
    text-transform: lowercase;
    letter-spacing: 0;
}

.stats-section .stats-grid {
    grid-template-columns: repeat(4, 1fr);
    margin-bottom: 0;
}

.stat-item {
    text-align: center;
}

/* Level Progression Bars */
.level-bars, .death-bars {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.level-bar-row, .death-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.level-label, .death-label {
    width: 24px;
    font-size: 11px;
    color: #666;
    text-align: right;
}

.level-bar-container, .death-bar-container {
    flex: 1;
    height: 16px;
    background: #0f0f1a;
    border-radius: 2px;
    overflow: hidden;
}

.level-bar.reached {
    height: 100%;
    background: #1a3a1a;
    border-radius: 2px;
    position: relative;
}

.level-bar.completed {
    height: 100%;
    background: #00ff88;
    border-radius: 2px;
}

.death-bar {
    height: 100%;
    background: #ff4444;
    border-radius: 2px;
}

.level-count, .death-count {
    width: 70px;
    font-size: 11px;
    color: #888;
    text-align: left;
}

.no-data {
    color: #444;
    font-style: italic;
    padding: 10px;
    text-align: center;
}

/* Pivot Stats in Modal */
.pivot-stats-grid {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 16px;
}

.pivot-stat-item {
    text-align: center;
}

.pivot-stat-val {
    font-size: 24px;
    color: #00ffff;
    font-weight: bold;
}

.pivot-stat-name {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
}

.pivot-type-bars {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.pivot-type-label {
    width: 80px;
    font-size: 11px;
    color: #888;
    text-align: right;
}

.pivot-type-bar-container {
    flex: 1;
    height: 16px;
    background: #0f0f1a;
    border-radius: 2px;
    overflow: hidden;
}

.pivot-type-bar {
    height: 100%;
    background: #00ffff;
    border-radius: 2px;
}

.pivot-type-count {
    width: 30px;
    font-size: 11px;
    color: #888;
    text-align: right;
}

.pivot-type-winrate {
    width: 40px;
    font-size: 11px;
    text-align: right;
}

.pivot-type-winrate.good { color: #00ff88; }
.pivot-type-winrate.bad { color: #ff4444; }

/* Legend */
.legend {
    font-size: 14px;
    color: #888;
    line-height: 1.8;
    padding: 8px 12px;
}

.legend-header {
    cursor: pointer;
    color: #666;
    font-size: 12px;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-header:hover {
    color: #0ff;
}

.legend-toggle {
    color: #0ff;
    font-weight: bold;
    font-size: 14px;
}

.legend-arrow {
    font-size: 10px;
    transition: transform 0.2s;
}

.legend.collapsed .legend-arrow {
    transform: rotate(0deg);
}

.legend:not(.collapsed) .legend-arrow {
    transform: rotate(90deg);
}

.legend-items {
    margin-top: 8px;
}

.legend.collapsed .legend-items {
    display: none;
}

.legend-item {
    display: inline-block;
    margin-right: 15px;
    cursor: help;
    position: relative;
}

.legend-item:hover {
    color: #fff;
}

.legend-item:hover::after {
    content: attr(data-info);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a2e;
    border: 1px solid #00ff88;
    color: #00ff88;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    margin-bottom: 5px;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.legend-item:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #00ff88;
    margin-bottom: -7px;
    z-index: 1001;
}

.legend-char {
    color: #00ff88;
    font-size: 16px;
    font-weight: bold;
}

/* Inventory panel */
.inventory {
    padding: 8px 12px;
    background: rgba(0, 20, 0, 0.8);
}

.inventory-items {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.inv-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: #1a1a2e;
    border: 1px solid #444;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.inv-item:hover {
    border-color: #00ff88;
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.4);
}

.inv-item kbd {
    background: #333;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    color: #888;
}

.inv-item .count {
    color: #00ff88;
    font-weight: bold;
}

.inv-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.inv-item.passive {
    cursor: default;
    border-color: #333;
}

.inv-item.passive:hover {
    border-color: #555;
    box-shadow: none;
}

.inv-item.solved {
    border-color: #00ff88;
    background: rgba(0, 255, 136, 0.15);
    animation: sidebarSolvedPulse 1.5s infinite;
}

@keyframes sidebarSolvedPulse {
    0%, 100% {
        box-shadow: 0 0 5px rgba(0, 255, 136, 0.4);
        border-color: #00ff88;
    }
    50% {
        box-shadow: 0 0 15px rgba(0, 255, 136, 0.8);
        border-color: #44ffaa;
    }
}

.inv-item:hover::after {
    content: attr(data-info);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a2e;
    border: 1px solid #00ff88;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 100;
    color: #ccc;
    margin-bottom: 8px;
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
}

.inv-item:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #00ff88;
    margin-bottom: -4px;
    z-index: 100;
}

/* Sprite colors */
.sp-player { color: #00ff00; font-weight: bold; }
.sp-floor { color: #333; }
.sp-wall { color: #444; }
.sp-void { color: #000; }
.sp-door { color: #8b4513; }
.sp-door_locked { color: #ff0000; }
.sp-node { color: #00ffff; }
.sp-data_stream { color: #00ff00; }
.sp-firewall { color: #ff4444; }
.sp-portal { color: #ff00ff; font-weight: bold; }

.sp-void_heart {
    color: #ff0066;
    font-weight: bold;
    animation: pulse 1s infinite;
    font-family: 'Segoe UI Symbol', 'Apple Symbols', 'Noto Sans Symbols', 'Symbola', monospace;
}

@keyframes pulse {
    0%, 100% { opacity: 1; text-shadow: 0 0 10px #ff0066; }
    50% { opacity: 0.7; text-shadow: 0 0 20px #ff0066, 0 0 30px #ff0066; }
}

.sp-terminal { color: #00ff00; }
.sp-corrupt { color: #aa00aa; }
.sp-xeno_scout { color: #ff00ff; }
.sp-xeno_drone { color: #aa00ff; }
.sp-xeno_guardian { color: #ff00aa; font-weight: bold; }
.sp-xeno_mind { color: #ff0000; font-weight: bold; }

.sp-void_core {
    color: #ff0066;
    font-weight: bold;
    animation: pulse 0.5s infinite;
    font-family: 'Segoe UI Symbol', 'Apple Symbols', 'Noto Sans Symbols', 'Symbola', monospace;
    text-shadow: 0 0 15px #ff0066, 0 0 25px #ff0066;
}

.sp-xeno_tendril { color: #cc00cc; }
.sp-xeno_spore { color: #ff88ff; }
.sp-item_data { color: #ffff00; }
.sp-item_key { color: #ffd700; }
.sp-item_tool { color: #00ffff; }
.sp-item_shield { color: #4444ff; }
.sp-npc_hacker { color: #00ffff; }
.sp-npc_ai { color: #ffff00; }
.sp-npc_ghost { color: #888888; }
.sp-petri_place { color: #888888; }
.sp-petri_place_data { color: #4444ff; }
.sp-petri_place_power { color: #ffff00; }
.sp-petri_place_virus { color: #ff4444; }
.sp-petri_place_memory { color: #44ff44; }
.sp-petri_place_signal { color: #aa44ff; }
.sp-petri_place_wild { color: #ffffff; }
.sp-petri_place_goal { color: #00ff00; font-weight: bold; }
.sp-petri_trans { color: #888888; }
.sp-petri_trans_ready { color: #00ff00; font-weight: bold; }
.sp-token_data { color: #4444ff; }
.sp-token_power { color: #ffff00; }
.sp-token_virus { color: #ff4444; }
.sp-token_memory { color: #44ff44; }
.sp-token_signal { color: #aa44ff; }
.sp-token_wild { color: #ffffff; font-weight: bold; }
.sp-item_virus { color: #ff0000; }
.sp-explored { color: #222; }

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.blink { animation: blink 1s infinite; }

/* Damage flash effect */
@keyframes damage-flash {
    0% {
        text-shadow: 0 0 0 rgba(255, 0, 0, 1);
        color: #ff0000;
    }
    50% {
        text-shadow: 0 0 15px rgba(255, 0, 0, 0.8),
                     0 0 30px rgba(255, 0, 0, 0.6),
                     0 0 45px rgba(255, 0, 0, 0.4);
        color: #ff4444;
    }
    100% {
        text-shadow: 0 0 0 rgba(255, 0, 0, 0);
        color: #00ff00;
    }
}

@keyframes damage-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.8);
        opacity: 1;
    }
    100% {
        box-shadow: 0 0 0 20px rgba(255, 0, 0, 0);
        opacity: 0;
    }
}

.sp-player.damaged {
    animation: damage-flash 0.4s ease-out;
}

.damage-ring {
    position: absolute;
    width: 10px;
    height: 16px;
    border-radius: 50%;
    pointer-events: none;
    animation: damage-ring 0.5s ease-out forwards;
}

/* Ping heal effect */
@keyframes ping-pulse {
    0% {
        text-shadow: 0 0 0 rgba(0, 255, 255, 1);
        color: #00ffff;
    }
    50% {
        text-shadow: 0 0 20px rgba(0, 255, 255, 0.8),
                     0 0 40px rgba(0, 255, 255, 0.6),
                     0 0 60px rgba(0, 255, 255, 0.4);
        color: #88ffff;
    }
    100% {
        text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
        color: #00ff00;
    }
}

@keyframes ping-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 255, 255, 0.8),
                    0 0 0 0 rgba(0, 255, 255, 0.4);
    }
    100% {
        box-shadow: 0 0 0 30px rgba(0, 255, 255, 0),
                    0 0 0 60px rgba(0, 255, 255, 0);
    }
}

.sp-player.pinging {
    animation: ping-pulse 0.6s ease-out;
}

.ping-ring {
    position: absolute;
    width: 8px;
    height: 14px;
    border-radius: 50%;
    pointer-events: none;
    animation: ping-ring 0.8s ease-out forwards;
}

.health-bar .fill.healing {
    animation: health-heal 0.4s ease-out;
}

@keyframes health-heal {
    0% { background: linear-gradient(90deg, #ff0066, #ff00ff); }
    50% { background: #00ffff; box-shadow: 0 0 10px #00ffff; }
    100% { background: linear-gradient(90deg, #ff0066, #ff00ff); }
}

/* Dialogue overlay */
.dialogue-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.85);
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.dialogue-box {
    background: #0f0f1a;
    border: 2px solid #00ffff;
    border-radius: 8px;
    padding: 20px 30px;
    max-width: 500px;
    box-shadow: 0 0 20px rgba(0,255,255,0.3);
}

.dialogue-box h3 {
    color: #00ffff;
    margin-bottom: 10px;
    font-size: 16px;
}

.dialogue-box p {
    color: #00ff88;
    margin-bottom: 15px;
    line-height: 1.5;
}

.dialogue-option {
    display: block;
    width: 100%;
    padding: 10px 15px;
    margin: 5px 0;
    background: transparent;
    border: 1px solid #444;
    color: #888;
    font-family: inherit;
    font-size: 12px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

.dialogue-option:hover,
.dialogue-option.selected {
    border-color: #00ffff;
    color: #00ffff;
    background: rgba(0,255,255,0.1);
}

.dialogue-option.selected {
    border-width: 2px;
    box-shadow: 0 0 10px rgba(0,255,255,0.3);
}

.dialogue-option .key {
    display: inline-block;
    background: #1a1a2e;
    padding: 2px 6px;
    border-radius: 2px;
    margin-right: 8px;
    color: #00ffff;
    font-size: 10px;
}

.dialogue-option .hex-id {
    color: #666;
    font-size: 10px;
    font-family: monospace;
    margin-right: 4px;
}

.dialogue-option:hover .hex-id,
.dialogue-option.selected .hex-id {
    color: #888;
}

/* Mission/Puzzle overlay */
.mission-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.92);
    justify-content: center;
    align-items: center;
    z-index: 1600;
}

.mission-box {
    background: #0a0a12;
    border: 2px solid #ff00ff;
    border-radius: 8px;
    padding: 20px 30px;
    max-width: 700px;
    min-width: 500px;
    box-shadow: 0 0 30px rgba(255,0,255,0.3);
}

.mission-box h3 {
    color: #ff00ff;
    margin-bottom: 15px;
    font-size: 16px;
    text-align: center;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.mission-graph {
    font-family: monospace;
    font-size: 12px;
    line-height: 1.4;
    white-space: pre;
    color: #888;
    background: #050508;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    overflow-x: auto;
}

.mission-graph .place { color: #00ff88; cursor: pointer; }
.mission-graph .place:hover { text-decoration: underline; }
.mission-graph .place-empty { color: #444; cursor: pointer; }
.mission-graph .place-empty:hover { color: #666; }
.mission-graph .place-fulfilled { color: #00aa66; cursor: pointer; }
.mission-graph .place-fulfilled:hover { text-decoration: underline; }
.mission-graph .fulfilled { color: #00aa66; font-weight: bold; }
.mission-graph .transition { color: #ffff00; cursor: pointer; }
.mission-graph .transition:hover { text-decoration: underline; }
.mission-graph .transition-ready { color: #00ffff; font-weight: bold; cursor: pointer; }
.mission-graph .transition-ready:hover { text-decoration: underline; text-shadow: 0 0 5px #00ffff; }
.mission-graph .arrow { color: #666; }
.mission-graph .token { color: #ff00ff; }
.mission-graph .clickable { cursor: pointer; }
.mission-graph .clickable:hover { filter: brightness(1.3); }
.mission-graph .undiscovered { color: #333; font-style: italic; }

/* Puzzle Solved States */
.mission-box.puzzle-solved {
    border-color: #00ff88;
    box-shadow: 0 0 40px rgba(0, 255, 136, 0.5);
    animation: solvedPulse 2s infinite;
}

.mission-box.puzzle-solved h3 {
    color: #00ff88;
}

@keyframes solvedPulse {
    0%, 100% { box-shadow: 0 0 30px rgba(0, 255, 136, 0.4); }
    50% { box-shadow: 0 0 50px rgba(0, 255, 136, 0.7); }
}

.puzzle-solved-banner {
    text-align: center;
    padding: 15px;
    margin-top: 10px;
    background: linear-gradient(135deg, #001a10 0%, #002a18 100%);
    border: 2px solid #00ff88;
    border-radius: 6px;
    color: #00ff88;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0 0 10px #00ff88;
    animation: bannerGlow 1.5s infinite;
}

@keyframes bannerGlow {
    0%, 100% { text-shadow: 0 0 10px #00ff88, 0 0 20px #00ff88; }
    50% { text-shadow: 0 0 20px #00ff88, 0 0 40px #00ff88; }
}

.puzzle-warp-info {
    display: block;
    margin-top: 8px;
    color: #ff00ff;
    font-size: 14px;
    text-shadow: 0 0 5px #ff00ff;
}

.mission-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 11px;
    color: #666;
    margin-top: 10px;
}

.mission-legend span { margin-right: 5px; }

.mission-close {
    display: block;
    width: 100%;
    padding: 10px;
    background: #1a1a2e;
    border: 1px solid #ff00ff;
    color: #ff00ff;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    margin-top: 15px;
}

.mission-close:hover {
    background: #ff00ff;
    color: #000;
}

/* History overlay */
.history-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.92);
    justify-content: center;
    align-items: center;
    z-index: 85;
}

.history-box {
    background: #0a0a12;
    border: 2px solid #00ff88;
    border-radius: 8px;
    padding: 20px 30px;
    max-width: 600px;
    min-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 0 30px rgba(0,255,136,0.3);
}

.history-box h3 {
    color: #00ff88;
    margin-bottom: 15px;
    font-size: 16px;
    text-align: center;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.history-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 15px;
    padding: 10px;
    background: #0f0f1a;
    border-radius: 4px;
}

.history-stat {
    text-align: center;
}

.history-stat .value {
    font-size: 24px;
    color: #00ffff;
    font-weight: bold;
}

.history-stat .label {
    font-size: 10px;
    color: #666;
    text-transform: uppercase;
}

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

.history-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    margin: 4px 0;
    background: #0f0f1a;
    border-radius: 4px;
    border-left: 3px solid #666;
    font-size: 11px;
}

.history-entry.victory {
    border-left-color: #00ff88;
}

.history-entry.defeat {
    border-left-color: #ff0066;
}

.history-entry .result {
    font-weight: bold;
    width: 60px;
}

.history-entry.victory .result {
    color: #00ff88;
}

.history-entry.defeat .result {
    color: #ff0066;
}

.history-entry .details {
    flex: 1;
    color: #888;
    margin: 0 10px;
}

.history-entry .seed {
    font-family: monospace;
    color: #666;
    cursor: pointer;
}

.history-entry .seed:hover {
    color: #00ffff;
    text-decoration: underline;
}

.history-entry .date {
    color: #444;
    font-size: 10px;
}

.history-actions {
    display: flex;
    gap: 10px;
}

.history-btn {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: 1px solid #666;
    color: #666;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
}

.history-btn:hover {
    border-color: #ff0066;
    color: #ff0066;
}

.history-close {
    flex: 1;
    padding: 10px;
    background: #1a1a2e;
    border: 1px solid #00ff88;
    color: #00ff88;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
}

.history-close:hover {
    background: #00ff88;
    color: #000;
}

/* Replay Picker Overlay */
.replay-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.replay-picker-overlay.hidden { display: none; }

.replay-picker-box {
    background: #0a0a12;
    border: 2px solid #0ff;
    padding: 20px;
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.replay-picker-box h2 {
    color: #0ff;
    text-align: center;
    margin-bottom: 10px;
    text-shadow: 0 0 10px #0ff;
}

.replay-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
}

.replay-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: #111;
    border: 1px solid #333;
    cursor: pointer;
    transition: all 0.2s;
}

.replay-card:hover {
    border-color: #0ff;
    background: #1a1a2e;
}

.replay-card.victory { border-left: 3px solid #0f0; }
.replay-card.defeat { border-left: 3px solid #f00; }

.replay-glyph {
    font-size: 8px;
    line-height: 1;
    color: #0ff;
    white-space: pre;
    font-family: monospace;
}

.replay-info {
    flex: 1;
}

.replay-id {
    color: #0ff;
    font-size: 0.9em;
    font-family: monospace;
}

.replay-meta {
    color: #666;
    font-size: 0.8em;
    margin-top: 3px;
}

.replay-stats {
    color: #888;
    font-size: 0.8em;
}

.replay-close {
    display: block;
    margin: 15px auto 0;
    padding: 10px 30px;
    background: transparent;
    border: 1px solid #666;
    color: #666;
    font-family: inherit;
    cursor: pointer;
}

.replay-close:hover {
    border-color: #0ff;
    color: #0ff;
}

/* Replay controls bar */
.replay-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: #111;
    border: 1px solid #0ff;
    margin-bottom: 10px;
}

.replay-controls.hidden { display: none; }

.replay-btn {
    padding: 5px 12px;
    background: transparent;
    border: 1px solid #0ff;
    color: #0ff;
    font-family: monospace;
    cursor: pointer;
}

.replay-btn:hover { background: #0ff; color: #000; }
.replay-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.replay-progress {
    flex: 1;
    color: #0ff;
    font-family: monospace;
    font-size: 0.9em;
}

.replay-speed {
    color: #666;
    font-size: 0.8em;
}

/* After-Action Report */
.report-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.report-box {
    background: #0a0a14;
    border: 2px solid #00ffff;
    padding: 20px 30px;
    max-width: 900px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 0 40px rgba(0, 255, 255, 0.3);
}

.report-header {
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #1a1a2e;
    padding-bottom: 15px;
}

.report-header h2 {
    color: #00ffff;
    margin: 0 0 15px 0;
    font-size: 24px;
    letter-spacing: 3px;
}

.report-outcome {
    font-size: 18px;
    margin-bottom: 10px;
}

.report-victory {
    color: #00ff88;
    font-weight: bold;
}

.report-defeat {
    color: #ff0066;
    font-weight: bold;
}

.report-stats-row {
    display: flex;
    justify-content: center;
    gap: 30px;
    color: #888;
    font-size: 14px;
}

.report-frames {
    min-height: 300px;
    margin-bottom: 20px;
}

.report-loading,
.report-error,
.report-no-frames {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-style: italic;
}

.report-error {
    color: #ff6666;
}

.report-frame {
    background: #0f0f1a;
    border: 1px solid #1a1a2e;
    padding: 15px;
}

.frame-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #1a1a2e;
}

.frame-type {
    font-size: 16px;
    color: #00ffff;
}

.frame-turn,
.frame-depth {
    color: #666;
    font-size: 12px;
}

.frame-description {
    color: #ccc;
    margin-bottom: 10px;
    line-height: 1.5;
}

.frame-hp {
    font-size: 12px;
    margin-bottom: 15px;
    padding: 5px 10px;
    display: inline-block;
    border-radius: 3px;
}

.frame-hp.healthy {
    color: #00ff88;
    background: rgba(0, 255, 136, 0.1);
}

.frame-hp.warning {
    color: #ffaa00;
    background: rgba(255, 170, 0, 0.1);
}

.frame-hp.critical {
    color: #ff0066;
    background: rgba(255, 0, 102, 0.1);
}

.frame-ascii {
    background: #000;
    border: 1px solid #1a1a2e;
    padding: 10px;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.2;
    overflow-x: auto;
    white-space: nowrap;
    color: #888;
}

.report-nav {
    display: none;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.report-nav-btn {
    background: transparent;
    border: 1px solid #00ffff;
    color: #00ffff;
    padding: 8px 16px;
    cursor: pointer;
    font-family: monospace;
    transition: all 0.2s;
}

.report-nav-btn:hover:not(:disabled) {
    background: #00ffff;
    color: #000;
}

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

.report-frame-indicator {
    color: #666;
    font-size: 14px;
}

.report-close {
    display: block;
    width: 100%;
    background: transparent;
    border: 1px solid #666;
    color: #666;
    padding: 10px 20px;
    cursor: pointer;
    font-family: monospace;
    font-size: 14px;
    transition: all 0.2s;
}

.report-close:hover {
    border-color: #00ffff;
    color: #00ffff;
}

/* Intervention Overlay */
.intervention-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    justify-content: center;
    align-items: center;
    z-index: 1500;
}

.intervention-box {
    background: #0a0a14;
    border: 2px solid #ff00ff;
    padding: 30px 40px;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 0 60px rgba(255, 0, 255, 0.4);
    animation: intervention-pulse 2s ease-in-out infinite;
}

@keyframes intervention-pulse {
    0%, 100% { box-shadow: 0 0 40px rgba(255, 0, 255, 0.3); }
    50% { box-shadow: 0 0 80px rgba(255, 0, 255, 0.5); }
}

.intervention-box h2 {
    color: #ff00ff;
    margin: 0 0 20px 0;
    font-size: 28px;
    letter-spacing: 4px;
}

.intervention-context {
    color: #ccc;
    font-size: 16px;
    margin-bottom: 20px;
    line-height: 1.6;
}

.intervention-puzzle {
    background: #0f0f1a;
    border: 1px solid #1a1a2e;
    padding: 15px;
    margin-bottom: 25px;
    text-align: left;
}

.intervention-puzzle .puzzle-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.intervention-puzzle .puzzle-label {
    color: #888;
}

.intervention-puzzle .puzzle-value {
    color: #00ffff;
    font-weight: bold;
}

.intervention-puzzle .puzzle-value.complete {
    color: #00ff88;
}

/* Intervention Stats */
.intervention-stats {
    margin: 15px 0;
    padding: 15px;
    background: #0a0a14;
    border: 1px solid #444;
    border-radius: 6px;
}

.intervention-stats .stats-header {
    color: #00ffff;
    font-size: 12px;
    margin-bottom: 12px;
    text-align: center;
    border-bottom: 1px solid #333;
    padding-bottom: 8px;
}

.intervention-stats .stats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.intervention-stats .stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #050508;
    border-radius: 4px;
    font-size: 12px;
}

.intervention-stats .stat-item.complete {
    border: 1px solid #00ff88;
    color: #00ff88;
}

.intervention-stats .stat-item.incomplete {
    border: 1px solid #ff8800;
    color: #ff8800;
}

.intervention-stats .stat-icon {
    font-family: monospace;
    font-weight: bold;
}

.intervention-stats .stat-label {
    color: #888;
}

.intervention-stats .stat-value {
    font-weight: bold;
}

.intervention-stats .stats-warning {
    margin-top: 12px;
    text-align: center;
    color: #ff8800;
    font-size: 13px;
    animation: warningPulse 1.5s infinite;
}

@keyframes warningPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.intervention-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.intervention-back-btn {
    background: transparent;
    border: 1px solid #ff8800;
    color: #ff8800;
    padding: 12px 25px;
    font-family: monospace;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.intervention-back-btn:hover {
    background: rgba(255, 136, 0, 0.2);
    box-shadow: 0 0 20px rgba(255, 136, 0, 0.4);
}

.intervention-puzzle-btn {
    background: transparent;
    border: 1px solid #00ffff;
    color: #00ffff;
    padding: 12px 25px;
    font-family: monospace;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.intervention-puzzle-btn:hover {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.4);
}

.intervention-continue {
    background: linear-gradient(135deg, #ff00ff 0%, #aa00aa 100%);
    border: none;
    color: #fff;
    padding: 15px 40px;
    font-family: monospace;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.intervention-continue:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 0, 255, 0.6);
}

/* Advisor Overlay */
.advisor-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    justify-content: center;
    align-items: center;
    z-index: 1600;
}

.advisor-box {
    background: #0a0a14;
    border: 2px solid #00ffff;
    padding: 25px 35px;
    max-width: 450px;
    text-align: center;
    box-shadow: 0 0 60px rgba(0, 255, 255, 0.3);
    animation: advisor-pulse 2s ease-in-out infinite;
}

@keyframes advisor-pulse {
    0%, 100% { box-shadow: 0 0 40px rgba(0, 255, 255, 0.2); }
    50% { box-shadow: 0 0 70px rgba(0, 255, 255, 0.4); }
}

.advisor-box h2 {
    color: #00ffff;
    margin: 0 0 20px 0;
    font-size: 22px;
    letter-spacing: 3px;
}

.advisor-content {
    margin-bottom: 20px;
}

.advisor-suggestion {
    background: #0f0f1a;
    border: 1px solid #00ffff;
    padding: 15px;
    margin-bottom: 15px;
}

.advisor-label {
    color: #666;
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.advisor-action {
    color: #00ff88;
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 1px;
}

.advisor-reason-box {
    background: #0f0f1a;
    border: 1px solid #1a1a2e;
    padding: 12px;
}

.advisor-reason {
    color: #ccc;
    font-size: 14px;
    line-height: 1.4;
}

.advisor-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 15px;
}

.advisor-btn {
    border: none;
    padding: 12px 30px;
    font-family: monospace;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.advisor-btn.accept {
    background: linear-gradient(135deg, #00ff88 0%, #00aa66 100%);
    color: #000;
}

.advisor-btn.accept:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.5);
}

.advisor-btn.override {
    background: #333;
    color: #ff6666;
    border: 1px solid #ff6666;
}

.advisor-btn.override:hover {
    background: #442222;
    box-shadow: 0 0 20px rgba(255, 102, 102, 0.3);
}

.advisor-hint {
    color: #666;
    font-size: 11px;
}

/* Intervention Stats in Stats Modal */
.intervention-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.intervention-stat-item {
    text-align: center;
    padding: 8px;
    background: #0a0a12;
    border: 1px solid #1a1a2e;
}

.intervention-stat-val {
    font-size: 20px;
    font-weight: bold;
    color: #00ffff;
}

.intervention-stat-name {
    font-size: 10px;
    color: #666;
    text-transform: uppercase;
}

.intervention-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.breakdown-title {
    color: #888;
    font-size: 11px;
    width: 80px;
}

.breakdown-item {
    background: #1a1a2e;
    padding: 3px 8px;
    font-size: 11px;
    color: #0ff;
    border-radius: 3px;
}

/* Achievement Toast */
.achievement-toast {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #0a0a14 100%);
    border: 2px solid #ffd700;
    padding: 15px 20px;
    z-index: 2000;
    animation: achievement-slide-in 0.5s ease-out, achievement-glow 2s ease-in-out infinite;
    max-width: 350px;
}

.achievement-toast.show {
    display: flex;
    align-items: center;
    gap: 15px;
}

@keyframes achievement-slide-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes achievement-glow {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.3); }
    50% { box-shadow: 0 0 40px rgba(255, 215, 0, 0.6); }
}

.achievement-icon {
    font-size: 36px;
    line-height: 1;
}

.achievement-content {
    flex: 1;
}

.achievement-label {
    color: #ffd700;
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 2px;
    margin-bottom: 4px;
}

.achievement-name {
    color: #fff;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 2px;
}

.achievement-desc {
    color: #888;
    font-size: 12px;
}

/* Achievements Grid in Stats Modal */
.achievement-count {
    color: #888;
    font-size: 12px;
    font-weight: normal;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.achievement-card {
    background: #0a0a12;
    border: 1px solid #1a1a2e;
    padding: 10px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.achievement-card.unlocked {
    border-color: #ffd700;
    background: linear-gradient(135deg, #1a1a2e 0%, #0a0a14 100%);
}

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

.achievement-card .icon {
    font-size: 24px;
    line-height: 1;
}

.achievement-card .info {
    flex: 1;
    min-width: 0;
}

.achievement-card .name {
    color: #fff;
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 2px;
}

.achievement-card.locked .name {
    color: #666;
}

.achievement-card .desc {
    color: #888;
    font-size: 11px;
    line-height: 1.3;
}

.achievement-card .progress-bar {
    height: 4px;
    background: #1a1a2e;
    margin-top: 6px;
    border-radius: 2px;
    overflow: hidden;
}

.achievement-card .progress-fill {
    height: 100%;
    background: #ffd700;
    transition: width 0.3s;
}

/* Footer Menu */
.footer-menu {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #0a0a12;
    border-top: 1px solid #1a1a2e;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    z-index: 100;
}

.footer-brand {
    color: #ff00ff;
    font-weight: bold;
    letter-spacing: 2px;
    opacity: 0.7;
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    color: #666;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #0ff;
}

/* Music Toggle */
#music-toggle {
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
}

#music-toggle.music-off {
    color: #555;
}

#music-toggle.music-on {
    color: #0f0;
    background: rgba(0, 255, 0, 0.1);
    border: 1px solid #0f0;
}

#music-toggle.music-on:hover {
    color: #0f0;
}

/* Docs Modal */
.docs-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 18, 0.95);
    display: none;
    justify-content: center;
    align-items: flex-start;
    z-index: 2000;
    overflow-y: auto;
    padding: 40px 20px;
}

.docs-modal-box {
    background: #0d0d15;
    border: 1px solid #1a1a2e;
    border-radius: 4px;
    max-width: 800px;
    width: 100%;
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
}

.docs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #1a1a2e;
}

.docs-header h2 {
    color: #ff00ff;
    margin: 0;
    font-size: 18px;
}

.docs-close {
    background: none;
    border: none;
    color: #666;
    font-size: 24px;
    cursor: pointer;
    padding: 0 5px;
}

.docs-close:hover {
    color: #0ff;
}

.docs-content {
    padding: 20px;
    overflow-y: auto;
    color: #ccc;
    line-height: 1.7;
}

.docs-content h1 {
    color: #ff00ff;
    font-size: 24px;
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #1a1a2e;
}

.docs-content h2 {
    color: #0ff;
    font-size: 18px;
    margin: 25px 0 15px 0;
}

.docs-content h3 {
    color: #00ff88;
    font-size: 14px;
    margin: 20px 0 10px 0;
}

.docs-content p {
    margin: 0 0 15px 0;
}

.docs-content ul, .docs-content ol {
    margin: 0 0 15px 20px;
}

.docs-content li {
    margin: 5px 0;
}

.docs-content code {
    background: #1a1a2e;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    color: #00ff88;
}

.docs-content pre {
    background: #1a1a2e;
    padding: 15px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 15px 0;
}

.docs-content pre code {
    background: none;
    padding: 0;
}

.docs-content a {
    color: #0ff;
}

.docs-content blockquote {
    border-left: 3px solid #ff00ff;
    padding-left: 15px;
    margin: 15px 0;
    color: #999;
}

.docs-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.docs-content th, .docs-content td {
    border: 1px solid #1a1a2e;
    padding: 8px 12px;
    text-align: left;
}

.docs-content th {
    background: #1a1a2e;
    color: #0ff;
}

/* Docs Index */
.docs-index {
    display: grid;
    gap: 10px;
}

.docs-index-item {
    display: block;
    padding: 15px;
    background: #1a1a2e;
    border: 1px solid #2a2a3e;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.docs-index-item:hover {
    border-color: #0ff;
    background: #1f1f2f;
}

.docs-index-item h3 {
    color: #0ff;
    margin: 0 0 5px 0;
    font-size: 14px;
}

.docs-index-item p {
    color: #888;
    margin: 0;
    font-size: 12px;
}

/* Compare Modal */
.compare-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 18, 0.95);
    display: none;
    justify-content: center;
    align-items: flex-start;
    z-index: 2000;
    overflow-y: auto;
    padding: 40px 20px;
}

.compare-modal-box {
    background: #0d0d15;
    border: 1px solid #1a1a2e;
    border-radius: 4px;
    max-width: 900px;
    width: 100%;
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
}

.compare-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #1a1a2e;
}

.compare-header h2 {
    color: #ff00ff;
    margin: 0;
    font-size: 18px;
}

.compare-close {
    background: none;
    border: none;
    color: #666;
    font-size: 24px;
    cursor: pointer;
}

.compare-close:hover {
    color: #0ff;
}

.compare-content {
    padding: 20px;
    overflow-y: auto;
}

.compare-select {
    text-align: center;
}

.compare-select p {
    color: #888;
    margin-bottom: 20px;
}

.compare-slots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.compare-slot {
    background: #1a1a2e;
    border: 2px solid #2a2a3e;
    border-radius: 4px;
    padding: 20px 30px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 200px;
    text-align: center;
}

.compare-slot:hover {
    border-color: #0ff;
}

.compare-slot.selected {
    border-color: #ff00ff;
}

.compare-slot.active {
    border-color: #0ff;
    background: #1f1f2f;
}

.slot-label {
    display: block;
    color: #666;
    font-size: 11px;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.slot-value {
    display: block;
    color: #0ff;
    font-size: 14px;
}

.compare-vs {
    color: #ff00ff;
    font-size: 18px;
    font-weight: bold;
}

.compare-btn {
    background: #1a1a2e;
    border: 1px solid #ff00ff;
    color: #ff00ff;
    padding: 10px 30px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s;
}

.compare-btn:hover:not(:disabled) {
    background: #ff00ff;
    color: #000;
}

.compare-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.compare-results {
    margin-top: 20px;
}

.compare-results.hidden {
    display: none;
}

.compare-summary {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: #1a1a2e;
    border-radius: 4px;
}

.compare-run {
    text-align: center;
}

.compare-run h3 {
    color: #0ff;
    margin: 0 0 10px 0;
    font-size: 14px;
}

.compare-run .outcome {
    font-size: 18px;
    margin-bottom: 5px;
}

.compare-run .outcome.victory {
    color: #0f0;
}

.compare-run .outcome.defeat {
    color: #f66;
}

.compare-divider {
    display: flex;
    align-items: center;
    color: #666;
}

.compare-stats {
    display: grid;
    gap: 8px;
}

.compare-stat-row {
    display: grid;
    grid-template-columns: 80px 1fr 50px 1fr 80px;
    gap: 10px;
    align-items: center;
    padding: 8px;
    background: #1a1a2e;
    border-radius: 4px;
}

.compare-stat-row .stat-name {
    color: #888;
    text-align: center;
    font-size: 12px;
}

.compare-stat-row .stat-val {
    text-align: center;
    font-size: 14px;
}

.compare-stat-row .stat-val.better {
    color: #0f0;
}

.compare-stat-row .stat-val.worse {
    color: #f66;
}

.compare-stat-row .stat-val.same {
    color: #888;
}

.compare-stat-row .stat-bar {
    height: 6px;
    background: #2a2a3e;
    border-radius: 3px;
    overflow: hidden;
}

.compare-stat-row .stat-bar .fill {
    height: 100%;
    background: #0ff;
}

.compare-diverge {
    margin-top: 20px;
    padding: 15px;
    background: #1a1a2e;
    border-radius: 4px;
    border-left: 3px solid #ff00ff;
}

.compare-diverge h4 {
    color: #ff00ff;
    margin: 0 0 10px 0;
}

.compare-diverge p {
    color: #ccc;
    margin: 0;
}

.docs-nav {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #1a1a2e;
}

.docs-nav a {
    color: #0ff;
    text-decoration: none;
    font-size: 13px;
}

.docs-nav a:hover {
    text-decoration: underline;
}

/* Adjust body padding for footer */
body {
    padding-bottom: 50px;
}

/* Debug Panel - shows when ?debug in URL */
.debug-panel {
    position: fixed;
    top: 10px;
    left: 10px;
    width: 320px;
    min-width: 200px;
    max-width: 80vw;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid #ff0;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    z-index: 9999;
    box-shadow: 0 0 10px rgba(255, 255, 0, 0.3);
    resize: both;
}

.debug-header {
    background: #330;
    color: #ff0;
    padding: 6px 10px;
    font-weight: bold;
    border-bottom: 1px solid #ff0;
    position: sticky;
    top: 0;
}

.debug-content {
    padding: 8px;
}

.debug-section {
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #333;
}

.debug-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.debug-section-title {
    color: #0ff;
    font-weight: bold;
    margin-bottom: 4px;
    font-size: 10px;
    text-transform: uppercase;
}

.debug-row {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
}

.debug-label {
    color: #888;
}

.debug-value {
    color: #0f0;
    font-weight: bold;
}

.debug-value.true {
    color: #0f0;
}

.debug-value.false {
    color: #f00;
}

.debug-value.active {
    color: #ff0;
    animation: debug-blink 0.5s infinite;
}

@keyframes debug-blink {
    50% { opacity: 0.5; }
}

.debug-overlay-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.debug-overlay-tag {
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
}

.debug-overlay-tag.visible {
    background: #030;
    color: #0f0;
    border: 1px solid #0f0;
}

.debug-overlay-tag.hidden {
    background: #111;
    color: #444;
    border: 1px solid #333;
}

.debug-actions {
    margin-top: 8px;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.debug-btn {
    background: #222;
    color: #0ff;
    border: 1px solid #0ff;
    padding: 3px 8px;
    font-size: 10px;
    cursor: pointer;
    font-family: inherit;
}

.debug-btn:hover {
    background: #033;
}

/* Debug Speed Controls */
.debug-speed-controls {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 4px 8px;
}

.debug-speed-controls button {
    background: #222;
    color: #0ff;
    border: 1px solid #333;
    padding: 2px 6px;
    font-size: 9px;
    cursor: pointer;
    font-family: inherit;
}

.debug-speed-controls button:hover {
    background: #033;
    border-color: #0ff;
}

.debug-speed-controls button.speed-active {
    background: #033;
    border-color: #0ff;
    color: #fff;
}

#speed-display {
    color: #0f0;
    font-size: 10px;
    margin-left: 8px;
}

/* Debug Visualization Controls */
.debug-viz-controls {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.debug-viz-controls button {
    background: #111;
    border: 1px solid #333;
    color: #0f0;
    padding: 2px 8px;
    font-family: inherit;
    font-size: 10px;
    cursor: pointer;
}

.debug-viz-controls button:hover {
    background: #033;
    border-color: #0ff;
}

/* Debug Sessions Panel */
.debug-sessions {
    padding: 8px;
}

.debug-sessions-controls {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.debug-sessions-controls button {
    background: #222;
    color: #0ff;
    border: 1px solid #0ff;
    padding: 3px 8px;
    font-size: 10px;
    cursor: pointer;
    font-family: inherit;
}

.debug-sessions-controls button:hover {
    background: #033;
}

.debug-sessions-controls input {
    background: #111;
    color: #0f0;
    border: 1px solid #333;
    padding: 3px 6px;
    font-size: 10px;
    font-family: inherit;
}

.debug-sessions-list {
    max-height: 200px;
    overflow-y: auto;
}

.debug-session-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid #222;
    font-size: 10px;
    gap: 8px;
}

.debug-session-item .debug-session-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.debug-session-item .debug-session-info .id {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.debug-session-item:last-child {
    border-bottom: none;
}

.debug-session-item.current {
    background: rgba(255, 255, 0, 0.1);
    border-left: 2px solid #ff0;
    padding-left: 4px;
}

.debug-session-item.current .id {
    color: #ff0;
}

.debug-session-info {
    color: #888;
}

.debug-session-info .id {
    color: #0ff;
    font-weight: bold;
}

.debug-session-info .meta {
    color: #666;
    font-size: 9px;
}

.debug-session-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.debug-session-actions button {
    background: #111;
    color: #0f0;
    border: 1px solid #333;
    padding: 2px 6px;
    font-size: 9px;
    cursor: pointer;
}

.debug-session-actions button:hover {
    background: #030;
    border-color: #0f0;
}
