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

:root {
    --bg: #faf6ee;
    --surface: #ffffff;
    --border: #e4dccd;
    --text: #2a2533;
    --text-dim: #7b7468;
    --accent: #4f58c9;
    --accent-hover: #3a43b3;
    --danger: #c0392b;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.7;
}

#app {
    max-width: 680px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.hidden { display: none !important; }

/* --- Game List --- */
#game-list h1 {
    font-size: 2rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: var(--text-dim);
    margin-bottom: 2rem;
}

.game-card {
    display: block;
    padding: 1.25rem 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 0.75rem;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.2s;
}
.game-card:hover { border-color: var(--accent); }
.game-card h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.25rem; }
.game-card p { color: var(--text-dim); font-size: 0.9rem; }

.empty { color: var(--text-dim); }
.empty a { color: var(--accent); }

/* --- Game Play --- */
#game-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
#game-header h2 {
    font-size: 1.2rem;
    font-weight: 400;
    letter-spacing: 0.03em;
}
#btn-back {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 1.2rem;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}
#btn-back:hover { border-color: var(--accent); color: var(--accent); }

/* Narrative Log (previous scenes) */
#narrative-log {
    opacity: 0.6;
    margin-bottom: 1rem;
}
.log-entry {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.log-entry h3 { font-size: 1rem; color: var(--text-dim); margin-bottom: 0.5rem; }
.log-entry .body p { margin-bottom: 0.75rem; font-size: 0.95rem; color: var(--text-dim); }
.chosen-action {
    color: var(--accent);
    font-style: italic;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

/* Current Scene */
#scene-text h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--accent);
}
#scene-text .body p {
    margin-bottom: 1rem;
    font-size: 1.05rem;
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Choices */
#choices-container {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.choice-btn {
    display: block;
    width: 100%;
    padding: 0.9rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.4;
}
.choice-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(79, 88, 201, 0.06);
}

/* Ending */
#ending-container {
    text-align: center;
    margin-top: 2rem;
    padding: 2rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}
#ending-message {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}
#btn-restart {
    padding: 0.75rem 2rem;
    background: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
}
#btn-restart:hover { background: var(--accent-hover); }

@media (max-width: 600px) {
    #app { padding: 1rem; }
    #scene-text .body p { font-size: 1rem; }
}
