/* AQUASPRINT QUEENS - STYLES WITH EXPLICIT BUTTON RESETS & CACHE BUSTING */

:root {
    --bg-dark: #030a16;
    --pool-cyan: #00f0ff;
    --pool-blue: #0077ff;
    --accent-green: #38ef7d;
    --accent-red: #ff3366;
    --accent-gold: #ffd700;
    --accent-silver: #e0e0e0;
    --accent-bronze: #cd7f32;

    --glass-bg: rgba(6, 20, 40, 0.92);
    --glass-border: rgba(0, 240, 255, 0.35);
    --glass-shadow: 0 16px 45px rgba(0, 0, 0, 0.75);

    --font-heading: 'Outfit', -apple-system, sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: var(--font-body);
    color: #ffffff;
}

#appContainer {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* Background Canvas */
#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    display: block;
}

/* UI Overlay Layer */
#uiOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    overflow-y: auto;
    padding: 1.5rem;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none !important;
    transform: scale(0.96);
    display: none !important;
}

/* UI Card Glassmorphism */
.ui-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 20px;
    padding: 2.2rem;
    max-width: 1120px;
    width: 96%;
    max-height: 92vh;
    overflow-y: auto;
    margin: auto;
}

.modal-card {
    max-width: 480px;
    text-align: center;
}

/* Brand Header */
.brand {
    text-align: center;
    margin-bottom: 1.5rem;
}

.brand .badge {
    display: inline-block;
    background: linear-gradient(90deg, rgba(255, 42, 95, 0.25), rgba(0, 240, 255, 0.25));
    border: 1px solid var(--pool-cyan);
    color: var(--pool-cyan);
    padding: 4px 16px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
}

.brand .title {
    font-family: var(--font-heading);
    font-size: 2.6rem;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.brand .highlight {
    background: linear-gradient(135deg, #ff2a5f, var(--pool-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand .subtitle {
    color: #94a3b8;
    font-size: 0.95rem;
    margin-top: 4px;
}

/* Menu Grid */
.menu-grid {
    display: grid;
    grid-template-columns: 1.25fr 0.75fr;
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .menu-grid {
        grid-template-columns: 1fr;
    }
}

.config-panel, .info-panel {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 1.4rem;
}

h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--pool-cyan);
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* CHARACTER GRID SELECTOR (4 COLUMNS - 8 ATHLETES) */
.character-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 0.8rem;
}

@media (max-width: 700px) {
    .character-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

button.char-card {
    appearance: none;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px;
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #ffffff !important;
    outline: none !important;
}

button.char-card:hover {
    background: rgba(0, 240, 255, 0.15) !important;
    border-color: var(--pool-cyan) !important;
    transform: translateY(-2px);
}

button.char-card.active {
    background: linear-gradient(135deg, rgba(255, 42, 95, 0.35), rgba(0, 240, 255, 0.35)) !important;
    border: 2px solid var(--pool-cyan) !important;
    box-shadow: 0 0 14px rgba(0, 240, 255, 0.4);
}

.char-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
}

.char-hair-icon {
    font-size: 1rem;
}

.char-flag {
    position: absolute;
    bottom: -4px;
    right: -4px;
    font-size: 0.75rem;
}

.char-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.char-name {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.85rem;
    color: #ffffff;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.char-country {
    font-size: 0.68rem;
    color: #94a3b8;
}

/* SWIMMER COUNT SELECTOR GRID */
.swimmer-count-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 6px;
}

@media (max-width: 750px) {
    .swimmer-count-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

button.count-card {
    appearance: none;
    -webkit-appearance: none;
    background: rgba(0, 0, 0, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 10px;
    padding: 10px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #ffffff !important;
    outline: none !important;
}

button.count-card:hover {
    background: rgba(0, 240, 255, 0.2) !important;
    border-color: var(--pool-cyan) !important;
}

button.count-card.active {
    background: linear-gradient(135deg, var(--pool-cyan), var(--pool-blue)) !important;
    border: 2px solid var(--pool-cyan) !important;
    box-shadow: 0 0 16px rgba(0, 240, 255, 0.6);
}

.count-title {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 800;
    color: #ffffff;
}

button.count-card.active .count-title {
    color: #030a16 !important;
}

.count-desc {
    font-size: 0.68rem;
    color: #cbd5e1;
    margin-top: 2px;
}

button.count-card.active .count-desc {
    color: #030a16 !important;
    font-weight: 700;
}

/* LAP SELECTOR GRID */
.lap-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 6px;
}

button.lap-card {
    appearance: none;
    -webkit-appearance: none;
    background: rgba(0, 0, 0, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #ffffff !important;
    outline: none !important;
}

button.lap-card:hover {
    background: rgba(0, 240, 255, 0.2) !important;
    border-color: var(--pool-cyan) !important;
}

button.lap-card.active {
    background: linear-gradient(135deg, var(--pool-cyan), var(--pool-blue)) !important;
    border: 2px solid var(--pool-cyan) !important;
    box-shadow: 0 0 16px rgba(0, 240, 255, 0.6);
}

.lap-dist {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 900;
    color: #ffffff;
}

button.lap-card.active .lap-dist {
    color: #030a16 !important;
}

.lap-count {
    font-size: 0.7rem;
    color: #cbd5e1;
    margin-top: 2px;
}

button.lap-card.active .lap-count {
    color: #030a16 !important;
    font-weight: 700;
}

/* TOURNAMENT ROUND SELECTOR GRID */
.round-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 6px;
}

@media (max-width: 750px) {
    .round-grid {
        grid-template-columns: repeat(1, 1fr);
    }
}

button.round-card {
    appearance: none;
    -webkit-appearance: none;
    background: rgba(0, 0, 0, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 10px;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #ffffff !important;
    outline: none !important;
}

button.round-card:hover {
    background: rgba(0, 240, 255, 0.2) !important;
    border-color: var(--pool-cyan) !important;
}

button.round-card.active {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.35), rgba(255, 42, 95, 0.45)) !important;
    border: 2px solid var(--pool-cyan) !important;
    box-shadow: 0 0 16px rgba(0, 240, 255, 0.6);
}

.round-title {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 800;
}

.round-title.green { color: #38ef7d; }
.round-title.yellow { color: #ffd700; }
.round-title.red { color: #ff2a5f; }

.round-desc {
    font-size: 0.68rem;
    color: #cbd5e1;
    margin-top: 2px;
}

button.round-card.active .round-desc {
    color: #ffffff !important;
    font-weight: 700;
}

/* 5-TIER DIFFICULTY SELECTOR GRID */
.difficulty-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-top: 6px;
}

@media (max-width: 750px) {
    .difficulty-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

button.diff-card {
    appearance: none;
    -webkit-appearance: none;
    background: rgba(0, 0, 0, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 10px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #ffffff !important;
    outline: none !important;
}

button.diff-card:hover {
    background: rgba(0, 240, 255, 0.2) !important;
    border-color: var(--pool-cyan) !important;
}

button.diff-card.active {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.35), rgba(255, 42, 95, 0.45)) !important;
    border: 2px solid var(--pool-cyan) !important;
    box-shadow: 0 0 14px rgba(0, 240, 255, 0.5);
}

.diff-title {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 800;
}

.diff-title.green { color: #38ef7d; }
.diff-title.blue { color: #00f0ff; }
.diff-title.yellow { color: #ffd700; }
.diff-title.orange { color: #ff9f43; }
.diff-title.red { color: #ff2a5f; }

.diff-desc {
    font-size: 0.65rem;
    color: #94a3b8;
    margin-top: 2px;
    text-align: center;
}

button.diff-card.active .diff-desc {
    color: #ffffff !important;
    font-weight: 700;
}

.form-group {
    margin-bottom: 0.9rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 0.4rem;
}

input[type="text"] {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 10px 14px;
    color: #fff;
    font-family: var(--font-body);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

input[type="text"]:focus {
    border-color: var(--pool-cyan);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

/* Controls list */
.controls-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    margin-bottom: 1.2rem;
}

.controls-list li {
    font-size: 0.85rem;
    color: #cbd5e1;
    line-height: 1.4;
}

.key-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-bottom: 3px solid rgba(255, 255, 255, 0.4);
    border-radius: 6px;
    padding: 2px 8px;
    font-weight: 800;
    font-family: var(--font-heading);
    color: var(--pool-cyan);
    margin-right: 4px;
}

.stats-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.2rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: 10px;
}

.stat-box {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.75rem;
    color: #94a3b8;
}

.stat-val {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-green);
}

/* Primary Button */
.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.25s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(135deg, #ff2a5f, var(--pool-cyan));
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(255, 42, 95, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0, 240, 255, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

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

/* IN-GAME HUD OVERLAY */
.hud-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 10;
}

.hud-screen.hidden {
    display: none !important;
}

/* TOP FRAME BAR */
.hud-frame-top {
    width: 100%;
    height: 80px;
    background: rgba(2, 10, 22, 0.95);
    border-bottom: 2px solid rgba(0, 240, 255, 0.3);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    pointer-events: auto;
}

/* BOTTOM FRAME BAR */
.hud-frame-bottom {
    width: 100%;
    height: 85px;
    background: rgba(2, 10, 22, 0.95);
    border-top: 2px solid rgba(0, 240, 255, 0.3);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    pointer-events: auto;
}

.hud-pill-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 240, 255, 0.25);
    border-radius: 10px;
    padding: 6px 18px;
    min-width: 130px;
}

.hud-pill-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 1px;
}

.hud-pill-val {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 800;
}

.highlight-gold { color: var(--accent-gold); }
.highlight-cyan { color: var(--pool-cyan); }
.highlight-green { color: var(--accent-green); }

/* Pause & Back Button Group */
.hud-btn-group {
    display: flex;
    gap: 10px;
}

.hud-action-btn {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.2), rgba(0, 119, 255, 0.3));
    border: 1px solid var(--pool-cyan);
    color: #ffffff;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.9rem;
    padding: 8px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hud-action-btn:hover {
    background: var(--pool-cyan);
    color: #030a16;
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.5);
}

.hud-action-btn.secondary-action {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
}

.hud-action-btn.secondary-action:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

/* Touch Turbo Button */
.hud-touch-group {
    display: flex;
}

.hud-touch-btn {
    background: linear-gradient(135deg, #ff2a5f, var(--pool-cyan));
    border: none;
    color: #ffffff;
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 1rem;
    padding: 10px 24px;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(255, 42, 95, 0.4);
}

.hud-touch-btn:active {
    transform: scale(0.96);
}

/* Pause Modal Actions */
.pause-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 1rem;
}

/* RESULTS & PODIUM SCREEN */
.podium-container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 1.5rem;
    margin: 1.5rem 0 2rem;
    height: 180px;
}

.podium-place {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 120px;
}

.podium-swimmer {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 6px;
    text-align: center;
}

.podium-box {
    width: 100%;
    border-radius: 12px 12px 0 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: var(--font-heading);
    font-weight: 900;
    color: #030a16;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.place-1 .podium-box {
    height: 130px;
    background: linear-gradient(180deg, #ffe57f, var(--accent-gold));
    font-size: 2.2rem;
}
.place-2 .podium-box {
    height: 95px;
    background: linear-gradient(180deg, #ffffff, var(--accent-silver));
    font-size: 1.8rem;
}
.place-3 .podium-box {
    height: 70px;
    background: linear-gradient(180deg, #f4a460, var(--accent-bronze));
    font-size: 1.5rem;
}

.results-table-container {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.results-table th {
    background: rgba(0, 240, 255, 0.1);
    color: var(--pool-cyan);
    padding: 10px;
    text-align: left;
    font-weight: 700;
}

.results-table td {
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.results-table tr.highlight-player {
    background: rgba(255, 42, 95, 0.2);
    font-weight: 700;
}

.results-actions {
    display: flex;
    gap: 1rem;
}
