/* Global Variables & Design System */
:root {
    --bg-main: hsl(230, 35%, 7%);
    --bg-card: hsla(230, 25%, 12%, 0.75);
    --bg-card-hover: hsla(230, 25%, 16%, 0.85);
    --border-color: hsla(230, 25%, 22%, 0.5);
    --border-color-glow: hsla(188, 90%, 50%, 0.3);
    
    --color-primary: hsl(188, 90%, 50%); /* Vibrant Turquoise */
    --color-primary-hover: hsl(188, 90%, 42%);
    --color-primary-glow: hsla(188, 90%, 50%, 0.2);
    
    --color-secondary: hsl(225, 20%, 25%);
    --color-secondary-hover: hsl(225, 20%, 32%);
    
    --color-accent: hsl(48, 100%, 52%); /* Sunny Duck Yellow */
    --color-pink: hsl(330, 95%, 65%); /* Soft Lollipop Pink */
    --color-cyan: hsl(192, 95%, 55%);
    
    --color-text-main: hsl(220, 20%, 96%);
    --color-text-muted: hsl(220, 12%, 72%);
    --color-text-dark: hsl(230, 30%, 12%);
    
    --color-success: hsl(145, 85%, 45%);
    --color-success-glow: hsla(145, 85%, 45%, 0.2);
    --color-danger: hsl(355, 90%, 60%);
    
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.45);
    --radius-sm: 8px;
    --radius-md: 18px;
    --radius-lg: 28px;
    
    --transition-fast: 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --transition-normal: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

body {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(circle at 10% 20%, hsla(200, 70%, 15%, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, hsla(180, 80%, 15%, 0.12) 0%, transparent 45%),
        radial-gradient(circle, rgba(255, 255, 255, 0.01) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 24px 24px;
    color: var(--color-text-main);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    height: 100vh;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--color-secondary);
    border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary-hover);
}

/* App Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 20px;
    gap: 15px;
    max-width: 1600px;
    margin: 0 auto;
}

/* Header Styles */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}
.header-logo {
    display: flex;
    align-items: center;
    gap: 15px;
}
.logo-icon {
    font-size: 28px;
    color: var(--color-accent);
    filter: drop-shadow(0 0 8px hsla(45, 95%, 50%, 0.4));
    animation: bounce 3s infinite ease-in-out;
}
.logo-text h1 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 1.5px;
    line-height: 1.1;
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.logo-text span {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--color-text-muted);
}
.header-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.header-badge i {
    font-size: 14px;
}

/* Workspace Grid Layout */
.app-workspace {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    flex: 1;
    min-height: 0; /* Important for scrollable containers inside grid */
}

/* Workspace Panels */
.workspace-panel {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
}
.workspace-panel:hover {
    border-color: rgba(188, 90, 50, 0.2);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 25px rgba(188, 90, 50, 0.08);
}

.panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.panel-header h2 {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.panel-header h2 i {
    color: var(--color-primary);
}

.panel-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Forms & Setup Fields */
.setup-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}
.setup-label {
    font-size: 13px !important;
    font-weight: 800 !important;
    letter-spacing: 0.5px;
    color: #f1f5f9 !important;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
}
.tooltip {
    cursor: help;
    font-size: 12px;
    color: var(--color-primary);
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}
.tooltip:hover {
    opacity: 1;
}

/* Commitment Box */
.commitment-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.hash-display-container {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 11px;
}
.hash-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.hash-field .label {
    color: var(--color-text-muted);
    font-weight: 600;
}
.hash-field .value {
    color: var(--color-primary);
    word-break: break-all;
}
.hash-text {
    font-family: monospace;
    font-size: 10px;
}

/* Seed Input Custom CSS */
.seed-input-wrapper {
    display: flex;
    gap: 8px;
}
.seed-input-wrapper input {
    flex: 1;
}
input[type="text"], textarea {
    background: #1e293b !important;
    border: 3px solid #000000 !important;
    color: #ffffff !important;
    padding: 10px 14px;
    border-radius: 14px !important;
    font-family: var(--font-body);
    font-size: 13px;
    outline: none;
    transition: all 0.1s ease;
}
input[type="text"]:focus, textarea:focus {
    border-color: #38bdf8 !important;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.5) !important;
    background: #0f172a !important;
}
textarea {
    resize: none;
    line-height: 1.5;
}
.duck-count-badge {
    background: #a855f7 !important; /* purple badge */
    border: 2px solid #000000 !important;
    color: #ffffff !important;
    font-size: 10px;
    font-weight: 800 !important;
    padding: 2px 10px !important;
    border-radius: 20px;
    box-shadow: 0 2px 0 #000000;
    margin-left: auto;
    white-space: nowrap;
    flex-shrink: 0;
}

.textarea-actions {
    display: flex;
    justify-content: space-between;
    margin-top: -4px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 22px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    outline: none;
    transition: transform var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.btn-block {
    width: 100%;
}
.btn-large {
    padding: 14px 32px;
    font-size: 15px;
    border-radius: var(--radius-lg);
}
.btn-primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important; /* bright green gradient */
    color: #ffffff !important;
    border: 3px solid #000000 !important;
    border-radius: 16px !important;
    box-shadow: 0 5px 0 #000000 !important;
    font-weight: 800 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px) !important;
    box-shadow: 0 7px 0 #000000 !important;
}
.btn-primary:active:not(:disabled) {
    transform: translateY(3px) !important;
    box-shadow: 0 2px 0 #000000 !important;
}
.btn-secondary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%) !important; /* indigo gradient */
    color: #ffffff !important;
    border: 3px solid #000000 !important;
    border-radius: 16px !important;
    box-shadow: 0 5px 0 #000000 !important;
    font-weight: 800 !important;
}
.btn-secondary:hover:not(:disabled) {
    transform: translateY(-2px) !important;
    box-shadow: 0 7px 0 #000000 !important;
}
.btn-secondary:active:not(:disabled) {
    transform: translateY(3px) !important;
    box-shadow: 0 2px 0 #000000 !important;
}
.btn-success {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%) !important; /* cyan/blue gradient */
    color: #ffffff !important;
    border: 3px solid #000000 !important;
    border-radius: 16px !important;
    box-shadow: 0 5px 0 #000000 !important;
    font-weight: 800 !important;
}
.btn-success:hover:not(:disabled) {
    transform: translateY(-2px) !important;
    box-shadow: 0 7px 0 #000000 !important;
}
.btn-success:active:not(:disabled) {
    transform: translateY(3px) !important;
    box-shadow: 0 2px 0 #000000 !important;
}

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    flex-shrink: 0;
    background: #a855f7 !important; /* purple icon button */
    color: #ffffff !important;
    border: 3px solid #000000 !important;
    border-radius: 12px !important;
    box-shadow: 0 3px 0 #000000 !important;
}
.btn-icon:hover {
    background: #9333ea !important;
}
.btn-icon:active {
    transform: translateY(2px) !important;
    box-shadow: 0 1px 0 #000000 !important;
}
.btn-text {
    background: #64748b !important;
    color: #ffffff !important;
    border: 2px solid #000000 !important;
    box-shadow: 0 3px 0 #000000 !important;
    border-radius: 10px !important;
    padding: 6px 12px !important;
    font-size: 11px;
    font-weight: 700 !important;
    cursor: pointer;
    text-transform: uppercase;
}
.btn-text:hover {
    background: #475569 !important;
}
.btn-text:active {
    transform: translateY(2px) !important;
    box-shadow: 0 1px 0 #000000 !important;
}
.btn.disabled, .btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Tabs Navigation inside Visualizer Panel */
.panel-nav {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-color);
}
.nav-tab {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 14px 10px;
    color: var(--color-text-muted);
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--transition-fast);
}
.nav-tab:hover {
    color: var(--color-text-main);
    background: rgba(255, 255, 255, 0.02);
}
.nav-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    background: rgba(255, 255, 255, 0.04);
}

/* Tab Content Visibility */
.tab-content-container {
    position: relative;
    padding: 0; /* Managed by tab wrappers */
    display: flex;
    flex-direction: column;
}
.tab-content {
    display: none;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}
.tab-content.active {
    display: flex;
}

/* TAB 1: Race Track Layout */
#tab-race {
    position: relative;
    padding: 15px;
    gap: 15px;
}

/* Simulation Viewport Card */
.simulation-viewport {
    flex: 1;
    min-height: 250px;
    background: radial-gradient(circle at 50% 50%, hsl(205, 55%, 15%) 0%, hsl(215, 60%, 8%) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.8);
}

/* Canvas stretching */
#race-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Lobbies & Overlays inside Viewport */
.race-viewport-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 10;
    background: rgba(10, 15, 25, 0.85);
    backdrop-filter: blur(4px);
    overflow-y: auto;
    padding: 20px 0;
    box-sizing: border-box;
}
.lobby-content {
    text-align: center;
    max-width: 420px;
    padding: 20px;
}
.floating-ducks-graphic {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 15px;
    margin-bottom: 25px;
    height: 80px;
}
.floating-ducks-graphic i {
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
}
.floating-ducks-graphic .size-lg { font-size: 54px; }
.floating-ducks-graphic .size-md { font-size: 38px; }
.floating-ducks-graphic .size-sm { font-size: 24px; }
.color-yellow { color: var(--color-accent); }
.color-cyan { color: var(--color-cyan); }
.color-pink { color: var(--color-pink); }

.lobby-content h3 {
    font-family: var(--font-heading);
    font-size: 20px;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}
.lobby-content p {
    color: var(--color-text-muted);
    font-size: 13px;
}

/* HUD Panel Overlay */
.race-hud {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px 20px;
    border-radius: 50px;
    z-index: 5;
    box-shadow: var(--shadow-sm);
}
.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.hud-label {
    font-size: 8px;
    font-weight: 700;
    color: var(--color-text-muted);
    letter-spacing: 1px;
}
.hud-value {
    font-size: 14px;
    font-weight: 800;
    color: #fff;
}
.font-mono {
    font-family: monospace;
}

/* Podium Card Styles */
.podium-card {
    width: 100%;
    max-width: 440px;
    padding: 30px;
    text-align: center;
    margin: auto;
    position: relative;
    background: rgba(30, 41, 59, 0.9) !important;
    border: 4px solid #000000 !important;
    border-radius: 24px !important;
    box-shadow: 0 10px 0 #000000 !important;
}
.podium-header {
    margin-bottom: 25px;
}
.trophy-crown {
    font-size: 48px;
    color: #fbbf24 !important;
    margin-bottom: 10px;
    text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000;
    animation: bounce 2s infinite ease-in-out;
}
.podium-header h2 {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 24px;
    letter-spacing: 1px;
    color: #ffffff;
    text-shadow: -3px -3px 0 #000, 3px -3px 0 #000, -3px 3px 0 #000, 3px 3px 0 #000;
}
.podium-places {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 30px;
    height: 180px;
}
.podium-place {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative; /* relative parent context for the absolute crown */
}
.avatar-holder {
    width: 54px;
    height: 54px;
    background: #7dd3fc !important; /* Watery blue background */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    position: relative;
    border: 3px solid #000000 !important;
    box-shadow: 0 3px 0 #000000;
    overflow: hidden;
}
.crown-overlay {
    position: absolute;
    top: -16px; /* float above the circle */
    left: 50%;
    z-index: 99 !important; /* render on top of the circle border */
    font-size: 24px;
    color: #fbbf24 !important;
    text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000;
    transform: translateX(-50%) rotate(-10deg);
}
.podium-name {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 800;
    width: 95px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 8px;
    color: #ffffff;
    text-transform: uppercase;
    text-shadow: 0 2px 0 #000000;
}
.pedestal {
    width: 100%;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #000000 !important;
    border-bottom: none !important;
    border-radius: 12px 12px 0 0 !important;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.4);
}
.place-1 .pedestal {
    height: 90px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%) !important; /* Gold */
    color: #000000 !important;
}
.place-1 .avatar-holder {
    width: 68px;
    height: 68px;
}
.place-2 .pedestal {
    height: 60px;
    background: linear-gradient(135deg, #f472b6 0%, #ec4899 100%) !important; /* Pink */
    color: #000000 !important;
}
.place-2 .avatar-holder {
    width: 56px;
    height: 56px;
}
.place-3 .pedestal {
    height: 40px;
    background: linear-gradient(135deg, #22d3ee 0%, #06b6d4 100%) !important; /* Cyan */
    color: #000000 !important;
}
.place-3 .avatar-holder {
    width: 50px;
    height: 50px;
}

.podium-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    margin-top: 15px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}
.podium-actions .btn {
    width: 100%;
    height: 46px;
    font-size: 14px;
    font-weight: 800 !important;
}

/* Standings Leaderboard */
.leaderboard-container {
    height: 180px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.15);
    overflow: hidden;
}
.leaderboard-header {
    background: rgba(0,0,0,0.25);
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
}
.leaderboard-header h3 {
    font-family: var(--font-heading);
    font-size: 13px;
    letter-spacing: 0.5px;
}
.leaderboard-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.leaderboard-placeholder {
    color: var(--color-text-muted);
    font-size: 12px;
    text-align: center;
    padding: 20px;
}
.leaderboard-item {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 12px;
    transition: all var(--transition-fast);
}
.leaderboard-item.rank-1 {
    border-color: rgba(234, 179, 8, 0.3);
    background: rgba(234, 179, 8, 0.05);
}
.leaderboard-rank {
    width: 25px;
    font-weight: 800;
    font-family: var(--font-heading);
}
.rank-1 .leaderboard-rank { color: var(--color-accent); }
.rank-2 .leaderboard-rank { color: var(--color-pink); }
.rank-3 .leaderboard-rank { color: var(--color-cyan); }

.leaderboard-avatar {
    margin-right: 10px;
}
.leaderboard-name {
    flex: 1;
    font-weight: 600;
}
.leaderboard-progress-track {
    width: 100px;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    margin-right: 15px;
    overflow: hidden;
    position: relative;
}
.leaderboard-progress-bar {
    height: 100%;
    border-radius: 10px;
    background: var(--color-primary);
}
.rank-1 .leaderboard-progress-bar { background: var(--color-accent); }
.leaderboard-distance {
    font-family: monospace;
    color: var(--color-text-muted);
}
.leaderboard-status-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 10px;
    text-transform: uppercase;
}
.badge-boosting {
    background: rgba(234, 179, 8, 0.2);
    color: var(--color-accent);
    border: 1px solid var(--color-accent);
}
.badge-stuck {
    background: rgba(239, 68, 68, 0.2);
    color: var(--color-danger);
    border: 1px solid var(--color-danger);
}

/* TAB 2: AUDITOR */
.auditor-layout {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.auditor-info h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    margin-bottom: 6px;
}
.auditor-info p {
    color: var(--color-text-muted);
    font-size: 13px;
}
.audit-form {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: grid;
    gap: 15px;
}
.grid-2 {
    grid-template-columns: 1fr 1fr;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.form-group.full-width {
    grid-column: span 2;
}
.form-group label {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
}
.form-group input, .form-group textarea {
    background: rgba(0, 0, 0, 0.3);
}

/* Audit Result Panel */
.audit-result-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: rgba(0,0,0,0.2);
    overflow: hidden;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.result-header {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
}
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 4px;
}
.status-indicator.success {
    background: var(--color-success-glow);
    border: 1px solid var(--color-success);
    color: var(--color-success);
}
.status-indicator.failure {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--color-danger);
    color: var(--color-danger);
}
.result-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.verification-step {
    display: flex;
    gap: 15px;
}
.step-num {
    width: 24px;
    height: 24px;
    background: var(--color-secondary);
    color: var(--color-text-muted);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}
.step-desc {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.step-desc strong {
    font-size: 13px;
    font-weight: 600;
}
.step-desc p {
    font-size: 12px;
    color: var(--color-text-muted);
}
.code-comparison {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 11px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.code-comparison div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}
.code-comparison .tag {
    color: var(--color-text-muted);
    font-weight: 600;
}
.code-comparison .code {
    word-break: break-all;
    text-align: right;
}

/* TAB 3: HISTORY */
.history-container {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: 0;
    flex: 1;
}
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.history-header h3 {
    font-family: var(--font-heading);
    font-size: 18px;
}
.history-table-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: rgba(0,0,0,0.15);
    -webkit-overflow-scrolling: touch;
}
.history-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 12px;
}
.history-table th {
    background: rgba(0,0,0,0.25);
    padding: 12px 16px;
    font-weight: 600;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 2;
}
.history-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}
.history-table tbody tr:hover {
    background: rgba(255,255,255,0.02);
}
.table-empty {
    text-align: center;
    color: var(--color-text-muted);
    padding: 40px !important;
}

/* Footer Styles */
.app-footer {
    text-align: center;
    font-size: 11px;
    color: var(--color-text-muted);
    padding: 10px 0;
    border-top: 1px solid var(--border-color);
}
.footer-version {
    margin-top: 4px;
    font-size: 11px;
}
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }

/* Animation Keyframes */
@keyframes bounce {
    0%, 100% { transform: translateY(0) rotate(0); }
    50% { transform: translateY(-4px) rotate(-3deg); }
}

@keyframes pulseGlow {
    0% { filter: drop-shadow(0 0 4px hsla(45, 95%, 50%, 0.3)); }
    100% { filter: drop-shadow(0 0 12px hsla(45, 95%, 50%, 0.6)); }
}

@keyframes slideUp {
    from { transform: translateY(10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.animation-float-1 { animation: float 4s infinite ease-in-out; }
.animation-float-2 { animation: float 3.5s infinite ease-in-out 0.5s; }
.animation-float-3 { animation: float 4.5s infinite ease-in-out 1s; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0); }
    50% { transform: translateY(-8px) rotate(4deg); }
}

/* Utilities */
.hidden { display: none !important; }
.btn-block { display: flex; width: 100%; }

/* Responsiveness overrides */
@media (max-width: 992px) {
    body {
        height: auto;
        overflow-y: auto;
    }
    .app-container {
        height: auto;
        padding: 10px;
    }
    .app-workspace {
        grid-template-columns: 1fr;
        height: auto;
    }
    .setup-panel {
        max-height: none;
        order: 2; /* Move configuration setup panel below visualizer on mobile */
    }
    .visualizer-panel {
        order: 1; /* Prioritize the active race screen at the top on mobile */
    }
    .simulation-viewport {
        aspect-ratio: 16 / 9;
        height: auto;
        min-height: 220px;
    }
    .grid-2 {
        grid-template-columns: 1fr;
    }
    .form-group.full-width {
        grid-column: span 1;
    }
}

@media (max-width: 600px) {
    .app-header {
        flex-direction: column;
        gap: 10px;
        padding: 12px;
        align-items: stretch;
    }
    .header-logo {
        justify-content: center;
    }
    .header-badge {
        justify-content: center;
        width: 100%;
    }
    .panel-body {
        padding: 12px;
    }
    .auditor-layout {
        padding: 12px;
    }
    #tab-race {
        padding: 8px;
        gap: 10px;
    }
    .history-container {
        padding: 12px;
    }
    .lobby-card, .podium-card {
        padding: 24px 16px;
    }
    .floating-ducks-graphic {
        height: 60px;
        margin-bottom: 15px;
    }
    .floating-ducks-graphic .size-lg { font-size: 38px; }
    .floating-ducks-graphic .size-md { font-size: 28px; }
    .floating-ducks-graphic .size-sm { font-size: 18px; }
}

/* Setup panel toggle transition */
.app-workspace.setup-hidden {
    grid-template-columns: 1fr;
}
.app-workspace.setup-hidden .setup-panel {
    display: none;
}

/* Lobby Card Styles */
.lobby-card {
    width: 100%;
    max-width: 440px;
    padding: 30px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    text-align: center;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.lobby-header h3 {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 22px;
    letter-spacing: 1px;
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}
.lobby-header p {
    color: var(--color-text-muted);
    font-size: 13px;
}
.lobby-checklist {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: left;
}
.checklist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    font-weight: 600;
}
.checklist-item .status-icon {
    font-size: 16px;
    width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.checklist-item .status-text {
    color: var(--color-text-muted);
}
.checklist-item.ready .status-text {
    color: var(--color-text-main);
}
.lobby-actions {
    margin-top: 10px;
}
.lobby-instructions {
    font-size: 13px;
    color: var(--color-primary);
    font-weight: 700;
    animation: pulseGlow 1.5s infinite alternate;
}



/* Whimsical Floating Cartoon Hats Background */
.bubble-decor {
    position: fixed;
    pointer-events: none;
    z-index: -1;
    border-radius: 50%;
    border: 4px solid #000000;
    /* Chunky solid black 3D shadow matching the site theme */
    box-shadow: inset -6px -6px 0 rgba(0, 0, 0, 0.15), 0 8px 0 #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    animation: float-bubble 15s infinite ease-in-out;
}

/* Translucent gradient themes for bubbles */
.bubble-decor.theme-cyan {
    background: radial-gradient(circle at 35% 35%, hsla(188, 100%, 95%, 0.45) 0%, hsla(188, 90%, 60%, 0.22) 60%, hsla(188, 90%, 50%, 0.12) 100%);
}
.bubble-decor.theme-pink {
    background: radial-gradient(circle at 35% 35%, hsla(330, 100%, 95%, 0.45) 0%, hsla(330, 95%, 75%, 0.22) 60%, hsla(330, 95%, 65%, 0.12) 100%);
}
.bubble-decor.theme-yellow {
    background: radial-gradient(circle at 35% 35%, hsla(48, 100%, 95%, 0.45) 0%, hsla(48, 100%, 70%, 0.22) 60%, hsla(48, 100%, 52%, 0.12) 100%);
}
.bubble-decor.theme-purple {
    background: radial-gradient(circle at 35% 35%, hsla(270, 100%, 95%, 0.45) 0%, hsla(270, 90%, 75%, 0.22) 60%, hsla(270, 90%, 60%, 0.12) 100%);
}

/* Glossy specular highlight (top left) */
.bubble-decor::before {
    content: '';
    position: absolute;
    top: 12%;
    left: 12%;
    width: 24%;
    height: 16%;
    background: #ffffff;
    border-radius: 50%;
    transform: rotate(-30deg);
    opacity: 0.9;
}

/* Secondary subtle reflection (bottom right) */
.bubble-decor::after {
    content: '';
    position: absolute;
    bottom: 14%;
    right: 14%;
    width: 16%;
    height: 10%;
    background: #ffffff;
    border-radius: 50%;
    transform: rotate(-30deg);
    opacity: 0.4;
}

.bubble-decor svg {
    filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.15));
    display: block;
    width: 78%;
    height: 78%;
}

.bubble-1 { 
    width: 140px; 
    height: 140px; 
    left: 3%; 
    top: 12%; 
    animation-duration: 20s; 
}
.bubble-2 { 
    width: 90px; 
    height: 90px; 
    right: 6%; 
    top: 22%; 
    animation-duration: 16s; 
    animation-delay: -3s; 
}
.bubble-3 { 
    width: 160px; 
    height: 160px; 
    left: 12%; 
    bottom: 8%; 
    animation-duration: 24s; 
    animation-delay: -6s; 
}
.bubble-4 { 
    width: 70px; 
    height: 70px; 
    right: 10%; 
    bottom: 12%; 
    animation-duration: 12s; 
    animation-delay: -1s; 
}

@keyframes float-bubble {
    0%, 100% { transform: translateY(0) translateX(0) scale(1) rotate(0deg); }
    33% { transform: translateY(-35px) translateX(25px) scale(1.08) rotate(12deg); }
    66% { transform: translateY(-15px) translateX(-25px) scale(0.92) rotate(-12deg); }
}



/* Minimize / Expand Podium Overlay Styles */
.btn-minimize-podium {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast) ease-in-out;
}
.btn-minimize-podium:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
    transform: scale(1.05);
}

.race-viewport-overlay.minimized {
    background: rgba(10, 15, 25, 0.1);
    backdrop-filter: none;
    pointer-events: none;
}
.race-viewport-overlay.minimized .podium-card {
    display: none;
}

.btn-expand-podium {
    display: none;
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
    pointer-events: auto;
    box-shadow: var(--shadow-lg);
    background: rgba(15, 23, 42, 0.95);
    border: 2px solid var(--color-accent);
    color: var(--color-accent);
    border-radius: var(--radius-md);
    padding: 10px 18px;
    font-weight: 800;
    font-family: var(--font-heading);
    cursor: pointer;
    font-size: 13px;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-fast) cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: bounceIn 0.5s ease-out;
}
.btn-expand-podium:hover {
    transform: scale(1.08) translateY(-2px);
    background: var(--color-accent);
    color: #0f172a;
    box-shadow: 0 8px 20px rgba(251, 191, 36, 0.4);
}
.race-viewport-overlay.minimized .btn-expand-podium {
    display: flex;
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

.nav-tab.disabled-during-race {
    opacity: 0.4;
    pointer-events: none;
    cursor: not-allowed;
    filter: grayscale(80%);
}

/* Guide Tab Styles */
.guide-container {
    padding: 10px 5px;
    max-height: calc(100vh - 250px);
    overflow-y: auto;
}
.guide-header {
    margin-bottom: 30px;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 20px;
}
.guide-header h3 {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--color-accent);
    display: flex;
    align-items: center;
    gap: 10px;
}
.guide-header p {
    color: var(--color-text-muted);
    font-size: 14px;
    line-height: 1.5;
}
.guide-section {
    margin-bottom: 35px;
}
.guide-section h4 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
}
.guide-steps {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}
@media (min-width: 640px) {
    .guide-steps {
        grid-template-columns: 1fr 1fr;
    }
}
.guide-step-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: transform var(--transition-fast) ease, background-color var(--transition-fast) ease;
}
.guide-step-card:hover {
    background: rgba(255, 255, 255, 0.04);
    transform: translateY(-2px);
}
.step-icon {
    font-size: 24px;
    color: var(--color-accent);
    margin-bottom: 12px;
}
.guide-step-card h5 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #fff;
}
.guide-step-card p {
    font-size: 12px;
    line-height: 1.6;
    color: var(--color-text-muted);
}
.code-block {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    padding: 10px;
    font-size: 11px;
    overflow-x: auto;
    color: var(--color-cyan);
    margin-top: 8px;
}

.physics-details-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}
@media (min-width: 640px) {
    .physics-details-grid {
        grid-template-columns: 1fr 1fr;
    }
}
.physics-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: transform var(--transition-fast) ease, background-color var(--transition-fast) ease;
}
.physics-card:hover {
    background: rgba(255, 255, 255, 0.04);
    transform: translateY(-2px);
}
.physics-card h5 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}
.physics-card h5 i {
    color: var(--color-cyan);
}
.physics-card p {
    font-size: 12px;
    line-height: 1.6;
    color: var(--color-text-muted);
}

/* Wide Control Center Lobby Card Styles */
/* Wide Control Center Lobby Card Styles */
.setup-lobby-card {
    max-width: 820px !important;
    width: 90% !important;
    padding: 30px !important;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-sizing: border-box;
    margin: auto;
    
    background: rgba(30, 41, 59, 0.85) !important;
    border: 4px solid #000000 !important;
    border-radius: 24px !important;
    box-shadow: 0 10px 0 #000000 !important;
}

.setup-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 30px;
    margin: 10px 0;
    width: 100%;
    box-sizing: border-box;
}

.setup-col {
    display: flex;
    flex-direction: column;
    gap: 15px;
    text-align: left;
    min-width: 0;
}

.lobby-actions-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-top: 15px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    width: 100%;
}

.lobby-actions-footer .btn {
    flex: 1;
    height: 48px;
    font-size: 15px;
    font-weight: 800 !important;
}

@media (max-width: 768px) {
    .race-viewport-overlay {
        position: relative;
        top: auto;
        left: auto;
        width: 100%;
        height: auto;
        z-index: 10;
        overflow-y: visible;
        padding: 0;
        display: block;
        background: transparent;
        backdrop-filter: none;
    }
    .setup-lobby-card, .podium-card {
        width: 100% !important;
        max-width: 100% !important;
        padding: 20px 15px !important;
        margin: 10px auto !important;
    }
    
    /* Hide siblings on mobile when lobby or podium is active */
    #race-lobby:not(.hidden) ~ .leaderboard-container {
        display: none !important;
    }
    #race-podium:not(.hidden):not(.minimized) ~ .simulation-viewport,
    #race-podium:not(.hidden):not(.minimized) ~ .leaderboard-container {
        display: none !important;
    }

    .setup-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .lobby-actions-footer {
        flex-direction: column;
        gap: 12px;
    }
    .lobby-actions-footer .btn {
        width: 100%;
    }
}

@media (max-height: 550px) {
    .setup-lobby-card {
        padding: 15px !important;
        gap: 10px;
    }
    .setup-grid {
        gap: 15px;
        margin: 5px 0;
    }
    .lobby-actions-footer {
        margin-top: 10px;
        padding-top: 10px;
        gap: 10px;
    }
    .lobby-actions-footer .btn {
        height: 40px;
        font-size: 13px;
    }
}

/* Timer Setup Panel & Keypad styling */
.timer-setup-container {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.timer-display-panel {
    background: #eef2f7;
    border: 3px solid #000000;
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #000000;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.timer-display-text {
    font-family: 'Outfit', monospace;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 1.5px;
}

.timer-display-indicator {
    font-family: 'Outfit', sans-serif;
    font-size: 10px;
    font-weight: 600;
    color: #888888;
    text-align: right;
    line-height: 1;
}

.timer-keypad {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}

.btn-keypad {
    background: #fbbf24 !important; /* gaming yellow */
    border: 3px solid #000000 !important;
    border-radius: 12px !important;
    color: #000000 !important;
    font-family: 'Outfit', sans-serif;
    font-size: 20px !important;
    font-weight: 800 !important;
    padding: 8px 0;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 4px 0 #000000 !important;
    transition: transform 0.05s, box-shadow 0.05s, background-color 0.05s;
    user-select: none;
}

.btn-keypad:hover {
    background: #f59e0b !important;
}

.btn-keypad:active {
    transform: translateY(3px) !important;
    box-shadow: 0 1px 0 #000000 !important;
}

.btn-keypad-action {
    border-radius: 12px !important;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 800 !important;
    padding: 8px 0;
    cursor: pointer;
    text-align: center;
    transition: transform 0.05s, box-shadow 0.05s, background-color 0.05s;
    user-select: none;
}

.btn-keypad-action:active {
    transform: translateY(3px) !important;
    box-shadow: 0 1px 0 #000000 !important;
}

.btn-keypad-set {
    background: #10b981 !important; /* emerald green */
    border: 3px solid #000000 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 0 #000000 !important;
}

.btn-keypad-set:hover {
    background: #059669 !important;
}

.btn-keypad-clear {
    background: #ef4444 !important; /* rose red */
    border: 3px solid #000000 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 0 #000000 !important;
}

.btn-keypad-clear:hover {
    background: #dc2626 !important;
}

.timer-status-msg {
    font-size: 11px;
    color: var(--color-text-muted);
    font-weight: 600;
    text-align: center;
}

/* Redesigned Lobby Header & Centered Clock/Keypad Overlay */
/* Redesigned Lobby Header & Centered Clock/Keypad Overlay */
#race-lobby:not(.hidden) {
    background: rgba(10, 15, 25, 0.25) !important; /* more transparent backdrop so we can see the ducks fully! */
    backdrop-filter: blur(1.5px) !important;
    display: block !important; /* block display avoids flexbox scroll bugs */
    overflow-y: auto !important;
    padding: 20px 0;
    box-sizing: border-box;
}

#race-podium:not(.hidden) {
    background: rgba(10, 15, 25, 0.25) !important;
    backdrop-filter: blur(1.5px) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow-y: auto !important;
    padding: 20px 0;
    box-sizing: border-box;
}

.lobby-clock-box {
    background: #ffffff !important;
    border: 4px solid #000000 !important;
    border-radius: 20px !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 560px; /* slightly more width */
    max-width: 90%;
    height: 72px;
    box-sizing: border-box;
    padding: 0 20px;
    color: #000000 !important; /* solid black text */
    box-shadow: 0 6px 0 #000000 !important; /* thick 3D gaming border style */
    margin: 0 auto 15px auto; /* center horizontally */
}

.lobby-clock-text {
    font-family: 'Outfit', monospace;
    font-size: 38px;
    font-weight: 800;
    letter-spacing: 1.5px;
    flex: 1;
    text-align: center;
    margin-left: 25px;
}

.lobby-clock-labels {
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-size: 9px;
    font-weight: 800;
    color: #64748b; /* slate gray shade */
    line-height: 1.15;
    margin-right: 15px;
}

.lobby-clock-icon-left,
.lobby-clock-icon-right {
    font-size: 24px;
    color: #000000 !important;
    display: flex;
    align-items: center;
}

#race-lobby .timer-keypad {
    width: 560px; /* slightly more width */
    max-width: 90%;
    margin: 0 auto 30px auto !important; /* more padding between timer and menu under */
    box-shadow: 0 8px 0 #000000 !important;
    background: rgba(30, 41, 59, 0.85) !important;
    padding: 12px;
    border-radius: 20px !important;
    border: 4px solid #000000 !important;
}

/* Fullscreen Panel & Interactive Toggle Styles */
.btn-fullscreen-toggle {
    background: transparent;
    border: none;
    padding: 14px 18px;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.btn-fullscreen-toggle:hover {
    color: var(--color-primary);
    background: rgba(255, 255, 255, 0.04);
}

/* Fullscreen Immersive Modal Mode */
.visualizer-panel.panel-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    z-index: 99999 !important;
    border-radius: 0 !important;
    border: none !important;
    margin: 0 !important;
    background: #0b0f19 !important;
    display: flex;
    flex-direction: column;
}

/* In fullscreen mode, get rid of the standings area completely so canvas fills everything */
.visualizer-panel.panel-fullscreen .leaderboard-container {
    display: none !important;
}

.visualizer-panel.panel-fullscreen .panel-body {
    padding: 10px !important;
    flex: 1;
}

.visualizer-panel.panel-fullscreen #tab-race {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 5px !important;
    gap: 10px;
}

.visualizer-panel.panel-fullscreen .simulation-viewport {
    flex: 1 !important;
    height: 100% !important;
    min-height: 0 !important;
    aspect-ratio: auto !important;
}

/* Mobile Responsiveness & Scaling for Setup Lobby Modal */
@media (max-width: 768px) {
    #race-lobby:not(.hidden) {
        display: block !important;
        padding: 10px;
        overflow-y: auto !important;
        box-sizing: border-box;
    }
    
    .setup-lobby-card {
        max-height: none !important;
        background: rgba(30, 41, 59, 0.9) !important;
        margin: 15px auto 30px auto !important; /* bottom spacing to allow scrolling past buttons */
    }
    
    .lobby-clock-box {
        width: 100%;
        height: 60px;
        padding: 0 12px;
    }
    
    .lobby-clock-text {
        font-size: 28px;
        margin-left: 15px;
    }
    
    .lobby-clock-icon-left,
    .lobby-clock-icon-right {
        font-size: 18px;
    }
    
    #race-lobby .timer-keypad {
        width: 100%;
        padding: 6px;
    }
    
    .btn-keypad {
        font-size: 18px !important;
        padding: 6px 0;
    }
    
    .btn-keypad-action {
        font-size: 12px;
        padding: 6px 0;
    }
}

/* ==========================================================================
   UNIVERSAL SILLY 3D GAME STYLE OVERHAUL OVERRIDES
   ========================================================================== */

/* Minimize Podium Backdrop & Blur Fix */
#race-podium.minimized {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* App Header Overhaul */
.app-header {
    background: rgba(30, 41, 59, 0.95) !important;
    border: 4px solid #000000 !important;
    border-radius: 24px !important;
    box-shadow: 0 8px 0 #000000 !important;
    padding: 14px 24px !important;
    transition: transform 0.1s ease;
    margin-bottom: 10px !important;
}

.logo-icon {
    font-size: 32px !important;
    color: #fbbf24 !important;
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.6)) !important;
    animation: logoBounce 2s infinite ease-in-out !important;
}

@keyframes logoBounce {
    0%, 100% { transform: translateY(0) scale(1) rotate(0deg); }
    50% { transform: translateY(-8px) scale(1.15) rotate(8deg); }
}

.header-badge {
    background: #1e293b !important;
    padding: 8px 18px !important;
    border-radius: 20px !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    border: 3px solid #000000 !important;
    box-shadow: 0 4px 0 #000000 !important;
    color: #ffffff !important;
    font-family: var(--font-heading) !important;
    transition: all 0.1s ease !important;
}

#btn-sound-toggle:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 0 #000000 !important;
    background: #334155 !important;
}

#btn-sound-toggle:active {
    transform: translateY(2px) !important;
    box-shadow: 0 2px 0 #000000 !important;
}

/* Main Workspace Panel */
.visualizer-panel {
    background: rgba(15, 23, 42, 0.95) !important;
    border: 4px solid #000000 !important;
    border-radius: 28px !important;
    box-shadow: 0 12px 0 #000000 !important;
    overflow: hidden !important;
}

/* Chunky Navigation Tabs */
.panel-nav {
    background: rgba(15, 23, 42, 0.6) !important;
    border-bottom: 4px solid #000000 !important;
    padding: 12px 16px !important;
    gap: 12px !important;
    display: flex !important;
    flex-wrap: wrap !important;
}

.nav-tab {
    flex: 1;
    min-width: 120px;
    background: #1e293b !important;
    border: 3px solid #000000 !important;
    border-radius: 16px !important;
    color: #94a3b8 !important;
    font-family: var(--font-heading) !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    padding: 12px 14px !important;
    box-shadow: 0 4px 0 #000000 !important;
    transition: all 0.1s ease !important;
    transform: translateY(0);
    border-bottom-color: #000000 !important; /* fix initial border bottom default */
}

.nav-tab:hover {
    color: #ffffff !important;
    background: #334155 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 0 #000000 !important;
}

.nav-tab.active {
    color: #ffffff !important;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important; /* vibrant blue gradient */
    box-shadow: 0 1px 0 #000000 !important;
    transform: translateY(3px) !important;
}

.btn-fullscreen-toggle {
    background: #1e293b !important;
    border: 3px solid #000000 !important;
    border-radius: 16px !important;
    color: #94a3b8 !important;
    padding: 10px 14px !important;
    box-shadow: 0 4px 0 #000000 !important;
    transition: all 0.1s ease !important;
    cursor: pointer !important;
    font-size: 15px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-left: 3px solid #000000 !important;
}

.btn-fullscreen-toggle:hover {
    color: #ffffff !important;
    background: #334155 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 0 #000000 !important;
}

.btn-fullscreen-toggle:active {
    transform: translateY(2px) !important;
    box-shadow: 0 2px 0 #000000 !important;
}

/* Auditor Tab Overhaul */
.auditor-layout {
    padding: 24px !important;
    gap: 24px !important;
}

.auditor-info h3 {
    font-family: var(--font-heading) !important;
    font-weight: 800 !important;
    font-size: 20px !important;
    color: #ffffff !important;
}

.audit-form {
    background: rgba(30, 41, 59, 0.85) !important;
    border: 4px solid #000000 !important;
    border-radius: 20px !important;
    padding: 20px !important;
    box-shadow: 0 8px 0 #000000 !important;
}

.form-group label {
    font-family: var(--font-heading) !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    color: #ffffff !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

#btn-run-audit {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: #ffffff !important;
    border: 3px solid #000000 !important;
    border-radius: 16px !important;
    box-shadow: 0 6px 0 #000000 !important;
    font-weight: 800 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
    padding: 14px 28px !important;
    font-size: 15px !important;
    font-family: var(--font-heading) !important;
    cursor: pointer !important;
    transition: all 0.1s ease !important;
}

#btn-run-audit:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 0 #000000 !important;
}

#btn-run-audit:active {
    transform: translateY(2px) !important;
    box-shadow: 0 4px 0 #000000 !important;
}

.audit-result-card {
    border: 4px solid #000000 !important;
    border-radius: 20px !important;
    background: rgba(30, 41, 59, 0.85) !important;
    box-shadow: 0 8px 0 #000000 !important;
}

.result-header {
    padding: 16px 20px !important;
    border-bottom: 4px solid #000000 !important;
    background: rgba(0, 0, 0, 0.15) !important;
}

.status-indicator.success {
    background: #10b981 !important;
    border: 3px solid #000000 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 0 #000000 !important;
    border-radius: 12px !important;
    font-weight: 800 !important;
    padding: 6px 14px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.status-indicator.failure {
    background: #ef4444 !important;
    border: 3px solid #000000 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 0 #000000 !important;
    border-radius: 12px !important;
    font-weight: 800 !important;
    padding: 6px 14px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
}

#btn-copy-audit-link {
    background: #3b82f6 !important;
    color: #ffffff !important;
    border: 3px solid #000000 !important;
    box-shadow: 0 4px 0 #000000 !important;
    border-radius: 12px !important;
    font-weight: 800 !important;
    padding: 6px 14px !important;
    text-transform: uppercase !important;
    font-family: var(--font-heading) !important;
    transition: all 0.1s ease !important;
    cursor: pointer !important;
}

#btn-copy-audit-link:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 0 #000000 !important;
}

#btn-copy-audit-link:active {
    transform: translateY(2px) !important;
    box-shadow: 0 2px 0 #000000 !important;
}

.step-num {
    width: 32px !important;
    height: 32px !important;
    background: #fbbf24 !important; /* Gaming yellow */
    color: #000000 !important;
    border: 3px solid #000000 !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 14px !important;
    font-weight: 800 !important;
    flex-shrink: 0 !important;
    box-shadow: 0 3px 0 #000000 !important;
}

.code-comparison {
    background: #0f172a !important;
    border: 3px solid #000000 !important;
    border-radius: 12px !important;
    padding: 12px 16px !important;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.4) !important;
}

/* Race History Tab Overhaul */
.history-container h3 {
    font-family: var(--font-heading) !important;
    font-weight: 800 !important;
    font-size: 20px !important;
    color: #ffffff !important;
}

#btn-clear-history {
    background: #ef4444 !important;
    color: #ffffff !important;
    border: 3px solid #000000 !important;
    box-shadow: 0 4px 0 #000000 !important;
    border-radius: 12px !important;
    font-weight: 800 !important;
    padding: 8px 16px !important;
    text-transform: uppercase !important;
    font-family: var(--font-heading) !important;
    cursor: pointer !important;
    transition: all 0.1s ease !important;
}

#btn-clear-history:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 0 #000000 !important;
}

#btn-clear-history:active {
    transform: translateY(2px) !important;
    box-shadow: 0 2px 0 #000000 !important;
}

.history-table-wrapper {
    border: 4px solid #000000 !important;
    border-radius: 20px !important;
    background: rgba(30, 41, 59, 0.85) !important;
    box-shadow: 0 8px 0 #000000 !important;
    overflow: hidden !important;
}

.history-table th {
    background: #0f172a !important;
    color: #ffffff !important;
    font-family: var(--font-heading) !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    border-bottom: 3px solid #000000 !important;
    padding: 14px 16px !important;
}

.history-table td {
    border-bottom: 2px solid rgba(0,0,0,0.15) !important;
    padding: 14px 16px !important;
    font-weight: 600 !important;
}

.btn-audit-item {
    padding: 6px 12px !important;
    font-size: 11px !important;
    border-radius: 10px !important;
}

/* How It Works Tab Overhaul */
.guide-container h3 {
    font-family: var(--font-heading) !important;
    font-weight: 800 !important;
    font-size: 20px !important;
    color: #ffffff !important;
}

.guide-section h4 {
    font-family: var(--font-heading) !important;
    font-weight: 800 !important;
    font-size: 16px !important;
    border-bottom: 2px dashed rgba(255, 255, 255, 0.15) !important;
    padding-bottom: 8px !important;
}

.guide-step-card {
    background: rgba(30, 41, 59, 0.7) !important;
    border: 3px solid #000000 !important;
    border-radius: 20px !important;
    padding: 20px !important;
    box-shadow: 0 6px 0 #000000 !important;
    transition: all 0.15s ease !important;
}

.guide-step-card:hover {
    background: rgba(30, 41, 59, 0.95) !important;
    transform: translateY(-4px) !important;
    box-shadow: 0 10px 0 #000000 !important;
}

.step-icon {
    font-size: 32px !important;
    color: #fbbf24 !important;
}

.guide-step-card h5 {
    font-family: var(--font-heading) !important;
    font-weight: 800 !important;
    font-size: 14px !important;
}

.code-block {
    background: #0f172a !important;
    border: 3px solid #000000 !important;
    border-radius: 12px !important;
    padding: 12px !important;
    color: #22d3ee !important; /* neon cyan */
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.4) !important;
}

.physics-card {
    background: rgba(30, 41, 59, 0.7) !important;
    border: 3px solid #000000 !important;
    border-radius: 20px !important;
    padding: 20px !important;
    box-shadow: 0 6px 0 #000000 !important;
    transition: all 0.15s ease !important;
}

.physics-card:hover {
    background: rgba(30, 41, 59, 0.95) !important;
    transform: translateY(-4px) !important;
    box-shadow: 0 10px 0 #000000 !important;
}

.physics-card h5 {
    font-family: var(--font-heading) !important;
    font-weight: 800 !important;
    font-size: 14px !important;
    color: #ffffff !important;
}

/* Footer Styling */
.app-footer {
    text-align: center !important;
    font-size: 12px !important;
    padding: 16px 0 !important;
    border-top: 4px solid #000000 !important;
    margin-top: 20px !important;
    background: transparent !important;
}

.footer-version {
    margin-top: 8px !important;
    display: inline-block !important;
    background: #3b82f6 !important;
    border: 3px solid #000000 !important;
    color: #ffffff !important;
    font-weight: 800 !important;
    font-size: 10px !important;
    padding: 3px 12px !important;
    border-radius: 14px !important;
    box-shadow: 0 3px 0 #000000 !important;
}

/* Hide background cartoon hats on mobile viewports */
@media (max-width: 768px) {
    .bubble-decor {
        display: none !important;
    }
}


