/* ============================================
   LIDM Game — Global Styles
   Pastel Theme, Nunito Font, Bubbly UI
   ============================================ */

:root {
    /* Pastel Color Palette */
    --pastel-green: #a8d8a8;
    --pastel-green-light: #c5e8c5;
    --pastel-green-dark: #7bc67b;
    --pastel-blue: #a8c8e8;
    --pastel-blue-light: #c8ddf5;
    --pastel-blue-dark: #7badd4;
    --pastel-pink: #f0b8c8;
    --pastel-pink-light: #f8d4de;
    --pastel-yellow: #f8e8a0;
    --pastel-yellow-light: #fcf3cc;
    --pastel-orange: #f8c898;
    --pastel-purple: #c8a8e8;
    --pastel-purple-light: #dcc8f0;
    --pastel-red: #f0a0a0;
    --pastel-teal: #a0d8d0;
    --pastel-brown: #d4b896;
    --pastel-sand: #f0e4c8;
    --pastel-cream: #faf5eb;

    /* UI Colors */
    --bg-primary: #2a1f3d;
    --bg-secondary: #3d2e5c;
    --bg-card: rgba(255, 255, 255, 0.12);
    --bg-card-solid: #4a3770;
    --text-primary: #faf5eb;
    --text-secondary: #c8b8e0;
    --text-dark: #2a1f3d;
    --accent: #f8c898;
    --accent-hover: #f0b878;

    /* Stat Bar Colors */
    --hp-color: #f07878;
    --hp-bg: #5c2a2a;
    --hunger-color: #f0b878;
    --hunger-bg: #5c4a2a;
    --water-color: #78b8f0;
    --water-bg: #2a3a5c;
    --exp-color: #f0e078;
    --exp-bg: #5c5a2a;

    /* Spacing */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.15);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.25);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.35);
    --shadow-glow: 0 0 20px rgba(248, 200, 152, 0.3);
}

/* ============================================
   RESET & BASE
   ============================================ */

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.hidden {
    display: none !important;
}

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

#loading-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #2a1f3d 0%, #4a3770 50%, #2a1f3d 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: loadingBgShift 4s ease-in-out infinite;
}

@keyframes loadingBgShift {
    0%, 100% { background-position: 0% 0%; }
    50% { background-position: 100% 100%; }
}

.loading-content {
    text-align: center;
    padding: 40px;
}

.loading-title {
    font-size: 72px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--pastel-yellow) 0%, var(--pastel-orange) 50%, var(--pastel-pink) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 8px;
    margin-bottom: 8px;
    text-shadow: none;
    filter: drop-shadow(0 4px 8px rgba(240, 184, 120, 0.3));
}

.loading-subtitle {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 48px;
    letter-spacing: 2px;
}

.magnifier-container {
    position: relative;
    width: 300px;
    height: 60px;
    margin: 0 auto 32px;
}

.magnifier {
    font-size: 48px;
    position: absolute;
    top: 0;
    left: 0;
    animation: magnifierSearch 2.5s ease-in-out infinite;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
}

@keyframes magnifierSearch {
    0% { left: 0; transform: rotate(0deg) scale(1); }
    25% { left: 60%; transform: rotate(-15deg) scale(1.1); }
    50% { left: 30%; transform: rotate(10deg) scale(0.95); }
    75% { left: 80%; transform: rotate(-5deg) scale(1.05); }
    100% { left: 0; transform: rotate(0deg) scale(1); }
}

.magnifier.found {
    animation: magnifierFound 0.8s ease-out forwards;
}

@keyframes magnifierFound {
    0% { transform: scale(1) rotate(0deg); }
    30% { transform: scale(1.5) rotate(-20deg); }
    60% { transform: scale(1.3) rotate(10deg); }
    100% { transform: scale(2) rotate(0deg); opacity: 0; }
}

.loading-bar-container {
    width: 300px;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    margin: 0 auto 16px;
    overflow: hidden;
}

.loading-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--pastel-teal), var(--pastel-blue), var(--pastel-purple));
    border-radius: 6px;
    transition: width 0.3s ease;
}

.loading-text {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
}

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

#main-menu {
    position: fixed;
    inset: 0;
    z-index: 100;
}

#menu-bg-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.menu-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(42, 31, 61, 0.3) 0%, rgba(42, 31, 61, 0.8) 100%);
}

.menu-logo {
    text-align: center;
    margin-bottom: 48px;
}

.game-title {
    font-size: 96px;
    font-weight: 900;
    background: linear-gradient(135deg, var(--pastel-yellow) 0%, var(--pastel-orange) 40%, var(--pastel-pink) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 10px;
    filter: drop-shadow(0 6px 12px rgba(240, 184, 120, 0.4));
    animation: titlePulse 3s ease-in-out infinite;
}

@keyframes titlePulse {
    0%, 100% { filter: drop-shadow(0 6px 12px rgba(240, 184, 120, 0.4)); }
    50% { filter: drop-shadow(0 8px 24px rgba(240, 184, 120, 0.6)); }
}

.game-tagline {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-top: 8px;
    letter-spacing: 3px;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 280px;
}

.menu-btn {
    font-family: 'Nunito', sans-serif;
    font-size: 18px;
    font-weight: 700;
    padding: 14px 32px;
    border: none;
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: var(--bg-card);
    color: var(--text-primary);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-sm);
    letter-spacing: 1px;
}

.menu-btn:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: var(--shadow-md);
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.18);
}

.menu-btn:active {
    transform: translateY(0) scale(0.98);
}

.menu-btn.primary-btn {
    background: linear-gradient(135deg, var(--pastel-orange), var(--pastel-yellow));
    color: var(--text-dark);
    border: none;
    box-shadow: var(--shadow-md), var(--shadow-glow);
    font-size: 20px;
}

.menu-btn.primary-btn:hover {
    box-shadow: var(--shadow-lg), 0 0 30px rgba(248, 200, 152, 0.5);
}

/* ============================================
   GAME CANVAS
   ============================================ */

#game-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
}

/* ============================================
   HUD
   ============================================ */

#hud {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 50;
}

#hud > * {
    pointer-events: auto;
}

.hud-top-left {
    position: absolute;
    top: 16px;
    left: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 10px;
    border-radius: var(--radius-md);
    backdrop-filter: blur(8px);
    min-width: 180px;
}

.stat-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.stat-bar-bg {
    flex: 1;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.5s ease;
}

.hp-fill { background: linear-gradient(90deg, #f07878, #f8a0a0); width: 100%; }
.hunger-fill { background: linear-gradient(90deg, #f0b878, #f8d098); width: 100%; }
.water-fill { background: linear-gradient(90deg, #78b8f0, #a0d0f8); width: 100%; }
.exp-fill { background: linear-gradient(90deg, #f0e078, #f8f0a0); width: 0%; }

.stat-value {
    font-size: 12px;
    font-weight: 800;
    min-width: 28px;
    text-align: right;
}

.hud-top-center {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    align-items: center;
}

.location-badge, .time-badge {
    background: rgba(0, 0, 0, 0.5);
    padding: 6px 16px;
    border-radius: var(--radius-xl);
    font-weight: 700;
    font-size: 14px;
    backdrop-filter: blur(8px);
    letter-spacing: 1px;
}

.hud-top-right {
    position: absolute;
    top: 16px;
    right: 16px;
}

#minimap-canvas {
    border-radius: var(--radius-md);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-md);
    background: rgba(0, 0, 0, 0.4);
}

.hud-bottom-left {
    position: absolute;
    bottom: 80px;
    left: 16px;
}

.quest-indicator {
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 700;
    backdrop-filter: blur(8px);
    border-left: 3px solid var(--pastel-yellow);
    max-width: 250px;
}

.hud-bottom-center {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.hud-bottom-center:hover {
    opacity: 1;
}

.control-hint {
    font-size: 11px;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.hud-bottom-right {
    position: absolute;
    bottom: 16px;
    right: 16px;
    display: flex;
    gap: 8px;
}

.hud-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.15);
    font-size: 20px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hud-btn:hover {
    transform: scale(1.15);
    background: rgba(0, 0, 0, 0.7);
    border-color: rgba(255, 255, 255, 0.3);
}

/* ============================================
   DIALOG OVERLAY
   ============================================ */

#dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dialog-dim {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    animation: fadeIn 0.3s ease;
}

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

.dialog-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 600px;
    width: 90%;
    animation: dialogSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes dialogSlideUp {
    from { opacity: 0; transform: translateY(40px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.dialog-npc-sprite {
    width: 120px;
    height: 160px;
    margin-bottom: 16px;
}

.dialog-npc-name {
    font-size: 22px;
    font-weight: 900;
    color: var(--pastel-yellow);
    margin-bottom: 12px;
    letter-spacing: 2px;
}

.dialog-text-box {
    background: rgba(42, 31, 61, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-lg);
    padding: 24px 32px;
    backdrop-filter: blur(12px);
    width: 100%;
    box-shadow: var(--shadow-lg);
}

.dialog-text {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.7;
    color: var(--text-primary);
    min-height: 48px;
}

.dialog-choices {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
    width: 100%;
}

.dialog-choice-btn {
    font-family: 'Nunito', sans-serif;
    font-size: 15px;
    font-weight: 700;
    padding: 12px 24px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.dialog-choice-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: var(--pastel-yellow);
    transform: translateX(6px);
}

.dialog-continue {
    margin-top: 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    animation: pulseText 1.5s ease-in-out infinite;
}

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

/* ============================================
   QUIZ OVERLAY
   ============================================ */

#quiz-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s ease;
}

.quiz-container {
    background: linear-gradient(145deg, var(--bg-secondary), var(--bg-primary));
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-xl);
    padding: 32px;
    max-width: 650px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: dialogSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.quiz-subject {
    font-size: 16px;
    font-weight: 800;
    color: var(--pastel-teal);
}

.quiz-timer {
    font-size: 18px;
    font-weight: 800;
    color: var(--pastel-yellow);
    animation: pulseText 1s ease-in-out infinite;
}

.quiz-progress {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
}

.quiz-question {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.6;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quiz-option-btn {
    font-family: 'Nunito', sans-serif;
    font-size: 16px;
    font-weight: 700;
    padding: 14px 20px;
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.quiz-option-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: var(--pastel-blue);
    transform: translateX(4px);
}

.quiz-option-btn.correct {
    background: rgba(120, 200, 120, 0.25);
    border-color: var(--pastel-green);
    animation: correctPulse 0.5s ease;
}

.quiz-option-btn.wrong {
    background: rgba(240, 120, 120, 0.25);
    border-color: var(--pastel-red);
    animation: wrongShake 0.4s ease;
}

@keyframes correctPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

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

.quiz-feedback {
    margin-top: 20px;
    padding: 16px;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 700;
    text-align: center;
}

.quiz-feedback.correct {
    background: rgba(120, 200, 120, 0.15);
    color: var(--pastel-green-light);
    border: 1px solid rgba(120, 200, 120, 0.3);
}

.quiz-feedback.wrong {
    background: rgba(240, 120, 120, 0.15);
    color: var(--pastel-pink-light);
    border: 1px solid rgba(240, 120, 120, 0.3);
}

/* ============================================
   SHOP OVERLAY
   ============================================ */

#shop-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
}

.shop-container {
    background: linear-gradient(145deg, var(--bg-secondary), var(--bg-primary));
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-xl);
    padding: 28px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: dialogSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.shop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.shop-title {
    font-size: 22px;
    font-weight: 900;
}

.shop-coins {
    font-size: 16px;
    font-weight: 800;
    color: var(--pastel-yellow);
}

.shop-close, .inventory-close, .notebook-close, .ranking-close, .settings-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shop-close:hover, .inventory-close:hover, .notebook-close:hover, .ranking-close:hover, .settings-close:hover {
    background: rgba(240, 120, 120, 0.3);
    transform: scale(1.1);
}

.shop-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.shop-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.shop-item:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--pastel-yellow);
    transform: translateY(-2px);
}

.shop-item-icon {
    font-size: 28px;
}

.shop-item-info {
    flex: 1;
}

.shop-item-name {
    font-weight: 700;
    font-size: 15px;
}

.shop-item-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.shop-item-price {
    font-weight: 800;
    color: var(--pastel-yellow);
    font-size: 14px;
}

/* ============================================
   INVENTORY OVERLAY
   ============================================ */

#inventory-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
}

.inventory-container {
    background: linear-gradient(145deg, var(--bg-secondary), var(--bg-primary));
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-xl);
    padding: 28px;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    animation: dialogSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.inventory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.inventory-header h2, .notebook-header h2, .ranking-header h2, .settings-header h2 {
    font-size: 22px;
    font-weight: 900;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.inventory-slot {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.inventory-slot:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--pastel-teal);
    transform: scale(1.05);
}

.inventory-slot.selected {
    border-color: var(--pastel-yellow);
    background: rgba(248, 200, 152, 0.15);
}

.inventory-slot .item-count {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 11px;
    font-weight: 800;
    color: var(--text-primary);
}

.inventory-info {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
}

/* ============================================
   NOTEBOOK OVERLAY
   ============================================ */

#notebook-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
}

.notebook-container {
    background: linear-gradient(145deg, #f5eedd, #faf5eb);
    border: 2px solid rgba(180, 160, 120, 0.3);
    border-radius: var(--radius-xl);
    padding: 28px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: dialogSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: var(--text-dark);
}

.notebook-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(180, 160, 120, 0.2);
}

.notebook-header h2 {
    color: var(--text-dark);
}

.notebook-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.notebook-tab {
    font-family: 'Nunito', sans-serif;
    padding: 6px 16px;
    border-radius: var(--radius-xl);
    border: 2px solid rgba(180, 160, 120, 0.2);
    background: rgba(180, 160, 120, 0.08);
    color: var(--text-dark);
    cursor: pointer;
    font-weight: 700;
    font-size: 13px;
    transition: all 0.2s;
}

.notebook-tab:hover {
    background: rgba(180, 160, 120, 0.15);
}

.notebook-tab.active {
    background: var(--pastel-yellow);
    border-color: var(--pastel-orange);
}

.notebook-entry {
    padding: 14px 16px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--pastel-blue);
}

.notebook-entry-title {
    font-weight: 800;
    font-size: 15px;
    margin-bottom: 4px;
}

.notebook-entry-content {
    font-size: 13px;
    line-height: 1.6;
    color: #555;
}

/* ============================================
   RANKING OVERLAY
   ============================================ */

#ranking-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
}

.ranking-container {
    background: linear-gradient(145deg, var(--bg-secondary), var(--bg-primary));
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-xl);
    padding: 28px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: dialogSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ranking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ranking-entry {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.ranking-entry.top-1 { background: rgba(255, 215, 0, 0.12); border: 1px solid rgba(255, 215, 0, 0.2); }
.ranking-entry.top-2 { background: rgba(192, 192, 192, 0.1); border: 1px solid rgba(192, 192, 192, 0.2); }
.ranking-entry.top-3 { background: rgba(205, 127, 50, 0.1); border: 1px solid rgba(205, 127, 50, 0.2); }

.ranking-position {
    font-size: 20px;
    font-weight: 900;
    min-width: 36px;
    text-align: center;
}

.ranking-name {
    flex: 1;
    font-weight: 700;
    font-size: 15px;
}

.ranking-exp {
    font-weight: 800;
    color: var(--pastel-yellow);
    font-size: 14px;
}

/* ============================================
   SETTINGS OVERLAY
   ============================================ */

#settings-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
}

.settings-container {
    background: linear-gradient(145deg, var(--bg-secondary), var(--bg-primary));
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-xl);
    padding: 28px;
    max-width: 450px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: dialogSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-group label {
    font-weight: 700;
    font-size: 15px;
}

.setting-group h3 {
    font-weight: 800;
    font-size: 16px;
    margin-bottom: 4px;
}

.setting-group input[type="range"] {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    outline: none;
}

.setting-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--pastel-teal);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.keybind-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.keybind-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
}

.keybind-action {
    font-weight: 600;
    font-size: 13px;
}

.keybind-key {
    font-family: 'Nunito', sans-serif;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    font-weight: 800;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.keybind-key:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--pastel-yellow);
}

.keybind-key.listening {
    background: rgba(248, 200, 152, 0.2);
    border-color: var(--pastel-yellow);
    animation: pulseText 0.7s ease-in-out infinite;
}

/* ============================================
   MAP TRANSITION
   ============================================ */

#transition-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: linear-gradient(180deg, #87CEEB 0%, #B0E0E6 40%, #a8d8a8 100%);
}

#transition-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.transition-text {
    position: absolute;
    bottom: 25%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 32px;
    font-weight: 900;
    color: white;
    text-shadow: 0 3px 12px rgba(0,0,0,0.3);
    letter-spacing: 4px;
    animation: transitionTextPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
}

@keyframes transitionTextPop {
    from { opacity: 0; transform: translateX(-50%) translateY(20px) scale(0.8); }
    to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* ============================================
   NOTIFICATION
   ============================================ */

#notification {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 250;
    background: rgba(42, 31, 61, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-xl);
    padding: 12px 28px;
    font-weight: 700;
    font-size: 15px;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-md);
    animation: notifSlide 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* ============================================
   INTERACT PROMPT
   ============================================ */

#interact-prompt {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 60;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 24px;
    border-radius: var(--radius-xl);
    font-weight: 700;
    font-size: 14px;
    backdrop-filter: blur(8px);
    animation: promptBounce 1.5s ease-in-out infinite;
}

@keyframes promptBounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-6px); }
}

#interact-prompt kbd {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    margin: 0 2px;
}

/* ============================================
   MOBILE CONTROLS
   ============================================ */

#mobile-controls {
    position: fixed;
    inset: 0;
    z-index: 55;
    pointer-events: none;
}

#mobile-controls > * {
    pointer-events: auto;
}

.joystick-container {
    position: absolute;
    bottom: 40px;
    left: 40px;
}

.joystick-base {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.25);
    border: 3px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    touch-action: none;
}

.joystick-thumb {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.4);
    position: absolute;
    transition: none;
}

.mobile-action-buttons {
    position: absolute;
    bottom: 40px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}

.mobile-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-family: 'Nunito', sans-serif;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

.mobile-btn:active {
    transform: scale(0.9);
    background: rgba(0, 0, 0, 0.5);
}

.mobile-btn.action-btn {
    background: rgba(120, 200, 120, 0.3);
    border-color: rgba(120, 200, 120, 0.4);
}

.mobile-btn.cancel-btn {
    background: rgba(240, 120, 120, 0.3);
    border-color: rgba(240, 120, 120, 0.4);
}

/* ============================================
   SCROLLBAR
   ============================================ */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .loading-title { font-size: 48px; }
    .game-title { font-size: 56px; }
    .game-tagline { font-size: 16px; }
    .menu-buttons { min-width: 240px; }
    .menu-btn { font-size: 15px; padding: 12px 24px; }
    .menu-btn.primary-btn { font-size: 17px; }
    
    .stat-bar { min-width: 140px; padding: 3px 8px; }
    .stat-icon { font-size: 13px; }
    .stat-value { font-size: 11px; }
    
    .hud-bottom-center { display: none; }
    
    .location-badge, .time-badge { font-size: 12px; padding: 4px 10px; }
    
    .quiz-container { padding: 20px; }
    .quiz-question { font-size: 17px; }
    
    .dialog-text { font-size: 15px; }
    .dialog-text-box { padding: 18px 22px; }
    
    .transition-text { font-size: 24px; }
}

@media (max-width: 480px) {
    .hud-top-left { top: 8px; left: 8px; }
    .stat-bar { min-width: 120px; }
    .hud-top-right { top: 8px; right: 8px; }
    #minimap-canvas { width: 100px; height: 75px; }
    .inventory-grid { grid-template-columns: repeat(4, 1fr); }
}
