/* ============================================
   Design System - DreamCup2025 Fuel Manager
   ============================================ */

:root {
    /* Color Palette - Racing Theme */
    --color-bg-primary: #0a0e27;
    --color-bg-secondary: #141b3d;
    --color-bg-card: rgba(20, 27, 61, 0.6);
    --color-border: rgba(255, 255, 255, 0.1);

    /* Accent Colors */
    --color-racing-red: #ff3366;
    --color-electric-blue: #00d4ff;
    --color-gold: #ffd700;
    --color-success: #00ff88;
    --color-warning: #ffaa00;
    --color-danger: #ff3366;

    /* Text Colors */
    --color-text-primary: #ffffff;
    --color-text-secondary: #a0aec0;
    --color-text-muted: #718096;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-racing: linear-gradient(135deg, #ff3366 0%, #ff6b35 100%);
    --gradient-success: linear-gradient(135deg, #00ff88 0%, #00d4ff 100%);

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.3);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* ============================================
   Reset & Base Styles
   ============================================ */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    line-height: 1.6;
    min-height: 100vh;
    background-image:
        radial-gradient(circle at 20% 20%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 51, 102, 0.1) 0%, transparent 50%);
}

/* ============================================
   Typography
   ============================================ */

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    line-height: 1.2;
}

h1 {
    font-size: 2.5rem;
    background: var(--gradient-racing);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h2 {
    font-size: 1.75rem;
    color: var(--color-electric-blue);
}

h3 {
    font-size: 1.25rem;
    color: var(--color-text-primary);
}

/* ============================================
   Layout
   ============================================ */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-md);
}

.header {
    text-align: center;
    padding: var(--spacing-xl) 0;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: var(--spacing-lg);
}

.race-info {
    display: flex;
    justify-content: center;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-md);
    flex-wrap: wrap;
}

.info-badge {
    background: var(--color-bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.info-badge strong {
    color: var(--color-electric-blue);
    margin-right: var(--spacing-xs);
}

/* ============================================
   Cards & Panels
   ============================================ */

.card {
    background: var(--color-bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    border-color: rgba(0, 212, 255, 0.3);
    transform: translateY(-2px);
}

.glass-panel {
    background: rgba(20, 27, 61, 0.4);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
}

/* ============================================
   Grid System
   ============================================ */

.grid {
    display: grid;
    gap: var(--spacing-lg);
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* ============================================
   Forms & Inputs
   ============================================ */

.form-group {
    margin-bottom: var(--spacing-md);
}

label {
    display: block;
    margin-bottom: var(--spacing-xs);
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

input[type="number"],
input[type="text"],
input[type="email"],
input[type="password"],
select {
    width: 100%;
    padding: var(--spacing-sm);
    background: var(--color-bg-secondary);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

/* Larger inputs for auth forms */
.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"] {
    font-size: 1.1rem;
    padding: 0.875rem;
}

input[type="number"]:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus {
    outline: none;
    border-color: var(--color-electric-blue);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    box-shadow: var(--shadow-md), var(--shadow-glow);
    transform: translateY(-2px);
}

.btn-racing {
    background: var(--gradient-racing);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-racing:hover {
    box-shadow: var(--shadow-md), 0 0 20px rgba(255, 51, 102, 0.3);
    transform: translateY(-2px);
}

.btn-block {
    width: 100%;
}

/* ============================================
   Dashboard
   ============================================ */

.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin: var(--spacing-lg) 0;
}

.metric-card {
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease;
}

.metric-card:hover {
    transform: scale(1.05);
}

.metric-value {
    font-size: 2.5rem;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    margin: var(--spacing-xs) 0;
}

.metric-label {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.9;
}

/* ============================================
   Chart & Canvas
   ============================================ */

.chart-container {
    position: relative;
    width: 100%;
    height: 400px;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    overflow: hidden;
}

#fuelChart {
    width: 100%;
    height: 100%;
}

/* ============================================
   Timeline
   ============================================ */

.timeline {
    position: relative;
    padding: var(--spacing-lg) 0;
}

.timeline-item {
    position: relative;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    background: var(--glass-panel);
    border-left: 4px solid var(--color-electric-blue);
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}

.timeline-item:hover {
    background: rgba(20, 27, 61, 0.8);
    transform: translateX(5px);
}

.timeline-item.pit-stop {
    border-left-color: var(--color-racing-red);
}

.timeline-item.driver-change {
    border-left-color: var(--color-gold);
}

.timeline-time {
    font-family: 'Orbitron', sans-serif;
    color: var(--color-electric-blue);
    font-weight: 700;
    font-size: 1.125rem;
    margin-bottom: var(--spacing-xs);
}

.timeline-content {
    color: var(--color-text-secondary);
}

/* ============================================
   Strategy Cards
   ============================================ */

.strategy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.strategy-card {
    background: var(--color-bg-card);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    transition: all 0.3s ease;
}

.strategy-card.recommended {
    border-color: var(--color-success);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.2);
}

.strategy-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.strategy-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.strategy-badge {
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success {
    background: var(--color-success);
    color: var(--color-bg-primary);
}

.badge-warning {
    background: var(--color-warning);
    color: var(--color-bg-primary);
}

.badge-info {
    background: var(--color-electric-blue);
    color: var(--color-bg-primary);
}

/* ============================================
   Alerts & Messages
   ============================================ */

.alert {
    padding: var(--spacing-md);
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-md);
    border-left: 4px solid;
    animation: slideIn 0.3s ease;
}

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

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

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

.alert-warning {
    background: rgba(255, 170, 0, 0.1);
    border-color: var(--color-warning);
    color: var(--color-warning);
}

.alert-danger {
    background: rgba(255, 51, 102, 0.1);
    border-color: var(--color-danger);
    color: var(--color-danger);
}

/* ============================================
   Utilities
   ============================================ */

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

.mt-1 {
    margin-top: var(--spacing-xs);
}

.mt-2 {
    margin-top: var(--spacing-sm);
}

.mt-3 {
    margin-top: var(--spacing-md);
}

.mt-4 {
    margin-top: var(--spacing-lg);
}

.mb-1 {
    margin-bottom: var(--spacing-xs);
}

.mb-2 {
    margin-bottom: var(--spacing-sm);
}

.mb-3 {
    margin-bottom: var(--spacing-md);
}

.mb-4 {
    margin-bottom: var(--spacing-lg);
}

/* ============================================
   Stint Inputs
   ============================================ */

.stint-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-sm);
}

.stint-input-card {
    background: rgba(255, 255, 255, 0.03);
    padding: var(--spacing-md);
    border-radius: var(--radius-sm);
    border: 2px solid var(--color-border);
    transition: all 0.3s ease;
}

.stint-input-card:hover {
    border-color: var(--color-electric-blue);
    background: rgba(0, 212, 255, 0.05);
    transform: translateY(-2px);
}

.stint-input-card.highlight {
    border-color: var(--color-racing-red);
    background: rgba(255, 51, 102, 0.1);
}

.stint-input-card label {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

.stint-input-card input {
    font-size: 1.125rem;
    font-weight: 600;
    text-align: center;
}

.stint-input-card small {
    font-size: 0.7rem;
    display: block;
    margin-top: 0.25rem;
    text-align: center;
}

/* ============================================
   Utilities
   ============================================ */

.hidden {
    display: none;
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .race-info {
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .dashboard {
        grid-template-columns: repeat(2, 1fr);
    }

    .chart-container {
        height: 300px;
    }

    .container {
        padding: var(--spacing-sm);
    }
}

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

    .metric-value {
        font-size: 2rem;
    }
}

/* ============================================
   Modal Styles
   ============================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-md);
}

.modal.hidden {
    display: none;
}

.modal-content {
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--color-border);
}

.modal-header h2 {
    margin: 0;
}

.btn-close {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}

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

.modal-body {
    padding: var(--spacing-sm) 0;
}

/* Driver List */
.driver-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-outline-danger {
    background: transparent;
    border: 1px solid var(--color-danger);
    color: var(--color-danger);
}

.btn-outline-danger:hover:not(:disabled) {
    background: var(--color-danger);
    color: white;
}

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

.mt-3 {
    margin-top: var(--spacing-md);
}

.mt-4 {
    margin-top: var(--spacing-lg);
}

/* Input Group */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.input-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
}

/* Select Styling */
select {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 243, 255, 0.1);
}

select option {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
}

/* Success Button */
.btn-success {
    background: linear-gradient(135deg, #00ff88 0%, #00d4ff 100%);
    color: #0a0e27;
    font-weight: 600;
}

.btn-success:hover {
    background: linear-gradient(135deg, #00ff99 0%, #00e0ff 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.3);
}

/* Timeline Table */
.timeline-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.timeline-table th {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    padding: 0.75rem 0.5rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--color-accent);
}

.timeline-table td {
    padding: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.timeline-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.timeline-table .pit-work-row {
    font-style: italic;
}

.timeline-table .spacer-row td {
    padding: 0.25rem;
    border: none;
}

/* ============================================
   Auth Screen Styles - Racing Theme
   ============================================ */

.auth-screen {
    position: fixed;
    /* Changed from relative to fixed */
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 9999;
    /* Always on top */
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3c 50%, #0d1229 100%);
    padding: var(--spacing-md);
    overflow-y: auto;
    /* Allow internal scrolling if content is tall */
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Utility to prevent body scroll */
body.no-scroll {
    overflow: hidden;
}

/* ============================================
   Body-Level Mode Control (CRITICAL)
   These rules enforce absolute separation between auth and app screens.
   ============================================ */

/* Auth Mode: Show auth screen, hide main app, lock scroll */
body.auth-mode {
    overflow: hidden;
    /* Prevent page scroll */
}

body.auth-mode #authScreen {
    display: flex !important;
    /* Force visible */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 9999;
}

body.auth-mode #mainApp {
    display: none !important;
    /* Force hidden */
}

/* App Mode: Show main app, hide auth screen, allow scroll */
body.app-mode {
    overflow: auto;
    /* Allow normal scrolling */
}

body.app-mode #authScreen {
    display: none !important;
    /* Force hidden */
}

body.app-mode #mainApp {
    display: block !important;
    /* Force visible */
}

/* Racing Background Animation */
.racing-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.racing-stripe {
    position: absolute;
    width: 200%;
    height: 4px;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 51, 102, 0.5) 20%,
            rgba(0, 212, 255, 0.8) 50%,
            rgba(255, 51, 102, 0.5) 80%,
            transparent 100%);
    animation: stripeMove 3s linear infinite;
}

.stripe-1 {
    top: 20%;
    animation-delay: 0s;
}

.stripe-2 {
    top: 50%;
    animation-delay: 1s;
    opacity: 0.7;
}

.stripe-3 {
    top: 80%;
    animation-delay: 2s;
    opacity: 0.5;
}

@keyframes stripeMove {
    0% {
        transform: translateX(-50%);
    }

    100% {
        transform: translateX(0%);
    }
}

.checkered-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(45deg, rgba(255, 255, 255, 0.02) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(255, 255, 255, 0.02) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.02) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.02) 75%);
    background-size: 40px 40px;
    background-position: 0 0, 0 20px, 20px -20px, -20px 0px;
}

.auth-container {
    max-width: 420px;
    width: 100%;
    text-align: center;
    position: relative;
    z-index: 1;
}

/* Hero Section */
.auth-hero {
    margin-bottom: var(--spacing-md);
    /* Reduced from lg */
}

.speedometer {
    width: 80px;
    /* Reduced from 100px */
    height: 80px;
    border-radius: 50%;
    background: conic-gradient(from 225deg,
            var(--color-success) 0deg,
            var(--color-warning) 90deg,
            var(--color-racing-red) 180deg,
            transparent 180deg);
    margin: var(--spacing-md) auto var(--spacing-md);
    /* Added top margin */
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.speedometer::before {
    content: '';
    position: absolute;
    width: 64px;
    /* Reduced proportionally */
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a1f3c 0%, #0d1229 100%);
    z-index: 1;
}

.speedometer::after {
    content: '🏁';
    position: absolute;
    font-size: 1.6rem;
    /* Reduced from 2rem */
    z-index: 2;
}

.speedometer-needle {
    position: absolute;
    width: 3px;
    height: 35px;
    background: linear-gradient(to top, var(--color-racing-red), #ff6b8a);
    border-radius: 2px;
    bottom: 50%;
    left: 50%;
    transform-origin: bottom center;
    transform: translateX(-50%) rotate(-45deg);
    animation: needleSweep 2s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(255, 51, 102, 0.5);
    z-index: 3;
}

@keyframes needleSweep {

    0%,
    100% {
        transform: translateX(-50%) rotate(-60deg);
    }

    50% {
        transform: translateX(-50%) rotate(60deg);
    }
}

.speedometer-center {
    display: none;
}

.auth-title {
    font-family: 'Orbitron', sans-serif;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: var(--spacing-sm);
}

.title-line {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--color-text-primary);
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.4), 0 2px 10px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.15em;
}

.title-line.accent {
    font-size: 1.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-tagline {
    color: var(--color-text-secondary);
    font-size: 0.95rem;
    margin-top: var(--spacing-sm);
}

/* Form Styles */
.auth-form {
    background: linear-gradient(145deg, rgba(13, 18, 41, 0.95), rgba(26, 31, 60, 0.9));
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(0, 212, 255, 0.3);
    text-align: left;
    backdrop-filter: blur(20px);
    box-shadow:
        0 15px 50px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.form-title {
    text-align: center;
    margin-bottom: var(--spacing-md);
    font-size: 1.5rem;
    font-family: 'Orbitron', sans-serif;
}

.form-description {
    text-align: center;
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-md);
    font-size: 0.9rem;
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    margin: var(--spacing-md) 0;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-border), transparent);
}

.auth-divider span {
    padding: 0 var(--spacing-sm);
}

/* Google Button */
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: #fff;
    color: #333;
    border: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-google:hover {
    background: #f5f5f5;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.2);
}

.google-icon {
    flex-shrink: 0;
}

/* Button Icon */
.btn-icon {
    margin-right: 0.25rem;
}

/* Auth Footer */
.auth-footer {
    margin-top: var(--spacing-lg);
    color: var(--color-text-muted);
    font-size: 0.8rem;
}

@keyframes pulse {

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

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

.auth-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--spacing-lg);
}

.auth-form {
    background: var(--color-bg-secondary);
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    text-align: left;
}

.auth-form h2 {
    text-align: center;
    margin-bottom: var(--spacing-md);
    font-size: 1.5rem;
}

.auth-switch {
    text-align: center;
    margin-top: var(--spacing-md);
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.auth-switch a {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 600;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.auth-error {
    background: rgba(255, 51, 102, 0.1);
    border: 1px solid var(--color-danger);
    color: var(--color-danger);
    padding: var(--spacing-sm);
    border-radius: var(--radius-sm);
    margin-top: var(--spacing-md);
    text-align: center;
}

.team-options {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

/* ============================================
   Game-Style Team Selection
   ============================================ */

.team-select-game {
    max-width: 500px !important;
    padding: var(--spacing-lg) !important;
}

/* Profile Header */
.game-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(255, 51, 102, 0.1));
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.profile-avatar {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-accent), var(--color-racing-red));
    border-radius: 50%;
}

.profile-info {
    flex: 1;
}

.profile-label {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    letter-spacing: 0.1em;
    font-weight: 700;
}

.profile-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

.btn-logout-mini {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-logout-mini:hover {
    background: rgba(255, 51, 102, 0.3);
    transform: scale(1.1);
}

/* Existing Team Card */
.team-card {
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(180deg, rgba(0, 50, 100, 0.4), rgba(0, 20, 40, 0.6));
    border: 2px solid var(--color-accent);
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    position: relative;
    animation: cardGlow 2s ease-in-out infinite alternate;
}

@keyframes cardGlow {
    from {
        box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
    }

    to {
        box-shadow: 0 0 40px rgba(0, 212, 255, 0.4);
    }
}

.team-card-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-accent);
    color: #000;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    letter-spacing: 0.05em;
}

.team-card-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.team-card-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 0.5rem;
}

.team-card-code {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

.code-label {
    color: var(--color-text-muted);
    margin-right: 0.5rem;
}

.code-value {
    font-family: 'Consolas', monospace;
    color: var(--color-accent);
    background: rgba(0, 0, 0, 0.3);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

/* Game Title */
.game-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    color: var(--color-text-muted);
    text-align: center;
    letter-spacing: 0.15em;
    margin-bottom: 1rem;
}

/* Action Cards */
.action-cards {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.action-card {
    flex: 1;
    min-width: 120px;
    max-width: 150px;
    padding: 1.5rem 1rem;
    text-align: center;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    background: rgba(255, 255, 255, 0.03);
}

.action-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--color-accent);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.action-card.primary {
    background: linear-gradient(180deg, rgba(0, 212, 255, 0.2), rgba(0, 100, 150, 0.3));
    border-color: var(--color-accent);
}

.action-card.primary:hover {
    background: linear-gradient(180deg, rgba(0, 212, 255, 0.4), rgba(0, 150, 200, 0.5));
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.4);
}

.action-card.create {
    background: linear-gradient(180deg, rgba(50, 200, 100, 0.15), rgba(30, 100, 60, 0.2));
}

.action-card.create:hover {
    border-color: var(--color-success);
    box-shadow: 0 0 25px rgba(50, 200, 100, 0.3);
}

.action-card.join {
    background: linear-gradient(180deg, rgba(255, 170, 50, 0.15), rgba(120, 80, 30, 0.2));
}

.action-card.join:hover {
    border-color: var(--color-warning);
    box-shadow: 0 0 25px rgba(255, 170, 50, 0.3);
}

.action-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.action-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: 0.1em;
    margin-bottom: 0.25rem;
}

.action-desc {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

/* ============================================
   Team Bar Styles

/* Stopwatch Styles */
.stopwatch-card {
    text-align: center;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.4), rgba(0, 20, 40, 0.6));
    border: 1px solid var(--color-accent);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.1);
}

.stopwatch-display {
    font-family: 'Orbitron', monospace;
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--color-accent);
    margin-bottom: 1rem;
    text-shadow: 0 0 15px rgba(0, 212, 255, 0.4);
    letter-spacing: 2px;
}

.stopwatch-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.team-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.6), rgba(0, 30, 60, 0.4));
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
    gap: var(--spacing-md);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.team-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    color: var(--color-text-primary);
}

.info-pair {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.info-label-mini {
    font-size: 0.65rem;
    color: var(--color-text-secondary);
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.team-name {
    font-weight: 700;
    color: var(--color-accent);
    font-size: 1.1rem;
    line-height: 1.2;
}


.invite-code {
    font-family: 'Consolas', 'Monaco', monospace;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.invite-code:hover {
    background: var(--color-accent);
    color: #000;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.user-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 1rem;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

.session-select {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    max-width: 150px;
}

.team-actions select {
    min-width: 150px;
}

/* ============================================
   Session List Styles
   ============================================ */

.session-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    max-height: 300px;
    overflow-y: auto;
}

.session-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    transition: all 0.3s ease;
}

.session-item:hover {
    border-color: var(--color-accent);
    background: rgba(0, 212, 255, 0.05);
}

.session-item.active {
    border-color: var(--color-success);
    background: rgba(0, 255, 136, 0.1);
}

.session-info {
    flex: 1;
}

.session-name {
    font-weight: 600;
    color: var(--color-text-primary);
}

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

.session-actions {
    display: flex;
    gap: var(--spacing-xs);
}

/* ============================================
   Invite Code Display
   ============================================ */

.invite-code-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: rgba(0, 212, 255, 0.1);
    border: 2px dashed var(--color-accent);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-sm);
}

.invite-code-display span {
    font-family: 'Orbitron', monospace;
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-accent);
    letter-spacing: 0.2em;
}

/* ============================================
   Member List Styles
   ============================================ */

.member-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.member-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

.member-email {
    color: var(--color-text-primary);
}

.member-role {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    background: rgba(0, 212, 255, 0.2);
    color: var(--color-accent);
}

.member-role.owner {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
}

/* ============================================
   Editable Timeline Row
   ============================================ */

.timeline-table tr.editable {
    cursor: pointer;
}

.timeline-table tr.editable:hover {
    background: rgba(0, 212, 255, 0.1);
}

.edit-icon {
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
    color: var(--color-accent);
}

.timeline-table tr:hover .edit-icon {
    opacity: 1;
}

/* Blink animation for message board */
@keyframes blink {

    0%,
    50%,
    100% {
        opacity: 1;
    }

    25%,
    75% {
        opacity: 0.3;
    }
}

/* ============================================
   Saved Race Plans Styles
   ============================================ */

.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.plan-card {
    padding: 1.25rem;
    background: linear-gradient(145deg, rgba(13, 18, 41, 0.8), rgba(26, 31, 60, 0.7));
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.plan-card:hover {
    border-color: var(--color-accent);
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 212, 255, 0.2);
}

.plan-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.75rem;
}

.plan-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 0.25rem;
}

.plan-card-author {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

.plan-compare-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin-right: 0.5rem;
    accent-color: var(--color-accent);
}

.plan-card-actions {

    display: flex;
    gap: 0.25rem;
}

.plan-card-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.plan-card-btn.danger:hover {
    background: var(--color-danger);
    color: #fff;
}

.plan-card-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.plan-stat {
    text-align: center;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
}

.plan-stat-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-bottom: 0.25rem;
}

.plan-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-accent);
}

.plan-card-desc {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--color-border);
    font-style: italic;
}

.plan-card-date {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 0.5rem;
}

.plan-card.is-set {
    border-color: var(--color-success);
    background: linear-gradient(145deg, rgba(0, 255, 136, 0.1), rgba(0, 255, 136, 0.05));
}

.plan-set-badge {
    position: absolute;
    top: -8px;
    right: 10px;
    background: var(--color-success);
    color: #000;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================
   Gradient Cards for Race Dashboard
   ============================================ */

.gradient-card {
    position: relative;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    text-align: center;
    color: white;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.gradient-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.gradient-card-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.gradient-card-value {
    font-size: 3rem;
    font-weight: bold;
    line-height: 1;
    margin-bottom: 0.5rem;
    font-family: 'Orbitron', monospace;
}

.gradient-card-sub {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* Gradient Colors */
.gradient-red {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF5252 100%);
}

.gradient-blue {
    background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
}

.gradient-green {
    background: linear-gradient(135deg, #00F5A0 0%, #00D9F5 100%);
}

.gradient-yellow {
    background: linear-gradient(135deg, #FFC837 0%, #FF8008 100%);
}

/* ============================================
   Responsive Design - Mobile & Tablet
   ============================================ */

/* Tablet (768px以下) */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.5rem;
    }

    .mode-switcher button {
        font-size: 0.85rem !important;
        padding: 0.4rem 0.8rem !important;
    }

    .gradient-card-value {
        font-size: 2rem !important;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    .race-timeline {
        font-size: 0.85rem;
    }

    .race-timeline th,
    .race-timeline td {
        padding: 0.5rem 0.3rem;
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Mobile (480px以下) */
@media (max-width: 480px) {

    /* Header Adjustments for Mobile */
    .header>div:first-child {
        /* タイトルと設定ボタンのコンテナ */
        display: flex !important;
        align-items: center !important;
        gap: 0.5rem;
    }

    .header h1 {
        font-size: 1.1rem !important;
        /* 少し小さく */
        line-height: 1.2;
    }

    .header button {
        /* 設定ボタン */
        font-size: 0.8rem !important;
        padding: 0.3rem 0.6rem !important;
        white-space: nowrap;
    }

    /* ユーザー情報の表示調整 */
    .user-display {
        font-size: 0.75rem !important;
        margin-right: 0.5rem !important;
        max-width: 140px;
        /* 幅制限 */
    }

    #userEmailDisplay {
        display: inline-block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        vertical-align: middle;
    }


    .mode-switcher {
        flex-direction: column;
        gap: 0.5rem !important;
    }

    .gradient-card {
        padding: 1rem;
    }

    .gradient-card-label {
        font-size: 0.8rem;
    }

    .gradient-card-value {
        font-size: 1.8rem !important;
    }

    .gradient-card-sub {
        font-size: 0.75rem;
    }

    .stopwatch-display {
        font-size: 2.5rem;
    }

    .btn {
        font-size: 0.9rem;
        padding: 0.6rem 1rem;
    }

    .card {
        padding: 1rem;
    }

    .race-timeline {
        font-size: 0.75rem;
    }

    .race-timeline th,
    .race-timeline td {
        padding: 0.4rem 0.2rem;
    }

    /* ホリゾンタルスクロール対応 */
    .race-timeline-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* タッチデバイス最適化 */
@media (hover: none) and (pointer: coarse) {

    .btn,
    button {
        min-height: 44px;
        min-width: 44px;
    }

    input,
    select,
    textarea {
        font-size: 16px;
        /* iOS zoom防止 */
    }
}