:root {
    --bg-color: #050505;
    --panel-bg: rgba(20, 20, 20, 0.7);
    --accent-color: #00f2ff;
    --text-color: #ffffff;
    --font-main: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

canvas {
    display: block;
}

/* Betting Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(15px);
    transition: opacity 0.5s;
    overflow-y: auto;
    padding: 20px 0;
}

.overlay.hidden {
    display: none !important;
}

#attract-screen {
    z-index: 3000;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(3px);
}

#main-menu {
    z-index: 2500;
}

.lobby-main-content {
    display: flex;
    flex-direction: row;
    gap: 20px;
    width: 95%;
    max-width: 1400px;
    align-items: flex-start;
    justify-content: center;
}

.betting-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    width: 60%;
    margin: 10px 0;
}

.bet-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: 0.3s;
}

.bet-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-5px);
}

.bet-card.selected {
    border-color: #00f2ff;
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.3);
}

.bank-display {
    position: fixed;
    top: 20px;
    right: 320px;
    font-size: 28px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    z-index: 2500;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 15px;
    border-radius: 10px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

/* Post-Match Analytics */
#heatmapCanvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 5;
    opacity: 0;
    transition: opacity 1s;
}

/* Mini-game */
#miniGame {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 3000;
}

.hidden {
    display: none !important;
}

.fade-out {
    opacity: 0;
    pointer-events: none;
}

#ui-container {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 4px;
    text-shadow: 0 0 10px var(--accent-color);
    margin-bottom: 5px;
}

header p {
    font-size: 1rem;
    opacity: 0.8;
}

#stats,
.status-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 250px;
    pointer-events: auto;
    /* Enable interaction if we add buttons later */
}

/* Specific arena panel styling */
#arena-stats {
    border-left: 4px solid var(--accent-color);
}

#right-panel-stack {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 10;
    pointer-events: none;
}

#commentary-panel {
    width: 100%;
    max-height: 400px;
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px;
    display: flex;
    flex-direction: column;
}

#commentary-panel h3 {
    font-size: 0.8rem;
    color: var(--accent-color);
    letter-spacing: 2px;
    margin-bottom: 10px;
    text-align: center;
    border-bottom: 1px solid rgba(0, 242, 255, 0.2);
    padding-bottom: 5px;
}

#commentary-log {
    flex-grow: 1;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#legend-panel {
    width: 100%;
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#legend-panel h3 {
    font-size: 0.75rem;
    color: var(--accent-color);
    letter-spacing: 2px;
    text-align: center;
    border-bottom: 1px solid rgba(0, 242, 255, 0.2);
    padding-bottom: 5px;
}

.legend-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.legend-title {
    font-size: 0.65rem;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
}

.legend-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.85);
}

.legend-icon {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.15);
    color: #000;
}

.legend-icon.hazard-spinner {
    border: 2px solid #ff3300;
    background:
        linear-gradient(45deg, transparent 45%, #ff3300 45%, #ff3300 55%, transparent 55%),
        linear-gradient(-45deg, transparent 45%, #ff3300 45%, #ff3300 55%, transparent 55%);
    border-radius: 2px;
}

.legend-icon.hazard-anchor-attract {
    border: 2px solid #bc00ff;
    border-radius: 50%;
    background: transparent;
}

.legend-icon.hazard-anchor-repel {
    border: 2px solid #00ffaa;
    border-radius: 50%;
    background: transparent;
}

.legend-icon.hazard-entropy {
    background: #ff3300;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(255, 51, 0, 0.6);
}

.legend-icon.hazard-void-gap {
    border: 2px solid #000;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
}

.legend-icon.hazard-laser {
    width: 16px;
    height: 4px;
    border-radius: 2px;
    background: #ff0055;
    box-shadow: 0 0 6px rgba(255, 0, 85, 0.6);
}

.legend-icon.hazard-tesla {
    background: #00f2ff;
    box-shadow: 0 0 6px rgba(0, 242, 255, 0.6);
}

.legend-icon.hazard-freeze {
    border: 1px solid rgba(0, 242, 255, 0.7);
    border-radius: 50%;
    background: rgba(0, 150, 255, 0.2);
}

.legend-icon.hazard-accelerator {
    background: #ffcc00;
}

.legend-icon.hazard-teleport {
    border: 2px solid #bc00ff;
    border-radius: 50%;
    background: rgba(188, 0, 255, 0.15);
}

.legend-icon.hazard-saw {
    background: #ccc;
    border-radius: 50%;
    border: 1px solid #999;
}

.legend-icon.hazard-vortex {
    background: #000;
    border-radius: 50%;
    border: 1px solid #fff;
}

.legend-icon.powerup {
    color: #000;
    font-weight: bold;
}

.legend-icon.powerup.health {
    background: #00ff44;
}

.legend-icon.powerup.boost {
    background: #ffcc00;
}

.legend-icon.powerup.shockwave {
    background: #00f2ff;
}

.legend-icon.powerup.shield {
    background: #00f2ff;
}

.legend-icon.powerup.regen {
    background: #bc00ff;
    color: #fff;
}

.commentary-entry {
    font-size: 0.85rem;
    line-height: 1.2;
    padding: 5px 8px;
    background: rgba(255, 255, 255, 0.03);
    border-left: 2px solid var(--accent-color);
    border-radius: 4px;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

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

.ball-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.health-bar-bg {
    width: 100px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.health-bar-fill {
    height: 100%;
    transition: width 0.3s ease-out;
}

.stat-badge {
    font-size: 14px;
    cursor: help;
    animation: pulse-simple 2s infinite ease-in-out;
}

.stat-badge.leader {
    filter: drop-shadow(0 0 5px #ffd700);
}

.stat-badge.healthy {
    filter: drop-shadow(0 0 5px #00f2ff);
}

@keyframes pulse-simple {

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

    50% {
        transform: scale(1.2);
    }
}

#restartBtn {
    pointer-events: auto;
    padding: 12px 24px;
    background: var(--accent-color);
    border: none;
    border-radius: 8px;
    color: #000;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    margin-top: 10px;
}

#restartBtn:hover {
    transform: scale(1.05);
    background: #fff;
}

#celebration-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 100;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    padding: 3rem 5rem;
    border-radius: 24px;
    border: 2px solid var(--accent-color);
    box-shadow: 0 0 50px var(--accent-color);
    pointer-events: auto;
    transition: opacity 0.5s, transform 0.5s;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#celebration-overlay.hidden {
    opacity: 0;
    transform: translate(-50%, -40%) scale(0.8);
}

#celebration-overlay h2 {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: 8px;
    color: var(--accent-color);
    text-shadow: 0 0 20px var(--accent-color);
}

#celebration-overlay p {
    font-size: 1.5rem;
    letter-spacing: 4px;
    opacity: 0.8;
}

.ball-label {
    position: absolute;
    pointer-events: none;
    font-size: 12px;
    font-weight: 700;
    text-shadow: 0 0 4px #000;
    transform: translate(-50%, -150%);
    white-space: nowrap;
}

#summary-overlay {
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 2vh 2vw;
    overflow: hidden;
}

#summary-overlay h2 {
    font-size: clamp(1.2rem, 3vw, 2rem);
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    letter-spacing: 4px;
}

.summary-main-content {
    display: flex;
    flex-direction: row;
    gap: 15px;
    width: 95%;
    max-width: 1200px;
    max-height: 60vh;
    align-items: flex-start;
    justify-content: center;
    overflow: hidden;
}

#summary-list-container {
    width: 45%;
    max-height: 55vh;
    overflow-y: auto;
}

#summary-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.summary-item-name {
    font-weight: bold;
    font-size: 1.2rem;
}

.summary-item-wins {
    font-size: 1.2rem;
    color: #ffd700;
}


#summary-betting-result,
#summary-session-result {
    font-size: 1.1rem;
    margin-bottom: 0px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    backdrop-filter: blur(5px);
    min-width: 250px;
}

#summary-performance-container {
    width: 45%;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

#competitor-stats-container {
    width: 40%;
    margin-top: 10px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

#competitor-stats-container h3 {
    text-align: center;
    color: var(--accent-color);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#competitor-stats-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

#competitor-stats-table th {
    padding: 8px;
    text-align: left;
    color: #ffd700;
    font-size: 0.7rem;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
}

#competitor-stats-table td {
    padding: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.8rem;
}

#competitor-stats-table tr td:first-child {
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px 0 0 8px;
}

#competitor-stats-table tr td:last-child {
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0 8px 8px 0;
}

.global-narrator-control {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
}

.global-narrator-control .restart-btn {
    position: static;
    display: block;
    padding: 8px 15px;
    font-size: 0.8rem;
    background: var(--accent-color);
    color: #000;
    font-weight: bold;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.4);
    transition: 0.2s;
    pointer-events: auto;
}

.global-narrator-control .restart-btn:hover {
    transform: scale(1.05);
    background: #fff;
}

/* Narrative & Attract Mode Styling */
.narrative-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.narrative-layer.hidden {
    display: none !important;
}

#narrative-content {
    max-width: 800px;
    padding: 40px;
    text-align: center;
    position: relative;
    z-index: 10;
}

#narrative-title {
    color: var(--accent-color);
    font-size: 2rem;
    margin-bottom: 20px;
    letter-spacing: 8px;
    text-transform: uppercase;
}

#narrative-text {
    font-size: 1.2rem;
    line-height: 1.6;
    color: #fff;
    opacity: 0.9;
}

.skip-prompt {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    opacity: 0.5;
    letter-spacing: 3px;
    animation: pulse 2s infinite;
}

/* Attract Screen */
.attract-content {
    text-align: center;
}

.attract-logo {
    font-size: 6rem;
    font-weight: 700;
    letter-spacing: 20px;
    color: #fff;
    text-shadow: 0 0 30px var(--accent-color);
    margin-bottom: 10px;
    animation: glow 3s infinite alternate;
}

.attract-subtitle {
    font-size: 1.5rem;
    font-weight: 300;
    letter-spacing: 15px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 30px;
}

.attract-narrative-box {
    background: rgba(0, 0, 0, 0.8);
    padding: 15px 30px;
    border-top: 2px solid var(--accent-color);
    border-bottom: 2px solid var(--accent-color);
    margin: 40px 0;
}

#attract-narrative-text {
    font-size: 1rem;
    letter-spacing: 5px;
    color: var(--accent-color);
}

.click-to-start {
    font-size: 1.2rem;
    letter-spacing: 10px;
    margin-top: 50px;
    animation: blink 1.5s infinite;
}

/* Main Menu Buttons */
.menu-modes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    max-width: 900px;
    width: 90%;
}

.menu-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 12px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.menu-btn:hover {
    background: rgba(0, 242, 255, 0.1);
    border-color: var(--accent-color);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 242, 255, 0.2);
}

.btn-title {
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: 4px;
    margin-bottom: 10px;
    color: var(--accent-color);
}

.btn-desc {
    font-size: 0.8rem;
    opacity: 0.6;
    letter-spacing: 1px;
}

@keyframes glow {
    from {
        text-shadow: 0 0 10px var(--accent-color);
    }

    to {
        text-shadow: 0 0 40px var(--accent-color), 0 0 60px #bc00ff;
    }
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.2;
    }
}

@keyframes pulse {
    0% {
        opacity: 0.3;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.3;
    }
}

/* Sandbox Controls Sidebar */
#sandbox-controls {
    position: fixed;
    top: 100px;
    right: 20px;
    width: 200px;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid var(--accent-color);
    border-radius: 12px;
    padding: 15px;
    z-index: 1500;
    backdrop-filter: blur(10px);
}

#sandbox-controls.hidden {
    display: none;
}

#sandbox-controls h3 {
    color: var(--accent-color);
    font-size: 0.9rem;
    letter-spacing: 3px;
    margin-bottom: 15px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

.sandbox-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.sandbox-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 1px;
}

.sandbox-btn:hover {
    background: var(--accent-color);
    color: #000;
    transform: scale(1.02);
}

/* League Team Selection Cards */
.team-select-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 20px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.team-select-card:hover {
    background: rgba(0, 242, 255, 0.1);
    border-color: var(--accent-color);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 242, 255, 0.2);
}

.team-select-card .name {
    font-size: 1rem;
    font-weight: bold;
    color: #fff;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.team-select-card .wins {
    font-size: 0.75rem;
    color: #ffd700;
}

.team-select-card .faction {
    font-size: 0.65rem;
    opacity: 0.6;
    margin-top: 5px;
}

/* Upgrade Shop Items */
.upgrade-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.upgrade-card:hover:not(.owned):not(.locked) {
    background: rgba(0, 242, 255, 0.1);
    border-color: var(--accent-color);
}

.upgrade-card.owned {
    border-color: #00ff44;
    background: rgba(0, 255, 68, 0.1);
    cursor: default;
}

.upgrade-card.locked {
    opacity: 0.4;
    cursor: not-allowed;
}

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

.upgrade-card .info {
    flex: 1;
}

.upgrade-card .buff-name {
    font-weight: bold;
    color: #fff;
    margin-bottom: 4px;
}

.upgrade-card .desc {
    font-size: 0.8rem;
    opacity: 0.7;
}

.upgrade-card .cost {
    color: #ffd700;
    font-weight: bold;
}

.upgrade-card .tier-badge {
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 0.6rem;
    opacity: 0.5;
}

#league-team-select,
#league-upgrade-shop {
    z-index: 2600;
}

/* Settings Menu Styles */
#settings-overlay {
    z-index: 3500;
}

.settings-btn {
    background: linear-gradient(135deg, #00f2ff, #bc00ff);
    border: none;
    padding: 15px 40px;
    border-radius: 12px;
    color: #fff;
    font-size: 1rem;
    font-weight: bold;
    letter-spacing: 3px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(0, 242, 255, 0.3);
}

.settings-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 30px rgba(0, 242, 255, 0.5);
}

.settings-panel {
    background: rgba(10, 10, 15, 0.95);
    border: 1px solid rgba(0, 242, 255, 0.3);
    border-radius: 20px;
    padding: 40px;
    width: 90%;
    max-width: 500px;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.settings-panel h2 {
    color: var(--accent-color);
    font-size: 2rem;
    letter-spacing: 8px;
    text-align: center;
    margin-bottom: 30px;
    text-shadow: 0 0 20px var(--accent-color);
}

.settings-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-section:last-of-type {
    border-bottom: none;
}

.settings-section h3 {
    color: #ffd700;
    font-size: 0.9rem;
    letter-spacing: 3px;
    margin-bottom: 15px;
    text-transform: uppercase;
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.settings-row label {
    font-size: 1rem;
    color: #fff;
    opacity: 0.9;
}

.toggle-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 20px;
    border-radius: 20px;
    color: #fff;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 70px;
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.toggle-btn.active {
    background: linear-gradient(135deg, #00f2ff, #00aa99);
    border-color: #00f2ff;
    color: #000;
}

.settings-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 12px;
    border-radius: 8px;
    color: #fff;
    font-size: 0.8rem;
    cursor: pointer;
    min-width: 180px;
    max-width: 200px;
}

.settings-select:hover {
    background: rgba(255, 255, 255, 0.2);
}

.settings-select option {
    background: #1a1a1a;
    color: #fff;
}

.danger-btn {
    background: linear-gradient(135deg, #ff3300, #990000);
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.danger-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 20px rgba(255, 51, 0, 0.4);
}

.close-settings-btn {
    display: block;
    width: 100%;
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--accent-color);
    border-radius: 10px;
    color: var(--accent-color);
    font-size: 1rem;
    font-weight: bold;
    letter-spacing: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.close-settings-btn:hover {
    background: var(--accent-color);
    color: #000;
}

/* Global Navigation Buttons */
.global-nav {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nav-btn {
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: bold;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.home-btn {
    background: linear-gradient(135deg, rgba(50, 50, 60, 0.9), rgba(30, 30, 40, 0.9));
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.home-btn:hover {
    background: linear-gradient(135deg, rgba(70, 70, 80, 0.95), rgba(50, 50, 60, 0.95));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.quit-btn {
    background: linear-gradient(135deg, #ff3300, #990000);
    color: #fff;
}

.quit-btn:hover {
    background: linear-gradient(135deg, #ff5533, #bb2200);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 51, 0, 0.4);
}

.nav-btn.hidden {
    display: none !important;
}

/* Hide home button on attract screen */
#attract-screen:not(.hidden)~.global-nav .home-btn {
    display: none;
}

/* League Standings Overlay */
#league-standings-overlay {
    z-index: 2700;
}

.standings-panel {
    background: rgba(10, 10, 15, 0.95);
    border: 1px solid rgba(0, 242, 255, 0.3);
    border-radius: 20px;
    padding: 30px 40px;
    width: 95%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    backdrop-filter: blur(20px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.standings-header {
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(0, 242, 255, 0.2);
    padding-bottom: 15px;
}

.standings-header h2 {
    color: var(--accent-color);
    font-size: 2rem;
    letter-spacing: 8px;
    margin-bottom: 10px;
    text-shadow: 0 0 20px var(--accent-color);
}

.round-indicator {
    color: #ffd700;
    font-size: 1rem;
    letter-spacing: 3px;
}

/* Story Beat Panel */
.story-beat-panel {
    background: linear-gradient(135deg, rgba(0, 242, 255, 0.1), rgba(188, 0, 255, 0.1));
    border: 1px solid rgba(0, 242, 255, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.story-beat-panel.hidden {
    display: none;
}

.story-beat-panel h3 {
    color: #ffd700;
    font-size: 1.2rem;
    letter-spacing: 5px;
    margin-bottom: 10px;
}

.story-beat-panel p {
    color: #fff;
    opacity: 0.9;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Standings Table */
.standings-table-container {
    margin: 15px 0;
}

.standings-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 6px;
}

.standings-table th {
    padding: 10px 8px;
    text-align: center;
    color: var(--accent-color);
    font-size: 0.75rem;
    letter-spacing: 2px;
    border-bottom: 1px solid rgba(0, 242, 255, 0.2);
}

.standings-table th:nth-child(2) {
    text-align: left;
}

.standings-table td {
    padding: 12px 8px;
    text-align: center;
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.9rem;
}

.standings-table td:nth-child(2) {
    text-align: left;
    font-weight: bold;
}

.standings-table tr td:first-child {
    border-radius: 8px 0 0 8px;
    font-weight: bold;
    color: #ffd700;
}

.standings-table tr td:last-child {
    border-radius: 0 8px 8px 0;
}

/* Tracked configuration highlight */
.standings-table tr.tracked-cfg td {
    background: rgba(188, 0, 255, 0.15) !important;
    border-top: 1px solid rgba(188, 0, 255, 0.3) !important;
    border-bottom: 1px solid rgba(188, 0, 255, 0.3) !important;
}

.standings-table tr.tracked-cfg td:first-child {
    border-left: 3px solid #bc00ff !important;
}

.standings-table tr.tracked-cfg td:nth-child(2) {
    color: #bc00ff !important;
    font-weight: bold;
}

/* Rank medals */
.rank-medal {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    line-height: 24px;
    font-size: 0.8rem;
}

.rank-1 {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #000;
}

.rank-2 {
    background: linear-gradient(135deg, #c0c0c0, #888);
    color: #000;
}

.rank-3 {
    background: linear-gradient(135deg, #cd7f32, #a05a2c);
    color: #fff;
}

/* Standings Footer */
.standings-footer {
    margin-top: 20px;
    text-align: center;
}

.season-status {
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

.standings-continue-btn {
    background: linear-gradient(135deg, #00f2ff, #bc00ff) !important;
    padding: 15px 40px !important;
}

/* Big Bang Creation Event Overlay */
#bigbang-overlay {
    z-index: 9999;
    background: #000;
}

#bigbang-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    opacity: 0;
    pointer-events: none;
    z-index: 10000;
}

#bigbang-flash.active {
    animation: bigbang-flash 2s ease-out forwards;
}

@keyframes bigbang-flash {
    0% {
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

#bigbang-content {
    position: relative;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    padding: 40px;
    max-width: 700px;
}

.creation-text {
    text-align: center;
    font-size: 1.2rem;
    line-height: 2.5;
    letter-spacing: 3px;
    color: rgba(255, 255, 255, 0.9);
    opacity: 0;
    animation: fade-in-slow 2s ease-out forwards;
}

.creation-text p {
    margin: 10px 0;
    opacity: 0;
    animation: fade-in-line 1s ease-out forwards;
}

@keyframes fade-in-slow {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

@keyframes fade-in-line {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }

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

.universe-definition {
    text-align: center;
    padding: 30px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    max-width: 600px;
}

.universe-definition h3 {
    color: var(--accent-color);
    font-size: 0.9rem;
    letter-spacing: 5px;
    margin-bottom: 20px;
}

.universe-definition p {
    font-size: 1rem;
    line-height: 2;
    color: rgba(255, 255, 255, 0.8);
    margin: 8px 0;
}

.meta-lore {
    text-align: center;
    padding: 20px;
    margin-top: 20px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 2px;
    font-style: italic;
}

#bigbang-continue {
    margin-top: 30px;
    background: transparent !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    color: rgba(255, 255, 255, 0.7) !important;
}

#bigbang-continue:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

/* Team Selection Cards */
.team-card {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 12px;
    backdrop-filter: blur(10px);
}

.team-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-color);
    transform: scaleX(0);
    transition: transform 0.4s ease;
}

.team-card:hover {
    transform: translateY(-8px);
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(0, 242, 255, 0.5);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 242, 255, 0.1);
}

.team-card:hover::after {
    transform: scaleX(1);
}

.team-card h3 {
    margin: 0;
    font-size: 1.2rem;
    letter-spacing: 3px;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.team-card:hover h3 {
    color: var(--accent-color);
    text-shadow: 0 0 15px var(--accent-color);
}

.team-card .stability-value {
    font-family: monospace;
    font-size: 0.9rem;
    color: #ffd700;
}

.team-card .team-lore {
    font-size: 0.75rem;
    line-height: 1.5;
    opacity: 0.5;
    margin-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 12px;
}

.team-card:hover .team-lore {
    opacity: 0.8;
}

.team-card .faction-tag {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 0.6rem;
    letter-spacing: 1px;
    opacity: 0.3;
    font-weight: bold;
}

/* Book of Remnant Archival Styling */
.archival-panel {
    background: rgba(10, 10, 10, 0.95);
    border: 2px solid var(--accent-color);
    box-shadow: 0 0 50px rgba(0, 242, 255, 0.1);
    padding: 50px;
    border-radius: 20px;
    max-width: 900px;
    width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
}

.archival-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03) 0px, rgba(255, 255, 255, 0.03) 1px, transparent 1px, transparent 2px);
    pointer-events: none;
}

.archival-list {
    width: 100%;
    overflow-y: auto;
    padding-right: 15px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.archival-entry {
    background: rgba(255, 255, 255, 0.03);
    border-left: 4px solid var(--accent-color);
    padding: 20px;
    border-radius: 0 10px 10px 0;
    transition: all 0.3s ease;
}

.archival-entry:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(10px);
}

.archival-entry h3 {
    margin: 0 0 10px 0;
    letter-spacing: 5px;
    color: #fff;
}

.archival-entry .timestamp {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--accent-color);
    opacity: 0.6;
    margin-bottom: 10px;
}

.archival-entry .definition-list {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    font-style: italic;
}

/* Custom Scrollbar for Archive */
.archival-list::-webkit-scrollbar {
    width: 6px;
}

.archival-list::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 10px;
}

.archival-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

/* =========================
   ENHANCED BUTTON STYLING
   ========================= */
button,
.restart-btn,
.menu-btn {
    font-family: var(--font-main);
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #00f2ff 0%, #bc00ff 100%);
    color: #000;
    box-shadow: 0 4px 20px rgba(0, 242, 255, 0.3);
}

button:hover,
.restart-btn:hover,
.menu-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 30px rgba(188, 0, 255, 0.5);
    background: linear-gradient(135deg, #bc00ff 0%, #00f2ff 100%);
}

button:active,
.restart-btn:active,
.menu-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 10px rgba(0, 242, 255, 0.2);
}

/* Subtle pulse animation for primary action buttons */
@keyframes btn-pulse {

    0%,
    100% {
        box-shadow: 0 4px 20px rgba(0, 242, 255, 0.3);
    }

    50% {
        box-shadow: 0 4px 30px rgba(188, 0, 255, 0.5);
    }
}

.btn-primary {
    animation: btn-pulse 3s infinite ease-in-out;
}

/* Secondary / muted button style */
.btn-secondary,
button[style*="background:#444"],
button[style*="background: #444"] {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff !important;
    box-shadow: none;
}

.btn-secondary:hover,
button[style*="background:#444"]:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    border-color: var(--accent-color);
}

/* =========================
   INTERNAL VIEW OVERLAY (Win Animation)
   ========================= */
#internal-view-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 90;
    display: none;
    align-items: center;
    justify-content: center;
}

#internal-view-canvas {
    width: 100%;
    height: 100%;
}

/* =========================
   LAYOUT FIXES (prevent scrolling/overlap)
   ========================= */
.overlay {
    overflow: hidden !important;
    padding: 2vh 2vw;
}

.overlay>* {
    max-height: 90vh;
}

#summary-overlay {
    max-height: 100vh;
    overflow: hidden;
}

.summary-main-content {
    max-height: 75vh;
    overflow: hidden;
}

#betting-overlay {
    padding: 1vh 2vw;
}

.lobby-main-content {
    max-height: 85vh;
    overflow-y: auto;
}

/* Ensure celebration overlay fits screen */
#celebration-overlay {
    max-width: 90vw;
    max-height: 90vh;
    padding: 2rem 3rem;
}

#celebration-overlay h2 {
    font-size: clamp(1.5rem, 5vw, 4rem);
}
