/* Luckie Runner Game Styles */
@import url('./speech.css');

@font-face {
    font-family: 'Hey Gorgeous';
    src: url('./font/heygorgeous.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    --font-main: 'Hey Gorgeous', 'Trebuchet MS', 'Fredoka One', 'Segoe UI', sans-serif;
    --font-title: 'Cooper Black', 'Trebuchet MS', 'Segoe UI', cursive;
}

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

body {
    font-family: var(--font-main);
    background: linear-gradient(135deg, #ffb347 0%, #ffcc33 30%, #ff6f69 70%, #7fc7ff 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Force the custom font across UI surfaces */
body, button, input, select, textarea,
.menu, #gameUI, #inventoryContainer, #inventoryOverlay, .inventory,
#shopOverlay, .shop-overlay, #chestOverlay, .chest-overlay,
#speechBubble, .speech-bubble, .npc-bubble, #buffPanel, #inventoryPanel {
    font-family: var(--font-main) !important;
}

#gameContainer {
    position: relative;
    border: 4px solid #333;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    background: #000;
    transform: scale(1.5);
    transform-origin: center center;
}

#gameCanvas {
    display: block;
    border-radius: 4px;
    background: #87CEEB; /* Sky blue background */
}

.hidden {
    display: none !important;
}

/* SVG Palm Trees Overlay */
#palmTreeSVG {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2; /* Above canvas background, below UI */
    overflow: hidden;
}

.palm-tree {
    will-change: transform;
    transform-origin: bottom center;
}

.tree-group {
    transition: transform 0.1s ease-out;
}

/* Palm tree animations */
@keyframes palmSway {
    0%, 100% {
        transform: skewX(0deg);
    }
    50% {
        transform: skewX(1deg);
    }
}

/* Game UI Overlay */
#gameUI {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

#healthWrapper {
    position: absolute;
    top: 16px;
    left: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    width: fit-content;
}

#playerHealthIcon {
    width: 64px;
    height: 64px;
    background: url('../art/ui/player-health.png') center/contain no-repeat;
    filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.35));
    flex-shrink: 0;
}

/* Health Bar */
#healthBar {
    width: 200px;
    height: 18px;
    background: rgba(0, 0, 0, 0.15);
    border: 3px solid #000;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 0 #000, 0 6px 12px rgba(0, 0, 0, 0.35);
}

#healthFill {
    height: 100%;
    width: 100%;
    background: #3fd97b;
    border-radius: 8px;
    transition: width 0.25s ease, background-color 0.2s ease;
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.15);
}

/* Inventory panel (coins + rocks) */
#inventoryPanel {
    position: absolute;
    top: 40px; /* align vertically with taller health HUD */
    right: 16px;
    display: flex;
    gap: 8px;
    padding: 0 4px 0 0; /* no left padding so content starts at the edge */
    background: linear-gradient(90deg, #66d66f 0%, #45b45f 60%, #2d944b 100%);
    border: 1px solid #1f6f35;
    border-radius: 8px;
    box-shadow: 0 2px 0 #0f4e24, 0 5px 8px rgba(0, 0, 0, 0.26);
    pointer-events: none;
    overflow: visible; /* allow contents to pop out */
    height: 18px; /* keep the banner small so icons/text spill out */
    align-items: center;
    z-index: 12;
    transform: translateX(-6px);
}

.hud-entry {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 2px;
    background: transparent;
    border: none;
    border-radius: 12px;
    box-shadow: none;
    color: #1d1b27;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.hud-icon {
    width: 36px;
    height: 36px;
    border-radius: 0;
    box-shadow: none;
    background-color: transparent;
    background-repeat: no-repeat;
    background-size: contain;
    outline: none;
    flex-shrink: 0;
}

.coin-icon {
    background: url('../art/items/coin.png') center/contain no-repeat;
}

.rock-icon {
    background: url('../art/items/rock-item.png') center/contain no-repeat;
    border: none;
    width: 36px;
    height: 36px;
}

.hud-label {
    font-size: 24px;
    color: #fffdf5;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}

.hud-value {
    font-size: 30px;
    color: #fffdf5;
    text-shadow: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000;
    min-width: 28px;
    text-align: left;
}

.hud-hp-fraction {
    margin-left: 8px;
    display: inline-block;
    min-width: 76px;
}

/* Buff HUD */
.buff-panel {
    position: absolute;
    top: 98px;
    right: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    background: linear-gradient(90deg, #66d66f 0%, #45b45f 60%, #2d944b 100%);
    border: 1px solid #1f6f35;
    border-radius: 10px;
    box-shadow: 0 2px 0 #0f4e24, 0 5px 8px rgba(0, 0, 0, 0.26);
    pointer-events: none;
    z-index: 12;
    min-width: 90px;
}

  .buff-panel.hidden {
      display: none;
  }
  
  .buff-row {
      display: flex;
      align-items: center;
      gap: 8px;
  }
  
.buff-row.hidden {
    display: none;
}

.buff-icon {
    width: 42px;
    height: 42px;
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
    filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.35));
}

/* Debug overlay */
#debugControls {
    position: absolute;
    bottom: 16px;
    left: 12px;
    z-index: 20;
    pointer-events: auto;
}

.debug-toggle {
    padding: 6px 10px;
    font-size: 12px;
    border: 2px solid #444;
    border-radius: 6px;
    background: #f7f7f7;
    color: #111;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.debug-toggle.is-active {
    background: #222;
    color: #f7f7f7;
}

#debugPanel {
    position: absolute;
    bottom: 52px;
    left: 12px;
    width: 240px;
    padding: 10px;
    background: rgba(10, 10, 10, 0.85);
    color: #e8e8e8;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    z-index: 20;
    pointer-events: auto;
}

.debug-panel__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-weight: 600;
}

.debug-panel__header button {
    background: transparent;
    color: #e8e8e8;
    border: none;
    font-size: 16px;
    cursor: pointer;
}

.debug-panel__body {
    margin: 0;
    white-space: pre-wrap;
}

/* Town banner */
.town-banner {
    position: absolute;
    bottom: 12px;
    right: 12px;
    transform: translateX(0);
    min-width: 280px;
    max-width: 90vw;
    min-height: 140px;
    padding: 28px 60px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 30; /* above ground/scene */
    opacity: 0;
    transition: opacity 0.6s ease;
}

.town-banner__bg {
    position: absolute;
    inset: 0;
    background-image: url('../art/ui/scroll.png');
    background-position: center;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.35));
}

.town-banner__text {
    position: relative;
    font-family: 'Cooper Black', var(--font-title);
    font-size: 32px;
    color: #5c3a1a;
    text-shadow: -1px -1px 0 #f4e0c0, 1px -1px 0 #f4e0c0, -1px 1px 0 #f4e0c0, 1px 1px 0 #f4e0c0;
    padding: 0 12px;
}

.town-banner.show {
    opacity: 1;
}

  .coffee-icon {
      background-image: url('../art/items/coffee.png');
  }
  
  .shoe-icon {
      background-image: url('../art/items/shoe.png');
  }
  
.buff-text {
    text-align: center;
    color: #fffdf5;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
    font-family: var(--font-main);
}

.buff-name {
    font-size: 12px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    opacity: 0.9;
}

.buff-timer {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.6px;
}


/* Menus */
.menu {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.55)), url('../art/ui/title.png');
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    color: #fff;
    text-align: center;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45));
}

.menu *:not(h1):not(h2) {
    font-family: var(--font-main) !important;
}

.menu.hidden {
    display: none;
}

.menu h1 {
    font-family: var(--font-title);
    font-size: 56px;
    margin-bottom: 20px;
    color: #ffe66d;
    text-shadow: -3px -3px 0 #ff6f69, 3px 3px 0 #3a8cff, 0 0 18px rgba(255, 230, 109, 0.8);
    animation: pulse 2s infinite;
}

.menu h2 {
    font-family: var(--font-main);
    font-size: 34px;
    margin-bottom: 20px;
    color: #b4f8c8;
    text-shadow: -2px -2px 0 #ff928b, 3px 3px 0 #2c7cff, 0 0 10px rgba(180, 248, 200, 0.7);
}

#gameOverMenu h2,
#victoryMenu h2 {
    font-family: var(--font-title);
}

.menu p {
    font-family: var(--font-main);
    font-size: 17px;
    margin-bottom: 30px;
    max-width: 400px;
    line-height: 1.5;
    color: #f7f7ff;
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.6);
}

.menu button {
    background: radial-gradient(circle at 30% 30%, #fffa9d, #ffd166 45%, #ff9e6d 100%);
    border: 4px solid #2c7cff;
    color: #1d1b27;
    padding: 16px 34px;
    font-size: 20px;
    font-weight: 800;
    border-radius: 30px;
    cursor: pointer;
    margin: 12px;
    min-width: 170px;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
    box-shadow: 0 10px 0 #1a50a5, 0 14px 24px rgba(0, 0, 0, 0.35);
    font-family: var(--font-main);
    letter-spacing: 0.8px;
}

.menu button:hover {
    transform: translateY(-4px) scale(1.02) rotate(-1deg);
    box-shadow: 0 12px 0 #1a50a5, 0 18px 28px rgba(0, 0, 0, 0.45);
    filter: brightness(1.05) saturate(1.05);
}

.menu button:active {
    transform: translateY(2px);
    box-shadow: 0 6px 0 #1a50a5, 0 10px 18px rgba(0, 0, 0, 0.35);
    filter: brightness(0.95);
}

.save-slot-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 260px;
    overflow-y: auto;
    padding: 6px 0;
}

.save-slot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(0,0,0,0.45), rgba(0,0,0,0.25));
    color: #fff;
    text-align: left;
    gap: 12px;
}

.save-slot__meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.save-slot__title {
    font-weight: 800;
    font-size: 18px;
    letter-spacing: 0.3px;
}

.save-slot__subtitle {
    font-size: 14px;
    opacity: 0.85;
}

.save-slot__stats {
    font-size: 13px;
    opacity: 0.8;
}

.save-slot button {
    margin: 0;
    padding: 10px 14px;
    min-width: 110px;
}

/* Pause menu should show gameplay behind it */
#pauseMenu.menu {
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(3px);
}

/* Instructions */
.instructions {
    background: rgba(255, 255, 255, 0.12);
    padding: 22px;
    border-radius: 14px;
    margin: 20px 0;
    border: 3px dashed rgba(255, 230, 109, 0.6);
    backdrop-filter: blur(4px);
}

.instructions p {
    margin-bottom: 10px;
    font-size: 15px;
    color: #fffbe6;
}

.instructions strong {
    color: #ffe66d;
    text-shadow: 1px 1px 0 #ff6f69;
}

/* Responsive Design */
@media (max-width: 1400px) {
    #gameContainer {
        transform: scale(1.2);
    }
}

@media (max-width: 1200px) {
    #gameContainer {
        transform: scale(1.05);
    }
    
    .menu h1 {
        font-size: 36px;
    }
    
    .menu h2 {
        font-size: 28px;
    }
}

@media (max-width: 1000px) {
    #gameContainer {
        transform: scale(0.9);
    }
    
    body {
        overflow: auto;
    }
}

@media (max-height: 700px) {
    #gameContainer {
        transform: scale(1.05);
    }
}

/* Animations */
@keyframes pulse {
    0% {
        text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8);
        transform: scale(1);
    }
    50% {
        text-shadow: 3px 3px 6px rgba(255, 215, 0, 0.5);
        transform: scale(1.05);
    }
    100% {
        text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8);
        transform: scale(1);
    }
}

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

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

/* UI Animations */
#gameUI > * {
    animation: slideIn 0.5s ease-out;
}

.menu {
    animation: fadeIn 0.3s ease-out;
}

/* Loading States */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Game-specific UI elements */
.damage-number {
    position: absolute;
    color: #ff2b2b;
    font-weight: bold;
    font-size: 18px;
    text-shadow:
        -1px -1px 0 #7a0000,
        1px -1px 0 #7a0000,
        -1px 1px 0 #7a0000,
        1px 1px 0 #7a0000;
    pointer-events: none;
    z-index: 20;
    animation: floatUp 3s ease-out forwards;
}

.heal-number {
    position: absolute;
    color: #44ff44;
    font-weight: bold;
    font-size: 16px;
    text-shadow: 1px 1px 2px #000;
    pointer-events: none;
    z-index: 20;
    animation: floatUp 1s ease-out forwards;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(-30px);
    }
}

/* Pause overlay */
.pause-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 50;
    display: none;
}

.pause-overlay.active {
    display: block;
}

/* Debug information */
.debug-info {
    position: absolute;
    bottom: 10px;
    left: 10px;
    color: #fff;
    font-size: 12px;
    background: rgba(0, 0, 0, 0.7);
    padding: 5px;
    border-radius: 3px;
    font-family: var(--font-main);
    line-height: 1.2;
    z-index: 30;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .menu {
        background: rgba(0, 0, 0, 0.95);
    }
    
    .menu button {
        background: #000;
        border: 2px solid #fff;
        color: #fff;
    }
    
    .menu button:hover {
        background: #fff;
        color: #000;
    }
}

/* Audio Controls */
.audio-controls {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 300px;
}

.audio-controls h3 {
    color: #FFD700;
    margin-bottom: 15px;
    text-align: center;
    font-size: 20px;
}

.volume-control {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.volume-control label {
    color: #fff;
    font-size: 14px;
    margin-bottom: 5px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.volume-control input[type="range"] {
    width: 200px;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    outline: none;
    border-radius: 3px;
    appearance: none;
    cursor: pointer;
}

.volume-control input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: #FFD700;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.volume-control input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #FFD700;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.volume-control input[type="range"]::-webkit-slider-track {
    background: rgba(255, 255, 255, 0.3);
    height: 6px;
    border-radius: 3px;
}

.volume-control input[type="range"]::-moz-range-track {
    background: rgba(255, 255, 255, 0.3);
    height: 6px;
    border-radius: 3px;
    border: none;
}

#muteButton {
    background: linear-gradient(45deg, #ff6b6b, #ee5a52);
    font-size: 16px;
    padding: 10px 20px;
    min-width: 120px;
}

#muteButton:hover {
    background: linear-gradient(45deg, #ee5a52, #ff6b6b);
}

/* NPC hint bubble */
.npc-bubble {
    position: absolute;
    left: 50%;
    bottom: 50%;
    transform: translate(-50%, 0);
    padding: 8px 12px;
    background: #fffdf7;
    border: 3px solid #7b5a41;
    border-radius: 14px;
    box-shadow: 0 6px 0 #3f2a1d, 0 10px 16px rgba(0, 0, 0, 0.35);
    color: #2c1f15;
    font-family: var(--font-main);
    font-weight: 800;
    font-size: 14px;
    pointer-events: none;
    white-space: nowrap;
    z-index: 25;
}

.npc-bubble.hidden {
    display: none;
}

/* Inventory overlay (UI only) */
.inventory {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 32px;
    z-index: 90;
    background: radial-gradient(circle at 20% 20%, rgba(255, 235, 170, 0.4), rgba(255, 200, 200, 0.25) 40%, rgba(255, 255, 255, 0.2) 70%) rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(3px);
}

.inventory.active {
    display: flex;
}

.inventory.hidden {
    display: none;
}

.inventory-window {
    position: relative;
    width: 92%;
    max-width: 1180px;
    min-height: 520px;
    background:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.1) 0, rgba(255, 255, 255, 0.1) 18px, rgba(255, 255, 255, 0.18) 18px, rgba(255, 255, 255, 0.18) 36px),
        linear-gradient(135deg, #ffe3e5, #ffd6bc 40%, #ffd7f4 100%);
    border: 5px solid #ff8b8b;
    border-radius: 26px;
    box-shadow: 0 20px 0 #b44a53, 0 22px 28px rgba(0, 0, 0, 0.45);
    padding: 18px 18px 22px;
    color: #2d1c1c;
    font-family: var(--font-main);
}

.inventory-window::before {
    content: '';
    position: absolute;
    inset: 12px 10px;
    border-radius: 18px;
    background-image: radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.4) 0, rgba(255, 255, 255, 0) 46%), radial-gradient(circle at 82% 24%, rgba(255, 255, 255, 0.35) 0, rgba(255, 255, 255, 0) 50%), radial-gradient(circle at 50% 72%, rgba(255, 255, 255, 0.38) 0, rgba(255, 255, 255, 0) 50%);
    pointer-events: none;
    opacity: 0.65;
}

.inventory-tabs {
    position: relative;
    display: flex;
    gap: 10px;
    padding: 4px 6px 14px;
    width: 100%;
    flex-wrap: wrap;
    z-index: 1;
}

.inventory-tab {
    flex: 1 1 0;
    text-align: center;
    position: relative;
    border: none;
    background: linear-gradient(180deg, #ffeec0 0%, #ffc46b 85%, #d98145 100%);
    color: #5a1f1f;
    font-weight: 900;
    font-size: 17px;
    padding: 12px 24px;
    border-radius: 18px 18px 12px 12px;
    box-shadow: 0 8px 0 #b64c2b, 0 12px 16px rgba(0, 0, 0, 0.22);
    transform: translateY(4px);
    cursor: pointer;
    pointer-events: auto;
    font-family: var(--font-main);
}

.inventory-tab:hover {
    filter: brightness(1.05);
    transform: translateY(2px);
}

.inventory-tab:nth-child(2) {
    background: linear-gradient(180deg, #dedcff 0%, #9c9ef6 85%, #5a57d6 100%);
    box-shadow: 0 8px 0 #3c3099, 0 12px 16px rgba(0, 0, 0, 0.22);
}

.inventory-tab:nth-child(3) {
    background: linear-gradient(180deg, #d6ffd8 0%, #9be58d 85%, #4b9d4a 100%);
    box-shadow: 0 8px 0 #2f6b2e, 0 12px 16px rgba(0, 0, 0, 0.22);
}

.inventory-tab:nth-child(4) {
    background: linear-gradient(180deg, #fff2c0 0%, #f2c15c 85%, #b57716 100%);
    box-shadow: 0 8px 0 #7b4a0d, 0 12px 16px rgba(0, 0, 0, 0.22);
}

.inventory-tab:nth-child(5) {
    background: linear-gradient(180deg, #d7ecff 0%, #7db6f2 85%, #3767b0 100%);
    box-shadow: 0 8px 0 #21416f, 0 12px 16px rgba(0, 0, 0, 0.22);
}

.inventory-tab.is-active {
    transform: translateY(0);
    filter: brightness(1.05);
}
.inventory-tab:focus-visible {
    outline: 3px solid #ff8b8b;
    outline-offset: 2px;
}

.inventory-body {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    gap: 18px;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 18px;
    padding: 18px;
    border: 3px solid rgba(255, 143, 143, 0.45);
    box-shadow: inset 0 6px 0 rgba(255, 255, 255, 0.65), inset 0 -6px 0 rgba(255, 215, 215, 0.45);
}

.inventory-column {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.inventory-panels {
    flex: 1;
}

.inventory-panel {
    display: none;
}

.inventory-panel.active {
    display: block;
}

.inventory-placeholder {
    background: linear-gradient(135deg, #ffe3e5, #ffd6bc 60%, #ffd7f4 100%);
    border: 3px solid rgba(255, 143, 143, 0.45);
    border-radius: 16px;
    padding: 14px;
    box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.45);
    color: #5a1f1f;
}

.inventory-placeholder h3 {
    margin-bottom: 6px;
    font-size: 18px;
    font-weight: 900;
}

.inventory-placeholder p {
    margin-bottom: 10px;
}

.placeholder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.placeholder-card {
    background: rgba(255, 255, 255, 0.65);
    border: 2px solid rgba(255, 143, 143, 0.45);
    border-radius: 12px;
    padding: 10px;
    text-align: center;
    font-weight: 800;
    color: #5a1f1f;
}

.placeholder-card.muted {
    opacity: 0.6;
}

.inventory-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: calc(3 * 68px);
    min-height: calc(3 * 68px);
    overflow-y: auto;
    padding-right: 6px;
    scrollbar-width: auto;
    scrollbar-color: #b44a53 rgba(255, 200, 200, 0.4);
}

.inventory-items::-webkit-scrollbar {
    width: 10px;
}

.inventory-items::-webkit-scrollbar-track {
    background: rgba(255, 200, 200, 0.15);
    border-radius: 10px;
}

.inventory-items::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #ffb3b3, #ff8b8b);
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.6);
    box-shadow: inset 0 0 0 1px rgba(180, 74, 83, 0.35);
}

.inventory-items::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #ff9d9d, #ff7474);
}

.inventory-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 14px;
    border: 2px solid rgba(255, 201, 74, 0.35);
    border-radius: 14px;
    background: linear-gradient(90deg, rgba(255, 223, 128, 0.12), rgba(255, 200, 200, 0.08));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
    cursor: pointer;
    transition: box-shadow 0.12s ease, transform 0.12s ease, border-color 0.12s ease;
    pointer-events: auto;
}

.inventory-item:hover {
    box-shadow: 0 6px 0 #b44a53, 0 10px 16px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 143, 143, 0.6);
    transform: translateY(-2px);
}
.inventory-item:focus-visible {
    outline: 3px solid #ff8b8b;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(255, 143, 143, 0.35);
}

.inventory-item__name {
    font-weight: 900;
    color: #5a1f1f;
    letter-spacing: 0.3px;
}

.inventory-item__value {
    font-weight: 800;
    color: #a1373a;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* Inventory item modal */
.inventory-item-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9999;
}

.inventory-item-modal.active {
    display: flex !important; /* Ensure visibility even if a hidden class lingers */
}

.modal-card {
    width: 360px;
    max-width: 90%;
    background: linear-gradient(135deg, #ffe3e5, #ffd6bc 60%, #ffd7f4 100%);
    border: 4px solid #ff8b8b;
    border-radius: 18px;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.35), 0 10px 0 #b44a53;
    padding: 16px;
    color: #2d1c1c;
    font-family: var(--font-main);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.modal-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.75);
    border: 2px solid rgba(255, 143, 143, 0.45);
    border-radius: 12px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.modal-title {
    font-size: 20px;
    font-weight: 900;
}

.modal-body {
    margin: 10px 0 14px;
    font-weight: 700;
    color: #5a1f1f;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-btn {
    border: none;
    border-radius: 12px;
    padding: 10px 16px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 6px 0 #b44a53, 0 10px 18px rgba(0, 0, 0, 0.2);
    color: #2d1c1c;
}

.modal-btn.use {
    background: linear-gradient(135deg, #ffd166, #ffb347);
}

.modal-btn.exit {
    background: linear-gradient(135deg, #d7e7f7, #b9d1f0);
}

.modal-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}
.modal-btn:focus-visible {
    outline: 3px solid #ff8b8b;
    outline-offset: 2px;
}

.profile-card {
    position: relative;
    background: linear-gradient(135deg, #ffd7d7, #ffd18f 55%, #ffe8b5);
    border: 4px solid #d86e6e;
    border-radius: 18px;
    padding: 14px;
    box-shadow: 0 12px 0 #a04343, 0 16px 22px rgba(0, 0, 0, 0.26);
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 12px;
}

.profile-card::after {
    content: '';
    position: absolute;
    inset: 10px 10px auto auto;
    width: 18px;
    height: 18px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.7) 30%, rgba(255, 255, 255, 0) 70%);
    filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.15));
}

.profile-nameplate {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: 24px;
    color: #2f170d;
    text-shadow: -2px -2px 0 #ffe7a3, 2px 2px 0 #c25b40;
}

.profile-level {
    background: #f9eaa4;
    border: 3px solid #b25a42;
    border-radius: 12px;
    padding: 4px 10px;
    font-size: 15px;
    box-shadow: 0 4px 0 #7c3322;
}

.profile-rank {
    display: inline-block;
    background: #fff5d4;
    border: 3px dashed #ff9f65;
    color: #8a3c14;
    font-weight: 800;
    padding: 6px 10px;
    border-radius: 14px;
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.65);
    width: fit-content;
}

.profile-bust {
    width: 168px;
    height: 168px;
    border-radius: 18px;
    background: linear-gradient(135deg, #ffe0b5, #ffb59f);
    border: 4px solid #c05a44;
    box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.1), 0 10px 0 #7c3322;
    justify-self: center;
    background-image: url('../art/content/luckie-menu.png'), radial-gradient(circle at 60% 20%, rgba(255, 255, 255, 0.5), transparent 50%), linear-gradient(180deg, #ffd7d7, #ffb99c);
    background-size: 80%, auto, cover;
    background-position: center 55%, center, center;
    background-repeat: no-repeat;
}

.profile-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.profile-action {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #fff7df;
    border: 3px solid #d27c62;
    border-radius: 14px;
    box-shadow: 0 6px 0 #9b4a33;
    font-weight: 800;
    color: #562012;
    min-width: 0;
}

.action-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: wrap;
    flex: 1;
    min-width: 0;
    font-size: 10px;
}

.action-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #ffe99c;
    border: 3px solid #c45a36;
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12);
}

.action-hammer .action-icon {
    background: url('../art/items/rock-item.png') center/70% no-repeat, #ffe99c;
}

.action-coin .action-icon {
    background: url('../art/items/coin.png') center/70% no-repeat, #ffe99c;
}

.action-spin .action-icon {
    background: radial-gradient(circle at 50% 50%, #ffe9a8 0, #ffc567 50%, #ff9d4c 100%);
}

.stat-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.stat-card {
    position: relative;
    background: #f6f2de;
    border: 3px solid #d27c62;
    border-radius: 14px;
    padding: 10px 12px;
    box-shadow: 0 6px 0 #9b4a33;
    color: #40200f;
    font-weight: 900;
    text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.5);
}

.stat-card::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(180deg, #ffbdbd, #ff8a8a);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}

.stat-card .stat-label {
    display: block;
    font-size: 12px;
    letter-spacing: 0.5px;
    color: #7a3b2a;
    margin-left: 8px;
}

.stat-card .stat-value {
    display: block;
    font-size: 22px;
    margin-left: 8px;
}

.stat-heart::before { background: linear-gradient(180deg, #ff8da1, #ff6a7a); }
.stat-flower::before { background: linear-gradient(180deg, #f5e272, #ffcf4b); }
.stat-badge::before { background: linear-gradient(180deg, #9dd5ff, #5b9dff); }

.details .specials-card {
    position: relative;
    background: #f5f0df;
    border: 4px solid #cab289;
    border-radius: 16px;
    padding: 14px;
    box-shadow: 0 10px 0 #8d7558;
    min-height: 280px;
}

.specials-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.star-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: radial-gradient(circle at 40% 35%, #fff6b3 0, #ffd86f 35%, #ffb43b 70%);
    border: 3px solid #c27a27;
    box-shadow: 0 4px 0 #8a4f16;
}

.specials-title {
    display: flex;
    flex-direction: column;
    font-weight: 900;
    color: #3a2a1e;
    font-size: 20px;
}

.specials-dots {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.specials-dots .dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.25);
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.15);
}

.dot-gold { background: #f8cf4b; }
.dot-red { background: #ff6a6a; }
.dot-pink { background: #ff9bd2; }
.dot-purple { background: #ad7aff; }
.dot-navy { background: #4d67c7; }
.dot-teal { background: #50d3c1; }

.specials-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.specials-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff9ed;
    border: 3px solid #d6b780;
    border-radius: 12px;
    padding: 10px 12px;
    box-shadow: 0 6px 0 #94794d;
    font-weight: 800;
    color: #3b2b1e;
}

.specials-value {
    min-width: 70px;
    text-align: right;
    color: #1b1a25;
}

.bullet {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    margin-right: 10px;
    flex-shrink: 0;
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.18), 0 3px 0 rgba(0, 0, 0, 0.25);
}

.bullet-star { background: radial-gradient(circle at 40% 35%, #fff6b3 0, #ffd86f 40%, #ffb43b 75%); }
.bullet-coin { background: radial-gradient(circle at 40% 35%, #fff3c2 0, #ffc54a 40%, #e3942c 75%); }
.bullet-note { background: linear-gradient(135deg, #e4d7ff, #b7a1ff); }
.bullet-sun { background: radial-gradient(circle at 50% 50%, #fff6c5 0, #ffd568 55%, #ffb33f 100%); }
.bullet-clock { background: linear-gradient(135deg, #cde6ff, #8fb5ff); }

.specials-list li span:first-child {
    display: flex;
    align-items: center;
    gap: 10px;
}

.inventory-note {
    background: #fdfbf5;
    border: 4px solid #c6b4a1;
    border-radius: 18px;
    padding: 12px 16px;
    box-shadow: 0 8px 0 #8a7765;
    font-weight: 700;
    color: #3c2f25;
    text-align: center;
}

.inventory-note p {
    font-size: 15px;
}

@media (max-width: 1200px) {
    .inventory-body {
        grid-template-columns: 1fr;
    }

    .profile-card {
        grid-template-columns: 1fr;
    }

    .profile-bust {
        justify-self: flex-start;
    }

    .profile-actions {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Shop overlay */
.shop-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(3px);
    z-index: 95;
    padding: 24px;
}

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

.shop-overlay.hidden {
    display: none;
}

.shop-window {
    width: 720px;
    max-width: 92%;
    background: linear-gradient(180deg, #e5edf6 0%, #c5d5e6 40%, #fdfefe 100%);
    border: 5px solid #9cb5d4;
    border-radius: 28px;
    box-shadow: 0 16px 0 #6d7c8a, 0 22px 28px rgba(0, 0, 0, 0.4);
    padding: 12px 14px 16px;
    color: #233147;
    font-family: var(--font-main);
}

.shop-header {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 8px;
    background: linear-gradient(180deg, #7ecfff 0%, #4aa7e5 100%);
    border-radius: 18px 18px 10px 10px;
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.15);
    margin-bottom: 10px;
}

.shop-currency {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 12px;
    padding: 6px 8px;
    color: #13202d;
    font-weight: 900;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.1);
}

.chip.hp { background: linear-gradient(135deg, #ffd7d7, #ffafaf); }
.chip.fp { background: linear-gradient(135deg, #fff3c2, #ffd36f); }
.chip.star { background: linear-gradient(135deg, #ffe5a3, #ffd166); }
.chip.coin { background: linear-gradient(135deg, #ffeab5, #ffc76b); }
.chip.rock { background: linear-gradient(135deg, #e0e0e0, #b5b5b5); }

.chip-label {
    font-size: 12px;
    text-transform: uppercase;
}

.chip-value {
    font-size: 16px;
}

.shop-title {
    margin: 8px auto 12px;
    max-width: 260px;
    text-align: center;
    background: linear-gradient(180deg, #27c4ff 0%, #0096d1 100%);
    color: #f1fbff;
    padding: 10px 18px;
    border-radius: 18px;
    font-weight: 900;
    font-size: 20px;
    box-shadow: 0 6px 0 #0b5c8c;
}

.shop-list {
    background: linear-gradient(180deg, #ffffff 0%, #f6f8fb 100%);
    border: 4px solid #c9d7e8;
    border-radius: 18px;
    padding: 8px;
    box-shadow: inset 0 6px 0 rgba(255, 255, 255, 0.7), inset 0 -6px 0 rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.shop-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #f8fbff;
    border: 3px solid #d3deed;
    border-radius: 14px;
    box-shadow: 0 6px 0 #9db2c8;
    font-weight: 800;
    color: #223146;
}

.shop-item.is-selected {
    border-color: #ffd166;
    box-shadow: 0 6px 0 #c0892b;
    background: linear-gradient(180deg, #fff7d1 0%, #ffe08a 100%);
}
.shop-item:focus-visible {
    outline: 3px solid #ffd166;
    outline-offset: 2px;
    border-color: #ffd166;
    background: linear-gradient(180deg, #fff7d1 0%, #ffe08a 100%);
    box-shadow: 0 6px 0 #c0892b, 0 0 0 3px rgba(255, 209, 102, 0.4);
}
.shop-item:active {
    border-color: #ff9b4b;
    background: linear-gradient(180deg, #ffc27a 0%, #ff9b4b 100%);
    box-shadow: 0 4px 0 #b0641f, 0 0 0 2px rgba(255, 155, 75, 0.4);
}

.shop-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: #fff0d6;
    border: 3px solid #d7a85d;
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.14);
    display: inline-block;
}

.icon-mushroom {
    background: radial-gradient(circle at 50% 35%, #fffcf0 0, #ffb5a8 50%, #ff7d6f 85%);
}

.icon-honey {
    background: radial-gradient(circle at 50% 50%, #ffe9a8 0, #ffc857 55%, #e1992a 90%);
}

.icon-pow {
    background: linear-gradient(135deg, #7cc5ff 0%, #4e8acb 70%);
    position: relative;
}

.icon-pow::after {
    content: 'POW';
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 900;
    color: #fff;
    text-shadow: 1px 1px 0 #23436a;
}

.icon-fire {
    background: radial-gradient(circle at 50% 20%, #ffe9a6 0, #ff9957 60%, #e34b2b 95%);
}
.icon-rockbag {
    background: url('../art/items/rock-item.png') center/70% no-repeat, #fff0d6;
}
.icon-healthpotion {
    background: url('../art/sprites/health-pot.png') center/70% no-repeat, #fff0d6;
}
.icon-coffee {
    background: url('../art/items/coffee.png') center/70% no-repeat, #fff0d6;
}

.shop-item-price {
    color: #384b63;
    font-size: 14px;
}

.shop-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 12px;
    padding: 10px 12px;
    background: linear-gradient(180deg, #d7e7f7 0%, #c4d9ec 100%);
    border-radius: 14px;
    border: 3px solid #9cb5d4;
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.12);
    font-weight: 800;
    color: #2d3f58;
}

.footer-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.footer-control.stop::before,
.footer-control.confirm::before {
    content: '';
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(0, 0, 0, 0.15);
}

.footer-control.stop::before {
    background: #ff7b7b;
}

.footer-control.confirm::before {
    background: #6ad46a;
}

/* Chest overlay */
.chest-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 32px;
    z-index: 92;
    background: radial-gradient(circle at 20% 20%, rgba(255, 235, 170, 0.4), rgba(255, 200, 200, 0.25) 40%, rgba(255, 255, 255, 0.2) 70%) rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(3px);
}

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

.chest-overlay.hidden {
    display: none;
}

.chest-window {
    position: relative;
    width: 520px;
    max-width: 92%;
    background:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.1) 0, rgba(255, 255, 255, 0.1) 16px, rgba(255, 255, 255, 0.2) 16px, rgba(255, 255, 255, 0.2) 32px),
        linear-gradient(135deg, #ffe3e5, #ffd6bc 40%, #ffd7f4 100%);
    border: 5px solid #ff8b8b;
    border-radius: 22px;
    box-shadow: 0 16px 0 #b44a53, 0 18px 28px rgba(0, 0, 0, 0.4);
    color: #2d1c1c;
    font-family: var(--font-main);
    overflow: hidden;
}

.chest-window::before {
    content: '';
    position: absolute;
    inset: 10px 8px;
    border-radius: 16px;
    background-image: radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.35) 0, rgba(255, 255, 255, 0) 46%), radial-gradient(circle at 82% 24%, rgba(255, 255, 255, 0.3) 0, rgba(255, 255, 255, 0) 50%), radial-gradient(circle at 50% 72%, rgba(255, 255, 255, 0.32) 0, rgba(255, 255, 255, 0) 50%);
    pointer-events: none;
    opacity: 0.6;
}

.chest-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px 10px;
    background: linear-gradient(90deg, rgba(255, 227, 170, 0.4), rgba(255, 200, 220, 0.35));
    border-bottom: 2px solid rgba(255, 143, 143, 0.35);
    position: relative;
    z-index: 1;
}

.chest-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: radial-gradient(circle at 30% 35%, #ffe7a3, #ffc46b 65%, #f49fa0);
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.12), 0 8px 12px rgba(0, 0, 0, 0.25);
    position: relative;
}

.chest-icon::after {
    content: '';
    position: absolute;
    inset: 9px;
    background: url('../art/items/chest-open.png') center/contain no-repeat;
    filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.4));
}

.chest-header__text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chest-title {
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 0.5px;
    color: #a1373a;
    text-shadow: -1px -1px 0 #ffe3e5, 0 3px 0 #ffb3b3, 0 5px 12px rgba(0, 0, 0, 0.25);
}

.chest-subtitle {
    font-size: 13px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(70, 30, 30, 0.65);
}

.chest-close {
    border: none;
    background: #ffb3b3;
    color: #6b1f1f;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 800;
    box-shadow: 0 4px 0 #b44a53;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.chest-close:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #b44a53;
}

.chest-close:active {
    transform: translateY(1px);
    box-shadow: 0 3px 0 #b44a53;
}

.chest-body {
    padding: 16px 18px 10px;
    max-height: 320px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(255, 255, 255, 0.35);
    border-top: 3px solid rgba(255, 143, 143, 0.35);
    border-bottom: 3px solid rgba(255, 215, 215, 0.35);
    box-shadow: inset 0 6px 0 rgba(255, 255, 255, 0.6), inset 0 -4px 0 rgba(255, 200, 200, 0.35);
}

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

.chest-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(90deg, rgba(255, 200, 200, 0.15), rgba(255, 215, 180, 0.12));
    border: 2px solid rgba(255, 143, 143, 0.35);
    border-radius: 12px;
    padding: 10px 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.chest-item__info {
    flex: 1;
}

.chest-item__name {
    font-weight: 900;
    font-size: 16px;
    color: #a1373a;
}

.chest-item__desc {
    font-size: 13px;
    color: rgba(70, 30, 30, 0.75);
}

.chest-item__take {
    border: none;
    background: linear-gradient(180deg, #ffeec0 0%, #ffc46b 85%, #d98145 100%);
    color: #5a1f1f;
    font-weight: 800;
    padding: 8px 14px;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 0 #b64c2b, 0 8px 16px rgba(0, 0, 0, 0.22);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.chest-item__take:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #b64c2b;
}

.chest-item__take:active {
    transform: translateY(1px);
    box-shadow: 0 3px 0 #b64c2b;
}
.chest-item__take:focus-visible,
.chest-take-all:focus-visible,
.chest-close:focus-visible {
    outline: 3px solid #ff8b8b;
    outline-offset: 2px;
}

.chest-empty {
    text-align: center;
    padding: 18px 12px;
    background: rgba(255, 200, 200, 0.12);
    border: 2px dashed rgba(255, 143, 143, 0.5);
    border-radius: 12px;
    font-weight: 800;
    color: rgba(70, 30, 30, 0.7);
}

.chest-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px 18px;
    border-top: 2px solid rgba(255, 143, 143, 0.25);
    background: linear-gradient(180deg, rgba(255, 200, 200, 0.16), rgba(255, 215, 215, 0.08));
}

.chest-take-all {
    border: none;
    background: linear-gradient(135deg, #ffd166, #ffb347);
    color: #2c1f15;
    padding: 10px 18px;
    border-radius: 12px;
    font-weight: 900;
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow: 0 6px 0 #b44a53, 0 10px 18px rgba(0, 0, 0, 0.3);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.chest-take-all:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.chest-take-all:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #b44a53;
}

.chest-take-all:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: 0 4px 0 #b44a53;
}

.chest-hint {
    font-size: 13px;
    color: rgba(70, 30, 30, 0.65);
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Chest callout bubble */
.chest-callout {
    position: absolute;
    padding: 8px 12px;
    background: #ffe3e5;
    border: 2px solid #ff8b8b;
    border-radius: 14px;
    box-shadow: 0 6px 0 #b44a53, 0 10px 16px rgba(0, 0, 0, 0.3);
    color: #5a1f1f;
    font-family: var(--font-main);
    font-weight: 800;
    font-size: 14px;
    pointer-events: none;
    white-space: nowrap;
    z-index: 24;
    transform: translate(-50%, 0);
}

.chest-callout.hidden {
    display: none;
}

.sign-callout {
    position: absolute;
    padding: 8px 12px;
    background: #ffe3e5;
    border: 2px solid #ff8b8b;
    border-radius: 14px;
    box-shadow: 0 6px 0 #b44a53, 0 10px 16px rgba(0, 0, 0, 0.3);
    color: #5a1f1f;
    font-family: var(--font-main);
    font-weight: 800;
    font-size: 14px;
    pointer-events: none;
    white-space: nowrap;
    z-index: 24;
    transform: translate(-50%, 0);
}

.sign-callout.hidden {
    display: none;
}

.sign-speech-bubble {
    max-width: 78%;
}

/* Badge callout and inventory badge list */
.badge-callout {
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translate(-50%, -10px);
    min-width: 320px;
    width: min(740px, 92%);
    background: linear-gradient(180deg, #fff2d2 0%, #ffe6b3 60%, #ffd48a 100%);
    border: 4px solid #c4882c;
    border-radius: 16px;
    box-shadow: 0 10px 0 #8c5522, 0 18px 28px rgba(0, 0, 0, 0.35);
    padding: 12px 14px 14px;
    z-index: 120;
    color: #3b2415;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.28s ease, transform 0.28s ease;
}

.badge-callout.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.badge-callout__banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.badge-callout__title {
    font-weight: 900;
    font-size: 20px;
    letter-spacing: 0.3px;
}

.badge-callout__name {
    color: #c03b2b;
}

.badge-callout__sparkles {
    display: flex;
    gap: 6px;
    color: #f7c52e;
    font-weight: 800;
}

.badge-callout__body {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.badge-callout__burst {
    position: relative;
    width: 128px;
    height: 128px;
    display: grid;
    place-items: center;
}

.badge-callout__starburst {
    position: absolute;
    inset: 4px;
    background: conic-gradient(#fff7db, #ffd36a, #fff4c7, #ffc445, #fff7db);
    clip-path: polygon(50% 0%, 61% 25%, 98% 35%, 68% 57%, 79% 91%, 50% 72%, 21% 91%, 32% 57%, 2% 35%, 39% 25%);
    filter: drop-shadow(0 4px 0 rgba(0, 0, 0, 0.12));
    animation: badge-spin 8s linear infinite;
}

.badge-callout__burst-ring {
    position: absolute;
    inset: 16px;
    border-radius: 50%;
    border: 4px dashed rgba(255, 255, 255, 0.75);
    animation: badge-spin 12s linear infinite reverse;
}

.badge-callout__icon {
    position: relative;
    width: 78px;
    height: 78px;
    border-radius: 50%;
    background: #fffef8;
    border: 4px solid #ffcf6a;
    box-shadow: 0 6px 0 #ad6b20;
    padding: 6px;
    object-fit: contain;
}

.badge-callout__description {
    max-width: 380px;
    font-weight: 800;
    color: #5a2d1c;
    background: rgba(255, 255, 255, 0.65);
    border: 2px dashed rgba(195, 116, 36, 0.65);
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.6);
}

@keyframes badge-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.badge-panel {
    background: linear-gradient(135deg, #ffe8d0, #ffd4a2 60%, #ffeed2 100%);
}

.badge-panel__hint {
    margin: 6px 0 12px;
    font-weight: 800;
    color: #5a1f1f;
}

.badge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px;
}

.badge-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: linear-gradient(90deg, rgba(255, 235, 189, 0.9), rgba(255, 214, 170, 0.8));
    border: 3px solid rgba(214, 138, 51, 0.6);
    border-radius: 14px;
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.6), 0 8px 0 rgba(155, 93, 27, 0.4), 0 12px 18px rgba(0, 0, 0, 0.15);
}

.badge-card__icon {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 14px;
    background: #fff7e0;
    border: 3px solid #d28b33;
    box-shadow: 0 6px 0 #9b5d1b;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.badge-card__burst {
    position: absolute;
    inset: -8px;
    background: conic-gradient(#fff7db, #ffd36a, #fff4c7, #ffc445, #fff7db);
    clip-path: polygon(50% 0%, 61% 25%, 98% 35%, 68% 57%, 79% 91%, 50% 72%, 21% 91%, 32% 57%, 2% 35%, 39% 25%);
    opacity: 0.8;
    animation: badge-spin 9s linear infinite;
}

.badge-card__icon img {
    position: relative;
    width: 64%;
    height: 64%;
    object-fit: contain;
    z-index: 1;
}

.badge-card__meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
}

.badge-card__name {
    font-weight: 900;
    color: #4b2d1b;
    font-size: 16px;
}

.badge-card__desc {
    font-weight: 700;
    color: #6a3c2a;
    line-height: 1.3;
}

.badge-empty {
    margin-top: 8px;
    font-weight: 800;
    color: #874221;
    background: rgba(255, 255, 255, 0.7);
    border: 2px dashed rgba(214, 138, 51, 0.6);
    border-radius: 12px;
    padding: 10px 12px;
}

/* ============================
   Journal System Styles
   ============================ */

.journal-list {
    max-height: 380px;
    overflow-y: auto;
    padding-right: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.journal-list::-webkit-scrollbar {
    width: 10px;
}

.journal-list::-webkit-scrollbar-track {
    background: rgba(255, 235, 189, 0.3);
    border-radius: 10px;
}

.journal-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #d28b33, #9b5d1b);
    border-radius: 10px;
    border: 2px solid rgba(255, 235, 189, 0.3);
}

.journal-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #e09943, #a66621);
}

.journal-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: linear-gradient(90deg, rgba(255, 248, 230, 0.95), rgba(255, 235, 200, 0.9));
    border: 3px solid rgba(139, 90, 43, 0.5);
    border-radius: 12px;
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), 0 6px 0 rgba(100, 65, 30, 0.3), 0 10px 16px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.journal-card:hover {
    transform: translateY(-2px);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.6), 0 8px 0 rgba(100, 65, 30, 0.4), 0 14px 20px rgba(0, 0, 0, 0.2);
    border-color: rgba(139, 90, 43, 0.7);
}

.journal-card:active {
    transform: translateY(0);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.5), 0 4px 0 rgba(100, 65, 30, 0.3), 0 6px 12px rgba(0, 0, 0, 0.1);
}

.journal-card.unread {
    border-color: rgba(255, 183, 71, 0.8);
    background: linear-gradient(90deg, rgba(255, 250, 220, 0.98), rgba(255, 240, 180, 0.95));
}

.journal-card__icon {
    font-size: 32px;
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #fff7e0, #ffe4b5);
    border: 2px solid #d28b33;
    border-radius: 8px;
    box-shadow: 0 4px 0 #9b5d1b;
}

.journal-card__meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.journal-card__title {
    font-weight: 900;
    font-size: 16px;
    color: #3d2515;
    line-height: 1.2;
}

.journal-card__author {
    font-weight: 700;
    font-size: 13px;
    color: #6a3c2a;
    opacity: 0.85;
}

.journal-card__badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #ff6b6b, #ff4757);
    color: white;
    font-size: 11px;
    font-weight: 900;
    padding: 3px 8px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(255, 71, 87, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.journal-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #8b5a2b;
}

.journal-empty-state > p:first-child {
    font-size: 48px;
    margin-bottom: 8px;
}

.journal-empty-state > p:nth-child(2) {
    font-size: 18px;
    font-weight: 900;
    margin-bottom: 8px;
}

.journal-empty-hint {
    font-size: 14px;
    font-weight: 700;
    opacity: 0.7;
    max-width: 280px;
    margin: 0 auto;
    line-height: 1.4;
}

/* Journal Modal */
.journal-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-main);
}

.journal-modal.hidden {
    display: none;
}

.journal-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

.journal-modal-card {
    position: relative;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    background: linear-gradient(135deg, #fffaf0 0%, #fff8e7 100%);
    border: 5px solid #8b5a2b;
    border-radius: 16px;
    box-shadow: 
        inset 0 3px 0 rgba(255, 255, 255, 0.6),
        0 12px 0 #64411e,
        0 20px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.journal-modal-header {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 50%, #ffd700 100%);
    border-bottom: 4px solid #8b5a2b;
    padding: 20px 24px;
    position: relative;
}

.journal-modal-title {
    font-size: 24px;
    font-weight: 900;
    color: #3d2515;
    margin-bottom: 6px;
    text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.5);
}

.journal-modal-author {
    font-size: 15px;
    font-weight: 700;
    color: #6a3c2a;
    opacity: 0.9;
}

.journal-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #ff6b6b, #ff4757);
    border: 3px solid #c23838;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    font-weight: 900;
    cursor: pointer;
    display: grid;
    place-items: center;
    box-shadow: 0 4px 0 #a02828, 0 6px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.journal-modal-close:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #a02828, 0 8px 16px rgba(0, 0, 0, 0.3);
}

.journal-modal-close:active {
    transform: translateY(0);
    box-shadow: 0 2px 0 #a02828, 0 4px 8px rgba(0, 0, 0, 0.2);
}

.journal-modal-body {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    font-size: 15px;
    line-height: 1.7;
    color: #3d2515;
    font-weight: 700;
}

.journal-modal-body::-webkit-scrollbar {
    width: 12px;
}

.journal-modal-body::-webkit-scrollbar-track {
    background: rgba(139, 90, 43, 0.1);
    border-radius: 10px;
    margin: 4px;
}

.journal-modal-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #d28b33, #9b5d1b);
    border-radius: 10px;
    border: 2px solid rgba(255, 250, 240, 0.3);
}

.journal-modal-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #e09943, #a66621);
}

.journal-modal-body p {
    margin-bottom: 14px;
}

.journal-modal-body p:last-child {
    margin-bottom: 0;
}
