/* =============================================================
   Quiz 20: THE PERIPHERAL WATCH — Styles
   Night cockpit. Compass glow. Vessel lights on the dark horizon.
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

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

:root {
    --navy: #1e3a5f;
    --orange: #FF9800;
    --bg: #0a1628;
    --pw-sky-dark: #050510;
    --pw-sky-light: #0a0a20;
    --pw-horizon: #0d0d25;
    --pw-sea: #040410;
    --pw-instrument-bg: rgba(10, 30, 50, 0.85);
    --pw-heading-ok: #00cc66;
    --pw-heading-drift: #ffaa00;
    --pw-heading-miss: #ff4444;
    --pw-star: rgba(255, 255, 255, 0.5);
    --pw-target-glow: 0 0 12px;
    --nav-green: #22c55e;
    --nav-red: #ef4444;
    --nav-white: #e2e8f0;
    --flare-orange: #ff4400;
    --text: #e2e8f0;
    --text-secondary: rgba(255, 255, 255, 0.5);
}

html, body {
    touch-action: manipulation;
    overscroll-behavior: none;
}

body {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    overflow-x: hidden;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 1.5rem 1.2rem;
}

/* --- SCREENS --- */
.screen { display: none; animation: fadeIn 0.3s ease; }
.screen.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ===== LANDING PAGE ===== */

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

@keyframes ctaGlow {
    0%, 100% { box-shadow: 0 0 15px rgba(255,152,0,0.4); }
    50% { box-shadow: 0 0 30px rgba(255,152,0,0.6), 0 0 60px rgba(255,152,0,0.2); }
}

.landing-badge {
    display: block;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--orange);
    margin-bottom: 10px;
    animation: fadeSlideUp 0.5s ease both;
}

.landing-doi {
    display: block;
    text-align: center;
    font-size: 0.65rem;
    margin-bottom: 16px;
    animation: fadeSlideUp 0.5s ease 0.05s both;
}

.landing-doi a {
    color: rgba(255,255,255,0.35);
    text-decoration: none;
    font-family: 'JetBrains Mono', monospace;
}

.landing-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero-section {
    background: linear-gradient(180deg, rgba(5,5,16,0.9) 0%, rgba(10,10,32,0.95) 100%);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 2rem 1.5rem 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
    animation: fadeSlideUp 0.5s ease 0.1s both;
    position: relative;
    overflow: hidden;
}

.hero-section h1 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.1;
    margin-bottom: 0.6rem;
    text-shadow: 0 0 60px rgba(0,200,100,0.08), 0 2px 4px rgba(0,0,0,0.3);
}

.hero-section h2 {
    font-size: 1.05rem;
    font-weight: 500;
    color: rgba(255,255,255,0.6);
    margin-bottom: 1.5rem;
}

/* Compass preview animation */
.compass-preview {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 1rem;
}

.compass-preview-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'JetBrains Mono', monospace;
    font-size: 2rem;
    font-weight: 600;
    color: var(--pw-heading-ok);
    text-shadow: 0 0 20px rgba(0,204,102,0.3);
    z-index: 2;
}

.preview-light {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    opacity: 0;
}

@keyframes previewFade {
    0%, 100% { opacity: 0; }
    15%, 85% { opacity: 1; }
}

.preview-light-green {
    top: 50%;
    right: 0;
    background: var(--nav-green);
    box-shadow: 0 0 12px var(--nav-green);
    animation: previewFade 4s ease-in-out infinite;
}

.preview-light-red {
    top: 30%;
    left: 5%;
    background: var(--nav-red);
    box-shadow: 0 0 12px var(--nav-red);
    animation: previewFade 4s ease-in-out 1s infinite;
}

.preview-light-white {
    bottom: 10%;
    right: 20%;
    background: var(--nav-white);
    box-shadow: 0 0 12px rgba(226,232,240,0.6);
    animation: previewFade 4s ease-in-out 2s infinite;
}

.preview-light-green2 {
    top: 10%;
    right: 30%;
    background: var(--nav-green);
    box-shadow: 0 0 12px var(--nav-green);
    animation: previewFade 4s ease-in-out 3s infinite;
}

/* Feature pills */
.landing-features {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
    animation: fadeSlideUp 0.5s ease 0.5s both;
}
.feature-pill {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
    font-weight: 600;
}
.feature-pill-dot {
    color: rgba(255,255,255,0.25);
    font-size: 0.7rem;
}

/* CTA button */
.cta-button {
    display: block;
    width: 100%;
    max-width: 360px;
    margin: 1.5rem auto 1rem;
    padding: 1.1rem 2rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #0a1628;
    background: linear-gradient(135deg, var(--orange) 0%, #ff8f5e 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(255,152,0,0.35);
    -webkit-tap-highlight-color: transparent;
    animation: fadeSlideUp 0.5s ease 0.35s both, ctaGlow 3s ease-in-out 1.5s infinite;
    font-family: inherit;
}

.cta-button:hover {
    background: #ff8555;
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(255,152,0,0.45);
    animation: none;
}

.cta-button:active { transform: translateY(0); }

.sound-inline {
    cursor: pointer;
    vertical-align: middle;
    display: block;
    text-align: center;
    margin-top: 8px;
}

.sound-inline input[type="checkbox"] {
    accent-color: var(--orange);
    vertical-align: middle;
    margin-left: 2px;
}

/* ===== BRIEFING SCREEN ===== */
.briefing-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

.briefing-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #fff;
}

.briefing-instruction {
    font-size: 0.95rem;
    color: rgba(255,255,255,0.7);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.briefing-legend {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 1.5rem;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
}

.legend-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-dot-drift {
    background: var(--pw-heading-drift);
    box-shadow: 0 0 8px rgba(255,170,0,0.4);
}

.legend-dot-peripheral {
    background: var(--nav-green);
    box-shadow: 0 0 8px rgba(34,197,94,0.4);
}

.legend-info {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.legend-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
}

.legend-desc {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
}

.briefing-practice {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.4);
    margin-bottom: 1rem;
    font-style: italic;
}

.briefing-btn {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    padding: 1rem 2rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0a1628;
    background: linear-gradient(135deg, var(--orange) 0%, #ff8f5e 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    box-shadow: 0 4px 20px rgba(255,152,0,0.35);
}

.briefing-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(255,152,0,0.45);
}

/* ===== PHASE TRANSITION ===== */
.phase-transition-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

.phase-transition-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--orange);
    letter-spacing: 1px;
    margin-bottom: 1rem;
}

.phase-transition-instruction {
    font-size: 1rem;
    color: rgba(255,255,255,0.7);
    max-width: 400px;
    margin: 0 auto;
}

@keyframes timerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ===== GAME SCREEN ===== */
#game-page {
    position: relative;
}

#game-page.active {
    display: flex;
}

.game-area {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(180deg, var(--pw-sky-light) 0%, var(--pw-sky-dark) 40%, var(--pw-horizon) 60%, var(--pw-sea) 100%);
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
}

/* Starfield */
.starfield {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60%;
    pointer-events: none;
    z-index: 0;
}

.star {
    position: absolute;
    width: 1px;
    height: 1px;
    background: #fff;
    border-radius: 50%;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.7; }
}

/* Horizon line */
.horizon-line {
    position: absolute;
    top: 60%;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(30,58,95,0.3) 30%, rgba(30,58,95,0.5) 50%, rgba(30,58,95,0.3) 70%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

/* HUD */
.hud-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 16px;
    z-index: 10;
    pointer-events: none;
}

.hud-top > * {
    pointer-events: auto;
}

.hud-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hud-phase {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-secondary);
}

.hud-timer {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.4rem;
    font-weight: 600;
    color: rgba(255,255,255,0.8);
    transition: color 0.3s, text-shadow 0.3s;
}

/* Timer progress bar */
.timer-bar-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 12px;
    background: rgba(255,255,255,0.15);
    z-index: 10000;
}

.timer-bar-fill {
    height: 100%;
    width: 100%;
    background: #4ade80;
    transition: width 1s linear, background-color 0.5s ease;
    border-radius: 0 2px 2px 0;
}

.timer-bar-fill.timer-warning {
    background: #FF9800;
}

.timer-bar-fill.timer-danger {
    background: #ef4444;
    animation: timerBarPulse 1s ease-in-out infinite;
}

.timer-bar-fill.timer-critical {
    background: #ef4444;
    animation: timerBarPulse 0.5s ease-in-out infinite;
    height: 14px;
}

@keyframes timerBarPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.hud-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    z-index: 10;
    pointer-events: none;
}

.hud-stat {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Recording indicator */
.recording-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
}

.recording-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ff3b3b;
    animation: recordPulse 1.5s ease-in-out infinite;
}

@keyframes recordPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.recording-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.55rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: rgba(255,60,60,0.6);
}

/* ===== CENTRAL INSTRUMENT PANEL ===== */
.instrument-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40%;
    max-width: 320px;
    min-width: 220px;
    background: var(--pw-instrument-bg);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 20px 16px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 5;
    box-shadow: 0 0 30px rgba(0,200,100,0.08);
}

/* Compass bezel */
.compass-bezel {
    width: 100%;
    height: 60px;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(0,204,102,0.15);
    margin-bottom: 8px;
}

.compass-ribbon {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 200%;
    display: flex;
    align-items: center;
    transition: transform 0.5s ease-out;
}

.compass-tick-container {
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
}

.compass-target-marker {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    background: var(--orange);
    opacity: 0.8;
    z-index: 2;
}

.compass-target-marker::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid var(--orange);
}

/* Digital heading readout */
.heading-readout {
    font-family: 'JetBrains Mono', monospace;
    font-size: 48px;
    font-weight: 600;
    color: var(--pw-heading-ok);
    text-shadow: 0 0 20px rgba(0,204,102,0.3);
    margin: 8px 0;
    transition: color 0.3s ease, text-shadow 0.3s ease;
    text-align: center;
    line-height: 1;
}

.heading-readout.drifting {
    color: var(--pw-heading-drift);
    text-shadow: 0 0 20px rgba(255,170,0,0.4);
}

.heading-readout.missed {
    color: var(--pw-heading-miss);
    text-shadow: 0 0 20px rgba(255,68,68,0.4);
}

/* Drift feedback text */
.drift-feedback {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 600;
    text-align: center;
    min-height: 20px;
    margin-bottom: 8px;
    color: var(--pw-heading-ok);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.drift-feedback.visible {
    opacity: 1;
}

.drift-feedback.warning {
    color: var(--pw-heading-drift);
}

.drift-feedback.error {
    color: var(--pw-heading-miss);
}

/* Heading adjustment controls */
.heading-controls {
    display: flex;
    gap: 6px;
    justify-content: center;
    position: relative;
    z-index: 6;
}

.steer-btn {
    font-family: 'Manrope', sans-serif;
    font-weight: 700;
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s ease, transform 0.08s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    background: rgba(255,255,255,0.06);
}

.steer-btn-large {
    width: 64px;
    height: 48px;
    font-size: 0.8rem;
}

.steer-btn-small {
    width: 52px;
    height: 48px;
    font-size: 0.8rem;
}

.steer-btn:active {
    transform: scale(0.92);
    background: rgba(255,255,255,0.12);
}

.heading-controls.pulse .steer-btn {
    border-color: var(--orange);
    box-shadow: 0 0 12px rgba(255,152,0,0.3);
    animation: steerPulse 1s ease-in-out infinite;
}

@keyframes steerPulse {
    0%, 100% { box-shadow: 0 0 8px rgba(255,152,0,0.2); }
    50% { box-shadow: 0 0 16px rgba(255,152,0,0.5); }
}

.heading-controls.corrected .steer-btn {
    border-color: var(--pw-heading-ok);
    background: rgba(0,204,102,0.15);
}

.heading-controls.missed-flash .steer-btn {
    border-color: var(--pw-heading-miss);
    background: rgba(255,68,68,0.15);
}

/* Instrument readouts (decorative) */
.instrument-readouts {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.readout {
    text-align: center;
    flex: 1;
}

.readout-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.55rem;
    font-weight: 600;
    color: rgba(255,255,255,0.3);
    letter-spacing: 1px;
    margin-bottom: 2px;
}

.readout-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--pw-heading-ok);
    opacity: 0.6;
}

/* ===== PERIPHERAL TARGETS ===== */
.peripheral-zone {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
}

.peripheral-target {
    position: absolute;
    border-radius: 50%;
    pointer-events: auto;
    cursor: pointer;
    touch-action: manipulation;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 4;
    -webkit-tap-highlight-color: transparent;
}

.peripheral-target.visible {
    opacity: 1;
}

.peripheral-target.fading {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.peripheral-target.detected {
    animation: targetBurst 0.3s ease-out forwards;
}

@keyframes targetBurst {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(2); opacity: 0.5; }
    100% { transform: scale(3); opacity: 0; }
}

/* Target type styles */
.target-green-nav {
    background: var(--nav-green);
    box-shadow: 0 0 12px var(--nav-green), 0 0 24px rgba(34,197,94,0.3);
}

.target-red-nav {
    background: var(--nav-red);
    box-shadow: 0 0 12px var(--nav-red), 0 0 24px rgba(239,68,68,0.3);
}

.target-white-stern {
    background: var(--nav-white);
    box-shadow: 0 0 12px rgba(226,232,240,0.6), 0 0 24px rgba(226,232,240,0.2);
}

.target-silhouette {
    background: #2a2a3a;
    border-radius: 4px;
    box-shadow: none;
}

.target-flare {
    background: var(--flare-orange);
    box-shadow: 0 0 16px var(--flare-orange), 0 0 32px rgba(255,68,0,0.4);
    animation: flareFlicker 0.3s ease-in-out infinite alternate;
}

@keyframes flareFlicker {
    0% { opacity: 0.8; }
    100% { opacity: 1; }
}

/* Particle burst on detection */
.target-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    pointer-events: none;
    animation: particleFly 0.5s ease-out forwards;
    z-index: 5;
}

@keyframes particleFly {
    0% { opacity: 1; transform: translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translate(var(--px), var(--py)) scale(0); }
}

/* Peripheral miss message */
.peripheral-miss-message {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 400px;
    padding: 8px 16px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-left: 3px solid var(--nav-red);
    background: rgba(0,0,0,0.6);
    border-radius: 0 8px 8px 0;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
    pointer-events: none;
    text-align: left;
}

.peripheral-miss-message.visible {
    opacity: 1;
}

/* Edge flash on miss */
.edge-flash {
    position: absolute;
    pointer-events: none;
    z-index: 3;
    opacity: 0;
}

.edge-flash.active {
    animation: edgeFlash 0.8s ease-out forwards;
}

@keyframes edgeFlash {
    0% { opacity: 0.8; }
    100% { opacity: 0; }
}

.edge-flash-top {
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(180deg, rgba(239,68,68,0.4) 0%, transparent 100%);
}

.edge-flash-bottom {
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(0deg, rgba(239,68,68,0.4) 0%, transparent 100%);
}

.edge-flash-left {
    top: 0;
    bottom: 0;
    left: 0;
    width: 40px;
    background: linear-gradient(90deg, rgba(239,68,68,0.4) 0%, transparent 100%);
}

.edge-flash-right {
    top: 0;
    bottom: 0;
    right: 0;
    width: 40px;
    background: linear-gradient(270deg, rgba(239,68,68,0.4) 0%, transparent 100%);
}

/* Vessel missed text overlay */
.vessel-missed-text {
    position: absolute;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--pw-heading-miss);
    letter-spacing: 2px;
    opacity: 0;
    pointer-events: none;
    z-index: 6;
    text-shadow: 0 0 8px rgba(255,68,68,0.5);
    animation: vesselMissedFade 1.2s ease-out forwards;
}

@keyframes vesselMissedFade {
    0% { opacity: 1; transform: translateY(0); }
    70% { opacity: 0.8; }
    100% { opacity: 0; transform: translateY(-10px); }
}

/* ===== RESULTS PAGE ===== */
.results-container {
    padding-top: 2rem;
    padding-bottom: 3rem;
}

.score-display {
    text-align: center;
    margin-bottom: 2rem;
}

.score-number {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1;
    display: inline;
}

.score-label {
    font-size: 1.5rem;
    font-weight: 600;
    color: rgba(255,255,255,0.4);
    display: inline;
}

.score-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: 8px;
}

.score-message {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.7);
    margin-top: 8px;
    line-height: 1.6;
}

.score-green { color: var(--pw-heading-ok); }
.score-orange { color: var(--pw-heading-drift); }
.score-red { color: var(--pw-heading-miss); }

/* Dual-task cost highlight */
.dual-task-highlight {
    background: rgba(255,152,0,0.08);
    border: 1px solid rgba(255,152,0,0.2);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 2rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: rgba(255,255,255,0.85);
}

.dual-task-highlight strong {
    color: var(--orange);
}

/* Phase breakdown bars */
.chart-section {
    margin-bottom: 2rem;
}

.chart-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 16px;
    text-align: center;
}

.phase-bars {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.phase-bar-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.phase-bar-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
}

.phase-bar-track {
    height: 24px;
    background: rgba(255,255,255,0.06);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    position: relative;
}

.phase-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.8s ease-out;
    display: flex;
    align-items: center;
    padding: 0 8px;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: rgba(0,0,0,0.7);
    min-width: 40px;
}

.phase-bar-central { background: var(--pw-heading-ok); }
.phase-bar-peripheral { background: #3b82f6; }

.phase-bar-values {
    display: flex;
    gap: 16px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.phase-bar-values span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.phase-bar-values .dot-central {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--pw-heading-ok);
    display: inline-block;
}

.phase-bar-values .dot-peripheral {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3b82f6;
    display: inline-block;
}

/* Heatmap */
.heatmap-section {
    margin-bottom: 2rem;
    text-align: center;
}

.heatmap-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 12px;
}

#heatmap-canvas {
    max-width: 300px;
    width: 100%;
    height: auto;
    margin: 0 auto;
    display: block;
}

.heatmap-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* RT section */
.rt-section {
    background: rgba(255,255,255,0.04);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 2rem;
    text-align: center;
}

.rt-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--orange);
    margin-bottom: 4px;
}

.rt-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.rt-context {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.6);
    font-style: italic;
}

/* Explanation */
.explanation {
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 2rem;
    line-height: 1.7;
}

.explanation h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.explanation p {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.7);
    margin-bottom: 12px;
}

.insight-text {
    font-style: italic;
    border-left: 3px solid var(--orange);
    padding-left: 12px;
}

.study-link {
    color: var(--orange);
    text-decoration: none;
    font-weight: 600;
}

/* Social sharing */
.social-sharing {
    text-align: center;
    margin-bottom: 2rem;
}

.social-sharing h3 {
    font-size: 1rem;
    margin-bottom: 12px;
}

.share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.share-btn {
    padding: 10px 20px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s, border-color 0.2s;
}

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

/* Email gate, skip link, play again — reuse shared styles */
.skip-link {
    display: block;
    text-align: center;
    color: rgba(255,255,255,0.4);
    font-size: 0.85rem;
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    margin: 8px auto;
    padding: 8px;
}

.play-again-btn {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 2rem auto 0;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--orange);
    background: transparent;
    border: 2px solid var(--orange);
    border-radius: 50px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s, color 0.2s;
}

.play-again-btn:hover {
    background: var(--orange);
    color: #0a1628;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
    .instrument-panel {
        width: 55%;
        min-width: 200px;
        padding: 16px 12px 12px;
    }

    .heading-readout {
        font-size: 36px;
    }

    .steer-btn-large {
        width: 56px;
        height: 44px;
        font-size: 0.75rem;
    }
    .steer-btn-small {
        width: 46px;
        height: 44px;
        font-size: 0.75rem;
    }

    .compass-bezel {
        height: 50px;
    }

    .hero-section h1 {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .instrument-panel {
        width: 65%;
        min-width: 180px;
        padding: 12px 10px 10px;
    }

    .heading-readout {
        font-size: 30px;
    }

    .steer-btn-large {
        width: 50px;
        height: 40px;
        font-size: 0.7rem;
    }
    .steer-btn-small {
        width: 42px;
        height: 40px;
        font-size: 0.7rem;
    }
    .heading-controls {
        gap: 4px;
    }

    .compass-bezel {
        height: 40px;
    }

    .instrument-readouts {
        display: none;
    }

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

    .hero-section h1 {
        font-size: 1.5rem;
    }

    .container {
        padding: 1rem 0.8rem;
    }
}


/* Rotating compass needle — bold and visible */
.compass-needle {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    margin-left: -2px;
    transform-origin: 50% 50%;
    transition: transform 0.5s ease-out;
    z-index: 3;
    pointer-events: none;
}

.needle-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #00cc66;
    border-radius: 2px;
    box-shadow: 0 0 12px rgba(0,204,102,0.7), 0 0 24px rgba(0,204,102,0.3);
}

.needle-tip {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 10px solid #00cc66;
    filter: drop-shadow(0 0 6px rgba(0,204,102,0.8));
}
