:root {
    --bg: #05070a;
    --panel: #111827;
    --accent: #818cf8;
    --accent-glow: rgba(129, 140, 248, 0.4);
    --warning: #f59e0b;
    --text: #f3f4f6;
    --text-dim: #9ca3af;
    --border: rgba(255, 255, 255, 0.08);
    --glass: rgba(17, 24, 39, 0.7);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-font-smoothing: antialiased; }

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Noto Sans KR', sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
}

.screen {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hidden { display: none !important; }

/* --- Intro --- */
.intro-overlay {
    background: #000;
    position: fixed;
    top: 0; left: 0; z-index: 1000;
}

.fade-in-text {
    font-family: 'Nanum Myeongjo', serif;
    font-size: 2.5rem;
    letter-spacing: 0.3rem;
    animation: introEffect 5s forwards;
}

@keyframes introEffect {
    0% { opacity: 0; transform: scale(0.9); filter: blur(10px); }
    30% { opacity: 1; transform: scale(1); filter: blur(0); }
    70% { opacity: 1; transform: scale(1); filter: blur(0); }
    100% { opacity: 0; transform: scale(1.1); filter: blur(5px); }
}

/* --- Story Selection --- */
.container { width: 100%; max-width: 1200px; padding: 40px 20px; }
.section-title { font-size: 2.5rem; text-align: center; margin-bottom: 60px; font-family: 'Nanum Myeongjo', serif; }

.story-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
}

.story-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 40px;
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.story-card:hover:not(.locked) {
    transform: translateY(-15px);
    border-color: var(--accent);
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.story-badge { position: absolute; top: 20px; right: 20px; background: var(--accent); font-size: 0.7rem; padding: 4px 10px; border-radius: 10px; font-weight: bold; }
.story-icon { font-size: 4rem; margin-bottom: 20px; }
.story-card h3 { font-size: 1.6rem; margin-bottom: 15px; }
.story-card p { color: var(--text-dim); margin-bottom: 25px; flex-grow: 1; }
.difficulty { font-size: 0.9rem; color: var(--accent); margin-bottom: 20px; }

.start-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
}

.locked { opacity: 0.5; filter: grayscale(0.8); cursor: not-allowed; }
.lock-tag { display: inline-block; margin-top: 20px; background: #374151; padding: 8px; border-radius: 8px; font-size: 0.8rem; }

/* --- Game Screen --- */
.game-layout {
    width: 100%;
    max-width: 1100px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.game-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    background: var(--glass);
    backdrop-filter: blur(10px);
    padding: 20px 30px;
    border-radius: 20px;
    border: 1px solid var(--border);
}

.header-status { display: flex; gap: 20px; }
.info-item { display: flex; flex-direction: column; }
.info-item .label { font-size: 0.6rem; color: var(--text-dim); font-weight: bold; }
.info-item .value { font-family: monospace; font-size: 1.2rem; color: var(--accent); }

.game-main {
    display: grid;
    grid-template-columns: 2.5fr 1fr;
    gap: 20px;
}

@media (max-width: 900px) {
    .game-main { grid-template-columns: 1fr; }
}

.visual-area { padding: 0 !important; overflow: hidden; }
.room-viewport {
    width: 100%;
    aspect-ratio: 16/9;
    background-color: #000;
    position: relative;
    background-size: cover;
    background-position: center;
}

.interface-area { display: flex; flex-direction: column; gap: 20px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 20px; padding: 25px; }

.inventory h3, .log-area h3 { font-size: 0.8rem; color: var(--text-dim); margin-bottom: 15px; border-bottom: 1px solid var(--border); padding-bottom: 5px; }
.inventory-slots { display: flex; gap: 10px; }
.slot { width: 60px; height: 60px; background: rgba(0,0,0,0.3); border: 1px solid var(--border); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; }

.message-window { min-height: 80px; }
#game-message { color: var(--text); font-size: 0.95rem; line-height: 1.6; }

/* --- Controls & Buttons --- */
.game-footer { display: flex; gap: 15px; justify-content: flex-end; }

.action-hint-btn {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
    transition: 0.3s;
}

.action-hint-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(245, 158, 11, 0.4); }

.nav-btn {
    background: rgba(255,255,255,0.05);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 12px 25px;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.3s;
}

.nav-btn.accent { border-color: var(--accent); color: var(--accent); }
.nav-btn:hover { background: rgba(255,255,255,0.1); }

/* --- Puzzle Elements --- */
#puzzle-layer { width: 100%; height: 100%; position: relative; display: flex; align-items: center; justify-content: center; }
.book-shelf { display: flex; align-items: flex-end; gap: 12px; }
.book { width: 35px; background: #4b2c20; border: 1px solid #2a1810; cursor: pointer; border-radius: 4px 4px 0 0; }
.clock { width: 80px; height: 80px; border: 4px solid #fff; border-radius: 50%; position: relative; background: rgba(255,255,255,0.05); cursor: pointer; }
.hand { width: 4px; height: 35px; background: var(--accent); position: absolute; bottom: 50%; left: calc(50% - 2px); transform-origin: bottom center; }
.diary-piece { position: absolute; font-size: 2.5rem; cursor: pointer; filter: drop-shadow(0 0 10px gold); }

/* --- Modal --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9); z-index: 3000;
    display: flex; align-items: center; justify-content: center;
}

.modal-window {
    background: var(--panel); border: 1px solid var(--accent);
    padding: 50px; border-radius: 30px; width: 90%; max-width: 450px;
    position: relative; text-align: center;
}

.close-modal { position: absolute; top: 20px; right: 25px; font-size: 35px; background: none; border: none; color: white; cursor: pointer; }

.progress-container { width: 100%; height: 8px; background: #374151; border-radius: 4px; margin-top: 30px; overflow: hidden; }
.progress-bar { width: 0%; height: 100%; background: var(--accent); }
