/* ============================================
   CageWork Labs - Athletic Assessment App
   ============================================ */

:root {
    --bg-dark: #0a0a0f;
    --bg-card: #141420;
    --bg-surface: #1a1a2e;
    --accent-primary: #00d4ff;
    --accent-secondary: #7c3aed;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --text-primary: #f0f0f5;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --shadow-glow: 0 0 30px rgba(0, 212, 255, 0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font);
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Screens */
.screen {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    overflow-y: auto;
    padding: 20px;
}

.screen.active {
    opacity: 1;
    pointer-events: all;
}

#screen-report {
    align-items: flex-start;
    padding: 40px 20px;
}

#screen-report.active {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Landing Screen */
.landing-container {
    text-align: center;
    max-width: 700px;
    width: 100%;
}

.logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -1px;
    margin-bottom: 20px;
}

.brand-title {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: -2px;
    margin-bottom: 4px;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: 32px;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.landing-description {
    margin-bottom: 40px;
}

.landing-description p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.landing-description p:first-child {
    font-size: 1.25rem;
    color: var(--text-primary);
    font-weight: 500;
}

.game-preview-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 40px;
}

.preview-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 24px 16px;
    transition: border-color 0.3s, transform 0.3s;
}

.preview-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.preview-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.preview-card h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.preview-card p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.time-note {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 16px 48px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    letter-spacing: 0.5px;
}

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

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 32px;
    background: transparent;
    color: var(--accent-primary);
    font-size: 1rem;
    font-weight: 600;
    border: 2px solid var(--accent-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: rgba(0, 212, 255, 0.1);
}

/* Forms */
.form-container {
    max-width: 500px;
    width: 100%;
}

.form-container h2 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.form-subtitle {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: var(--font);
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

/* Game Intro */
.game-intro-container {
    text-align: center;
    max-width: 600px;
    width: 100%;
}

.game-number {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-primary);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.game-intro-container h2 {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 16px;
}

.game-intro-desc {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.game-instructions {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: left;
    margin-bottom: 32px;
}

.game-instructions h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent-primary);
    margin-bottom: 12px;
}

.game-instructions ul {
    list-style: none;
    padding: 0;
}

.game-instructions li {
    padding: 8px 0;
    padding-left: 20px;
    position: relative;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.game-instructions li::before {
    content: '>';
    position: absolute;
    left: 0;
    color: var(--accent-primary);
    font-weight: 700;
}

/* Game HUD */
.game-hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(10px);
    z-index: 10;
    border-bottom: 1px solid var(--border-subtle);
}

.hud-label {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent-primary);
}

.hud-timer {
    font-size: 1.5rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.hud-score {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

#screen-game {
    padding: 0;
    flex-direction: column;
}

#game-canvas {
    width: 100%;
    flex: 1;
    display: block;
    margin-top: 60px;
}

/* Game Overlay */
.game-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 15, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    backdrop-filter: blur(5px);
}

.game-overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
    max-width: 400px;
    padding: 40px;
}

.overlay-content h2 {
    font-size: 2rem;
    margin-bottom: 12px;
}

.overlay-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Game Complete */
.game-complete-container {
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.complete-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-success), #059669);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin-bottom: 24px;
}

.game-complete-container h2 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 12px;
}

.game-complete-container > p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.complete-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 32px;
}

.stat-item {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 16px 12px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent-primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

/* Report */
.report-container {
    max-width: 800px;
    width: 100%;
    padding: 40px 0;
}

.report-header {
    text-align: center;
    margin-bottom: 48px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border-subtle);
}

.report-header h1 {
    font-size: 2.2rem;
    font-weight: 900;
    margin-bottom: 8px;
}

.report-header .report-meta {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.report-section {
    margin-bottom: 40px;
}

.report-section h3 {
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent-primary);
    margin-bottom: 20px;
}

/* Trait bars */
.trait-grid {
    display: grid;
    gap: 16px;
}

.trait-item {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 20px;
}

.trait-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.trait-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.trait-score {
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--accent-primary);
}

.trait-bar {
    height: 8px;
    background: var(--bg-surface);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.trait-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1s ease;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
}

.trait-description {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Radar chart area */
.radar-container {
    display: flex;
    justify-content: center;
    margin-bottom: 32px;
}

/* Growth trajectory */
.trajectory-section {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 32px;
    margin-bottom: 32px;
}

.trajectory-section h4 {
    font-weight: 700;
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.trajectory-items {
    display: grid;
    gap: 12px;
}

.trajectory-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-subtle);
}

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

.trajectory-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.trajectory-icon.strength {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-success);
}

.trajectory-icon.growth {
    background: rgba(0, 212, 255, 0.2);
    color: var(--accent-primary);
}

.trajectory-icon.watch {
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent-warning);
}

.trajectory-text h5 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.trajectory-text p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Coach notes */
.coach-notes {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 32px;
}

.coach-notes h4 {
    font-weight: 700;
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.coach-notes ul {
    list-style: none;
    padding: 0;
}

.coach-notes li {
    padding: 10px 0;
    padding-left: 24px;
    position: relative;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-subtle);
}

.coach-notes li:last-child {
    border-bottom: none;
}

.coach-notes li::before {
    content: '\2022';
    position: absolute;
    left: 0;
    color: var(--accent-primary);
    font-size: 1.5rem;
    line-height: 1;
    top: 8px;
}

.report-footer {
    text-align: center;
    padding-top: 32px;
    border-top: 1px solid var(--border-subtle);
    margin-top: 40px;
}

.report-footer p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    transition: border-color 0.3s;
}

.btn-download:hover {
    border-color: var(--accent-primary);
}

/* Responsive */
@media (max-width: 768px) {
    .brand-title {
        font-size: 2rem;
    }

    .game-preview-cards {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .complete-stats {
        grid-template-columns: 1fr;
    }

    .report-container {
        padding: 20px 0;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.animate-in {
    animation: fadeInUp 0.5s ease forwards;
}

/* Game-specific styles */
.game-feedback {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    font-weight: 900;
    pointer-events: none;
    z-index: 15;
    animation: feedbackPop 0.8s ease forwards;
}

@keyframes feedbackPop {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(0.5); }
    50% { transform: translate(-50%, -50%) scale(1.2); }
    100% { opacity: 0; transform: translate(-50%, -70%) scale(1); }
}

.feedback-great { color: var(--accent-success); }
.feedback-good { color: var(--accent-primary); }
.feedback-miss { color: var(--accent-danger); }


/* Progress bar */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    transition: width 0.5s ease;
    z-index: 100;
}

/* Loading/transition states */
.screen-transition {
    position: absolute;
    inset: 0;
    background: var(--bg-dark);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.screen-transition.active {
    opacity: 1;
    pointer-events: all;
}

/* Countdown overlay */
.countdown {
    font-size: 5rem;
    font-weight: 900;
    color: var(--accent-primary);
    animation: countdownPulse 1s ease infinite;
}

@keyframes countdownPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

/* Timer warning state */
.hud-timer.warning {
    color: var(--accent-warning);
    animation: pulse 0.5s ease infinite;
}

.hud-timer.danger {
    color: var(--accent-danger);
    animation: pulse 0.3s ease infinite;
}

/* Touch ripple */
.touch-ripple {
    position: absolute;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--accent-primary);
    opacity: 0;
    transform: scale(0);
    animation: ripple 0.6s ease forwards;
    pointer-events: none;
    z-index: 15;
}

@keyframes ripple {
    0% { transform: scale(0); opacity: 1; }
    100% { transform: scale(3); opacity: 0; }
}

/* Better mobile game controls */
@media (max-width: 768px) {
    .game-hud {
        padding: 10px 16px;
    }

    .hud-timer {
        font-size: 1.2rem;
    }

    .hud-label {
        font-size: 0.7rem;
    }

    #game-canvas {
        margin-top: 50px;
    }

    .game-intro-container h2 {
        font-size: 1.8rem;
    }

    .game-instructions {
        padding: 16px;
    }

    .game-instructions li {
        font-size: 0.85rem;
    }
}

/* Print styles for report */
@media print {
    body {
        background: white;
        color: #1a1a2e;
    }

    .screen {
        position: static;
        opacity: 1;
        pointer-events: all;
    }

    #screen-report {
        display: block;
    }

    .report-footer button {
        display: none;
    }

    .trait-bar {
        background: #eee;
    }

    .trait-bar-fill {
        background: #333 !important;
    }
}

/* Smooth scroll for report */
#screen-report {
    scroll-behavior: smooth;
}

/* Ensure canvas doesn't interfere with touch */
#game-canvas {
    touch-action: none;
}
