/* ======================================================
   Pixel Life Hybrid - Complete 16-bit Retro RPG Stylesheet
   Stardew Valley / GameBoy Advance Cozy Aesthetic
   ====================================================== */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&family=DotGothic16&display=swap');

/* A nyers paletta (--parchment-*, --wood-*, --gold-*, --*-btn*, --felt-*,
   --text-*, --font-*) a tokens.css :root blokkjában lakik; itt csak
   hivatkozunk rá. Egy készlet, egy helyen. */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    image-rendering: pixelated;
}
/* A `user-select: none` korábban itt volt, mindenre. Emiatt semmit nem
   lehetett kimásolni, se azonosítót, se hibaüzenetet. A tokens.css most
   csak a gombokon és a vásznon tiltja. */

body {
    background-color: var(--bg-dark);
    background-image: radial-gradient(#3a2719 15%, transparent 16%), radial-gradient(#2d1c10 15%, transparent 16%);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    color: var(--text-dark);
    font-family: var(--font-retro);
    font-size: 19px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* CRT Scanlines Overlay */
.crt-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
    background-size: 100% 4px, 6px 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.65;
}

/* --- RETRO BOXES & CARDS --- */
.pixel-box {
    background-color: var(--parchment-light);
    border: 4px solid var(--wood-dark);
    box-shadow: 
        inset 3px 3px 0 var(--wood-highlight),
        inset -3px -3px 0 var(--wood-mid),
        4px 4px 0 rgba(0,0,0,0.6);
    position: relative;
    padding: 14px;
    margin-bottom: 12px;
}

.pixel-card {
    background-color: var(--parchment-mid);
    border: 3px solid var(--wood-mid);
    box-shadow: inset 2px 2px 0 var(--parchment-light), inset -2px -2px 0 var(--parchment-dark);
    padding: 10px;
    margin-bottom: 8px;
}

/* --- RETRO BUTTONS --- */
.pixel-btn {
    font-family: var(--font-pixel);
    font-size: 11px;
    padding: 10px 14px;
    background-color: var(--wood-mid);
    color: #fff;
    border: 3px solid var(--wood-dark);
    box-shadow: 
        inset 2px 2px 0 var(--wood-highlight),
        inset -2px -2px 0 #28170d,
        2px 2px 0 rgba(0,0,0,0.6);
    cursor: pointer;
    transition: all 0.08s ease;
    text-shadow: 1px 1px 0 #000;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.pixel-btn:hover {
    background-color: var(--wood-light);
    transform: translateY(-2px);
    box-shadow: 
        inset 2px 2px 0 #d99a65,
        inset -2px -2px 0 var(--wood-mid),
        2px 4px 0 rgba(0,0,0,0.6);
}

.pixel-btn:active {
    transform: translateY(2px);
    box-shadow: 
        inset 2px 2px 0 #28170d,
        inset -2px -2px 0 var(--wood-highlight),
        1px 1px 0 rgba(0,0,0,0.6);
}

.pixel-btn.green {
    background-color: var(--green-btn);
    box-shadow: inset 2px 2px 0 #7cb88d, inset -2px -2px 0 var(--green-btn-dark), 2px 2px 0 #000;
}
.pixel-btn.green:hover { background-color: var(--green-btn-hover); }

.pixel-btn.red {
    background-color: var(--red-btn);
    box-shadow: inset 2px 2px 0 #e86464, inset -2px -2px 0 var(--red-btn-dark), 2px 2px 0 #000;
}
.pixel-btn.red:hover { background-color: var(--red-btn-hover); }

.pixel-btn.gold {
    background-color: var(--gold-primary);
    color: #3b2405;
    text-shadow: none;
    box-shadow: inset 2px 2px 0 #ffea88, inset -2px -2px 0 var(--gold-shadow), 2px 2px 0 #000;
    font-weight: bold;
}
.pixel-btn.gold:hover { background-color: #ffc83b; }

.pixel-btn.blue {
    background-color: var(--blue-btn);
    box-shadow: inset 2px 2px 0 #73a7f5, inset -2px -2px 0 var(--blue-btn-dark), 2px 2px 0 #000;
}
.pixel-btn.blue:hover { background-color: var(--blue-btn-hover); }

.pixel-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* --- TOP HUD BAR --- */
#top-hud {
    background-color: var(--wood-dark);
    border-bottom: 4px solid #1a0f08;
    box-shadow: 0 4px 10px rgba(0,0,0,0.6);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    z-index: 100;
}

.hud-player-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-frame {
    width: 44px;
    height: 44px;
    background-color: var(--parchment-light);
    border: 3px solid var(--gold-primary);
    box-shadow: inset 2px 2px 0 #fff, inset -2px -2px 0 var(--gold-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
}

.player-details h2 {
    font-family: var(--font-pixel);
    font-size: 13px;
    color: var(--text-gold);
    text-shadow: 1px 1px 0 #000;
    margin-bottom: 3px;
}

.level-badge {
    font-size: 12px;
    color: #e3d2bf;
    background: rgba(0,0,0,0.3);
    padding: 2px 6px;
    border: 1px solid var(--wood-highlight);
}

.hud-currencies {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(0,0,0,0.4);
    border: 2px solid var(--wood-mid);
    padding: 6px 14px;
}

.currency-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-pixel);
    font-size: 12px;
    text-shadow: 1px 1px 0 #000;
}
.currency-item.cash { color: #55ff55; }
.currency-item.bank { color: #55ffff; }
.currency-item.gems { color: #ff55ff; }

/* Needs Progress Bars */
.hud-needs {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.need-bar-container {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 16px;
}

.need-track {
    width: 65px;
    height: 14px;
    background: #111;
    border: 2px solid #555;
    position: relative;
    overflow: hidden;
}

.need-fill {
    height: 100%;
    width: 100%;
    transition: width 0.3s ease;
}

.fill-health { background: linear-gradient(to right, #a83232, #ff4444); }
.fill-energy { background: linear-gradient(to right, #a88a32, #ffdd44); }
.fill-hunger { background: linear-gradient(to right, #32a852, #44ff77); }
.fill-happiness { background: linear-gradient(to right, #a8328c, #ff44d4); }

.hud-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    background: var(--wood-mid);
    border: 2px solid var(--wood-highlight);
    color: #fff;
    padding: 4px 8px;
    font-size: 16px;
    cursor: pointer;
}
.icon-btn:hover { background: var(--wood-light); }

/* --- NAVIGATION TABS BAR --- */
#nav-tabs-container {
    background: #2b180d;
    border-bottom: 3px solid var(--wood-dark);
    padding: 8px 16px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 50;
}

.nav-tabs-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.nav-tab {
    font-family: var(--font-pixel);
    font-size: 10px;
    padding: 8px 14px;
    background: var(--wood-dark);
    color: #d5be93;
    border: 2px solid var(--wood-mid);
    border-bottom: none;
    cursor: pointer;
    transition: all 0.1s ease;
    border-radius: 6px 6px 0 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-tab:hover {
    background: var(--wood-mid);
    color: #fff;
    transform: translateY(-2px);
}

.nav-tab.active {
    background: var(--parchment-light);
    color: var(--text-dark);
    border-color: var(--wood-dark);
    border-bottom: 2px solid var(--parchment-light);
    box-shadow: inset 2px 2px 0 #fff;
    margin-bottom: -2px;
    transform: none;
}

.nav-tab.zone-venue {
    background: #3d2c1d;
    border-color: var(--gold-shadow);
    color: var(--text-gold);
}
.nav-tab.zone-venue.active {
    background: var(--parchment-light);
    color: var(--text-dark);
}

/* --- MAIN CONTAINER & TAB PANELS --- */
#game-container,
#main-container {
    flex: 1;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 16px;
    position: relative;
    z-index: 1;
}

.tab-panel,
.tab-content {
    display: none !important;
}

.tab-panel.active,
.tab-content.active {
    display: block !important;
    animation: fadeIn 0.15s ease-out;
}

.retro-panel,
.wood-frame {
    background-color: var(--parchment-light);
    border: 4px solid var(--wood-dark);
    box-shadow: 
        inset 3px 3px 0 var(--wood-highlight),
        inset -3px -3px 0 var(--wood-mid),
        4px 4px 0 rgba(0,0,0,0.6);
    position: relative;
    padding: 16px;
    margin-bottom: 16px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--wood-mid);
    padding-bottom: 10px;
    margin-bottom: 14px;
    gap: 12px;
    flex-wrap: wrap;
}

.panel-header h2 {
    font-family: var(--font-pixel);
    font-size: 13px;
    color: var(--wood-dark);
    text-shadow: 1px 1px 0 rgba(255,255,255,0.4);
    margin: 0;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ======================================================
   MODULE 1: RETRO CITY MAP
   ====================================================== */


#city-map-canvas {
    width: 100%;
    height: 100%;
    display: block;
}



.zone-selector-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}





.venue-tag {
    font-family: var(--font-retro);
    font-size: 16px;
    color: var(--text-muted);
}

/* ======================================================
   MODULE 2: CHARACTER & SKILL TREE
   ====================================================== */
.character-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 16px;
}
@media (max-width: 900px) {
    .character-grid { grid-template-columns: 1fr; }
}

.skill-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: var(--parchment-mid);
    border: 2px solid var(--wood-mid);
    margin-bottom: 8px;
}

.skill-val {
    font-family: var(--font-pixel);
    font-size: 14px;
    color: #2b180d;
}

/* ======================================================
   MODULE 3: CASINO
   ====================================================== */
.casino-tabs-sub {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    border-bottom: 2px solid var(--wood-mid);
    padding-bottom: 8px;
}

.casino-game-panel {
    display: none;
    background: var(--felt-green);
    border: 6px solid var(--wood-dark);
    box-shadow: inset 4px 4px 0 #287a45, inset -4px -4px 0 var(--felt-dark), 0 4px 15px rgba(0,0,0,0.7);
    color: #fff;
    padding: 20px;
}
.casino-game-panel.active { display: block; }

.slots-cabinet {
    max-width: 540px;
    margin: 0 auto;
    background: #3b2413;
    border: 6px solid #ffcc00;
    box-shadow: 0 0 20px rgba(255, 204, 0, 0.4);
    padding: 20px;
    text-align: center;
    border-radius: 8px;
}

.slots-reels-window {
    background: #000;
    border: 4px solid #fff;
    padding: 15px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin: 15px 0;
    font-size: 48px;
}

.slot-reel {
    width: 90px;
    height: 90px;
    background: #fff;
    border: 3px solid #888;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ======================================================
   MODULE 4: LEADERBOARD & PODIUM
   ====================================================== */
.leaderboard-podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 16px;
    margin: 20px 0;
}

.podium-step {
    background: var(--wood-mid);
    border: 3px solid var(--wood-dark);
    color: #fff;
    text-align: center;
    padding: 12px;
    border-radius: 4px 4px 0 0;
    font-family: var(--font-pixel);
    font-size: 11px;
}
.podium-step.first { height: 140px; background: #e6b800; color: #000; }
.podium-step.second { height: 110px; background: #a6a6a6; }
.podium-step.third { height: 90px; background: #a86532; }

/* ======================================================
   MODULE 5: PRODUCT & ITEM GRIDS
   ====================================================== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.product-card {
    background: var(--parchment-mid);
    border: 3px solid var(--wood-mid);
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
}

.product-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-pixel);
    font-size: 11px;
}

/* ======================================================
   MODALS & TOASTS
   ====================================================== */
.retro-modal-backdrop {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.retro-modal-backdrop.active { display: flex; }

.retro-modal {
    width: 90%;
    max-width: 480px;
    background: var(--parchment-light);
    border: 4px solid var(--wood-dark);
    box-shadow: 0 0 25px rgba(0,0,0,0.8);
    padding: 20px;
}

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 9999;
}

.retro-toast {
    background: var(--parchment-light);
    border: 3px solid var(--wood-dark);
    padding: 10px 16px;
    font-family: var(--font-pixel);
    font-size: 11px;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.5);
    animation: toastSlide 0.2s ease-out;
}

@keyframes toastSlide {
    from { transform: translateX(50px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ======================================================
   NIGHT MODE THEME (AUTOMATIC OR TOGGLE)
   ====================================================== */
body.night-mode {
    --bg-dark: #080d1a;
    background-color: #080d1a;
    background-image: radial-gradient(#121c33 15%, transparent 16%), radial-gradient(#0c1426 15%, transparent 16%);
    --parchment-light: #131d31;
    --parchment-mid: #192742;
    --parchment-dark: #203152;
    --wood-dark: #0d1527;
    --wood-mid: #1d2e4d;
    --wood-light: #2c426d;
    --wood-highlight: #41639e;
    --text-dark: #e8f0fe;
    --text-muted: #95abcf;
    --gold-primary: #38ef7d;
    --gold-shadow: #11998e;
}

body.night-mode .retro-panel,
body.night-mode .wood-frame,
body.night-mode #top-hud {
    background-color: #131d31;
    border-color: #0d1527;
    color: var(--text-dark);
    box-shadow: 
        inset 3px 3px 0 #2c426d,
        inset -3px -3px 0 #090e1a,
        0 4px 16px rgba(10, 30, 60, 0.6);
}

body.night-mode .panel-header {
    border-bottom-color: #2c426d;
}

body.night-mode .panel-header h2 {
    color: #79b8ff;
    text-shadow: 1px 1px 0 #000;
}

body.night-mode .nav-tab {
    background: #111a2c;
    color: #8c9bbd;
    border-color: #22324f;
}

body.night-mode .nav-tab.active {
    background: #192742;
    color: #58a6ff;
    border-color: #58a6ff;
    box-shadow: inset 2px 2px 0 #2c426d;
}

/* Travel Mode Interactive Cards */
.travel-mode-card {
    background: var(--parchment-mid);
    border: 3px solid var(--wood-mid);
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.1s, border-color 0.1s, background 0.1s;
}
.travel-mode-card:hover {
    transform: translateY(-2px);
    border-color: var(--gold-primary);
    background: var(--parchment-light);
}
.travel-mode-card.active {
    border: 3px solid var(--gold-primary);
    background: #ffe9b8;
    box-shadow: 0 0 8px rgba(244, 180, 26, 0.5);
}
body.night-mode .travel-mode-card.active {
    background: #203152;
    border-color: #58a6ff;
    box-shadow: 0 0 10px rgba(88, 166, 255, 0.4);
}

/* ======================================================
   CLICKABLE HUD PROFILE & AVATAR
   ====================================================== */
.hud-player-info {
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    padding: 2px 6px;
    border-radius: 4px;
    border: 2px solid transparent;
}
.hud-player-info:hover {
    transform: scale(1.03);
    border-color: var(--gold-primary);
    background: rgba(244, 180, 26, 0.15);
}

.avatar-frame {
    width: 38px;
    height: 38px;
    border: 3px solid var(--gold-shadow);
    border-radius: 4px;
    background: var(--parchment-mid);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hud-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: pixelated;
}

/* Real-time Clock Widget */
.hud-clock-widget {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: var(--parchment-dark);
    border: 2px solid var(--wood-mid);
    font-family: var(--font-pixel);
    font-size: 10px;
    color: var(--text-dark);
}

/* World Event Banner */
.world-event-banner {
    background: #5a1a1a;
    border: 2px solid #a83232;
    color: #ffd2d2;
    padding: 6px 14px;
    font-family: var(--font-pixel);
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    animation: pulseGlow 2s infinite alternate;
}
@keyframes pulseGlow {
    from { box-shadow: 0 0 5px rgba(168, 50, 50, 0.3); }
    to { box-shadow: 0 0 15px rgba(255, 85, 85, 0.7); }
}

/* ======================================================
   DISTRICT VIEW & STREET EXPLORER (NEGYED NÉZET)
   ====================================================== */
.district-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--wood-mid);
    color: #fff;
    border-bottom: 3px solid var(--wood-dark);
    margin-bottom: 12px;
}

.buildings-street-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    padding: 8px;
}

.building-card {
    background: var(--parchment-mid);
    border: 4px solid var(--wood-mid);
    padding: 14px;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
}

.building-card:hover {
    transform: translateY(-4px);
    border-color: var(--gold-primary);
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    background: var(--parchment-light);
}

.building-icon {
    font-size: 44px;
    filter: drop-shadow(2px 2px 0 rgba(0,0,0,0.3));
}

.building-name {
    font-family: var(--font-pixel);
    font-size: 11px;
    color: var(--text-dark);
}

.building-desc {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.2;
}

/* ======================================================
   STOCKS 2-COLUMN TRADING TERMINAL
   ====================================================== */
.stocks-trading-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 14px;
}
@media (max-width: 900px) {
    .stocks-trading-grid { grid-template-columns: 1fr; }
}

.stock-table-card {
    background: var(--parchment-mid);
    border: 3px solid var(--wood-mid);
    padding: 6px;
    max-height: 480px;
    overflow-y: auto;
}

.stock-row-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-bottom: 1px dashed #c4af87;
    cursor: pointer;
    transition: background 0.1s;
}
.stock-row-item:hover, .stock-row-item.selected {
    background: #e2c99b;
    border-left: 4px solid var(--gold-shadow);
}

.stock-chart-panel {
    background: #111622;
    border: 4px solid var(--wood-dark);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: #fff;
}

/* ======================================================
   PROFILE SUMMARY MODAL / DASHBOARD
   ====================================================== */
.profile-modal-box {
    width: 92%;
    max-width: 680px;
    background: var(--parchment-light);
    border: 5px solid var(--wood-dark);
    box-shadow: 0 0 35px rgba(0,0,0,0.8);
    padding: 20px;
    max-height: 90vh;
    overflow-y: auto;
}

.profile-summary-header {
    display: flex;
    gap: 16px;
    align-items: center;
    border-bottom: 3px solid var(--wood-mid);
    padding-bottom: 14px;
    margin-bottom: 14px;
}

.profile-big-avatar {
    width: 68px;
    height: 68px;
    border: 4px solid var(--gold-shadow);
    border-radius: 6px;
    overflow: hidden;
    background: var(--parchment-mid);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
}

.profile-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin: 12px 0;
}

.profile-stat-box {
    background: var(--parchment-mid);
    border: 2px solid var(--wood-mid);
    padding: 8px;
    text-align: center;
}

/* ======================================================
   ADMIN CONSOLE TERMINAL (SYSADMIN / GM)
   ====================================================== */
.admin-console-terminal {
    background: #0d120d;
    border: 4px solid #1a331a;
    color: #33ff33;
    font-family: 'Courier New', monospace;
    padding: 18px;
    box-shadow: inset 0 0 20px rgba(0, 50, 0, 0.8), 0 0 15px rgba(51, 255, 51, 0.2);
}

.admin-console-terminal h3 {
    color: #33ff33;
    font-family: var(--font-pixel);
    font-size: 13px;
    border-bottom: 1px solid #1a331a;
    padding-bottom: 8px;
    margin-bottom: 14px;
}

.admin-terminal-input {
    background: #050a05;
    border: 1px solid #33ff33;
    color: #33ff33;
    font-family: monospace;
    padding: 6px 8px;
}

.admin-btn-hacker {
    background: #143314;
    border: 2px solid #33ff33;
    color: #33ff33;
    font-family: var(--font-pixel);
    font-size: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.admin-btn-hacker:hover {
    background: #33ff33;
    color: #050a05;
}
