@import url('https://fonts.googleapis.com/css2?family=Special+Elite&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
    --bg-dark: #1b120c;
    --panel-bg: #f4eccf;
    --panel-border: #8c7255;
    --panel-border-hover: #5c4033;
    
    --primary: #9e5828;
    --primary-glow: rgba(158, 88, 40, 0.15);
    --safe: #4e7a53;
    --safe-glow: rgba(78, 122, 83, 0.15);
    --danger: #b03a2e;
    --danger-glow: rgba(176, 58, 46, 0.15);
    --warning: #cc802b;
    --warning-glow: rgba(204, 128, 43, 0.15);
    --rare: #7d5a8c;
    --rare-glow: rgba(125, 90, 140, 0.15);
    
    --text-main: #2e1d11;
    --text-muted: #735d49;
    --text-dark: #f4eccf;
    
    --transition-speed: 0.12s;
    --card-shadow: 0 4px 8px rgba(46, 29, 17, 0.12);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'JetBrains Mono', monospace;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image: 
        radial-gradient(circle at center, rgba(140, 100, 70, 0.12) 0%, transparent 80%),
        repeating-linear-gradient(rgba(0, 0, 0, 0.2) 0px, rgba(0, 0, 0, 0.2) 1px, transparent 1px, transparent 3px);
    background-attachment: fixed;
}

/* 4:3 CRT Cabinet Bezel & Container */
.game-container {
    display: flex;
    flex-direction: column;
    width: 95vw;
    height: 71.25vw; /* 4:3 Aspect Ratio */
    max-width: 1100px;
    max-height: 825px;
    padding: 20px;
    gap: 12px;
    background-color: #dfd2bc; /* vintage beige cabinet base */
    border: 14px solid #4a3124; /* deep wood bezel */
    border-radius: 20px;
    box-shadow: 
        inset 0 0 40px rgba(0,0,0,0.35), 
        0 15px 40px rgba(0,0,0,0.85),
        0 0 0 6px #8c6f4f,
        0 0 0 10px #2e1d11;
    overflow: hidden;
    position: relative;
}

@media (min-aspect-ratio: 4/3) {
    .game-container {
        height: 95vh;
        width: 126.67vh;
    }
}

/* Screen CRT Scanline Overlay */
.game-container::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(rgba(46, 29, 17, 0) 50%, rgba(46, 29, 17, 0.05) 50%);
    background-size: 100% 4px;
    z-index: 999;
    pointer-events: none;
    border-radius: 4px;
}

/* Header Area */
header {
    height: 55px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    background: rgba(244, 236, 207, 0.8);
    border: 2px solid var(--text-main);
    border-radius: 8px;
    box-shadow: 3px 3px 0 rgba(46, 29, 17, 0.15);
    flex-shrink: 0;
    position: relative;
    z-index: 5;
}

.logo {
    font-family: 'Special Elite', cursive, Georgia, serif;
    font-weight: 800;
    font-size: 1.4rem;
    letter-spacing: 1px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo i {
    color: var(--primary);
    filter: drop-shadow(0 0 2px var(--primary-glow));
}

.time-display {
    display: flex;
    align-items: center;
    gap: 15px;
}

.day-badge {
    background: var(--primary);
    color: var(--text-dark);
    padding: 4px 12px;
    border: 2px solid var(--text-main);
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.85rem;
    font-family: 'Special Elite', cursive, Georgia, serif;
    box-shadow: 2px 2px 0 var(--text-main);
}

.clock {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.4);
    padding: 3px 10px;
    border-radius: 4px;
    border: 2px solid var(--text-main);
}

/* Main Layout Grid */
.main-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 12px;
    flex: 1;
    min-height: 0;
    position: relative;
    z-index: 5;
}

/* Base Panel Styles */
.panel {
    background: var(--panel-bg);
    border: 2px solid var(--panel-border);
    border-radius: 8px;
    box-shadow: 4px 4px 0 rgba(46, 29, 17, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.panel:hover {
    border-color: var(--panel-border-hover);
    box-shadow: 4px 4px 0 rgba(46, 29, 17, 0.15);
}

.panel-header {
    padding: 12px 16px;
    border-bottom: 2px solid var(--panel-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(46, 29, 17, 0.04);
    flex-shrink: 0;
}

.panel-title {
    font-family: 'Special Elite', cursive, Georgia, serif;
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    min-height: 0;
}

/* Back Button in header */
.btn-back {
    background: #fffdf5;
    border: 2px solid var(--text-main);
    color: var(--text-main);
    padding: 4px 10px;
    border-radius: 6px;
    font-family: 'Special Elite', cursive, Georgia, serif;
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 2px 2px 0 var(--text-main);
    transition: all var(--transition-speed);
}

.btn-back:hover {
    background: #fff;
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--text-main);
}

.btn-back:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 var(--text-main);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(46, 29, 17, 0.03);
}
::-webkit-scrollbar-thumb {
    background: var(--panel-border);
    border: 2px solid var(--text-main);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Left Column: Character Status & Equipment */
.left-panel {
    height: 100%;
}

.status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.status-bar-container {
    background: rgba(46, 29, 17, 0.03);
    border: 2px solid rgba(46, 29, 17, 0.12);
    border-radius: 6px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.status-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    display: flex;
    justify-content: space-between;
}

.status-val {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
}

.status-bar {
    height: 8px;
    background: rgba(46, 29, 17, 0.1);
    border: 1px solid var(--text-main);
    border-radius: 2px;
    overflow: hidden;
}

.status-fill {
    height: 100%;
    width: 100%;
    border-radius: 0px;
    transition: width 0.3s ease-out;
}

.fill-hp { background: var(--safe); }
.fill-hunger { background: var(--danger); }
.fill-thirst { background: var(--warning); }
.fill-stamina { background: var(--primary); }

.buffs-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    max-height: 60px;
    overflow-y: auto;
}
.buff-badge {
    font-size: 0.65rem;
    padding: 3px 6px;
    border-radius: 4px;
    background: rgba(125, 90, 140, 0.12);
    border: 1px solid rgba(125, 90, 140, 0.3);
    color: #4a285a;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 3px;
}
.buff-badge.debuff {
    background: rgba(176, 58, 46, 0.12);
    border: 1px solid rgba(176, 58, 46, 0.3);
    color: #801a10;
}

/* Character Graphic Silhouette overlay */
.character-area {
    display: flex;
    position: relative;
    height: calc(100% - 140px);
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    background: rgba(46, 29, 17, 0.02);
    border: 2px dashed var(--panel-border);
}

.character-silhouette {
    width: 55%;
    height: 80%;
    stroke: var(--text-muted);
    stroke-width: 2.2;
    fill: rgba(46, 29, 17, 0.04);
    stroke-linecap: round;
    stroke-linejoin: round;
}

.eq-slot {
    position: absolute;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.6);
    border: 2px dashed var(--panel-border);
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all var(--transition-speed);
}

.eq-slot:hover {
    border-color: var(--text-main);
    background: #fff;
    box-shadow: 2px 2px 0 var(--text-main);
}

.eq-slot.equipped {
    border: 2px solid var(--text-main);
    background: #fff;
    box-shadow: 2px 2px 0 rgba(46, 29, 17, 0.2);
}

.eq-slot::after {
    content: attr(data-slot-label);
    position: absolute;
    bottom: -15px;
    font-size: 0.55rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.slot-helmet { top: 5%; left: 50%; transform: translateX(-50%); }
.slot-weapon { top: 35%; left: 6%; }
.slot-cloth  { top: 35%; left: 50%; transform: translateX(-50%); }
.slot-pants  { top: 62%; left: 50%; transform: translateX(-50%); }
.slot-shoes  { bottom: 5%; left: 50%; transform: translateX(-50%); }

.slot-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.4;
}
.eq-slot.equipped .slot-icon {
    opacity: 1;
}

/* Right Panel: Split layout (Log + Menu) */
.right-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    min-height: 0;
}

.log-panel {
    height: 38%;
    min-height: 180px;
}

.menu-panel {
    height: 62%;
    flex: 1;
    min-height: 0;
}

/* Log Box Container */
.log-box {
    background: rgba(255, 255, 255, 0.4);
    border: 2px solid var(--panel-border);
    border-radius: 8px;
    padding: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    line-height: 1.45;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.log-entry {
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(46, 29, 17, 0.05);
    animation: fadeIn 0.12s ease-out;
}

.log-system { color: var(--text-muted); }
.log-loot { color: var(--safe); font-weight: 700; }
.log-danger { color: var(--danger); font-weight: 700; }
.log-combat-player { color: var(--primary); font-weight: 700; }
.log-combat-enemy { color: var(--warning); font-weight: 700; }
.log-day { 
    color: var(--text-main); 
    font-family: 'Special Elite', cursive, Georgia, serif;
    font-weight: 700; 
    border-bottom: 2px solid var(--panel-border); 
    padding: 4px 0; 
    font-size: 0.85rem;
}
.log-day::before {
    content: "📜 ";
}
.log-craft { color: var(--rare); font-weight: 700; }

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

/* Dynamic Content Areas */
.menu-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.menu-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* 1. Root Main Menu Grid (2x2 Grid of big buttons) */
.menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 12px;
    height: 100%;
    padding: 4px;
}

.btn-menu-main {
    background: #fffdf5;
    border: 2px solid var(--text-main);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    box-shadow: 4px 4px 0 var(--text-main);
    transition: all var(--transition-speed) ease;
}

.btn-menu-main:hover {
    background: #fff;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--text-main);
}

.btn-menu-main:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 var(--text-main);
}

.btn-menu-icon {
    font-size: 2.2rem;
}

.btn-menu-text {
    font-family: 'Special Elite', cursive, Georgia, serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
    letter-spacing: 0.5px;
}

/* 2. Scavenge View Grid */
.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
    overflow-y: auto;
    padding: 4px;
    flex: 1;
    min-height: 0;
}

.action-card {
    background: rgba(255, 255, 255, 0.4);
    border: 2px solid var(--panel-border);
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    box-shadow: 2px 2px 0 rgba(46, 29, 17, 0.05);
    transition: all var(--transition-speed);
}

.action-card:hover:not(.locked) {
    background: #fff;
    border-color: var(--text-main);
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--text-main);
}

.action-card:active:not(.locked) {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 var(--text-main);
}

.action-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.action-name {
    font-weight: 700;
    font-size: 0.9rem;
}

.action-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.danger-tag {
    font-weight: 800;
}
.danger-low { color: var(--safe); }
.danger-medium { color: var(--warning); }
.danger-high { color: var(--danger); }
.danger-very_high { color: var(--rare); }

.action-cost {
    text-align: right;
}

.cost-stamina {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 700;
}

.cost-time {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* 3. Crafting View Tabs & Recipes */
.crafting-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--panel-border);
    padding-bottom: 8px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.crafting-tab {
    background: none;
    border: 2px solid transparent;
    color: var(--text-muted);
    font-family: 'Special Elite', cursive, Georgia, serif;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 6px;
    transition: all var(--transition-speed);
}

.crafting-tab:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.3);
}

.crafting-tab.active {
    color: var(--text-main);
    background: #fffdf5;
    border-color: var(--text-main);
    box-shadow: 2px 2px 0 var(--text-main);
}

.recipe-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    padding: 4px;
}

.recipe-card {
    background: rgba(255, 255, 255, 0.4);
    border: 2px solid var(--panel-border);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 2px 2px 0 rgba(46, 29, 17, 0.05);
    transition: all var(--transition-speed);
    flex-shrink: 0;
}

.recipe-card:hover {
    border-color: var(--text-main);
    background: rgba(255, 255, 255, 0.6);
}

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

.recipe-name {
    font-weight: 700;
    font-size: 0.85rem;
}

.recipe-type {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.recipe-details {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.recipe-reqs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.req-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.req-badge.satisfied {
    background: rgba(78, 122, 83, 0.1);
    border: 1px solid rgba(78, 122, 83, 0.3);
    color: #3b5c3e;
    font-weight: 700;
}

.req-badge.insufficient {
    background: rgba(176, 58, 46, 0.1);
    border: 1px solid rgba(176, 58, 46, 0.3);
    color: #922b21;
    font-weight: 700;
}

.btn-craft {
    background: #fffdf5;
    border: 2px solid var(--text-main);
    color: var(--text-main);
    font-family: 'Special Elite', cursive, Georgia, serif;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 2px 2px 0 var(--text-main);
    transition: all var(--transition-speed);
}

.btn-craft:hover:not(:disabled) {
    background: var(--primary);
    color: var(--text-dark);
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--text-main);
}

.btn-craft:active:not(:disabled) {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 var(--text-main);
}

.btn-craft:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
    background: rgba(46, 29, 17, 0.05);
    border-color: var(--panel-border);
    color: var(--text-muted);
}

/* 4. Inventory Layout Structure */
.inventory-layout {
    display: grid;
    grid-template-columns: 1fr 240px;
    gap: 12px;
    height: 100%;
    min-height: 0;
}

.inventory-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
    min-height: 0;
}

.inventory-weight {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 700;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(55px, 1fr));
    grid-auto-rows: 55px;
    gap: 6px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.inv-item {
    background: rgba(255, 255, 255, 0.5);
    border: 2px solid var(--panel-border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    cursor: pointer;
    box-shadow: 2px 2px 0 rgba(46, 29, 17, 0.05);
    transition: all var(--transition-speed);
}

.inv-item:hover {
    background: #fff;
    border-color: var(--text-main);
}

.inv-item.selected {
    border-color: var(--text-main);
    background: #fffdf5;
    box-shadow: 2px 2px 0 var(--text-main);
}

.inv-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

/* PNG icon images used in place of emojis */
.item-icon {
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
    image-rendering: pixelated;
}

.inv-item-count {
    position: absolute;
    bottom: 3px;
    right: 5px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    font-weight: 700;
    background: var(--text-main);
    color: var(--text-dark);
    padding: 1px 4px;
    border-radius: 3px;
}

.inventory-right {
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid var(--panel-border);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.empty-detail-placeholder {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-align: center;
    padding: 16px;
    border: 2px dashed var(--panel-border);
    border-radius: 8px;
    background: transparent;
}

.item-detail-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.item-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.item-detail-name {
    font-family: 'Special Elite', cursive, Georgia, serif;
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--primary);
}

.item-detail-rarity {
    font-size: 0.6rem;
    text-transform: uppercase;
    font-weight: 700;
    border-radius: 4px;
    padding: 2px 6px;
    border: 1px solid currentColor;
}

.item-detail-rarity.rarity-common { color: var(--text-muted); }
.item-detail-rarity.rarity-uncommon { color: var(--primary); }
.item-detail-rarity.rarity-rare { color: var(--rare); }

.item-detail-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    line-height: 1.4;
}

.item-detail-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: auto;
}

.item-stat-badge {
    background: rgba(255, 255, 255, 0.6);
    padding: 4px 6px;
    border-radius: 4px;
    border: 1px solid var(--panel-border);
    font-size: 0.7rem;
    font-weight: 600;
}

.btn-action-main {
    background: #fffdf5;
    border: 2px solid var(--text-main);
    color: var(--text-main);
    font-family: 'Special Elite', cursive, Georgia, serif;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 2px 2px 0 var(--text-main);
    transition: all var(--transition-speed);
    width: 100%;
    flex-shrink: 0;
}

.btn-action-main:hover {
    background: var(--primary);
    color: var(--text-dark);
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--text-main);
}

.btn-action-main:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 var(--text-main);
}

/* 5. Camp View Options */
.camp-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.camp-card {
    background: rgba(255, 255, 255, 0.4);
    border: 2px solid var(--panel-border);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    gap: 16px;
    cursor: pointer;
    box-shadow: 2px 2px 0 rgba(46, 29, 17, 0.05);
    transition: all var(--transition-speed);
    flex-shrink: 0;
}

.camp-card:hover {
    background: #fff;
    border-color: var(--text-main);
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 var(--text-main);
}

.camp-card:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 var(--text-main);
}

.camp-icon {
    font-size: 2.2rem;
}

.camp-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.camp-info h3 {
    font-family: 'Special Elite', cursive, Georgia, serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
}

.camp-info p {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.camp-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Cabinet-bounded Overlays */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(46, 29, 17, 0.85);
    backdrop-filter: blur(3px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    border-radius: 4px;
}

.combat-window {
    background: var(--panel-bg);
    border: 3px solid var(--danger);
    box-shadow: 0 0 30px rgba(176, 58, 46, 0.3);
    width: 440px;
    max-width: 92%;
    border-radius: 8px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: scaleIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
    from { transform: scale(0.94); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.combat-header {
    text-align: center;
    border-bottom: 2px solid rgba(176, 58, 46, 0.3);
    padding-bottom: 12px;
}

.combat-title {
    font-family: 'Special Elite', cursive, Georgia, serif;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--danger);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.combat-versus {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin: 10px 0;
}

.fighter-card {
    text-align: center;
    width: 42%;
}

.fighter-name {
    font-family: 'Special Elite', cursive, Georgia, serif;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 6px;
    color: var(--text-main);
}

.fighter-hp-container {
    width: 100%;
    background: rgba(46, 29, 17, 0.15);
    height: 12px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--text-main);
}

.fighter-hp-bar {
    height: 100%;
    background: var(--danger);
    width: 100%;
    transition: width 0.2s ease-out;
}

.fighter-hp-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    margin-top: 4px;
    color: var(--text-muted);
}

.combat-log {
    background: rgba(255, 255, 255, 0.5);
    border: 2px solid var(--panel-border);
    height: 140px;
    border-radius: 6px;
    padding: 10px;
    overflow-y: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.combat-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.btn-combat {
    padding: 10px;
    border-radius: 6px;
    font-family: 'Special Elite', cursive, Georgia, serif;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-speed);
    text-transform: uppercase;
}

.btn-combat-attack {
    background: var(--danger);
    color: var(--text-dark);
    border: 2px solid var(--text-main);
    box-shadow: 2px 2px 0 var(--text-main);
}
.btn-combat-attack:hover {
    filter: brightness(1.1);
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--text-main);
}
.btn-combat-attack:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 var(--text-main);
}

.btn-combat-flee {
    background: #fffdf5;
    border: 2px solid var(--text-main);
    color: var(--text-main);
    box-shadow: 2px 2px 0 var(--text-main);
}
.btn-combat-flee:hover {
    background: #fff;
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--text-main);
}
.btn-combat-flee:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 var(--text-main);
}

/* GameOver Modal */
.gameover-window {
    background: var(--panel-bg);
    border: 4px solid var(--danger);
    box-shadow: 0 0 35px rgba(176, 58, 46, 0.4);
    width: 380px;
    max-width: 92%;
    border-radius: 8px;
    padding: 28px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.gameover-title {
    font-family: 'Special Elite', cursive, Georgia, serif;
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--danger);
    letter-spacing: 2px;
}

.gameover-stats {
    background: rgba(255, 255, 255, 0.5);
    border: 2px solid var(--panel-border);
    border-radius: 6px;
    padding: 12px;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gameover-stat-row {
    display: flex;
    justify-content: space-between;
}

.btn-restart {
    background: #fffdf5;
    border: 2px solid var(--text-main);
    color: var(--text-main);
    padding: 10px;
    border-radius: 6px;
    font-family: 'Special Elite', cursive, Georgia, serif;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 2px 2px 0 var(--text-main);
    transition: all var(--transition-speed);
}

.btn-restart:hover {
    background: var(--primary);
    color: var(--text-dark);
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--text-main);
}

.btn-restart:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 var(--text-main);
}

/* UI Helpers */
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.d-none {
    display: none !important;
}

.empty-state {
    color: var(--text-muted);
    font-size: 0.78rem;
    text-align: center;
    padding: 16px 0;
}

/* =============================================
   PHASE BADGE (DAY / NIGHT)
   ============================================= */
.phase-badge {
    padding: 4px 12px;
    border: 2px solid var(--text-main);
    border-radius: 4px;
    font-family: 'Special Elite', cursive, Georgia, serif;
    font-weight: 800;
    font-size: 0.78rem;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
    box-shadow: 2px 2px 0 var(--text-main);
}

.phase-day {
    background: #fbbf24;
    color: #2e1d11;
}

.phase-night {
    background: #7d5a8c;
    color: #fffdf5;
}

/* Night tint on body */
body.night-mode {
    background-color: #0d0905;
}

body.night-mode .game-container {
    background-color: #baa485;
    border-color: #3e2b22;
}

body.night-mode header {
    background: rgba(244, 236, 207, 0.75);
}

/* =============================================
   DAY/NIGHT TRANSITION SPLASH
   ============================================= */
.day-splash {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
}

.day-splash.show-day {
    animation: daySplashAnim 2.2s ease forwards;
}

.day-splash.show-night {
    animation: nightSplashAnim 2.2s ease forwards;
}

.day-splash-inner {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.day-splash-label {
    font-family: 'Special Elite', cursive, Georgia, serif;
    font-size: clamp(3rem, 10vw, 6rem);
    font-weight: 900;
    letter-spacing: 4px;
    line-height: 1;
    text-transform: uppercase;
}

.day-splash-sub {
    font-family: 'Special Elite', cursive, Georgia, serif;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
}

@keyframes daySplashAnim {
    0%   { opacity: 0; transform: scale(0.85); background: rgba(204, 128, 43, 0); }
    15%  { opacity: 1; transform: scale(1.02); background: rgba(204, 128, 43, 0.15); }
    60%  { opacity: 1; transform: scale(1); background: rgba(204, 128, 43, 0.08); }
    100% { opacity: 0; transform: scale(1.05); background: rgba(204, 128, 43, 0); }
}

@keyframes nightSplashAnim {
    0%   { opacity: 0; transform: scale(0.85); background: rgba(125, 90, 140, 0); }
    15%  { opacity: 1; transform: scale(1.02); background: rgba(125, 90, 140, 0.18); }
    60%  { opacity: 1; transform: scale(1); background: rgba(125, 90, 140, 0.15); }
    100% { opacity: 0; transform: scale(1.05); background: rgba(125, 90, 140, 0); }
}

.day-splash.show-day .day-splash-label {
    color: var(--warning);
    text-shadow: 2px 2px 0 var(--text-main);
}
.day-splash.show-day .day-splash-sub {
    color: var(--text-main);
}

.day-splash.show-night .day-splash-label {
    color: #fffdf5;
    text-shadow: 2px 2px 0 var(--text-main), 0 0 10px rgba(125, 90, 140, 0.5);
}
.day-splash.show-night .day-splash-sub {
    color: var(--text-main);
}

.action-card.locked {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(0.5);
}
.action-card.locked:hover {
    transform: none;
    border-color: var(--panel-border);
    background: rgba(255,255,255,0.4);
    box-shadow: none;
}

/* =============================================
   LOOT POPUP MODAL
   ============================================= */
.loot-window {
    background: var(--panel-bg);
    border: 3px solid var(--safe);
    box-shadow: 0 0 30px rgba(78, 122, 83, 0.25);
    width: 480px;
    max-width: 92%;
    border-radius: 8px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    animation: scaleIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.loot-header {
    text-align: center;
    border-bottom: 2px solid rgba(78, 122, 83, 0.3);
    padding-bottom: 14px;
}

.loot-title {
    font-family: 'Special Elite', cursive, Georgia, serif;
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: 2px;
    color: var(--safe);
    text-transform: uppercase;
}

.loot-location {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.loot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    min-height: 80px;
}

.loot-item-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.4);
    border: 2px solid var(--panel-border);
    border-radius: 8px;
    padding: 14px 10px;
    opacity: 0;
    transform: translateY(12px) scale(0.95);
    animation: lootItemIn 0.2s ease forwards;
}

.loot-item-card:hover {
    border-color: var(--text-main);
    background: rgba(255, 255, 255, 0.6);
}

.loot-item-card.rarity-common { border-color: var(--panel-border); }
.loot-item-card.rarity-uncommon { border-color: var(--primary); box-shadow: 2px 2px 0 var(--primary); }
.loot-item-card.rarity-rare { border-color: var(--rare); box-shadow: 2px 2px 0 var(--rare); }

@keyframes lootItemIn {
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.loot-item-icon-wrap {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    border: 2px solid var(--panel-border);
}

.loot-item-name {
    font-size: 0.68rem;
    font-weight: 700;
    text-align: center;
    color: var(--text-main);
    line-height: 1.2;
}

.loot-item-qty {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--safe);
}

.loot-item-rarity {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}
.rarity-label-common { color: var(--text-muted); }
.rarity-label-uncommon { color: var(--primary); }
.rarity-label-rare { color: var(--rare); }

.btn-loot-close {
    background: var(--safe);
    color: var(--text-dark);
    border: 2px solid var(--text-main);
    font-family: 'Special Elite', cursive, Georgia, serif;
    font-weight: 800;
    font-size: 0.9rem;
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 2px 2px 0 var(--text-main);
    transition: all 0.2s ease;
}

.btn-loot-close:hover {
    filter: brightness(1.1);
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--text-main);
}

.btn-loot-close:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 var(--text-main);
}

/* GameWin Modal */
.win-window {
    background: var(--panel-bg);
    border: 4px solid var(--safe);
    box-shadow: 0 0 35px rgba(78, 122, 83, 0.4);
    width: 380px;
    max-width: 92%;
    border-radius: 8px;
    padding: 28px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 18px;
    animation: scaleIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.win-title {
    font-family: 'Special Elite', cursive, Georgia, serif;
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--safe);
    letter-spacing: 1px;
}

.win-stats {
    background: rgba(255, 255, 255, 0.5);
    border: 2px solid var(--panel-border);
    border-radius: 6px;
    padding: 12px;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.win-stat-row {
    display: flex;
    justify-content: space-between;
}

/* Credits Overlay and Window */
.credits-window {
    background: var(--panel-bg);
    border: 3px double var(--text-main);
    box-shadow: 0 0 30px rgba(46, 29, 17, 0.25);
    width: 420px;
    max-width: 92%;
    border-radius: 8px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: scaleIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.credits-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--panel-border);
    padding-bottom: 10px;
}

.credits-title {
    font-family: 'Special Elite', cursive, Georgia, serif;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 1px;
}

.btn-credits-close {
    background: none;
    border: none;
    box-shadow: none;
    color: var(--text-main);
    font-size: 1.5rem;
    font-weight: 800;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    transition: color var(--transition-speed);
}

.btn-credits-close:hover {
    color: var(--danger);
    background: none;
    transform: none;
    box-shadow: none;
}

.credits-body {
    display: flex;
    flex-direction: row;
    gap: 20px;
    align-items: center;
}

@media (max-width: 480px) {
    .credits-body {
        flex-direction: column;
        text-align: center;
    }
}

.credits-photo-wrap {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--text-main);
    background: rgba(46, 29, 17, 0.05);
    flex-shrink: 0;
}

.credits-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 1 / 1;
}

.credits-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.credits-name {
    font-family: 'Special Elite', cursive, Georgia, serif;
    font-size: 1.25rem;
    color: var(--text-main);
}

.credits-nrp {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.credits-email {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.credits-email a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
}

.credits-email a:hover {
    text-decoration: underline;
}

.credits-divider {
    height: 1px;
    background: var(--panel-border);
    margin: 4px 0;
}

.credits-meta {
    font-size: 0.72rem;
    line-height: 1.4;
    color: var(--text-muted);
}

.credits-meta strong {
    color: var(--text-main);
}

/* Header Credits Button */
.btn-credits {
    background: #fffdf5;
    border: 2px solid var(--text-main);
    color: var(--text-main);
    padding: 4px 10px;
    border-radius: 6px;
    font-family: 'Special Elite', cursive, Georgia, serif;
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    box-shadow: 2px 2px 0 var(--text-main);
    transition: all var(--transition-speed);
}

.btn-credits:hover {
    background: #fff;
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--text-main);
}

.btn-credits:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 var(--text-main);
}

/* Header Music Toggle Button */
.btn-music-toggle {
    background: #fffdf5;
    border: 2px solid var(--text-main);
    color: var(--text-main);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    box-shadow: 2px 2px 0 var(--text-main);
    transition: all var(--transition-speed);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-music-toggle:hover {
    background: #fff;
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--text-main);
}

.btn-music-toggle:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 var(--text-main);
}
