/* Greek Pottery Aesthetic - Red Figure on Black */
:root {
    --terracotta: #E07A5F;
    --black-figure: #2c1810;
    --red-figure: #c44536;
    --parchment: #f4e8d0;
    --gold: #d4af37;
    --shadow: rgba(44, 24, 16, 0.3);
}

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

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background: linear-gradient(135deg, var(--black-figure) 0%, #1a0f0a 100%);
    color: var(--terracotta);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    overflow-x: hidden;
}

/* Retro Frame */
.game-frame {
    max-width: 420px;
    width: 100%;
    background: #2c1810;
    border: 8px solid #1a0f0a;
    border-radius: 15px 15px 40px 40px;
    box-shadow:
        0 0 0 3px var(--gold),
        0 10px 30px rgba(0, 0, 0, 0.8),
        inset 0 2px 5px rgba(255, 255, 255, 0.1);
    padding: 8px;
}

/* Screen Management */
.screen {
    display: none;
    width: 100%;
    animation: fadeIn 0.5s ease-in;
}

.screen.active {
    display: block;
}

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

/* Start Screen */
#start-screen {
    text-align: center;
    background: var(--black-figure);
    border: 2px solid var(--terracotta);
    border-radius: 8px;
    padding: 20px 15px;
    box-shadow: 0 5px 20px var(--shadow);
}

#start-screen .secondary-btn {
    margin-bottom: 50px;
}


.title-container h1 {
    font-size: 2rem;
    color: var(--gold);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 4px;
    margin-bottom: 5px;
}

.title-container h2 {
    font-size: 0.9rem;
    color: var(--terracotta);
    font-style: italic;
    margin-bottom: 10px;
}

.title-container .subtitle {
    font-size: 0.75rem;
    color: var(--parchment);
    opacity: 0.7;
    margin-bottom: 20px;
}

.character-creation {
    max-width: 100%;
    margin: 0 auto 15px;
}

.character-creation label {
    display: block;
    font-size: 0.85rem;
    margin: 10px 0 5px;
    color: var(--parchment);
}

#player-name {
    width: 100%;
    padding: 8px;
    font-size: 0.95rem;
    background: var(--parchment);
    border: 2px solid var(--terracotta);
    border-radius: 4px;
    font-family: Georgia, serif;
    color: var(--black-figure);
}

.gender-selection {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.gender-btn {
    flex: 1;
    padding: 12px;
    font-size: 1rem;
    background: transparent;
    border: 2px solid var(--terracotta);
    color: var(--terracotta);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: Georgia, serif;
}

.gender-btn:hover {
    background: var(--terracotta);
    color: var(--black-figure);
}

.gender-btn.selected {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--black-figure);
    font-weight: bold;
}

/* Buttons */
.primary-btn, .secondary-btn, .danger-btn {
    padding: 10px 20px;
    font-size: 0.9rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: Georgia, serif;
    transition: all 0.3s;
    box-shadow: 0 2px 6px var(--shadow);
}

.primary-btn {
    background: var(--gold);
    color: var(--black-figure);
    font-weight: bold;
}

.primary-btn:hover:not(:disabled) {
    background: #f0c84a;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px var(--shadow);
}

.primary-btn:disabled {
    background: #666;
    cursor: not-allowed;
    opacity: 0.5;
}

.secondary-btn {
    background: transparent;
    border: 2px solid var(--terracotta);
    color: var(--terracotta);
    margin-left: 10px;
}

.secondary-btn:hover {
    background: var(--terracotta);
    color: var(--black-figure);
}

.danger-btn {
    background: var(--red-figure);
    color: var(--parchment);
    margin-right: 10px;
}

.danger-btn:hover {
    background: #a03528;
}

/* Game Screen */
#game-screen {
    position: relative;
    background: var(--parchment);
    border: 3px solid var(--black-figure);
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 10px 40px var(--shadow);
    color: var(--black-figure);
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--terracotta);
}

.sundial-container {
    text-align: center;
}

.sundial {
    width: 100px;
    height: 100px;
    filter: drop-shadow(2px 2px 4px var(--shadow));
}

#sundial-shadow {
    transition: transform 0.5s ease;
    transform-origin: 100px 100px;
}

.time-label {
    margin-top: 10px;
    font-size: 1rem;
    color: var(--black-figure);
    font-weight: bold;
}

.player-info {
    text-align: right;
}

.player-name-display {
    font-size: 1.1rem;
    color: var(--black-figure);
}

.player-name-display span {
    font-weight: bold;
    color: var(--red-figure);
}

/* Narrative Container */
.narrative-container {
    background: linear-gradient(to bottom, rgba(228, 122, 95, 0.1), transparent);
    padding: 30px;
    margin-bottom: 30px;
    border-left: 4px solid var(--terracotta);
    min-height: 200px;
}

.narrative-text {
    font-size: 1.2rem;
    line-height: 1.8;
    color: var(--black-figure);
    text-align: justify;
}

.narrative-text p {
    margin-bottom: 20px;
}

/* Decision Container */
.decision-container {
    background: rgba(44, 24, 16, 0.05);
    padding: 30px;
    border-radius: 10px;
    border: 2px solid var(--terracotta);
}

#decision-prompt {
    font-size: 1.5rem;
    color: var(--red-figure);
    margin-bottom: 20px;
    text-align: center;
}

.choices-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.choice-btn {
    padding: 20px;
    font-size: 1.1rem;
    background: var(--parchment);
    border: 3px solid var(--black-figure);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: Georgia, serif;
    color: var(--black-figure);
    text-align: left;
    position: relative;
    overflow: hidden;
}

.choice-btn:before {
    content: '→';
    position: absolute;
    left: -30px;
    transition: left 0.3s;
    font-size: 1.5rem;
    color: var(--gold);
}

.choice-btn:hover {
    background: var(--terracotta);
    color: var(--parchment);
    border-color: var(--gold);
    transform: translateX(10px);
}

.choice-btn:hover:before {
    left: 15px;
}

#continue-btn {
    margin-top: 20px;
    width: 100%;
}

/* Ending Screen */
#ending-screen {
    background: var(--black-figure);
    border: 3px solid var(--gold);
    border-radius: 10px;
    padding: 50px;
    box-shadow: 0 10px 40px var(--shadow);
    text-align: center;
}

.ending-container h2 {
    font-size: 2.5rem;
    color: var(--gold);
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.ending-narrative {
    font-size: 1.3rem;
    line-height: 1.8;
    color: var(--parchment);
    margin-bottom: 10px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.ending-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* Chronicle Screen - Compact */
#chronicle-screen {
    background: var(--parchment);
    border: 2px solid var(--black-figure);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 5px 20px var(--shadow);
    max-height: 85vh;
    overflow-y: auto;
}

.chronicle-container h1 {
    font-size: 1.5rem;
    color: var(--red-figure);
    text-align: center;
    margin-bottom: 5px;
}

.chronicle-subtitle {
    text-align: center;
    font-style: italic;
    color: var(--black-figure);
    margin-bottom: 15px;
    font-size: 0.75rem;
}

.fate-ladder {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.ladder-section {
    padding: 8px;
    border-radius: 6px;
    border: 2px solid;
}

.ladder-section h3 {
    font-size: 0.9rem;
    margin-bottom: 8px;
    text-align: center;
}

.ladder-section.divine {
    background: linear-gradient(135deg, #fff9e6, #fffef0);
    border-color: var(--gold);
}

.ladder-section.divine h3 {
    color: var(--gold);
}

.ladder-section.heroic {
    background: linear-gradient(135deg, #e8f5e9, #f1f8f2);
    border-color: #4caf50;
}

.ladder-section.heroic h3 {
    color: #2e7d32;
}

.ladder-section.mundane {
    background: linear-gradient(135deg, #f5f5f5, #fafafa);
    border-color: #9e9e9e;
}

.ladder-section.mundane h3 {
    color: #616161;
}

.ladder-section.tragic {
    background: linear-gradient(135deg, #fce4ec, #f8e7ec);
    border-color: #e91e63;
}

.ladder-section.tragic h3 {
    color: #c2185b;
}

.ladder-section.cursed {
    background: linear-gradient(135deg, #3d2a2a, #2c1810);
    border-color: var(--red-figure);
}

.ladder-section.cursed h3 {
    color: var(--red-figure);
}

.endings-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
}

.ending-badge {
    padding: 4px 8px;
    border-radius: 10px;
    font-size: 0.65rem;
    border: 1px solid;
    cursor: pointer;
    transition: all 0.3s;
}

.ending-badge.unlocked {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--black-figure);
    font-weight: bold;
}

.ending-badge.locked {
    background: transparent;
    border-color: #ccc;
    color: #999;
    font-style: italic;
}

.ending-badge.hidden {
    background: var(--black-figure);
    border-color: var(--gold);
    color: var(--gold);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.chronicle-stats {
    text-align: center;
    font-size: 0.8rem;
    margin: 15px 0;
    color: var(--black-figure);
}

.chronicle-stats p {
    margin: 5px 0;
}

.chronicle-stats span {
    font-weight: bold;
    color: var(--red-figure);
}

.hidden-hint {
    font-style: italic;
    font-size: 0.7rem;
    color: #666;
}

.greek-wisdom {
    font-style: italic;
    font-size: 0.85rem;
    color: var(--terracotta);
    font-family: Georgia, serif;
    text-align: center;
    margin: 10px 20px;
    padding: 8px;
    border-left: 3px solid var(--gold);
    border-right: 3px solid var(--gold);
    background: rgba(212, 175, 55, 0.05);
    line-height: 1.4;
}

#chronicle-screen .primary-btn,
#chronicle-screen .secondary-btn,
#chronicle-screen .danger-btn {
    margin: 5px;
    font-size: 0.8rem;
    padding: 8px 15px;
}

#ending-screen .ending-actions {
    margin-bottom: 30px;
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 15px;
}

#ending-screen .primary-btn,
#ending-screen .secondary-btn {
    font-size: 0.8rem;
    padding: 8px 15px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .title-container h1 {
        font-size: 2.5rem;
    }

    .title-container h2 {
        font-size: 1.2rem;
    }

    .game-header {
        flex-direction: column;
        gap: 20px;
    }

    .player-info {
        text-align: center;
    }

    .narrative-text {
        font-size: 1rem;
    }

    .choice-btn {
        font-size: 1rem;
        padding: 15px;
    }

    .ending-actions {
        flex-direction: column;
    }

    .chronicle-container h1 {
        font-size: 2rem;
    }
}

/* =================================================================
   PHASE 1: Classic RPG-style Visual Overhaul
   ================================================================= */

/* Stats HUD - Retro Compact */
/* Control Buttons Container */
.control-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 8px 4px 8px;
}

.nav-buttons-left,
.nav-buttons-right {
    display: flex;
    gap: 8px;
}

.nav-button {
    background: var(--parchment);
    border: 1px solid var(--terracotta);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px var(--shadow);
}

.nav-button:hover {
    background: var(--gold);
    border-color: var(--gold);
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(212, 175, 55, 0.6);
}

.nav-button:active {
    transform: scale(0.95);
}

.nav-icon {
    font-size: 14px;
    line-height: 1;
    user-select: none;
}

.stats-hud {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto auto;
    gap: 6px;
    padding: 6px;
    background: linear-gradient(135deg, var(--black-figure), #1a0f0a);
    border-bottom: 2px solid var(--terracotta);
    position: relative;
}

/* Sound Toggle Button */
.sound-toggle {
    background: var(--parchment);
    border: 1px solid var(--terracotta);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px var(--shadow);
}

.sound-toggle:hover {
    background: var(--gold);
    border-color: var(--gold);
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(212, 175, 55, 0.6);
}

.sound-toggle:active {
    transform: scale(0.95);
}

.sound-toggle.muted {
    background: #ddd;
    border-color: #999;
    opacity: 0.7;
}

.sound-icon {
    font-size: 16px;
    line-height: 1;
    user-select: none;
    font-weight: bold;
}

.sound-toggle.muted .sound-icon {
    opacity: 0.5;
}

.rewind-button {
    background: var(--parchment);
    border: 1px solid var(--terracotta);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px var(--shadow);
}

.rewind-button:hover {
    background: var(--gold);
    border-color: var(--gold);
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(212, 175, 55, 0.6);
}

.rewind-button:active {
    transform: scale(0.95);
}

.rewind-icon {
    font-size: 16px;
    line-height: 1;
    user-select: none;
    font-weight: bold;
}

.stat-box {
    background: var(--parchment);
    border: 1px solid var(--terracotta);
    border-radius: 4px;
    padding: 4px 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 4px var(--shadow);
}

.clock-box {
    grid-row: 1 / 3;
    flex-direction: column;
    padding: 3px;
    justify-content: center;
}

.time-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 100%;
}

/* Zeus Ring - Bottom left, below health */
.zeus-box {
    display: flex;
    align-items: center;
    justify-content: center;
}

.zeus-corner-ring {
    width: 52px;
    height: 52px;
    cursor: help;
}

.zeus-double-ring {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.zeus-symbol {
    font-size: 18px;
    fill: var(--gold);
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
    user-select: none;
}

.roman-numeral {
    font-size: 32px;
    font-weight: bold;
    color: var(--red-figure);
    line-height: 1;
    font-family: Georgia, serif;
}

/* Special styling for hour XVIII - The Reckoning */
.roman-numeral.hour-xviii {
    color: var(--black-figure);
}

.hour-label-text {
    font-size: 9px;
    font-weight: bold;
    color: var(--black-figure);
    text-align: center;
}

/* Legacy styles */
#sundial-canvas {
    display: none;
}

.hour-display {
    display: none;
}

/* Legacy styles - can be removed */
.hour-label {
    display: block;
    font-size: 7px;
    color: var(--black-figure);
    font-weight: bold;
}

.hour-number {
    display: block;
    font-size: 14px;
    font-weight: bold;
    color: var(--red-figure);
}

.stat-icon {
    font-size: 16px;
    line-height: 1;
}

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.stat-label {
    font-size: 8px;
    font-weight: bold;
    color: var(--black-figure);
    text-transform: uppercase;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-value {
    font-size: 10px;
    font-weight: bold;
    color: var(--gold);
}

/* Health percentage colors */
.health-percent.very-high {
    color: #006400; /* Dark green */
}

.health-percent.high {
    color: #32CD32; /* Light green */
}

.health-percent.medium {
    color: #FFA500; /* Orange */
}

.health-percent.low {
    color: #FF6B6B; /* Light red */
}

.health-percent.very-low {
    color: #8B0000; /* Dark red */
}

.health-percent.critical {
    color: #8B0000; /* Dark red */
    animation: blink-health 1s infinite;
}

.health-percent.dead {
    color: #000000; /* Black */
    font-style: italic;
}

@keyframes blink-health {
    0%, 50%, 100% { opacity: 1; }
    25%, 75% { opacity: 0.3; }
}

.stat-bar-container {
    position: relative;
    height: 12px;
    background: #ddd;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--black-figure);
}

.stat-bar {
    height: 100%;
    transition: width 0.5s ease, background-color 0.3s;
    position: relative;
}

.wealth-bar {
    background: linear-gradient(90deg, #FFD700, #FFA500);
}

.health-bar {
    background: linear-gradient(90deg, #FF4444, #CC0000);
}

.health-bar.low {
    background: linear-gradient(90deg, #8B0000, #4A0000);
    animation: pulse-health 1s infinite;
}

.health-bar.medium {
    background: linear-gradient(90deg, #FFA500, #FF8C00);
}

@keyframes pulse-health {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Critical Health Indicator - shows when health is at 0% (displayed as 1%) */
.critical-health-indicator {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 8px;
    background: linear-gradient(90deg, #FF0000, #8B0000);
    border-radius: 6px 0 0 6px;
    animation: critical-pulse 1s infinite;
    box-shadow: 0 0 6px rgba(255, 0, 0, 0.8);
    z-index: 10;
}

@keyframes critical-pulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 6px rgba(255, 0, 0, 0.8);
    }
    50% {
        opacity: 0.4;
        box-shadow: 0 0 12px rgba(255, 0, 0, 1);
    }
}

/* Health box - no value display */
.health-box .stat-content {
    flex: 1;
}

/* Wealth display - coin icon with bar (like health) */
.wealth-bar {
    background: linear-gradient(90deg, #FFD700, #FFA500);
    transition: width 0.3s ease;
}

.wealth-bar.low {
    background: linear-gradient(90deg, #8B4513, #654321);
}

.wealth-bar.medium {
    background: linear-gradient(90deg, #DAA520, #B8860B);
}

.wealth-bar.high {
    background: linear-gradient(90deg, #FFD700, #FFA500);
    box-shadow: 0 0 6px rgba(255, 215, 0, 0.6);
}

/* Gods Favor Display - Circular Progress Rings */
.gods-box {
    grid-column: 2;
}

.gods-box .stat-label {
    text-align: center;
    display: block;
    width: 100%;
}

.gods-mini-display {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.god-mini {
    position: relative;
    width: 32px;
    height: 32px;
}

.god-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg); /* Start from top */
    transition: transform 0.3s ease;
}

/* Counter-clockwise for negative favor */
.god-mini.negative-favor .god-ring {
    transform: rotate(90deg) scaleX(-1); /* Flip horizontally and rotate to start from top counter-clockwise */
}

.ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 3;
}

.ring-progress {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dasharray 0.5s ease, stroke 0.3s ease;
}

/* Default state - neutral/zero favor */
.god-mini[data-favor="0"] .ring-progress {
    stroke: rgba(255, 255, 255, 0.3);
    stroke-dasharray: 0 100;
}

/* Positive favor - golden (clockwise) */
.god-mini.positive-favor .ring-progress {
    stroke: #B8860B;
}

/* High positive favor - glowing gold */
.god-mini[data-favor="14"] .ring-progress,
.god-mini[data-favor="15"] .ring-progress,
.god-mini[data-favor="16"] .ring-progress,
.god-mini[data-favor="17"] .ring-progress,
.god-mini[data-favor="18"] .ring-progress,
.god-mini[data-favor="19"] .ring-progress,
.god-mini[data-favor="20"] .ring-progress {
    filter: drop-shadow(0 0 4px #B8860B);
    animation: godGlow 2s infinite;
}

/* Negative favor - red (counter-clockwise) */
.god-mini.negative-favor .ring-progress {
    stroke: #FF4444;
}

@keyframes godGlow {
    0%, 100% { filter: drop-shadow(0 0 4px #FFD700); }
    50% { filter: drop-shadow(0 0 8px #FFD700); }
}

.god-symbol {
    font-size: 14px;
    fill: var(--parchment);
    pointer-events: none;
    transform: rotate(90deg); /* Counter-rotate to keep icon upright */
    transform-origin: center;
    transition: transform 0.3s ease;
}

/* Fix flipped emojis - Hermes and Dionysus need horizontal flip */
.god-mini[data-god="hermes"] .god-symbol,
.god-mini[data-god="dionysus"] .god-symbol {
    transform: rotate(90deg) scaleX(-1);
}

/* Counter parent scaleX(-1) when negative favor - keeps symbols upright */
/* Athena and Aphrodite just need to counter the parent's horizontal flip */
.god-mini.negative-favor[data-god="athena"] .god-symbol,
.god-mini.negative-favor[data-god="aphrodite"] .god-symbol {
    transform: rotate(90deg) scaleX(-1);
}

/* Hermes and Dionysus already have scaleX(-1), so negative favor returns to normal */
.god-mini.negative-favor[data-god="hermes"] .god-symbol,
.god-mini.negative-favor[data-god="dionysus"] .god-symbol {
    transform: rotate(90deg) scaleX(1);
}

.player-box {
    background: var(--gold);
    border-color: var(--black-figure);
    padding: 4px 8px;
    grid-column: 2;
}

.player-name {
    font-size: 11px;
    font-weight: bold;
    color: var(--black-figure);
}

/* Game Canvas Container - Compact */
.game-canvas-container {
    width: 100%;
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px 4px;
    margin-top: 8px;
}

#game-canvas {
    display: block;
    border: none;
    border-bottom: 2px solid #000;
    width: 100% !important;
    height: 180px !important;
}

/* Game Footer */
.game-footer {
    text-align: center;
    padding: 8px 4px;
    font-size: 0.75rem;
    color: var(--terracotta);
    opacity: 0.7;
    font-family: Georgia, serif;
}

.debug-info {
    font-size: 0.65rem;
    font-family: 'Courier New', monospace;
    color: #666;
    opacity: 0.5;
    margin-top: 4px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Narrative Box (Retro Compact) - FIXED HEIGHT */
.narrative-box {
    background: var(--parchment);
    border: 2px solid var(--black-figure);
    border-radius: 6px;
    padding: 10px 10px 14px 10px; /* Extra bottom padding for descenders */
    margin: 8px 4px 4px 4px;
    height: 145px; /* Fixed height - increased to show more lines */
    overflow: hidden; /* No scroll */
    box-shadow: inset 0 1px 4px rgba(0,0,0,0.1);
}

.narrative-text {
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--black-figure);
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    height: calc(100% - 25px); /* Leave room for bottom controls */
    overflow: hidden;
}

/* Chapter Break Styling */
.chapter-break {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 145px;
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--terracotta);
    letter-spacing: 0.3em;
    text-align: center;
}

/* Bottom controls container */
.narrative-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    margin: 0 4px 8px 4px;
}

/* Skip button (left) */
.skip-button {
    font-size: 9px;
    color: var(--black-figure);
    background: rgba(139, 69, 19, 0.1);
    border: 1px solid var(--terracotta);
    border-radius: 3px;
    padding: 2px 6px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.skip-button:hover {
    background: var(--terracotta);
    color: var(--parchment);
}

.skip-button:active {
    transform: scale(0.95);
}

.skip-button.hidden {
    visibility: hidden;
}

/* Advance prompt (right) - ALWAYS VISIBLE */
.advance-prompt {
    font-size: 10px;
    color: var(--red-figure);
    /* animation: blink 1.5s infinite; */ /* Removed - no blinking */
    user-select: none;
    margin-left: auto; /* Always push to the right */
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Feedback Box - Compact */
.feedback-box {
    background: linear-gradient(135deg, #FFE4B5, #FFDAB9);
    border: 2px solid var(--gold);
    border-radius: 6px;
    padding: 8px;
    margin: 6px 4px;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.5);
    animation: slideIn 0.3s ease-out;
}

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

.feedback-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.feedback-icon {
    font-size: 20px;
    flex-shrink: 0;
}

#feedback-text {
    font-size: 0.8rem;
    font-style: italic;
    color: var(--black-figure);
    line-height: 1.3;
}

/* Decision Container - Compact */
#game-screen .decision-container {
    background: rgba(44, 24, 16, 0.95);
    border: 2px solid var(--gold);
    border-radius: 6px;
    padding: 10px;
    margin: 8px 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

#game-screen #decision-prompt {
    color: var(--gold);
    font-size: 0.95rem;
    text-align: center;
    margin-bottom: 8px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    position: relative;
}

/* Narrative scroll icon */
.narrative-scroll-icon {
    display: inline-block;
    font-size: 1rem;
    margin-left: 8px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
    vertical-align: middle;
    user-select: none;
}

.narrative-scroll-icon:hover {
    opacity: 1;
    transform: scale(1.15);
}

.narrative-scroll-icon.active {
    opacity: 1;
    transform: scale(1.2) rotate(15deg);
}

/* Narrative tooltip (hidden by default, shown on click) */
.narrative-tooltip {
    display: none;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(100% + 12px);
    background: var(--parchment);
    border: 3px solid var(--terracotta);
    border-radius: 8px;
    padding: 16px;
    width: 90%;
    max-width: 380px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    text-align: left;
    font-size: 0.75rem;
    color: var(--black-figure);
    line-height: 1.5;
}

/* Show tooltip when active */
.narrative-tooltip.show {
    display: block;
    animation: tooltipFadeIn 0.2s ease;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.narrative-tooltip p {
    margin: 8px 0;
}

.narrative-tooltip p:first-child {
    margin-top: 0;
}

.narrative-tooltip p:last-child {
    margin-bottom: 0;
}

/* Arrow pointer for tooltip */
.narrative-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 10px solid transparent;
    border-top-color: var(--terracotta);
}

/* Custom scrollbar for tooltip */
.narrative-tooltip::-webkit-scrollbar {
    width: 8px;
}

.narrative-tooltip::-webkit-scrollbar-track {
    background: rgba(139, 69, 19, 0.1);
    border-radius: 4px;
}

.narrative-tooltip::-webkit-scrollbar-thumb {
    background: var(--terracotta);
    border-radius: 4px;
}

.narrative-tooltip::-webkit-scrollbar-thumb:hover {
    background: var(--gold);
}

/* Mobile optimization */
@media (max-width: 480px) {
    .narrative-tooltip {
        width: 95%;
        max-width: none;
        font-size: 0.7rem;
        padding: 12px;
        max-height: 200px;
    }

    .narrative-scroll-icon {
        font-size: 1.1rem;
    }
}

/* Choice buttons - Compact */
#game-screen .choice-btn {
    background: var(--parchment);
    border: 2px solid var(--terracotta);
    padding: 8px;
    margin: 4px 0;
    border-radius: 4px;
    font-size: 0.8rem;
    transition: all 0.2s;
    text-align: left;
}

#game-screen .choice-btn:hover {
    background: var(--terracotta);
    color: var(--parchment);
    transform: translateX(5px);
    border-color: var(--gold);
}

#game-screen .choice-btn.locked {
    opacity: 0.4;
    cursor: not-allowed;
    background: #888;
}

#game-screen .choice-btn.locked:hover {
    transform: none;
    background: #888;
}

.choice-key {
    display: inline-block;
    font-weight: bold;
    color: var(--terracotta);
    background: rgba(139, 69, 19, 0.15);
    padding: 2px 6px;
    border-radius: 3px;
    margin-right: 8px;
    font-size: 0.75rem;
    font-family: monospace;
    letter-spacing: 1px;
}

#game-screen .choice-btn:hover .choice-key {
    color: var(--gold);
    background: rgba(255, 215, 0, 0.2);
}

.choice-cost {
    display: inline-block;
    background: var(--gold);
    color: var(--black-figure);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: bold;
    margin-left: 8px;
}

.choice-requirement {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

/* Ending Screen - Compact */
#ending-screen {
    background: var(--black-figure);
    border: 2px solid var(--gold);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 5px 20px var(--shadow);
}

#ending-screen .ending-container {
    max-height: 500px;
    overflow-y: auto;
}

#ending-screen h2 {
    font-size: 1.3rem;
    margin-bottom: 10px;
}

#ending-screen .ending-narrative {
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 15px;
}

.ending-stats {
    background: rgba(244, 232, 208, 0.3);
    border: 2px solid var(--terracotta);
    border-radius: 6px;
    padding: 10px;
    margin: 10px 0;
}

.ending-stats h3 {
    color: var(--gold);
    margin-bottom: 8px;
    font-size: 1rem;
}

#final-stats-display {
    font-size: 0.85rem;
}

.eulogy-text {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px 20px;
    border-radius: 6px;
    /* border-left removed - v0.6.63 */
    line-height: 1.6;
    color: var(--black-figure);
    text-align: left;
    white-space: pre-line;
    font-style: italic;
    /* max-height removed - v0.6.63 */
}

.final-stat-label {
    font-size: 0.9rem;
    color: var(--parchment);
    opacity: 0.8;
}

.final-stat-value {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--gold);
}

/* Responsive - Already Mobile-First */
@media (max-width: 480px) {
    .game-frame {
        border-width: 4px;
        border-radius: 10px 10px 20px 20px;
        padding: 4px;
    }

    body {
        padding: 5px;
    }

    .narrative-text {
        font-size: 0.75rem;
    }

    #game-screen .choice-btn {
        font-size: 0.75rem;
        padding: 6px;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .game-frame {
        max-width: 480px;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

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

.shake {
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Retro Style Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--black-figure);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--terracotta);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gold);
}

/* Removed power light - too modern */

/* Compact everything for screen estate */
.game-frame {
    position: relative;
}

/* ========== CONTENT WARNING OVERLAY ========== */
.content-warning-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000; /* Above everything else */
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.5s ease;
}

.content-warning-modal {
    background: var(--parchment);
    border: 4px solid var(--terracotta);
    border-radius: 12px;
    padding: 30px;
    max-width: 550px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.8),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
    animation: slideIn 0.5s ease;
}

.warning-header {
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 3px solid var(--terracotta);
    padding-bottom: 15px;
}

.warning-header h2 {
    color: var(--terracotta);
    font-size: 26px;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.warning-body {
    color: var(--black-figure);
    font-size: 14px;
    line-height: 1.6;
}

.warning-intro {
    font-size: 16px;
    font-style: italic;
    color: var(--bronze);
    margin: 0 0 10px 0;
}

.warning-notice {
    font-size: 15px;
    color: var(--terracotta);
    margin: 0 0 20px 0;
    font-weight: bold;
}

.warning-content-list {
    background: rgba(139, 69, 19, 0.1);
    border-left: 4px solid var(--terracotta);
    padding: 15px;
    margin: 20px 0;
}

.warning-content-list p {
    margin: 0 0 10px 0;
    font-weight: bold;
    color: var(--bronze);
}

.warning-content-list ul {
    margin: 0;
    padding-left: 20px;
    list-style: none;
}

.warning-content-list li {
    margin: 8px 0;
    color: var(--black-figure);
    font-size: 14px;
}

.warning-content-list li::before {
    content: "•";
    color: var(--terracotta);
    font-weight: bold;
    display: inline-block;
    width: 1em;
    margin-left: -1em;
}

.warning-footer {
    margin: 20px 0 0 0;
    padding-top: 15px;
    border-top: 2px solid var(--bronze);
    text-align: center;
    font-size: 15px;
    color: var(--bronze);
}

.warning-footer strong {
    color: var(--terracotta);
    font-weight: bold;
    font-size: 16px;
}

.warning-actions {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.warning-actions button {
    width: 100%;
    padding: 14px 20px;
    font-size: 15px;
}

/* ========== HELP OVERLAY SYSTEM ========== */
.help-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.help-overlay.active {
    display: flex;
}

.help-modal {
    background: var(--parchment);
    border: 3px solid var(--terracotta);
    border-radius: 8px;
    padding: 20px;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    animation: slideIn 0.3s ease;
}

.help-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--terracotta);
    color: var(--parchment);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 24px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
}

.help-close-btn:hover {
    background: var(--gold);
    transform: scale(1.1);
}

.help-close-btn:active {
    transform: scale(0.95);
}

.help-modal h2 {
    color: var(--terracotta);
    font-size: 24px;
    margin: 0 0 20px 0;
    text-align: center;
    border-bottom: 2px solid var(--terracotta);
    padding-bottom: 10px;
}

.help-section {
    margin-bottom: 20px;
}

.help-section h3 {
    color: var(--bronze);
    font-size: 16px;
    margin: 0 0 8px 0;
}

.help-section p {
    color: var(--black-figure);
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}

.help-section strong {
    color: var(--terracotta);
    font-weight: bold;
}

.help-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--bronze);
    text-align: center;
}

.help-footer p {
    color: var(--bronze);
    font-style: italic;
    font-size: 12px;
    margin: 0;
}

.help-footer .version-info {
    margin-top: 10px;
    font-size: 11px;
    font-style: normal;
    color: var(--bronze);
    opacity: 0.7;
}

/* ========== EULOGY OVERLAY ========== */
.eulogy-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.eulogy-modal {
    background: var(--parchment);
    border: 3px solid var(--terracotta);
    border-radius: 8px;
    padding: 20px;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    animation: slideIn 0.3s ease;
}

.eulogy-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--terracotta);
    color: var(--parchment);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 24px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
}

.eulogy-close-btn:hover {
    background: var(--gold);
    transform: scale(1.1);
}

.eulogy-close-btn:active {
    transform: scale(0.95);
}

.eulogy-modal h2 {
    color: var(--terracotta);
    font-size: 24px;
    margin: 0 0 20px 0;
    text-align: center;
    border-bottom: 2px solid var(--terracotta);
    padding-bottom: 10px;
}

.eulogy-content {
    color: var(--black-figure);
    font-size: 14px;
    line-height: 1.6;
}

/* ========== START SCREEN FOOTER ========== */
.start-screen-footer {
    position: absolute;
    bottom: 40px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    font-size: 0.85rem;
}

.footer-version {
    color: var(--bronze);
}

.footer-link-btn {
    background: none;
    border: none;
    color: var(--gold);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.85rem;
    transition: color 0.2s ease;
}

.footer-link-btn:hover {
    color: var(--terracotta);
}

/* ========== DISCLAIMER OVERLAY ========== */
.disclaimer-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.disclaimer-modal {
    background: var(--parchment);
    border: 3px solid var(--terracotta);
    border-radius: 8px;
    padding: 20px;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    animation: slideIn 0.3s ease;
}

.disclaimer-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--terracotta);
    color: var(--parchment);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 24px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
}

.disclaimer-close-btn:hover {
    background: var(--gold);
    transform: scale(1.1);
}

.disclaimer-close-btn:active {
    transform: scale(0.95);
}

.disclaimer-modal h2 {
    color: var(--terracotta);
    font-size: 24px;
    margin: 0 0 20px 0;
    text-align: center;
    border-bottom: 2px solid var(--terracotta);
    padding-bottom: 10px;
}

.disclaimer-section {
    margin-bottom: 20px;
}

.disclaimer-section h3 {
    color: var(--bronze);
    font-size: 16px;
    margin: 0 0 8px 0;
}

.disclaimer-section p {
    color: var(--black-figure);
    font-size: 13px;
    line-height: 1.5;
    margin: 0 0 8px 0;
}

.disclaimer-section strong {
    color: var(--terracotta);
    font-weight: bold;
}

.disclaimer-section.important {
    background: rgba(139, 0, 0, 0.1);
    border-left: 4px solid var(--terracotta);
    padding: 15px;
    border-radius: 4px;
}

.disclaimer-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--bronze);
    text-align: center;
}

.disclaimer-footer p {
    color: var(--bronze);
    font-style: italic;
    font-size: 12px;
    margin: 0;
}


/* Read Eulogy link */
.eulogy-link-container {
    text-align: center;
    margin: 20px 0;
}

.read-eulogy-link {
    color: var(--gold);
    font-size: 1rem;
    font-weight: bold;
    text-decoration: underline;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
}

.read-eulogy-link:hover {
    color: var(--terracotta);
    transform: scale(1.05);
}

.read-eulogy-link:active {
    transform: scale(0.95);
}

/* ========== ENDING SCREEN UPDATES ========== */
#ending-screen .ending-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-height: 500px;
    overflow-y: auto;
    padding: 20px;
}

#ending-screen h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: var(--gold);
    text-align: center;
}

#ending-screen .ending-narrative {
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 20px;
    text-align: center;
    max-width: 600px;
}

#ending-screen .ending-actions {
    margin-top: auto;
    display: flex;
    gap: 10px;
    padding-top: 20px;
}


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

@keyframes slideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Help button specific style */
#help-button {
    font-weight: bold;
}

#help-button .nav-icon {
    font-weight: bold;
}

/* ========== MORPHEUS FAILSAFE OVERLAY ========== */
.morpheus-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 20, 0.95);
    z-index: 10001; /* Above content warning */
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.5s ease;
}

.morpheus-modal {
    background: linear-gradient(135deg, var(--parchment) 0%, #2a1f1f 100%);
    border: 4px solid var(--gold);
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    box-shadow: 0 12px 32px rgba(212, 175, 55, 0.4),
                0 0 60px rgba(212, 175, 55, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
    animation: slideIn 0.5s ease, glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { box-shadow: 0 12px 32px rgba(212, 175, 55, 0.4), 0 0 60px rgba(212, 175, 55, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
    50% { box-shadow: 0 12px 32px rgba(212, 175, 55, 0.6), 0 0 80px rgba(212, 175, 55, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3); }
}

.morpheus-header {
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 3px solid var(--gold);
    padding-bottom: 15px;
}

.morpheus-header h2 {
    color: var(--gold);
    font-size: 24px;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

.morpheus-body {
    color: var(--parchment);
    font-size: 15px;
    line-height: 1.8;
    text-align: center;
}

.morpheus-message {
    margin: 12px 0;
    color: #e8d4b8;
    font-style: italic;
}

.morpheus-signature {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid var(--gold);
    color: var(--gold);
    font-weight: bold;
    font-size: 14px;
    text-align: right;
}

.morpheus-actions {
    margin-top: 25px;
    display: flex;
    justify-content: center;
}

.morpheus-actions button {
    min-width: 150px;
    padding: 12px 24px;
    font-size: 15px;
}
