/* ========================================================================
   SURVIVE - Cemetery Horror Game
   Style System v1.0 Alpha
   Color Palette:
     #0a0a0a (void black)
     #1a1a1a (dark gray)
     #2a2a2a (medium dark)
     #8b0000 (blood red)
     #a33    (crimson accent)
     #d4c5a9 (bone/parchment)
     #666    (stone gray text)
     #444    (dark stone)
   Typography:
     Headings: Cinzel (serif, gravestone aesthetic)
     Body/UI:  Inter (clean sans-serif)
   ======================================================================== */

/* ---- CSS Custom Properties ---- */
:root {
    --color-void: #0a0a0a;
    --color-dark: #1a1a1a;
    --color-dark-mid: #2a2a2a;
    --color-blood: #8b0000;
    --color-crimson: #a33;
    --color-bone: #d4c5a9;
    --color-stone: #666;
    --color-iron: #444;
    --color-fog: rgba(212, 197, 169, 0.04);
    --font-heading: 'Cinzel', 'Times New Roman', serif;
    --font-body: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ---- Keyframe Animations ---- */
@keyframes fogDrift {
    0%   { transform: translateX(-30%) translateY(0); opacity: 0.3; }
    25%  { transform: translateX(-10%) translateY(-5%); opacity: 0.5; }
    50%  { transform: translateX(10%) translateY(2%); opacity: 0.35; }
    75%  { transform: translateX(30%) translateY(-3%); opacity: 0.5; }
    100% { transform: translateX(-30%) translateY(0); opacity: 0.3; }
}

@keyframes fogDrift2 {
    0%   { transform: translateX(20%) translateY(5%); opacity: 0.2; }
    50%  { transform: translateX(-20%) translateY(-5%); opacity: 0.4; }
    100% { transform: translateX(20%) translateY(5%); opacity: 0.2; }
}

@keyframes subtlePulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.85; }
}

@keyframes sanityPulse {
    0%, 100% { box-shadow: 0 0 4px rgba(139, 0, 0, 0.3); }
    50%      { box-shadow: 0 0 12px rgba(139, 0, 0, 0.8), 0 0 20px rgba(139, 0, 0, 0.4); }
}

@keyframes healthWarning {
    0%, 100% { border-color: var(--color-iron); }
    50%      { border-color: rgba(139, 0, 0, 0.6); }
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    92%      { opacity: 1; }
    93%      { opacity: 0.6; }
    94%      { opacity: 1; }
    96%      { opacity: 0.8; }
    97%      { opacity: 1; }
}

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

@keyframes breathe {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.02); }
}

/* ---- Base ---- */
body {
    margin: 0;
    overflow: hidden;
    font-family: var(--font-body);
    background-color: var(--color-void);
    color: #fff;
}

canvas { display: block; }

/* ========================================================================
   MAIN MENU
   ======================================================================== */

#main-menu {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    background-image: url('assets/cemetery_bg.png');
    background-size: cover;
    background-position: center;
    z-index: 100;
}

/* Fog layer behind content */
#menu-fog-layer {
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background:
        radial-gradient(ellipse 600px 200px at 30% 70%, rgba(212, 197, 169, 0.06) 0%, transparent 70%),
        radial-gradient(ellipse 800px 300px at 70% 60%, rgba(212, 197, 169, 0.04) 0%, transparent 70%),
        radial-gradient(ellipse 400px 150px at 50% 80%, rgba(139, 0, 0, 0.02) 0%, transparent 70%);
    animation: fogDrift 40s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

#menu-fog-layer::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse 500px 250px at 60% 50%, rgba(212, 197, 169, 0.04) 0%, transparent 60%),
        radial-gradient(ellipse 700px 200px at 20% 70%, rgba(100, 100, 100, 0.03) 0%, transparent 60%);
    animation: fogDrift2 55s ease-in-out infinite;
}

#menu-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom,
        rgba(10, 10, 10, 0.92) 0%,
        rgba(10, 10, 10, 0.7) 30%,
        rgba(10, 10, 10, 0.65) 50%,
        rgba(10, 10, 10, 0.75) 70%,
        rgba(10, 10, 10, 0.95) 100%);
    z-index: 1;
}

#menu-content {
    position: relative;
    width: 90%;
    max-width: 680px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
    animation: fadeInUp 1.2s ease-out;
    padding: 20px 0 40px 0;
    margin: auto 0;
}

/* ---- Menu Header ---- */
#menu-header {
    text-align: center;
    margin-bottom: 15px;
}

#game-logo {
    width: 100%;
    max-width: 500px;
    height: auto;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 30px rgba(139, 0, 0, 0.25));
    animation: breathe 8s ease-in-out infinite;
}

#menu-tagline {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 300;
    color: var(--color-bone);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 6px;
    opacity: 0.7;
}

#menu-studio {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 400;
    color: var(--color-stone);
    letter-spacing: 3px;
    text-transform: uppercase;
}

/* ---- Menu Options ---- */
#menu-options {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 360px;
    margin-bottom: 30px;
}

.menu-button {
    width: 100%;
    padding: 14px 0;
    margin: 6px 0;
    background-color: rgba(26, 26, 26, 0.8);
    color: var(--color-bone);
    border: 1px solid var(--color-iron);
    border-left: 3px solid var(--color-iron);
    border-right: 3px solid var(--color-iron);
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    box-sizing: border-box;
}

.menu-button:hover {
    background-color: rgba(42, 42, 42, 0.9);
    border-color: var(--color-crimson);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(139, 0, 0, 0.2), inset 0 0 30px rgba(139, 0, 0, 0.05);
    text-shadow: 0 0 10px rgba(139, 0, 0, 0.3);
}

.menu-button:active {
    transform: translateY(0);
    box-shadow: none;
}

.menu-button-secondary {
    background-color: rgba(20, 20, 20, 0.6);
    border-left-width: 1px;
    border-right-width: 1px;
    font-size: 14px;
    padding: 10px 0;
}

.menu-button-secondary:hover {
    background-color: rgba(35, 35, 35, 0.8);
}

.menu-button-row {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-top: 4px;
}

.menu-button-row .menu-button {
    flex: 1;
}

#start-game {
    background: linear-gradient(180deg, rgba(139, 0, 0, 0.5) 0%, rgba(80, 10, 10, 0.6) 100%);
    border-color: rgba(139, 0, 0, 0.5);
    border-left: 3px solid rgba(139, 0, 0, 0.6);
    border-right: 3px solid rgba(139, 0, 0, 0.6);
    color: #fff;
    font-size: 18px;
    padding: 16px 0;
    letter-spacing: 3px;
    margin-bottom: 14px;
}

#start-game:hover {
    background: linear-gradient(180deg, rgba(160, 10, 10, 0.7) 0%, rgba(100, 15, 15, 0.8) 100%);
    border-color: rgba(170, 50, 50, 0.8);
    box-shadow: 0 0 30px rgba(139, 0, 0, 0.3), inset 0 0 20px rgba(139, 0, 0, 0.1);
}

/* ---- Time & Quality Selection ---- */
#time-selection {
    width: 100%;
    margin: 8px 0;
    background-color: rgba(20, 20, 20, 0.7);
    border: 1px solid var(--color-iron);
    padding: 12px;
    box-sizing: border-box;
}

.time-label,
.quality-label {
    color: var(--color-bone);
    margin-bottom: 8px;
    text-align: center;
    font-family: var(--font-heading);
    font-weight: 400;
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0.7;
}

.time-options,
.quality-options {
    display: flex;
    justify-content: space-between;
    gap: 6px;
}

.time-option,
.quality-option {
    padding: 7px 0;
    flex: 1;
    text-align: center;
    background-color: rgba(30, 30, 30, 0.6);
    color: var(--color-stone);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 400;
}

.time-option:hover,
.quality-option:hover {
    background-color: rgba(50, 50, 50, 0.8);
    color: var(--color-bone);
}

.time-option.selected,
.quality-option.selected {
    background-color: rgba(139, 0, 0, 0.4);
    color: #fff;
    border-color: rgba(139, 0, 0, 0.5);
    box-shadow: 0 0 10px rgba(139, 0, 0, 0.2);
}

.quality-selection {
    width: 100%;
    margin: 6px 0;
    background-color: rgba(20, 20, 20, 0.7);
    border: 1px solid var(--color-iron);
    padding: 8px 10px;
    box-sizing: border-box;
}

/* ---- Fourth-Wall Settings ---- */
.settings-section {
    width: 100%;
    margin: 6px 0;
    background-color: rgba(20, 20, 20, 0.7);
    border: 1px solid var(--color-iron);
    padding: 8px 10px;
    box-sizing: border-box;
}

.settings-label {
    color: var(--color-bone);
    margin-bottom: 2px;
    font-family: var(--font-heading);
    font-weight: 400;
    font-size: 0.8rem;
    text-align: center;
}

.settings-description {
    color: #888;
    font-size: 0.65rem;
    text-align: center;
    margin-bottom: 6px;
    line-height: 1.2;
}

.toggle-setting {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--color-bone);
    font-size: 0.75rem;
    padding: 2px 0;
    cursor: pointer;
    user-select: none;
}

.toggle-setting.sub {
    padding-left: 16px;
    font-size: 0.7rem;
    color: #999;
}

.toggle-setting input[type="checkbox"] {
    accent-color: var(--color-blood);
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.fw-sub-settings {
    margin-top: 4px;
    border-top: 1px solid rgba(100, 100, 100, 0.3);
    padding-top: 4px;
}

/* ---- Feature Highlights ---- */
#menu-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
    max-width: 520px;
    width: 100%;
    padding: 0 10px;
    box-sizing: border-box;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--color-stone);
    font-family: var(--font-body);
    font-weight: 300;
    line-height: 1.4;
}

.feature-icon {
    font-size: 14px;
    opacity: 0.5;
    flex-shrink: 0;
    width: 18px;
    text-align: center;
}

/* ---- Version Info ---- */
#version-info {
    position: absolute;
    bottom: 12px;
    right: 16px;
    font-family: var(--font-body);
    font-size: 11px;
    color: var(--color-iron);
    z-index: 10;
    letter-spacing: 1px;
}

/* ========================================================================
   CONTROLS / HOW TO PLAY PANEL
   ======================================================================== */

#controls-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 10, 10, 0.92);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 102;
}

#controls-container {
    width: 85%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(26, 26, 26, 0.95) 0%, rgba(20, 20, 20, 0.98) 100%);
    padding: 20px 25px;
    border: 1px solid var(--color-iron);
    border-top: 2px solid rgba(139, 0, 0, 0.3);
}

#controls-container::-webkit-scrollbar {
    width: 4px;
}
#controls-container::-webkit-scrollbar-track {
    background: transparent;
}
#controls-container::-webkit-scrollbar-thumb {
    background: rgba(139, 0, 0, 0.3);
    border-radius: 2px;
}

#controls-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
    text-align: center;
    color: var(--color-bone);
    letter-spacing: 3px;
    text-transform: uppercase;
}

#controls-flavor {
    font-family: var(--font-body);
    font-size: 11px;
    font-style: italic;
    color: var(--color-stone);
    text-align: center;
    margin-bottom: 24px;
    line-height: 1.5;
}

#controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 20px;
}

.control-item {
    display: flex;
    align-items: center;
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--color-bone);
}

.key {
    background-color: rgba(20, 20, 20, 0.8);
    color: var(--color-bone);
    padding: 4px 10px;
    margin-right: 10px;
    min-width: 24px;
    text-align: center;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 1px;
    border: 1px solid var(--color-iron);
    border-bottom: 2px solid var(--color-iron);
    font-family: var(--font-body);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

#controls-tips {
    border-top: 1px solid rgba(68, 68, 68, 0.4);
    padding-top: 8px;
    margin-bottom: 10px;
}

.tip-item {
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--color-stone);
    margin-bottom: 8px;
    padding-left: 12px;
    border-left: 2px solid rgba(139, 0, 0, 0.3);
    line-height: 1.4;
}

#back-button {
    align-self: center;
    padding: 10px 30px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    display: block;
    margin: 0 auto;
    width: auto;
}

/* ========================================================================
   CREDITS PANEL
   ======================================================================== */

#credits-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 10, 10, 0.92);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 102;
}

#credits-container {
    width: 85%;
    max-width: 600px;
    background: linear-gradient(180deg, rgba(26, 26, 26, 0.95) 0%, rgba(20, 20, 20, 0.98) 100%);
    padding: 35px;
    border: 1px solid var(--color-iron);
    border-top: 2px solid rgba(139, 0, 0, 0.3);
    max-height: 80vh;
    overflow-y: auto;
}

#credits-title {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
    text-align: center;
    color: var(--color-bone);
    letter-spacing: 6px;
    text-transform: uppercase;
}

#credits-version {
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--color-stone);
    text-align: center;
    margin-bottom: 24px;
    letter-spacing: 2px;
}

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

.credits-section h3 {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 600;
    color: var(--color-bone);
    border-bottom: 1px solid rgba(68, 68, 68, 0.4);
    padding-bottom: 6px;
    margin-bottom: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.credits-section p {
    margin: 5px 0;
    color: var(--color-stone);
    line-height: 1.6;
    font-size: 13px;
}

.credits-quote {
    font-style: italic;
    color: rgba(212, 197, 169, 0.5) !important;
    font-size: 13px !important;
    line-height: 1.6;
}

.credits-detail {
    font-size: 12px !important;
    opacity: 0.7;
}

.credits-section a {
    color: rgba(212, 197, 169, 0.6);
    text-decoration: none;
    transition: color 0.2s ease, text-shadow 0.2s ease;
    border-bottom: 1px solid rgba(212, 197, 169, 0.15);
}

.credits-section a:hover {
    color: var(--color-bone);
    text-shadow: 0 0 8px rgba(212, 197, 169, 0.3);
    border-bottom-color: rgba(212, 197, 169, 0.4);
}

.credits-free p {
    font-family: var(--font-heading);
    font-size: 14px !important;
    color: var(--color-bone) !important;
    text-align: center;
    letter-spacing: 3px;
    text-transform: uppercase;
    opacity: 0.5;
    margin-top: 10px;
}

#credits-back-button {
    display: block;
    margin: 10px auto 0;
    width: auto;
    padding: 10px 30px;
}

/* ========================================================================
   LOADING SCREEN
   ======================================================================== */

#loading-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--color-void);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 103;
}

#loading-title {
    font-family: var(--font-heading);
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 30px;
    color: var(--color-bone);
    letter-spacing: 10px;
    text-transform: uppercase;
    animation: subtlePulse 3s ease-in-out infinite;
}

#loading-bar-container {
    width: 50%;
    max-width: 400px;
    height: 4px;
    background-color: rgba(42, 42, 42, 0.5);
    overflow: hidden;
    margin-bottom: 20px;
    border: 1px solid rgba(68, 68, 68, 0.3);
}

#loading-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(to right, var(--color-blood), #c00);
    transition: width 0.5s ease;
}

#loading-text {
    color: var(--color-stone);
    font-family: var(--font-body);
    font-size: 12px;
    letter-spacing: 1px;
}

/* ========================================================================
   PAUSE / CLICK-TO-PLAY OVERLAY
   ======================================================================== */

#click-to-play {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 10, 10, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 104;
    cursor: pointer;
}

#click-to-play-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    animation: fadeInUp 0.4s ease-out;
}

#pause-title {
    font-family: var(--font-heading);
    font-size: 36px;
    font-weight: 700;
    color: var(--color-bone);
    letter-spacing: 10px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

#pause-stats {
    display: flex;
    gap: 30px;
    margin-bottom: 10px;
}

.pause-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.pause-stat-label {
    font-family: var(--font-body);
    font-size: 10px;
    color: var(--color-stone);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.pause-stat-value {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 600;
    color: var(--color-bone);
}

#click-to-play-text {
    padding: 14px 40px;
    background: linear-gradient(180deg, rgba(139, 0, 0, 0.4) 0%, rgba(80, 10, 10, 0.5) 100%);
    color: #fff;
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-align: center;
    border: 1px solid rgba(139, 0, 0, 0.4);
    transition: all 0.3s ease;
}

#click-to-play:hover #click-to-play-text {
    background: linear-gradient(180deg, rgba(160, 10, 10, 0.6) 0%, rgba(100, 15, 15, 0.7) 100%);
    border-color: rgba(170, 50, 50, 0.6);
    box-shadow: 0 0 25px rgba(139, 0, 0, 0.3);
    transform: scale(1.02);
}

#pause-return-menu {
    width: auto;
    padding: 8px 24px;
    font-size: 12px;
    opacity: 0.7;
    transition: all 0.2s ease;
}

#pause-return-menu:hover {
    opacity: 1;
}

#click-to-play-credit {
    color: rgba(212, 197, 169, 0.3);
    font-family: var(--font-heading);
    font-size: 11px;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-top: 8px;
}

#pause-version {
    color: rgba(102, 102, 102, 0.4);
    font-family: var(--font-body);
    font-size: 10px;
    letter-spacing: 1px;
}

/* ========================================================================
   IN-GAME UI (HUD)
   ======================================================================== */

/* Crosshair */
#crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 2px;
    background-color: rgba(212, 197, 169, 0.6);
    transform: translate(-50%, -50%);
    pointer-events: none;
    box-shadow: 0 0 3px rgba(212, 197, 169, 0.3);
    display: none;
}

#crosshair::before,
#crosshair::after {
    content: '';
    position: absolute;
    background-color: rgba(212, 197, 169, 0.4);
}

#crosshair::before {
    width: 8px;
    height: 1px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#crosshair::after {
    width: 1px;
    height: 8px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Status Bars Panel */
#ui {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: linear-gradient(180deg, rgba(10, 10, 10, 0.75) 0%, rgba(10, 10, 10, 0.85) 100%);
    padding: 14px 16px;
    color: white;
    font-size: 14px;
    display: none;
    border: 1px solid rgba(68, 68, 68, 0.3);
    border-left: 2px solid rgba(139, 0, 0, 0.2);
    min-width: 200px;
}

.ui-section {
    margin-bottom: 10px;
}

.ui-section:last-child {
    margin-bottom: 0;
}

.ui-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3px;
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 500;
    color: rgba(212, 197, 169, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.progress-container {
    width: 100%;
    height: 6px;
    background-color: rgba(10, 10, 10, 0.6);
    overflow: hidden;
    border: 1px solid rgba(68, 68, 68, 0.3);
}

/* Health bar with low-health warning animation */
#health-bar {
    height: 100%;
    background: linear-gradient(90deg, #1a4d1a, #2d8c2d);
    width: 100%;
    transition: width 0.3s ease;
}

.health-critical .progress-container {
    animation: healthWarning 1.5s ease-in-out infinite;
}

.health-critical #health-bar {
    background: linear-gradient(90deg, #4d0000, #8b0000);
}

/* Sanity bar with low-sanity pulse */
#sanity-bar {
    height: 100%;
    background: linear-gradient(90deg, #2d0066, #6633cc);
    width: 100%;
    transition: width 0.3s ease;
}

.sanity-low #sanity-bar {
    animation: sanityPulse 2s ease-in-out infinite;
    background: linear-gradient(90deg, #4d0000, #8b0033);
}

#stamina-bar {
    height: 100%;
    background: linear-gradient(90deg, #806600, #b38f00);
    width: 100%;
    transition: width 0.3s ease;
}

#flashlight-bar {
    height: 100%;
    background: linear-gradient(90deg, #808000, #cccc33);
    width: 100%;
    transition: width 0.3s ease;
}

/* Flashlight icon */
.flashlight-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    background-color: #555;
    border-radius: 3px 3px 8px 8px;
    position: relative;
    vertical-align: middle;
}

.flashlight-icon:before {
    content: '';
    position: absolute;
    width: 10px;
    height: 5px;
    background-color: #ffcc00;
    border-radius: 50% 50% 0 0;
    top: -2px;
    left: 3px;
}

.flashlight-icon:after {
    content: '';
    position: absolute;
    width: 8px;
    height: 10px;
    background-color: rgba(255, 255, 153, 0.6);
    border-radius: 0 0 50% 50%;
    bottom: -6px;
    left: 4px;
    filter: blur(3px);
}

/* World Time */
#world-time {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(10, 10, 10, 0.7);
    padding: 6px 14px;
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 400;
    display: none;
    border: 1px solid rgba(68, 68, 68, 0.3);
    letter-spacing: 2px;
    color: var(--color-bone);
}

/* ========================================================================
   INVENTORY HOTBAR
   ======================================================================== */

#inventory-hotbar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    justify-content: center;
    background: rgba(10, 10, 10, 0.7);
    padding: 8px;
    border: 1px solid rgba(68, 68, 68, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 100;
}

.hotbar-slot {
    width: 56px;
    height: 56px;
    background-color: rgba(26, 26, 26, 0.6);
    border: 1px solid rgba(68, 68, 68, 0.4);
    margin: 0 4px;
    position: relative;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.5);
    transition: all 0.2s ease;
}

.hotbar-slot.selected {
    border-color: var(--color-bone);
    box-shadow: 0 0 10px rgba(212, 197, 169, 0.15), inset 0 0 5px rgba(0, 0, 0, 0.5);
    transform: translateY(-3px);
    background-color: rgba(42, 42, 42, 0.7);
}

.hotbar-item-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 14px;
    cursor: pointer;
}

.hotbar-key {
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(20, 20, 20, 0.9);
    color: var(--color-stone);
    padding: 1px 6px;
    font-family: var(--font-body);
    font-size: 10px;
    border: 1px solid rgba(68, 68, 68, 0.4);
}

.hotbar-item {
    width: 38px;
    height: 38px;
    background-color: rgba(60, 60, 60, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    font-weight: bold;
    color: #eee;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.7);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5));
}

/* Item icon types */
.hotbar-item.key { background-color: #8a6620; }
.hotbar-item.coin { background-color: #9a8833; }
.hotbar-item.relic { background-color: #556677; }
.hotbar-item.battery { background-color: #5a8815; box-shadow: 0 0 4px rgba(136, 204, 34, 0.5); }
.hotbar-item.small-battery { background-color: #5a8815; box-shadow: 0 0 4px rgba(136, 204, 34, 0.3); }
.hotbar-item.standard-battery { background-color: #2a7a0a; box-shadow: 0 0 6px rgba(68, 170, 17, 0.5); }
.hotbar-item.heavy-battery { background-color: #11cc00; box-shadow: 0 0 8px rgba(34, 255, 0, 0.6); }
.hotbar-item.matches { background-color: #8a4420; box-shadow: 0 0 3px rgba(204, 102, 51, 0.3); }
.hotbar-item.sedative { background-color: #442288; box-shadow: 0 0 4px rgba(102, 51, 204, 0.4); }
.hotbar-item.compass { background-color: #8a6620; box-shadow: 0 0 4px rgba(204, 153, 51, 0.4); }
.hotbar-item.journal-page { background-color: #6a5a3a; box-shadow: 0 0 4px rgba(212, 197, 160, 0.4); }
.hotbar-item.mysterious { background-color: #777; }

/* ========================================================================
   PROMPTS & HINTS
   ======================================================================== */

#interaction-prompt {
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 10, 10, 0.8);
    padding: 8px 16px;
    color: var(--color-bone);
    font-family: var(--font-body);
    font-size: 13px;
    display: none;
    pointer-events: none;
    border: 1px solid rgba(68, 68, 68, 0.3);
    text-align: center;
}

#drop-prompt {
    position: absolute;
    top: 65%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 10, 10, 0.8);
    padding: 8px 16px;
    color: var(--color-bone);
    font-family: var(--font-body);
    font-size: 13px;
    display: none;
    pointer-events: none;
    border: 1px solid rgba(68, 68, 68, 0.3);
    text-align: center;
}

#recharge-prompt {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(10, 10, 10, 0.85);
    padding: 8px 16px;
    color: #88cc22;
    font-family: var(--font-body);
    font-size: 13px;
    display: none;
    pointer-events: none;
    border: 1px solid rgba(100, 160, 30, 0.4);
    text-align: center;
    animation: pulse-recharge 2s ease-in-out infinite;
}

@keyframes pulse-recharge {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

.key-hint {
    display: inline-block;
    background-color: rgba(20, 20, 20, 0.8);
    color: var(--color-bone);
    padding: 2px 8px;
    margin: 0 4px;
    border: 1px solid var(--color-iron);
    border-bottom: 2px solid var(--color-iron);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 11px;
}

/* ========================================================================
   DEBUG PANEL
   ======================================================================== */

#debug-panel {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 300px;
    background-color: rgba(0, 0, 0, 0.8);
    border: 1px solid #444;
    border-radius: 5px;
    color: #fff;
    font-family: monospace;
    font-size: 12px;
    z-index: 1000;
    padding: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease;
    overflow-y: auto;
    max-height: 90vh;
}

.debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: bold;
    border-bottom: 1px solid #444;
    padding-bottom: 5px;
}

.debug-close {
    background-color: #600;
    color: white;
    border: none;
    border-radius: 3px;
    width: 20px;
    height: 20px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    font-size: 10px;
}

.debug-close:hover { background-color: #900; }

.debug-slider-container { margin-bottom: 8px; }
.debug-slider-container label { display: inline-block; width: 150px; }
.debug-value { display: inline-block; width: 30px; text-align: right; margin-right: 5px; }

.debug-slider {
    width: 100%;
    height: 5px;
    margin-top: 5px;
    background: #333;
    outline: none;
    border-radius: 3px;
}

.debug-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 15px;
    background: #a33;
    cursor: pointer;
    border-radius: 2px;
}

.debug-slider::-moz-range-thumb {
    width: 10px;
    height: 15px;
    background: #a33;
    cursor: pointer;
    border-radius: 2px;
}

.debug-toggle-container {
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.debug-toggle-container label { flex-grow: 1; }
.debug-toggle { width: 20px; height: 20px; cursor: pointer; }

.debug-reset-button {
    width: 100%;
    background-color: #333;
    color: white;
    border: 1px solid #555;
    border-radius: 3px;
    padding: 5px;
    margin-top: 10px;
    cursor: pointer;
}

.debug-reset-button:hover { background-color: #444; }

/* ========================================================================
   SOUND CONTROLS
   ======================================================================== */

.sound-controls {
    margin-top: 20px;
    border-top: 1px solid rgba(68, 68, 68, 0.4);
    padding-top: 15px;
}

.sound-controls h3 {
    margin-bottom: 15px;
    color: var(--color-bone);
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.control-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.control-row label {
    flex: 0 0 140px;
    margin-right: 10px;
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--color-stone);
}

.control-row input[type="range"] {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(42, 42, 42, 0.6);
    outline: none;
}

.control-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-crimson);
    cursor: pointer;
    border: 1px solid var(--color-iron);
}

.control-row input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-crimson);
    cursor: pointer;
    border: 1px solid var(--color-iron);
}

.control-row span {
    flex: 0 0 50px;
    text-align: right;
    margin-left: 10px;
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--color-stone);
}

.control-row input[type="checkbox"] {
    margin-left: 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ========================================================================
   SCROLLBAR (for credits panel overflow)
   ======================================================================== */

#credits-container::-webkit-scrollbar {
    width: 4px;
}

#credits-container::-webkit-scrollbar-track {
    background: rgba(10, 10, 10, 0.5);
}

#credits-container::-webkit-scrollbar-thumb {
    background: rgba(68, 68, 68, 0.5);
}

#credits-container::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 102, 102, 0.5);
}

/* ========================================================================
   SURVIVAL TIMER & SESSION HUD
   ======================================================================== */

/* Timer sits inside #world-time, separated by a divider */
.hud-timer {
    margin-left: 12px;
    padding-left: 12px;
    border-left: 1px solid rgba(68, 68, 68, 0.4);
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 2px;
    color: rgba(212, 197, 169, 0.6);
}

/* ========================================================================
   BATTERY WARNING STATES
   ======================================================================== */

/* Low battery (<30%) — pulsing red border and bar */
@keyframes batteryPulse {
    0%, 100% {
        border-color: rgba(68, 68, 68, 0.3);
    }
    50% {
        border-color: rgba(180, 0, 0, 0.7);
        box-shadow: 0 0 8px rgba(180, 0, 0, 0.3);
    }
}

@keyframes batteryBarPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

#flashlight-status.battery-low {
    animation: batteryPulse 1.5s ease-in-out infinite;
}

#flashlight-status.battery-low #flashlight-bar {
    background: linear-gradient(90deg, #800000, #cc3300) !important;
    animation: batteryBarPulse 1.5s ease-in-out infinite;
}

/* Dead battery (0%) — static red, show "NO BATTERY" label */
#flashlight-status.battery-dead .ui-label span:first-child::after {
    content: ' - NO BATTERY';
    color: #cc0000;
    font-size: 9px;
    letter-spacing: 1px;
    font-weight: 600;
}

#flashlight-status.battery-dead #flashlight-bar {
    background: linear-gradient(90deg, #330000, #660000) !important;
    width: 0% !important;
}

#flashlight-status.battery-dead {
    border-color: rgba(180, 0, 0, 0.5);
}

/* ========================================================================
   DEATH SCREEN STATS
   ======================================================================== */

.death-stats {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    margin-bottom: 20px;
    padding: 16px 24px;
    background: rgba(20, 20, 20, 0.6);
    border: 1px solid rgba(68, 68, 68, 0.2);
    min-width: 220px;
}

.death-stat-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    letter-spacing: 1px;
}

.death-stat-label {
    color: rgba(212, 197, 169, 0.5);
    text-transform: uppercase;
    font-size: 10px;
}

.death-stat-value {
    color: rgba(212, 197, 169, 0.8);
    font-size: 14px;
}

.death-stat-divider {
    width: 100%;
    height: 1px;
    background: rgba(68, 68, 68, 0.3);
    margin: 4px 0;
}

.death-total-deaths {
    color: rgba(139, 0, 0, 0.7);
    font-family: var(--font-heading);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 4px;
}
