/* ROOT VARIABLES */
:root {
    --bg-darker: #040508;
    --bg-dark: #090b0f;
    --bg-dialog: rgba(9, 11, 15, 0.9);
    
    --neon-cyan: #00f0ff;
    --neon-purple: #bd00ff;
    --neon-red: #ff0055;
    --neon-green: #39ff14;
    --neon-yellow: #ffb700;
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #475569;
    
    --font-header: 'Orbitron', 'Noto Sans KR', sans-serif;
    --font-mono: 'Share Tech Mono', monospace;
    --font-body: 'Noto Sans KR', sans-serif;
    
    --border-color: rgba(255, 0, 85, 0.15);
    --border-glow: rgba(255, 0, 85, 0.4);
}

/* RESET */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
}

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

/* BACKGROUND SCANLINES & NOISE */
.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%, 
        rgba(0, 0, 0, 0.35) 50%
    );
    background-size: 100% 4px;
    z-index: 100;
    pointer-events: none;
    opacity: 0.35;
}

.noise-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(0,0,0,0) 0%, rgba(0,0,0,0.92) 100%);
    z-index: 99;
    pointer-events: none;
}

/* VISUAL NOVEL CONTAINER */
.vn-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* TITLE SCREEN */
.title-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-darker);
    background-image: radial-gradient(circle at center, rgba(255, 0, 85, 0.12) 0%, var(--bg-darker) 70%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease-in-out;
}

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

.title-content {
    text-align: center;
    z-index: 202;
    padding: 2rem;
}

.title-sub {
    font-family: var(--font-header);
    font-size: 1.1rem;
    letter-spacing: 4px;
    color: var(--neon-red);
    margin-bottom: 1rem;
    text-shadow: 0 0 10px rgba(255, 0, 85, 0.5);
}

.title-main {
    font-family: var(--font-header);
    font-size: 3.5rem;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: 2px;
    margin-bottom: 1.5rem;
}

.title-eng {
    font-size: 1.8rem;
    letter-spacing: 8px;
}

.title-desc {
    font-size: 1.15rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
}

.start-btn {
    background: transparent;
    border: 2px solid var(--neon-red);
    color: var(--neon-red);
    padding: 1.1rem 3.5rem;
    font-family: var(--font-header);
    font-size: 1.25rem;
    font-weight: 700;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.start-btn:hover {
    background: var(--neon-red);
    color: var(--text-primary);
    box-shadow: 0 0 25px var(--neon-red);
    transform: scale(1.05);
}

.title-footer {
    position: absolute;
    bottom: 2rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    letter-spacing: 1px;
}

/* PLAY SCREEN LAYOUT */
.play-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease-in;
}

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

/* STAGE BACKGROUND */
.vn-stage {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('cyber_grief_room.png');
    background-size: cover;
    background-position: center;
    z-index: 1;
    transition: filter 0.5s ease;
}

.digital-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(rgba(255, 0, 85, 0.015) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255, 0, 85, 0.015) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

.hologram-flicker {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 0, 85, 0.04);
    opacity: 0.2;
    pointer-events: none;
    z-index: 2;
    animation: flicker 0.12s infinite;
    display: none;
}

/* TOP CONTROLS (BGM toggle button) */
.top-controls {
    position: absolute;
    top: 2rem;
    right: 2rem;
    z-index: 50;
}

.sound-btn {
    background: rgba(11, 15, 23, 0.75);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.6rem 1.2rem;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
}

.sound-btn:hover {
    border-color: var(--neon-red);
    color: var(--neon-red);
    box-shadow: 0 0 10px rgba(255, 0, 85, 0.2);
}

/* SCENE TITLE CONTAINER (상황 소제목) */
.scene-title-container {
    position: absolute;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    display: flex;
    align-items: center;
    background: rgba(11, 15, 23, 0.8);
    border: 1px solid var(--border-color);
    padding: 6px 18px;
    border-radius: 4px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6), inset 0 0 8px rgba(255, 0, 85, 0.05);
}

.scene-warning-label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 900;
    color: var(--neon-red);
    background: rgba(255, 0, 85, 0.12);
    border: 1px solid var(--neon-red);
    padding: 2px 7px;
    border-radius: 2px;
    margin-right: 12px;
    text-shadow: 0 0 4px rgba(255, 0, 85, 0.5);
    letter-spacing: 1px;
}

.scene-title {
    font-family: var(--font-header);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 1px;
}

/* LEFT FLOATING STATS PANEL */
.vn-stats {
    position: absolute;
    top: 2rem;
    left: 2rem;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(11, 15, 23, 0.75);
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(8px);
    width: 260px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-bar-container {
    height: 6px;
    background-color: rgba(255,255,255,0.06);
    border-radius: 3px;
    overflow: hidden;
}

.stat-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple));
    box-shadow: 0 0 6px var(--neon-cyan);
    border-radius: 3px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#stat-dependent .stat-bar {
    background: linear-gradient(90deg, var(--neon-purple), var(--neon-red));
    box-shadow: 0 0 6px var(--neon-purple);
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    color: var(--neon-cyan);
    text-align: right;
}

/* DECISION LOG PANEL (Choice History) */
.decision-log {
    position: absolute;
    top: 14.5rem;
    left: 2rem;
    z-index: 50;
    background: rgba(11, 15, 23, 0.75);
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(8px);
    width: 260px;
    max-height: 250px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.log-header {
    font-family: var(--font-header);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 4px;
    letter-spacing: 1px;
}

.log-list {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.log-empty {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 1rem 0;
}

.log-item {
    font-size: 0.82rem;
    line-height: 1.4;
    border-left: 2px solid var(--neon-purple);
    padding-left: 8px;
    color: var(--text-secondary);
    animation: msgFadeIn 0.3s ease forwards;
}

.log-item.regulation {
    border-left-color: var(--neon-red);
    color: var(--text-primary);
}

/* DIALOG WINDOW */
.dialog-container {
    position: relative;
    z-index: 40;
    width: 90%;
    max-width: 960px;
    margin: 0 auto 3rem auto;
    cursor: pointer;
}

.speaker-tag {
    position: absolute;
    top: -30px;
    left: 20px;
    background: var(--neon-red);
    color: white;
    font-family: var(--font-header);
    font-size: 0.95rem;
    font-weight: 900;
    padding: 5px 22px;
    border-radius: 4px 4px 0 0;
    border: 1px solid rgba(255, 0, 85, 0.3);
    border-bottom: none;
    text-shadow: 0 0 5px rgba(255,255,255,0.4);
    letter-spacing: 1px;
}

.dialog-box {
    background: var(--bg-dialog);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.8rem 2.2rem;
    min-height: 145px;
    backdrop-filter: blur(16px);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.6), inset 0 0 15px rgba(255, 0, 85, 0.02);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: border-color 0.3s ease;
}

.dialog-box:hover {
    border-color: var(--border-glow);
}

.dialog-text {
    font-size: 1.35rem;
    line-height: 1.85;
    color: var(--text-primary);
    text-shadow: 0 1px 3px rgba(0,0,0,0.95);
    font-weight: 400;
}

.next-indicator {
    align-self: flex-end;
    font-size: 0.9rem;
    color: var(--neon-red);
    text-shadow: 0 0 5px var(--neon-red);
    animation: indicatorPulse 1.2s infinite;
}

/* CHOICES OVERLAY */
.choices-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 5, 8, 0.65);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
}

.choices-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.choices-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 90%;
    max-width: 650px;
}

.choice-btn {
    background: rgba(11, 15, 23, 0.92);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 1.35rem 2.2rem;
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.choice-btn:hover {
    border-color: var(--neon-red);
    background: rgba(255, 0, 85, 0.12);
    box-shadow: 0 0 20px rgba(255, 0, 85, 0.3);
    transform: scale(1.02);
}

/* INTEGRATED ENDING SCREEN */
.ending-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-darker);
    background-image: radial-gradient(circle at center, rgba(255, 0, 85, 0.08) 0%, var(--bg-darker) 100%);
    z-index: 300;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1s ease-in-out;
    padding: 2rem;
}

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

.ending-content {
    width: 100%;
    max-width: 860px;
    padding: 2.5rem 3rem;
    border-radius: 8px;
    background: rgba(9, 11, 15, 0.75);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(24px);
    box-shadow: 0 0 40px rgba(0,0,0,0.9);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-height: 95vh;
    overflow-y: auto;
}

.ending-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0.5rem;
}

.report-stamp {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--neon-red);
    border: 1px solid var(--neon-red);
    padding: 2px 10px;
    border-radius: 3px;
    letter-spacing: 2px;
}

.ending-type {
    font-family: var(--font-header);
    font-size: 1.1rem;
    color: var(--neon-red);
    letter-spacing: 4px;
    text-shadow: 0 0 10px rgba(255, 0, 85, 0.4);
    text-transform: uppercase;
}

.ending-title {
    font-family: var(--font-header);
    font-size: 2.1rem;
    font-weight: 900;
    color: var(--text-primary);
    text-shadow: 0 0 15px rgba(255, 0, 85, 0.25);
}

.ending-desc {
    font-size: 1.05rem;
    line-height: 1.65;
    color: var(--text-secondary);
    border-left: 3px solid var(--neon-red);
    padding-left: 1.25rem;
}

/* INTEGRATED INCORRECT NOTE REPORT */
.integrated-note {
    background: rgba(255, 0, 85, 0.01);
    border: 1px solid rgba(255, 0, 85, 0.1);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: inset 0 0 10px rgba(255,0,85,0.01);
}

.note-header-bar {
    background: rgba(255, 0, 85, 0.05);
    padding: 0.6rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 0, 85, 0.1);
}

.terminal-dot {
    width: 8px;
    height: 8px;
    background-color: var(--neon-red);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--neon-red);
}

.note-title {
    font-family: var(--font-header);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--neon-yellow);
    letter-spacing: 1px;
}

.note-report-body {
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.report-sec {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.sec-badge {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 900;
    padding: 2px 8px;
    border-radius: 3px;
    min-width: 72px;
    text-align: center;
}

.badge-red {
    background-color: rgba(255, 0, 85, 0.15);
    border: 1px solid var(--neon-red);
    color: var(--neon-red);
}

.badge-yellow {
    background-color: rgba(255, 183, 0, 0.15);
    border: 1px solid var(--neon-yellow);
    color: var(--neon-yellow);
}

.badge-green {
    background-color: rgba(57, 255, 20, 0.15);
    border: 1px solid var(--neon-green);
    color: var(--neon-green);
}

.report-sec p {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-secondary);
    flex-grow: 1;
}

.btn-group {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 0.5rem;
}

.btn {
    padding: 0.8rem 2rem;
    border-radius: 4px;
    font-family: var(--font-header);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
}

.primary-btn {
    background: var(--neon-red);
    color: var(--text-primary);
    border: 1px solid var(--neon-red);
    box-shadow: 0 0 10px rgba(255, 0, 85, 0.2);
}

.primary-btn:hover {
    background: transparent;
    color: var(--neon-red);
    box-shadow: 0 0 15px var(--neon-red);
}

.secondary-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--text-muted);
}

.secondary-btn:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

/* SHAKE & FLASH EFFECTS */
.shake {
    animation: shakeEffect 0.5s ease-in-out;
}

.flash {
    animation: flashEffect 0.3s ease-out;
}

@keyframes shakeEffect {
    0%, 100% { transform: translate(0, 0); }
    10%, 30%, 50%, 70%, 90% { transform: translate(-6px, 0); }
    20%, 40%, 60%, 80% { transform: translate(6px, 0); }
}

@keyframes flashEffect {
    0% { background-color: transparent; }
    50% { background-color: rgba(255, 255, 255, 0.5); }
    100% { background-color: transparent; }
}

/* FLICKER ANIMATION */
@keyframes flicker {
    0% { opacity: 0.15; }
    50% { opacity: 0.28; }
    100% { opacity: 0.15; }
}

/* KEYFRAMES */
@keyframes indicatorPulse {
    0%, 100% { opacity: 1; transform: translateY(0); }
    50% { opacity: 0.3; transform: translateY(3px); }
}

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

/* RESPONSIVE SCALING */
@media (max-width: 900px) {
    .note-grid {
        grid-template-columns: 1fr;
    }
    .title-main {
        font-size: 2.2rem;
    }
    .ending-title {
        font-size: 1.7rem;
    }
    .vn-stats {
        width: calc(100% - 4rem);
        flex-direction: row;
        justify-content: space-between;
    }
    .stat-item {
        width: 30%;
    }
    .decision-log {
        display: none;
    }
    .scene-title-container {
        top: 15rem;
    }
}
