/* style.css - Frame Runner (Golden Film / Cinematic Animation Studio Theme) */
:root {
    --color-bg: #0c0a09;
    --color-surface: #1c1917;
    --color-surface-card: rgba(28, 25, 23, 0.88);
    --color-accent: #ffcc00;
    --color-accent-hover: #e69900;
    --color-accent-dim: rgba(255, 204, 0, 0.15);
    --color-text: #f8fafc;
    --color-text-muted: #a8a29e;
    --color-error: #f43f5e;
    --color-success: #10b981;
    --color-warning: #facc15;
    --color-glass: rgba(28, 25, 23, 0.92);
    --color-border: rgba(255, 204, 0, 0.3);
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 50% 15%, rgba(255, 204, 0, 0.08) 0%, var(--color-bg) 80%),
        linear-gradient(rgba(255, 204, 0, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 204, 0, 0.02) 1px, transparent 1px);
    background-size: 100% 100%, 30px 30px, 30px 30px;
}

.game-container-fluid {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

/* Screen Management */
.screen-container {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.screen {
    display: none !important;
    width: 100%;
    max-width: 960px;
}

.screen.hidden {
    display: none !important;
}

.screen.active {
    display: block !important;
    animation: fadeIn 0.4s ease-out;
}

.level-ui {
    display: none !important;
    width: 100%;
}

.level-ui.active {
    display: block !important;
    animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.level-ui.hidden {
    display: none !important;
}

/* Top HUD */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: var(--color-glass);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--color-border);
    z-index: 100;
    margin-top: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.hud-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.level-info {
    text-align: center;
    flex-grow: 1;
}

#level-title {
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--color-accent);
    font-size: 1.05rem;
    font-family: 'JetBrains Mono', monospace;
    text-shadow: 0 0 10px rgba(255, 204, 0, 0.3);
}

.progress-bar-container {
    width: 240px;
    height: 8px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 4px;
    margin: 6px auto 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ffcc00 0%, #ff8800 100%);
    box-shadow: 0 0 12px var(--color-accent);
    transition: width 0.3s ease;
}

.score-container {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: #facc15;
}

/* Film Cards */
.film-card {
    background: linear-gradient(135deg, rgba(32, 28, 26, 0.94) 0%, rgba(12, 10, 9, 0.98) 100%);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 204, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 20px;
    padding: 2.2rem;
    box-shadow: 0 12px 45px rgba(0, 0, 0, 0.8), 0 0 30px rgba(255, 204, 0, 0.12);
    margin: auto;
    width: 100%;
}

.studio-badge {
    display: inline-block;
    background: var(--color-accent-dim);
    border: 1px solid var(--color-accent);
    color: var(--color-accent);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    padding: 4px 14px;
    border-radius: 20px;
    margin-bottom: 0.8rem;
    box-shadow: 0 0 10px rgba(255, 204, 0, 0.2);
}

.film-title {
    font-size: clamp(2.2rem, 4vw, 3rem);
    font-weight: 800;
    color: #fff;
    text-shadow: 0 0 25px rgba(255, 204, 0, 0.5);
    margin: 0.4rem 0 0.8rem 0;
    letter-spacing: 1px;
}

.subtitle {
    color: var(--color-text-muted);
    font-size: 1.05rem;
    line-height: 1.6;
    max-width: 720px;
    margin: 0 auto 1.5rem auto;
}

.controls-legend-box {
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 204, 0, 0.25);
    border-radius: 14px;
    padding: 1.4rem 1.6rem;
    line-height: 1.7;
    font-size: 0.95rem;
}

.legend-step {
    margin-bottom: 6px;
    padding-left: 4px;
}

.start-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* Button UI System */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    gap: 8px;
    user-select: none;
}

.btn:active {
    transform: scale(0.96);
}

.film-btn {
    background: linear-gradient(135deg, #ffcc00 0%, #e69900 100%);
    color: #000;
    box-shadow: 0 0 18px rgba(255, 204, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.film-btn:hover {
    box-shadow: 0 0 28px rgba(255, 204, 0, 0.8);
    transform: translateY(-2px);
    color: #000;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 204, 0, 0.4);
    transform: translateY(-2px);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
    border-radius: 6px;
}

.w-100 {
    width: 100%;
}

/* In-game concept */
.in-game-concept-box {
    background: rgba(28, 25, 23, 0.9);
    border-left: 4px solid var(--color-accent);
    padding: 12px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.concept-icon {
    font-size: 1.4rem;
}

/* Film Viewport & Canvas Layouts */
.film-viewport-card {
    background: rgba(18, 16, 15, 0.85);
    border: 2px solid rgba(255, 204, 0, 0.3);
    border-radius: 16px;
    padding: 12px;
    max-width: 620px;
    margin: 1.2rem auto;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(255, 204, 0, 0.1);
}

.canvas-film-wrapper {
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    display: block;
}

.canvas-film-wrapper canvas {
    display: block;
    width: 100%;
    height: auto;
}

.film-hud-bar {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px 2px 12px;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* Timeline Track Bar (Level 2) */
.timeline-track-bar {
    position: relative;
    width: 96%;
    height: 24px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 204, 0, 0.3);
    border-radius: 6px;
    margin: 10px auto 4px auto;
}

.timeline-playhead-indicator {
    position: absolute;
    top: 0;
    left: 0%;
    width: 4px;
    height: 100%;
    background: #ff0055;
    box-shadow: 0 0 8px #ff0055;
    transition: left 0.03s linear;
}

.timeline-keyframe-mark {
    position: absolute;
    top: 2px;
    transform: translateX(-50%);
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--color-accent);
    background: rgba(0, 0, 0, 0.6);
    padding: 1px 4px;
    border-radius: 4px;
    border: 1px solid var(--color-accent);
}

/* Controls Panel & Presets */
.controls-panel-card {
    background: rgba(28, 25, 23, 0.85);
    border: 1px solid rgba(255, 204, 0, 0.25);
    border-radius: 16px;
    padding: 1.4rem;
    max-width: 620px;
    margin: 1rem auto;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

.presets-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.toolbar-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-text-muted);
}

.preset-pill-btn {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 204, 0, 0.3);
    color: var(--color-accent);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-pill-btn:hover {
    background: rgba(255, 204, 0, 0.2);
    border-color: var(--color-accent);
    transform: translateY(-1px);
}

/* Sliders */
.slider-group {
    text-align: left;
}

.slider-header-flex {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.slider-group input[type=range] {
    width: 100%;
    accent-color: var(--color-accent);
    cursor: pointer;
}

/* Format Choices Grid (Level 1 & 3) */
.format-choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    max-width: 620px;
    margin: 1rem auto;
}

.format-btn {
    background: rgba(28, 25, 23, 0.9);
    border: 1px solid rgba(255, 204, 0, 0.35);
    color: #fff;
    padding: 14px 12px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.format-btn:hover:not(:disabled) {
    border-color: var(--color-accent);
    background: rgba(255, 204, 0, 0.2);
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.5);
    transform: translateY(-2px);
}

.format-btn.btn-correct {
    border-color: var(--color-success) !important;
    background: rgba(16, 185, 129, 0.25) !important;
    color: #34d399 !important;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4) !important;
}

.format-btn.btn-wrong {
    border-color: var(--color-error) !important;
    background: rgba(244, 63, 94, 0.25) !important;
    color: #fb7185 !important;
    box-shadow: 0 0 15px rgba(244, 63, 94, 0.4) !important;
}

/* Dopesheet Storyboard List (Level 5) */
.dopesheet-reorder-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 620px;
    margin: 1.2rem auto;
}

.dopesheet-item {
    background: rgba(28, 25, 23, 0.9);
    border: 1px solid rgba(255, 204, 0, 0.3);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    text-align: left;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
}

.dopesheet-item:hover {
    border-color: var(--color-accent);
    background: rgba(38, 34, 31, 0.95);
}

.dopesheet-label {
    font-weight: 700;
    color: var(--color-accent);
    font-size: 0.95rem;
    margin-bottom: 2px;
}

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

.dopesheet-controls {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.shift-btn {
    background: rgba(255, 204, 0, 0.15);
    border: 1px solid var(--color-accent);
    color: var(--color-accent);
    font-weight: 800;
    font-size: 0.9rem;
    width: 32px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shift-btn:hover {
    background: var(--color-accent);
    color: #000;
    transform: scale(1.08);
    box-shadow: 0 0 10px rgba(255, 204, 0, 0.5);
}

.dopesheet-actions-row {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

/* Feedback */
.feedback {
    margin-top: 1.2rem;
    padding: 12px 18px;
    border-radius: 8px;
    font-weight: 600;
    min-height: 24px;
    font-size: 0.95rem;
    display: none;
    max-width: 620px;
    margin-left: auto;
    margin-right: auto;
}

.feedback.correct {
    display: block;
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid var(--color-success);
    color: #34d399;
}

.feedback.wrong {
    display: block;
    background: rgba(244, 63, 94, 0.2);
    border: 1px solid var(--color-error);
    color: #fb7185;
}

/* End Screen */
.final-score-box {
    font-size: 1.8rem;
    font-weight: 800;
    color: #facc15;
    margin: 1.2rem 0;
    text-shadow: 0 0 15px rgba(250, 204, 21, 0.5);
}

.results-box {
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 204, 0, 0.25);
    border-radius: 14px;
    padding: 1.6rem;
}

.learning-summary {
    line-height: 1.8;
    padding-left: 1.2rem;
    color: var(--color-text);
}

.learning-summary li {
    margin-bottom: 0.6rem;
}

/* Modal Overlay */
.how-to-play-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.how-to-play-overlay.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.how-to-play-modal {
    background: linear-gradient(135deg, #24201d 0%, #12100e 100%);
    border: 1px solid var(--color-accent);
    border-radius: 18px;
    padding: 2rem;
    max-width: 600px;
    width: 100%;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 30px rgba(255, 204, 0, 0.3);
}

.modal-close-btn {
    position: absolute;
    top: 14px; right: 18px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.8rem;
    cursor: pointer;
}

.visual-example-box {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 12px 16px;
    margin: 12px 0;
    text-align: left;
}

.example-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.example-card {
    background: rgba(0, 0, 0, 0.5);
    padding: 8px;
    border-radius: 8px;
    text-align: center;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

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

.pulse-anim {
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 15px rgba(255, 204, 0, 0.4); }
    50% { box-shadow: 0 0 30px rgba(255, 204, 0, 0.85); }
    100% { box-shadow: 0 0 15px rgba(255, 204, 0, 0.4); }
}
