/* Custom Properties for Premium Dark/Cyberpunk Theme */
:root {
    --bg-main: #090c12;
    --bg-sidebar: #0f131a;
    --bg-card: rgba(22, 28, 38, 0.75);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(0, 240, 255, 0.15);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    --accent-cyan: #00f0ff;
    --accent-purple: #a855f7;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-yellow: #f59e0b;

    --shadow-glow: 0 0 20px rgba(0, 240, 255, 0.15);
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Outfit', sans-serif;
}

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

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

/* App Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar Styling */
.sidebar {
    width: 320px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.logo-icon {
    font-size: 2rem;
    filter: drop-shadow(0 0 8px var(--accent-cyan));
}

.brand-text h1 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-primary);
}

.brand-text small {
    font-size: 0.75rem;
    color: var(--accent-cyan);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Navigation */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.95rem;
    text-align: left;
    transition: all 0.2s ease;
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    color: var(--accent-cyan);
    background: rgba(0, 240, 255, 0.06);
    border-color: rgba(0, 240, 255, 0.2);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.05);
}

.nav-item .icon {
    font-size: 1.1rem;
}

/* Settings Panel in Sidebar */
.settings-panel {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.settings-panel h3 {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    margin-bottom: 12px;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.input-group input[type="number"] {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.input-group input[type="number"]:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.2);
}

.checkbox-group {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    cursor: pointer;
}

.checkbox-group label {
    cursor: pointer;
    user-select: none;
}

.scientific-note {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.scientific-note strong {
    color: var(--accent-purple);
}

.sidebar-footer {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    height: 100vh;
    padding: 24px;
    position: relative;
    overflow-y: auto;
}

/* Screen Switcher */
.screen-view {
    display: none;
    height: 100%;
    flex-direction: column;
    gap: 20px;
}

.screen-view.active {
    display: flex;
}

/* Top bar details */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.session-info {
    display: flex;
    gap: 8px;
}

.badge {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge.active {
    color: var(--accent-green);
    border-color: rgba(16, 185, 129, 0.2);
    background: rgba(16, 185, 129, 0.05);
}

.game-timer {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.game-timer .label {
    color: var(--text-secondary);
}

.game-timer .value {
    color: var(--accent-cyan);
    font-weight: 700;
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

/* Calibration progress bar */
.calibration-progress-container {
    background: rgba(168, 85, 247, 0.05);
    border: 1px solid rgba(168, 85, 247, 0.2);
    border-radius: 8px;
    padding: 12px 16px;
    animation: slideIn 0.3s ease;
}

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

.calibration-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.calibration-header strong {
    color: var(--accent-purple);
}

.progress-bar-bg {
    background: rgba(255, 255, 255, 0.05);
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.progress-bar-fill {
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
}

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

/* Game Canvas Container */
.canvas-container {
    position: relative;
    flex-grow: 1;
    background: rgba(12, 17, 27, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

#aim-canvas {
    display: block;
    cursor: none; /* Hide default cursor during play */
    width: 100%;
    height: 100%;
}

.canvas-overlay {
    position: absolute;
    inset: 0;
    background: rgba(9, 12, 18, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.overlay-content {
    max-width: 500px;
    padding: 32px;
}

.overlay-content h2 {
    font-family: var(--font-heading);
    font-size: 2rem;
    margin-bottom: 12px;
    color: var(--accent-cyan);
    text-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
}

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

/* Buttons */
.btn {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--accent-cyan);
    color: #000;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
}

.btn-primary:hover {
    background: #00d2df;
    box-shadow: 0 0 25px rgba(0, 240, 255, 0.5);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: var(--border-color);
}

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

/* Metrics Dashboard Cards */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 10px;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    backdrop-filter: blur(12px);
    transition: border-color 0.3s ease;
}

.metric-card:hover {
    border-color: var(--border-glow);
}

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

.metric-header .label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-header .icon {
    font-size: 1.1rem;
}

.metric-value {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.metric-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Calibration Results Layout */
.results-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    height: 100%;
}

.results-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    backdrop-filter: blur(12px);
}

.premium-card {
    border-color: rgba(168, 85, 247, 0.25);
    box-shadow: 0 0 25px rgba(168, 85, 247, 0.05);
}

.premium-card h2 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    margin-bottom: 4px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

/* Custom Chart */
.comparison-charts-container {
    margin-bottom: 28px;
}

.comparison-charts-container h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.chart-box {
    display: flex;
    gap: 16px;
    height: 200px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.custom-chart-y-axis {
    display: flex;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    writing-mode: vertical-rl;
    transform: rotate(180deg);
}

.chart-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.custom-chart {
    flex-grow: 1;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 4px;
}

.chart-bar-container {
    flex-grow: 1;
    max-width: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    position: relative;
}

.chart-bar-value {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-secondary);
}

.chart-bar {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px 4px 0 0;
    transition: height 0.6s cubic-bezier(0.16, 1, 0.3, 1), background 0.3s ease;
    height: 0%; /* Dynamic */
}

.chart-bar.current {
    background: rgba(0, 240, 255, 0.3);
    border: 1px solid var(--accent-cyan);
}

.chart-bar.optimal {
    background: rgba(16, 185, 129, 0.3);
    border: 1px solid var(--accent-green);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.1);
}

.custom-chart-x-axis {
    display: flex;
    justify-content: space-around;
    padding-top: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* AI Recommendation Box */
.recommendation-box {
    background: rgba(0, 240, 255, 0.03);
    border: 1px solid rgba(0, 240, 255, 0.15);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.02);
}

.rec-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.rec-icon {
    font-size: 1.75rem;
    background: rgba(0, 240, 255, 0.1);
    border-radius: 8px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rec-header h4 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    color: var(--text-primary);
}

.rec-header p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.rec-values {
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 16px;
    background: rgba(0, 0, 0, 0.2);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.02);
    margin-bottom: 16px;
}

.rec-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.rec-item .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.rec-item .value {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
}

.rec-item.highlight .value {
    color: var(--accent-green);
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.arrow {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.rec-explanation {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 20px;
    border-left: 2px solid var(--accent-cyan);
    padding-left: 12px;
}

.rec-actions {
    display: flex;
    gap: 12px;
}

.rec-actions .btn {
    flex: 1;
}

/* Science Insights Cards */
.science-card h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.science-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.science-item h5 {
    font-family: var(--font-heading);
    color: var(--accent-purple);
    font-size: 0.9rem;
    margin-bottom: 6px;
}

.science-item p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

/* Mini Stats Sidebar Card */
.mini-stats-card h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.mini-stats-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mini-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 1px dotted rgba(255, 255, 255, 0.05);
}

.mini-stat-row:last-child {
    border-bottom: none;
}

.mini-stat-row .stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.mini-stat-row .stat-val {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 600;
}

.mini-stat-row .stat-val.better {
    color: var(--accent-green);
}

/* History Screen */
.history-card h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.history-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.history-table-container {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.history-table th, .history-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.history-table th {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.history-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.01);
}

.history-table tr:last-child td {
    border-bottom: none;
}

.actions-row {
    display: flex;
    justify-content: flex-end;
}
