/* Quiz L2-5: Passage Decisions — Things Are Going Wrong */

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

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

:root { --navy: #1e3a5f; --orange: #FF9800; --text: #ffffff; }

body {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: linear-gradient(135deg, #0a1628 0%, #162a4a 100%);
    color: #ffffff;
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

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

/* Screen Management */
.screen { display: none; animation: fadeIn 0.3s ease-in; }
.screen.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

/* Level 2 indicator */
.level-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 12px;
    animation: fadeSlideUp 0.5s ease 0.05s both;
}
.level-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: rgba(255,152,0,0.15);
    border: 1px solid rgba(255,152,0,0.3);
}
.level-dot.filled {
    background: #FF9800;
    border-color: #FF9800;
    box-shadow: 0 0 6px rgba(255,152,0,0.4);
}
.level-line {
    width: 20px; height: 2px;
    background: rgba(255,152,0,0.2);
}

.landing-title {
    text-align: center;
    font-size: 2.6rem;
    font-weight: 800;
    color: #FF9800;
    margin-bottom: 0.3rem;
    letter-spacing: -1px;
    line-height: 1.1;
    text-shadow: 0 0 30px rgba(255,152,0,0.2), 0 0 80px rgba(255,152,0,0.05);
    opacity: 0;
    animation: fadeSlideUp 0.6s ease 0.1s forwards;
}

.landing-subtitle {
    text-align: center;
    font-size: 1.15rem;
    font-weight: 400;
    color: rgba(255,255,255,0.65);
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: fadeSlideUp 0.6s ease 0.25s forwards;
}

/* ===== Passage Hero Panel ===== */

.passage-hero {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto 1.5rem;
    opacity: 0;
    animation: fadeSlideUp 0.6s ease 0.4s forwards;
}

.hero-panel {
    background: rgba(10,22,40,0.8);
    border: 1px solid rgba(255,152,0,0.15);
    border-radius: 12px;
    padding: 1.2rem 1rem;
    position: relative;
    overflow: hidden;
}

.hero-panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.04) 2px, rgba(0,0,0,0.04) 4px);
    pointer-events: none;
}

.hero-instruments {
    display: flex;
    justify-content: space-around;
    margin-bottom: 0.8rem;
}

.hero-gauge {
    text-align: center;
    position: relative;
}
.gauge-label {
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.3);
    margin-bottom: 2px;
}
.gauge-value {
    font-size: 1.6rem;
    font-weight: 800;
    font-family: 'Courier New', monospace;
    line-height: 1;
}
.gauge-unit {
    font-size: 0.6rem;
    color: rgba(255,255,255,0.35);
    margin-top: 2px;
}
.gauge-wind .gauge-value { color: #FF9800; }
.gauge-swell .gauge-value { color: rgba(100,180,255,0.8); }
.gauge-hrs .gauge-value { color: #ff4444; }

.gauge-trend {
    position: absolute;
    top: 0; right: -8px;
    width: 0; height: 0;
}
.gauge-trend.rising {
    border-left: 3px solid transparent;
    border-right: 3px solid transparent;
    border-bottom: 5px solid #FF9800;
}
.gauge-trend.danger {
    border-left: 3px solid transparent;
    border-right: 3px solid transparent;
    border-bottom: 5px solid #ff4444;
}

.hero-awake-counter {
    animation: awakeCount 4s ease 1.5s forwards;
}

@keyframes awakeCount {
    0% { content: '0'; }
    100% { content: '20'; }
}

.hero-alert {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #ff4444;
    animation: alertFlash 2s ease-in-out infinite;
}

.hero-alert-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #ff4444;
    box-shadow: 0 0 6px #ff4444;
    animation: dotPulse 1.5s ease-in-out infinite;
}

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

@keyframes dotPulse {
    0%, 100% { box-shadow: 0 0 4px #ff4444; }
    50% { box-shadow: 0 0 14px #ff4444, 0 0 28px rgba(255,68,68,0.3); }
}

/* Scenario text */
.scenario-text {
    text-align: center;
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: fadeSlideUp 0.6s ease 0.6s forwards;
}
.scenario-text p {
    font-size: 0.95rem;
    color: rgba(255,255,255,0.45);
    margin-bottom: 0.3rem;
}
.scenario-highlight {
    font-size: 1.05rem;
    font-weight: 600;
    color: #FF9800;
}

/* CTA */
@keyframes ctaGlow {
    0%, 100% { box-shadow: 0 4px 20px rgba(255,107,53,0.35); }
    50% { box-shadow: 0 6px 28px rgba(255,107,53,0.5); }
}

.cta-button {
    display: block;
    width: 100%;
    max-width: 400px;
    margin: 0 auto 0.5rem;
    padding: 1.2rem 2rem;
    font-size: 1.2rem;
    font-weight: 700;
    font-family: inherit;
    color: #0a1f44;
    background: linear-gradient(135deg, #FF9800 0%, #ff8f5e 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 20px rgba(255,107,53,0.35);
    animation: fadeSlideUp 0.5s ease 0.8s forwards, ctaGlow 3s ease-in-out 1.3s infinite;
    opacity: 0;
}
.cta-button:hover { background: #ff8555; transform: translateY(-2px); }
.cta-button:active { transform: translateY(0); }
.cta-icon { font-size: 0.8rem; margin-right: 0.2rem; vertical-align: middle; }

.landing-features {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 0.8rem;
    opacity: 0;
    animation: fadeSlideUp 0.5s ease 1s forwards;
}
.feature-pill {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255,255,255,0.4);
    padding: 0.2rem 0.6rem;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
}
.feature-pill-dot { color: rgba(255,255,255,0.15); font-size: 0.7rem; }

/* Level cross-link */
.level-link {
    text-align: center;
    margin-bottom: 1rem;
    opacity: 0;
    animation: fadeSlideUp 0.5s ease 0.7s forwards;
}
.level-link p {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.35);
}
.level-link a {
    color: rgba(255,255,255,0.55);
    text-decoration: underline;
    transition: color 0.2s;
}
.level-link a:hover { color: #FF9800; }

/* ===== GAME SCREEN ===== */

#game {
    background: linear-gradient(135deg, #0a1628 0%, #162a4a 100%);
    min-height: 100vh;
}

.game-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: rgba(10,22,40,0.95);
    border-bottom: 1px solid rgba(255,152,0,0.1);
}
.hud-left, .hud-right { text-align: center; min-width: 60px; }
.hud-label {
    display: block;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255,152,0,0.35);
}
.hud-value {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: #FF9800;
}
.hud-center { flex: 1; text-align: center; }

.hud-timer {
    font-family: 'Courier New', monospace;
    font-size: 1.5rem;
    color: #FF9800;
    transition: color 0.3s;
}
.hud-timer.warning { color: #ff6b35; }
.hud-timer.urgent { color: #ff4444; animation: timerPulse 0.5s ease infinite; }
@keyframes timerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Timer bar */
.timer-bar {
    width: 100%;
    height: 3px;
    background: rgba(255,152,0,0.08);
}
.timer-bar-fill {
    height: 100%;
    background: #FF9800;
    transition: width 0.1s linear;
}
.timer-bar-fill.warning { background: #ff6b35; }
.timer-bar-fill.urgent { background: #ff4444; }

/* Scenario container */
.scenario-container {
    padding: 16px;
    max-width: 600px;
    margin: 0 auto;
}

.situation-header {
    text-align: center;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255,152,0,0.4);
    margin-bottom: 8px;
}

.briefing {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    margin-bottom: 12px;
    min-height: 2.4em;
    line-height: 1.4;
}

.instruction {
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: #FF9800;
    margin-top: 12px;
    letter-spacing: 0.5px;
}

/* ===== SITUATION DISPLAY ===== */

.situation-display {
    position: relative;
    width: 100%;
    max-width: 500px;
    aspect-ratio: 100 / 60;
    margin: 0 auto;
    border-radius: 8px;
    overflow: hidden;
    background: #0a1628;
    border: 2px solid rgba(255,152,0,0.15);
    box-shadow: 0 0 30px rgba(0,0,0,0.5), 0 0 60px rgba(255,152,0,0.03);
}

.situation-svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* Boat pulse animation */
.boat-pulse {
    animation: boatPulse 2s ease-in-out infinite;
}
@keyframes boatPulse {
    0%, 100% { r: 1.5; opacity: 1; }
    50% { r: 2.2; opacity: 0.7; }
}

/* Alarm flash animation */
.alarm-flash {
    animation: alarmBlink 1s ease-in-out infinite;
}
@keyframes alarmBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Instrument strip (for mid-scenario context) */
.instrument-strip {
    display: flex;
    justify-content: space-around;
    background: rgba(10,22,40,0.8);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 6px;
    padding: 8px;
    margin-top: 8px;
}

/* ===== CHOICES PANEL ===== */

.choices-panel {
    margin-top: 16px;
}

.choices-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    max-width: 500px;
    margin: 0 auto;
}

.choice-btn {
    padding: 14px 16px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: #ddd;
    background: rgba(255,152,0,0.06);
    border: 1px solid rgba(255,152,0,0.15);
    border-radius: 10px;
    cursor: pointer;
    min-height: 48px;
    text-align: left;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.choice-btn:active {
    background: rgba(255,152,0,0.15);
    border-color: rgba(255,152,0,0.4);
}
.choice-btn.correct {
    background: rgba(76,175,80,0.25);
    border-color: #4caf50;
    color: #4caf50;
}
.choice-btn.wrong {
    background: rgba(255,68,68,0.2);
    border-color: #ff4444;
    color: #ff4444;
}
.choice-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== FEEDBACK BANNER ===== */

.feedback-banner {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    padding: 14px 18px;
    z-index: 100;
    animation: slideUp 0.3s ease;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-height: 40vh;
    overflow-y: auto;
}
.feedback-banner.correct {
    background: rgba(10,40,20,0.96);
    border-top: 2px solid #4caf50;
}
.feedback-banner.wrong {
    background: rgba(40,10,10,0.96);
    border-top: 2px solid #ff4444;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.feedback-icon {
    font-size: 1.3rem;
    font-weight: 800;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
    margin-top: 2px;
}
.feedback-icon.correct { color: #4caf50; }
.feedback-icon.wrong { color: #ff4444; }

.feedback-content { flex: 1; }

.feedback-text {
    font-size: 0.85rem;
    line-height: 1.4;
    color: rgba(255,255,255,0.85);
    margin-bottom: 4px;
}

.feedback-detail {
    font-size: 0.75rem;
    line-height: 1.4;
    color: rgba(255,255,255,0.45);
    font-style: italic;
}

/* ===== RESULTS PAGE ===== */

#results h1 {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 1.5rem;
    color: #fff;
}

.score-display {
    background: rgba(255,255,255,0.06);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.rank-title {
    font-size: 1.5rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
}

.score-number {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    color: #fff;
}
.score-number span { font-size: 2.2rem; }
.score-of { font-size: 1.2rem; color: rgba(255,255,255,0.4); font-weight: 400; }

.score-breakdown {
    display: flex;
    justify-content: center;
    gap: 1.2rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.stat-correct { color: #4caf50; }
.stat-wrong { color: #ff6b35; }
.stat-missed { color: #ff4444; }

.score-bar {
    width: 100%;
    height: 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    overflow: hidden;
}
.score-bar-fill {
    height: 100%;
    background: #FF9800;
    transition: width 0.6s ease;
    border-radius: 10px;
}

/* Rank colors */
.score-display.rank-green .rank-title { color: #ff4444; }
.score-display.rank-green .score-bar-fill { background: #ff4444; }
.score-display.rank-crew .rank-title { color: #ff6b35; }
.score-display.rank-crew .score-bar-fill { background: #ff6b35; }
.score-display.rank-mate .rank-title { color: #FF9800; }
.score-display.rank-mate .score-bar-fill { background: #FF9800; }
.score-display.rank-skipper .rank-title { color: #4caf50; }
.score-display.rank-skipper .score-bar-fill { background: #4caf50; }
.score-display.rank-ocean .rank-title { color: #ffd700; }
.score-display.rank-ocean .score-bar-fill { background: #ffd700; }

.score-message {
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    font-size: 1.1rem;
    line-height: 1.7;
    color: #ccc;
}

/* Forum attribution */
.forum-attribution {
    background: rgba(255,152,0,0.06);
    border-radius: 8px;
    padding: 1rem 1.2rem;
    margin-bottom: 1.5rem;
}
.forum-attribution p {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.4);
    font-style: italic;
    line-height: 1.5;
}

/* Callout */
.passage-callout {
    background: rgba(255,152,0,0.08);
    border-left: 4px solid #FF9800;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}
.passage-callout p { margin-bottom: 0.5rem; color: #ccc; }
.passage-callout p:last-child { margin-bottom: 0; }
.passage-callout strong { color: #FF9800; }

/* Explanation */
.explanation {
    background: rgba(255,255,255,0.04);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}
.explanation h2 {
    font-size: 1.2rem;
    color: #FF9800;
    margin-bottom: 0.8rem;
}
.explanation p {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.6);
    margin-bottom: 0.8rem;
    line-height: 1.6;
}
.insight-link {
    color: #FF9800;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.9rem;
}
.insight-link:hover { text-decoration: underline; }

/* Email gate */
.email-gate {
    background: rgba(255,255,255,0.06);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    text-align: center;
}
.email-gate h3 { color: #fff; margin-bottom: 0.3rem; font-size: 1.2rem; }
.gate-subtext { color: rgba(255,255,255,0.5); font-size: 0.85rem; margin-bottom: 1rem; }
.email-gate input[type="email"] {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    color: #fff;
    font-size: 1rem;
    font-family: inherit;
    margin-bottom: 8px;
}
.email-gate input[type="email"]::placeholder { color: rgba(255,255,255,0.3); }
.subscribe-button {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #FF9800, #ff8f5e);
    color: #0a1628;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    margin-top: 4px;
}
.gdpr-consent { display: flex; align-items: flex-start; gap: 8px; font-size: 0.75rem; color: rgba(255,255,255,0.4); margin: 8px 0; text-align: left; }
.gdpr-consent a { color: rgba(255,255,255,0.5); }
.reassurance-text { font-size: 0.75rem; color: rgba(255,255,255,0.3); margin-top: 8px; }
.reassurance-text a { color: rgba(255,255,255,0.4); }
.form-message { font-size: 0.85rem; margin-top: 8px; }
.form-message.success { color: #4caf50; }
.form-message.error { color: #ff4444; }

/* Skip link */
.skip-link { text-align: center; margin: 1rem 0; }
.skip-link a { color: rgba(255,255,255,0.3); font-size: 0.85rem; text-decoration: none; }
.skip-link a:hover { color: rgba(255,255,255,0.6); }

/* Social sharing */
.social-sharing {
    margin-bottom: 2rem;
    text-align: center;
}
.social-sharing h3 { color: #fff; margin-bottom: 0.8rem; font-size: 1rem; }
.share-buttons { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.share-btn {
    padding: 10px 18px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    color: #ddd;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.share-btn:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.3); }

/* Second chance */
.second-chance {
    background: rgba(255,255,255,0.04);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}
.second-chance h3 { color: #fff; font-size: 1rem; margin-bottom: 0.3rem; }
.second-chance p { color: rgba(255,255,255,0.5); font-size: 0.85rem; margin-bottom: 0.8rem; }
.second-chance input[type="email"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    color: #fff;
    font-size: 0.95rem;
    font-family: inherit;
    margin-bottom: 6px;
}

/* Play again */
.play-again { text-align: center; margin-top: 2rem; }

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

@media (max-width: 480px) {
    .landing-title { font-size: 2.2rem; }
    .landing-subtitle { font-size: 1rem; }
    .container { padding: 1.5rem 1rem; }
    .briefing { font-size: 0.95rem; }
    .choice-btn { padding: 12px 14px; font-size: 0.85rem; }
    .hero-gauge .gauge-value { font-size: 1.3rem; }
    .feedback-banner { padding: 12px 14px; }
    .feedback-text { font-size: 0.8rem; }
    .feedback-detail { font-size: 0.7rem; }
}

@media (max-width: 360px) {
    .landing-title { font-size: 1.8rem; }
    .hero-instruments { gap: 4px; }
}
