.section-header-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

#how-to-play.data-btn {
    min-height: 32px;
    margin-left: auto;
    display: flex;
    align-items: center;
}
/* Medieval Fantasy Dungeon Idle Game CSS */
:root {
    /* Color Palette */
    --primary: #c9a227;
    --primary-light: #e6c158;
    --primary-dark: #9e7c18;
    --secondary: #8b4513;
    --secondary-light: #a0522d;
    --secondary-dark: #6b3000;
    --background: #121820;
    --surface: #1a2430;
    --surface-light: #243040;
    --text: #e8d9b0;
    --text-secondary: #a89c7d;
    --success: #2e8b57;
    --warning: #cd853f;
    --error: #8b0000;
    --gold: #ffd700;
    --silver: #c0c0c0;
    --bronze: #cd7f32;

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 20px;
    --spacing-xl: 28px;

    /* Borders */
    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --border-radius-lg: 16px;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.3);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Touch targets */
    --touch-target-size: 44px;
}

/* Base Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&family=Cinzel:wght@700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    padding-top: 152px; /* Adjusted space for title header (56px) + top controls (48px) + resource bar (48px) */
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(18, 24, 32, 0.4) 0%, rgba(18, 24, 32, 0.8) 70%, rgba(18, 24, 32, 0.95) 100%);
    pointer-events: none;
    z-index: -1;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Cinzel', serif;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--gold);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 1px;
}

h1 {
    font-size: 2.5rem;
    text-transform: uppercase;
    position: relative;
    padding-bottom: 15px;
}

h1::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

h2 {
    font-size: 1.8rem;
    position: relative;
    display: inline-block;
}

h2::before, h2::after {
    content: "❖";
    color: var(--gold);
    margin: 0 10px;
    font-size: 0.8em;
    opacity: 0.7;
}

button {
    cursor: pointer;
    border: 2px solid var(--gold);
    border-radius: var(--border-radius-sm);
    background: linear-gradient(to bottom, #3c2a0e, #1a1306);
    color: var(--gold);
    padding: var(--spacing-sm) var(--spacing-md);
    font-weight: 500;
    font-family: 'Cinzel', serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 215, 0, 0.2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    min-height: var(--touch-target-size);
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.2), transparent);
    transition: 0.5s;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 215, 0, 0.3);
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

button:hover::before {
    left: 100%;
}

button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 215, 0, 0.1);
}

input {
    background: rgba(26, 36, 48, 0.8);
    border: 1px solid var(--gold);
    color: var(--text);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius-sm);
    outline: none;
    transition: all var(--transition-fast);
    font-family: 'Fondamento', 'Cinzel', serif;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
}

input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 5px rgba(201, 162, 39, 0.5), inset 0 0 5px rgba(0, 0, 0, 0.5);
}

/* Game Container */
/* Top Controls Strip */
.main-title-header {
    background: linear-gradient(to bottom, rgba(18, 24, 32, 0.98), rgba(18, 24, 32, 0.95));
    padding: 10px 0;
    text-align: center;
    border-bottom: 2px solid rgba(201, 162, 39, 0.4);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1002;
    height: 56px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-title-header .logo {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin: 0 auto;
}

.main-title-header i {
    font-size: 1.8rem;
    color: var(--gold);
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.4));
}

.main-title-header h1 {
    margin: 0;
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    color: var(--gold);
    letter-spacing: 4px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    font-weight: 700;
}

.top-controls-strip {
    position: fixed;
    top: 56px; /* Position below the title header */
    left: 0;
    right: 0;
    height: 48px; /* Adjusted height */
    background: linear-gradient(to bottom, rgba(26, 36, 48, 0.95), rgba(18, 24, 32, 0.95));
    z-index: 1001;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 var(--spacing-lg);
    border-bottom: 1px solid rgba(201, 162, 39, 0.3);
    box-sizing: border-box;
    gap: var(--spacing-md);
}

.mini-logo {
    display: flex;
    align-items: center;
}

.mini-logo i {
    font-size: 0.9rem;
    color: var(--gold);
    opacity: 0.7;
}

.mini-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    justify-self: end;
    grid-column: 3;
}

.mini-btn {
    background: rgba(26, 36, 48, 0.6);
    border: 1px solid rgba(201, 162, 39, 0.3);
    color: var(--gold);
    font-size: 1.1rem;
    padding: 8px;
    height: 36px;
    min-height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.mini-btn:hover {
    background: rgba(201, 162, 39, 0.2);
    border-color: var(--gold);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.mini-btn:active {
    transform: translateY(0);
}

.toggle-switch.mini {
    width: 36px; /* Wider toggle */
    height: 20px; /* Taller toggle */
    margin-left: 0;
    margin-top: 0;
}

.toggle-switch.mini .toggle-slider:before {
    height: 14px; /* Larger toggle knob */
    width: 14px;
    left: 3px;
    bottom: 3px;
}

.toggle-switch.mini input:checked + .toggle-slider:before {
    transform: translateX(16px); /* Adjusted for wider toggle */
}

.game-container {
    display: flex;
    flex-direction: column;
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-md);
    min-height: calc(100vh - 152px);
    background-color: rgba(18, 24, 32, 0.7);
    box-shadow: 0 0 50px 20px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
    margin-top: 0; /* Remove margin since body has padding now */
}

.game-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(to bottom, 
        rgba(0, 0, 0, 0.5) 0%, 
        rgba(0, 0, 0, 0.3) 50%, 
        transparent 100%);
    pointer-events: none;
    z-index: 1;
}

.game-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(to top, 
        rgba(0, 0, 0, 0.5) 0%, 
        rgba(0, 0, 0, 0.3) 50%, 
        transparent 100%);
    pointer-events: none;
    z-index: 1;
}

/* Header */
/* Game header removed and moved to main-title-header */

/* remove header logo spacing */
.logo { 
    display: flex; 
    align-items: center;
}
.logo i { 
    display: inline-block;
    font-size: 1.8rem;
    color: #ffd700;
    margin-right: 10px;
}
.logo h1 { 
    margin: 0;
    font-size: 1.8rem;
    color: #ffd700;
    font-weight: bold;
}

/* Remove duplicate logo i styles */

.logo h1 {
    font-size: 2.2rem;
    margin: 0;
    padding: 0;
    text-transform: uppercase;
    background: linear-gradient(45deg, var(--gold), #e6c158, var(--gold));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 2px;
    font-weight: 800;
}

.logo h1::after {
    display: none;
}

.resource-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    background: rgba(18, 24, 32, 0.65);
    border-radius: 8px;
    padding: 0 var(--spacing-xl);
    border: 1px solid rgba(201, 162, 39, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
    align-self: center;
    background-image: linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('woodtexture.png');
    background-size: cover;
    background-position: center;
    line-height: 1;
    text-align: center;
}

.resource-bar > i,
.resource-bar > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}
.resource-bar .resource-divider {
    align-self: center;
}
.resource-bar.resource-bar-global {
    margin: 0;
    width: 100%;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    box-sizing: border-box;
    position: fixed;
    top: 104px; /* Position below the top controls strip (56px + 48px) */
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 0 var(--spacing-xl);
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.resource-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.5), transparent);
}

.resource-bar i {
    color: var(--gold);
    font-size: 1rem;
    opacity: 0.8;
    margin-right: 2px;
}

.resource-divider {
    height: 16px;
    width: 1px;
    background: linear-gradient(to bottom, transparent, var(--gold), transparent);
    opacity: 0.5;
    margin: 0 var(--spacing-sm);
}

#balance, #dgn-per-second {
    font-weight: bold;
    color: var(--gold);
    font-size: 1.1rem;
    margin: 0 2px;
}

.currency {
    color: var(--gold);
    font-size: 0.9rem;
    opacity: 0.8;
    font-family: 'MedievalSharp', 'Cinzel', serif;
}

.controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    justify-content: flex-end;
    flex: 1;
}

#disconnect-wallet {
    opacity: 0.9;
}

/* Wallet address display styles */
.wallet-address-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    grid-column: 2;
}

.wallet-connect-btn {
    background: linear-gradient(135deg, rgba(201, 162, 39, 0.2), rgba(201, 162, 39, 0.1));
    border: 2px solid rgba(201, 162, 39, 0.5);
    color: var(--gold);
    padding: 8px 16px;
    border-radius: var(--border-radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
}

.wallet-connect-btn:hover {
    background: linear-gradient(135deg, rgba(201, 162, 39, 0.3), rgba(201, 162, 39, 0.2));
    border-color: var(--gold);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

#wallet-address-text {
    font-family: monospace;
    color: var(--gold);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--border-radius-sm);
    border: 1px solid rgba(201, 162, 39, 0.3);
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mini-logo { display: none; }

/* Chain selector styles */
.chain-selector {
    display: flex;
    align-items: center;
    justify-self: start;
    grid-column: 1;
}

.chain-selector select {
    background: rgba(26, 36, 48, 0.8);
    border: 2px solid rgba(201, 162, 39, 0.5);
    color: var(--gold);
    padding: 6px 12px;
    border-radius: var(--border-radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    min-height: 36px;
    transition: all 0.2s ease;
}

.chain-selector select:hover {
    border-color: var(--gold);
    background: rgba(26, 36, 48, 0.95);
}

.chain-selector select:focus {
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.3);
    border-color: var(--gold);
}

.chain-selector select option {
    background: #1a2430;
    color: var(--gold);
}

/* Game Layout */
.game-layout {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    flex: 1;
    min-height: 0;
    padding: 0 var(--spacing-sm);
    width: 100%;
    margin: 0 auto;
    position: relative;
}

/* Sidebar */
.game-sidebar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--surface);
    padding: var(--spacing-sm) var(--spacing-xs);
    height: 70px; /* Increased height for better touch targets */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    border-top: 2px solid var(--gold);
    position: fixed;
    z-index: 50;
    gap: var(--spacing-xs);
    bottom: 0;
    left: 0;
    right: 0;
}

.game-sidebar::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 1px solid rgba(201, 162, 39, 0.3);
    pointer-events: none;
    border-radius: var(--border-radius-sm);
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) 0;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    border: none;
    overflow: hidden;
    min-height: 60px; /* Taller for better touch targets */
    min-width: 48px; /* Minimum width for touch targets */
}

.sidebar-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.1), transparent);
    transition: 0.5s;
}

.sidebar-section:hover {
    background-color: rgba(26, 36, 48, 0.8);
    border: 1px solid rgba(201, 162, 39, 0.3);
    text-shadow: 0 0 5px rgba(232, 217, 176, 0.3);
}

.sidebar-section:hover::before {
    left: 100%;
}

.sidebar-section.active {
    background: linear-gradient(to bottom, rgba(201, 162, 39, 0.2), rgba(139, 69, 19, 0.2));
    color: var(--gold);
    border: 1px solid var(--gold);
    box-shadow: 0 0 10px rgba(201, 162, 39, 0.2);
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

.sidebar-section i {
    width: 32px; /* Wider icon area */
    text-align: center;
    color: var(--gold);
    font-size: 1.6rem; /* Larger icons */
    opacity: 0.8;
}

.sidebar-section span {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: none; /* Hide text labels on mobile */
}

.sidebar-section.active i {
    opacity: 1;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

.notification-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(to bottom, var(--gold), var(--secondary));
    color: var(--surface);
    font-size: 0.7rem;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Main Content */
.game-content {
    flex: 1;
    overflow-y: auto;
    position: relative;
    padding-bottom: 85px; /* Increased space for bottom nav */
}

/* Active Buffs Sidebar */
.active-buffs-sidebar {
    position: fixed;
    top: 200px;
    right: 10px;
    width: 70px;
    display: none;
    flex-direction: column;
    gap: 5px;
    z-index: 100;
}

@media (min-width: 1200px) {
    .active-buffs-sidebar {
        display: flex;
    }
}

.buff-container {
    margin-bottom: 2px;
}

.buff-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    position: relative;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    border: 2px solid var(--gold);
    box-shadow: 0 0 10px rgba(201, 162, 39, 0.5);
    overflow: hidden;
}

.buff-icon::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    background: conic-gradient(var(--gold) var(--progress), transparent var(--progress));
    opacity: 0.5;
}

.buff-icon-inner {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #1a2430;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 2;
}

.buff-icon i {
    font-size: 20px;
    color: var(--gold);
}

.buff-icon img {
    width: 60%;
    height: 60%;
    object-fit: contain;
}

.buff-timer {
    text-align: center;
    font-weight: bold;
    color: var(--gold);
    font-size: 0.8rem;
    margin-top: 1px;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.8);
}

/* Top-up button at bottom of buff list */
.buff-topup {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    position: relative;
    background: linear-gradient(to bottom, #f7d547, #d4af37);
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 8px auto 0;
    border: 1px solid #e6c33c;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
}

.buff-topup:hover {
    background: linear-gradient(to bottom, #fae269, #e6c33c);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.buff-topup-inner {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 2;
    padding: 2px;
    line-height: 1;
    text-align: center;
}

.buff-topup-label {
    font-weight: bold;
    color: #1a1a1a;
    font-size: 1.05rem;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.3);
    margin-bottom: 1px;
}

.buff-topup-cost {
    font-size: 0.55rem;
    color: #1a1a1a;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.3);
}

/* Game Sections */
.game-section {
    background: var(--surface);
    border-radius: var(--border-radius-sm);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    display: none;
    border: 2px solid #3c2a0e;
    position: relative;
}

/* Skip rendering offscreen sections until needed to improve initial load */
.game-section:not(.active) {
    content-visibility: auto;
    contain-intrinsic-size: 800px 600px;
}

/* Buffs purchase header next to title */
.purchase-buffs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}
.purchase-buffs-header h3 {
    margin: 0;
    color: var(--gold);
    font-size: 1.5rem;
    font-family: 'Cinzel', serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}
.purchase-buffs-header .unlock-all-buffs {
    white-space: nowrap;
    margin-left: auto;
    background: linear-gradient(to bottom, #f7d547, #d4af37);
    color: #1a1a1a;
    border: 1px solid #e6c33c;
    border-radius: var(--border-radius-sm);
    padding: 6px 12px;
    font-weight: bold;
    font-size: 0.9rem;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    text-shadow: 0 1px 1px rgba(255,255,255,0.3);
}
.purchase-buffs-header .unlock-all-buffs:hover {
    background: linear-gradient(to bottom, #fae269, #e6c33c);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
    color: #000;
}
@media (max-width: 520px) {
    .purchase-buffs-header .unlock-all-buffs {
        padding: 6px 10px;
        font-size: 0.9em;
    }
}

.game-section::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 1px solid rgba(201, 162, 39, 0.3);
    pointer-events: none;
    border-radius: var(--border-radius-sm);
}

.game-section.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    position: relative;
    border-bottom: none;
}

.section-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10%;
    right: 10%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.section-header h2 {
    font-size: 2rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    color: var(--gold);
    text-transform: uppercase;
    font-family: 'Cinzel', serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 2px;
}

.section-header h2 i {
    color: var(--gold);
    font-size: 1.8rem;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* Dashboard */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    gap: var(--spacing-md);
}

.dashboard-card {
    background: rgba(26, 36, 48, 0.8);
    border-radius: var(--border-radius-sm);
    padding: var(--spacing-md);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border: 1px solid #3c2a0e;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
    margin-bottom: var(--spacing-md);
}

.dashboard-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, 
        rgba(201, 162, 39, 0.1) 0%, 
        rgba(201, 162, 39, 0) 50%,
        rgba(201, 162, 39, 0.1) 100%);
    pointer-events: none;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    border-color: var(--gold);
}

.dashboard-card h3 {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    color: var(--gold);
    font-size: 1.2rem;
    font-weight: 600;
    font-family: 'Cinzel', serif;
    letter-spacing: 1px;
    text-transform: uppercase;
    position: relative;
    padding-bottom: 8px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.dashboard-card h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 2px;
    background: var(--gold);
}

/* Main Mining Card */
.main-mining {
    grid-row: span 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: var(--spacing-md);
}

/* Mining Operations Header */
.mining-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid rgba(201, 162, 39, 0.3);
}

.mining-header h3 {
    margin: 0;
    font-size: 1.8rem;
    color: var(--gold);
    text-shadow: 0 0 10px rgba(201, 162, 39, 0.5);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.mining-header h3 i {
    color: var(--gold);
    text-shadow: 0 0 8px rgba(201, 162, 39, 0.6);
}

.help-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    aspect-ratio: 1 / 1;
    background: var(--accent-gold);
    border: none;
    color: var(--dark);
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(201, 162, 39, 0.4);
}

.help-btn:hover {
    background: linear-gradient(135deg, #DAA520, var(--gold));
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(201, 162, 39, 0.6);
}

.mining-stats {
    margin-bottom: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    background: rgba(0, 0, 0, 0.4);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-lg);
    border: 1px solid rgba(201, 162, 39, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.mining-stats .stat {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius);
    border-left: 3px solid var(--gold);
    transition: all 0.3s ease;
}

.mining-stats .stat:hover {
    background: rgba(201, 162, 39, 0.1);
    transform: translateX(4px);
}

.mining-stats .stat i {
    color: var(--gold);
    font-size: 1.2rem;
    width: 20px;
    text-align: center;
}

.mining-stats .stat-label {
    color: var(--text-light);
    font-weight: 600;
    font-size: 1rem;
}

.mining-stats .stat-sublabel {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-left: 2px;
}

.mining-stats .stat-value {
    color: var(--gold);
    font-weight: bold;
    font-size: 1.1rem;
    margin-left: auto;
    text-shadow: 0 0 5px rgba(201, 162, 39, 0.3);
}

.mine-btn {
    background: linear-gradient(to bottom, #8B4513, #3c2a0e);
    color: var(--gold);
    font-size: 1.6rem; /* Larger font */
    padding: var(--spacing-lg) var(--spacing-xl); /* More horizontal padding */
    border-radius: var(--border-radius-sm);
    margin-top: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    border: 2px solid var(--gold);
    text-transform: uppercase;
    font-family: 'Cinzel', serif;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 215, 0, 0.2);
    position: relative;
    overflow: hidden;
    min-height: 60px; /* Minimum height for touch targets */
}

.mine-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.3), transparent);
    transition: 0.5s;
}

.mine-btn:hover {
    background: linear-gradient(to bottom, #a0522d, #8B4513);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 215, 0, 0.3);
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    transform: translateY(-2px);
}

.mine-btn:hover::before {
    left: 100%;
}

.mine-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 215, 0, 0.1);
}

/* Quick Upgrades Section */
.quick-upgrades-section {
    margin-top: var(--spacing-md);
    border-top: 1px solid rgba(201, 162, 39, 0.3);
    padding-top: var(--spacing-md);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.quick-upgrades-section h4 {
    color: var(--gold);
    font-family: 'Cinzel', serif;
    margin-bottom: var(--spacing-md);
    font-size: 1.1rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.quick-upgrades-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    flex: 1;
    min-height: 100px; /* Ensure container has minimum height */
}

.quick-upgrade-item {
    background: rgba(26, 36, 48, 0.6);
    border: 1px solid var(--gold);
    border-radius: var(--border-radius-sm);
    padding: var(--spacing-md); /* More padding */
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    min-height: 44px; /* Minimum height for touch targets */
    gap: var(--spacing-sm);
}

.quick-upgrade-item.disabled {
    opacity: 0.55;
    filter: grayscale(15%);
    pointer-events: none;
}

.quick-upgrade-item:hover {
    background: rgba(26, 36, 48, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.quick-upgrade-item:active {
    transform: translateY(1px);
}

.quick-upgrade-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.1), transparent);
    transition: 0.5s;
}

.quick-upgrade-item:hover::before {
    left: 100%;
}

.quick-upgrade-image {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border-radius: var(--border-radius-sm);
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(201, 162, 39, 0.3);
}

.quick-upgrade-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.quick-upgrade-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.quick-upgrade-name {
    color: var(--gold);
    font-weight: bold;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.quick-upgrade-value {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.quick-upgrade-price {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    color: var(--gold);
    font-weight: bold;
}

.quick-upgrade-price i {
    color: var(--gold);
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
}

/* Ad Container */
.ad-container {
    margin-top: var(--spacing-md);
    flex: 1;
    min-height: 120px; /* Ensure container has minimum height */
    display: none; /* hidden by default */
    align-items: center;
    justify-content: center;
}

.ad-container.hidden {
    display: none !important;
    pointer-events: none !important;
}

.ad-container:empty {
    pointer-events: none; /* don't capture clicks when no ad */
}

.ad-image {
    max-width: 100%;
    height: auto;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

/* Quick Stats */
.stats-grid-small {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
}

.quick-stat {
    text-align: center;
    padding: var(--spacing-md);
    background: var(--surface);
    border-radius: var(--border-radius-md);
}

.quick-stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: var(--spacing-xs);
}

.quick-stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Quick Actions */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
}

.quick-action-btn {
    background: var(--surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-lg); /* More padding */
    border-radius: var(--border-radius-md);
    transition: all var(--transition-fast);
    min-height: 60px; /* Minimum height for touch targets */
}

.quick-action-btn i {
    font-size: 1.5rem; /* Larger icons */
    color: var(--primary);
}

.quick-action-btn span {
    font-size: 0.9rem; /* Larger text */
    margin-top: var(--spacing-xs); /* Add spacing */
}

.quick-action-btn:hover {
    background: var(--primary);
}

.quick-action-btn:hover i,
.quick-action-btn:hover span {
    color: white;
}

/* Milestone */
.milestone-progress {
    background: var(--surface);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.milestone-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
}

.milestone-cost {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Next Dungeon Preview */
.next-dungeon-preview {
    margin: var(--spacing-md) 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.preview-image-container {
    width: 100%;
    height: 100px;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    border: 1px solid var(--primary-dark);
    box-shadow: var(--shadow-md);
}

.preview-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.progress-bar {
    height: 10px;
    background: var(--surface-light);
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 5px;
    transition: width var(--transition-normal);
}

/* Upgrades, Adventurers, Dungeons Grids */
.upgrades-grid,
.adventurers-grid,
.dungeons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--spacing-lg);
}

.upgrade-item,
.adventurer-item,
.dungeon-item {
    background: rgba(26, 36, 48, 0.8);
    background-image: url('https://www.transparenttextures.com/patterns/parchment.png');
    border-radius: var(--border-radius-sm);
    padding: var(--spacing-lg);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border: 2px solid #3c2a0e;
}

.upgrade-item::before,
.adventurer-item::before,
.dungeon-item::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 1px solid rgba(201, 162, 39, 0.3);
    pointer-events: none;
    border-radius: var(--border-radius-sm);
    z-index: 1;
}

.upgrade-item:hover,
.adventurer-item:hover,
.dungeon-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.upgrade-item.disabled,
.adventurer-item.disabled,
.dungeon-item.disabled {
    opacity: 0.6;
    filter: grayscale(0.7);
}

.upgrade-item:not(.disabled):not(.unlocked),
.adventurer-item:not(.disabled):not(.unlocked),
.dungeon-item:not(.disabled):not(.unlocked) {
    border: 2px solid var(--gold);
}

.upgrade-item.unlocked,
.adventurer-item.unlocked {
    border: 2px solid var(--success);
    box-shadow: 0 0 15px rgba(46, 139, 87, 0.3);
    opacity: 1;
    filter: none;
}

.upgrade-item.unlocked::after,
.adventurer-item.unlocked::after {
    background: linear-gradient(90deg, var(--success), #8bc34a);
    opacity: 1;
}

/* Item card effects */
.upgrade-item::after,
.adventurer-item::after,
.dungeon-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--gold), var(--secondary));
    opacity: 0;
    transition: opacity var(--transition-normal);
    z-index: 2;
}

.upgrade-item:not(.disabled):not(.unlocked):hover::after,
.adventurer-item:not(.disabled):not(.unlocked):hover::after,
.dungeon-item:not(.disabled):not(.unlocked):hover::after {
    opacity: 1;
}

.dungeon-item.unlocked::after {
    background: linear-gradient(90deg, var(--success), #8bc34a);
    opacity: 1;
}

/* Dungeon Preview Images */
.dungeon-preview {
    width: 100%;
    height: 120px;
    margin-bottom: var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    border: 1px solid var(--primary-dark);
    box-shadow: var(--shadow-sm);
    background: var(--surface-light);
}

.dungeon-preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.2s ease;
}

.dungeon-item:hover .dungeon-preview-image {
    transform: scale(1.05);
}

/* Ensure dungeon items have enough space for preview */
.dungeon-item {
    min-height: 320px;
}

.upgrade-item:not(.disabled):not(.unlocked) .corner-ribbon,
.adventurer-item:not(.disabled):not(.unlocked) .corner-ribbon,
.dungeon-item:not(.disabled):not(.unlocked) .corner-ribbon {
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 30px 30px 0;
    border-color: transparent var(--gold) transparent transparent;
    z-index: 3;
}

.item-image-container {
    width: 64px;
    height: 64px;
    margin: var(--spacing-md) auto;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border-radius: var(--border-radius-sm);
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(201, 162, 39, 0.3);
}

.item-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.item-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: var(--spacing-md);
    position: relative;
    border-bottom: 1px solid rgba(201, 162, 39, 0.3);
    padding-bottom: var(--spacing-sm);
    text-align: center;
}

.item-name {
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--gold);
    font-family: 'Cinzel', serif;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    letter-spacing: 1px;
    text-align: center;
    width: 100%;
}

.item-owned {
    background: linear-gradient(to bottom, var(--gold), var(--secondary-dark));
    color: var(--surface);
    padding: 3px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-family: 'MedievalSharp', 'Cinzel', serif;
    position: relative;
    z-index: 1; /* Lower than status but still above background */
}

.item-description {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    font-size: 0.95rem;
    font-style: italic;
    line-height: 1.4;
}

.item-stats {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-md);
    background: rgba(0, 0, 0, 0.2);
    padding: var(--spacing-sm);
    border-radius: var(--border-radius-sm);
    border: 1px solid rgba(201, 162, 39, 0.2);
}

.item-stat {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.item-price {
    text-align: right;
    font-weight: bold;
    color: var(--gold);
    margin-top: var(--spacing-sm);
    font-family: 'MedievalSharp', 'Cinzel', serif;
    font-size: 1.1rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--spacing-xs);
}

.item-status {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 8px;
    z-index: 5; /* Ensure it's above other elements */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    white-space: nowrap;
}

.item-status.available {
    background: linear-gradient(to bottom, var(--success), #1a5c37);
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.item-status.locked {
    background: linear-gradient(to bottom, var(--error), #5c0000);
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.item-status.owned {
    background: linear-gradient(to bottom, var(--primary), var(--primary-dark));
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Staking Section */
.staking-card {
    background: rgba(26, 36, 48, 0.8);
    background-image: url('https://www.transparenttextures.com/patterns/parchment.png');
    border-radius: var(--border-radius-sm);
    padding: var(--spacing-xl);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    border: 2px solid #3c2a0e;
    position: relative;
}

.staking-card::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 1px solid rgba(201, 162, 39, 0.3);
    pointer-events: none;
    border-radius: var(--border-radius-sm);
}

.staking-info {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.staking-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
}

.staking-controls {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.input-group {
    display: flex;
    position: relative;
}

.input-group input {
    flex: 1;
    padding-right: 60px;
}

.max-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: var(--border-radius-sm);
    font-size: 0.8rem;
}

.staking-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
}

@media (max-width: 480px) {
    .staking-buttons {
        grid-template-columns: 1fr; /* Stack buttons on small screens */
        gap: var(--spacing-sm);
    }
    
    .staking-buttons button {
        min-height: 50px; /* Taller buttons on mobile */
    }
}

.stake-btn {
    background: var(--primary);
    color: white;
}

.unstake-btn {
    background: var(--surface);
    color: var(--text);
}

.claim-btn {
    background: var(--gold);
    color: var(--background);
}

/* Prestige Section */
.prestige-card {
    background: var(--surface-light);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-lg);
}

.prestige-info {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.prestige-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
}

.prestige-description {
    background: var(--surface);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-md);
}

.prestige-description p {
    margin-bottom: var(--spacing-md);
}

.prestige-description ul {
    padding-left: var(--spacing-lg);
}

.prestige-btn {
    background: linear-gradient(45deg, #9c27b0, #673ab7);
    color: white;
    padding: var(--spacing-lg);
    font-size: 1.2rem; /* Larger font */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    min-height: 60px; /* Minimum height for touch targets */
}

.prestige-btn:hover {
    background: linear-gradient(45deg, #b92fd8, #7e57c2);
    box-shadow: 0 5px 20px rgba(156, 39, 176, 0.4);
}

.prestige-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Stats Section */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
}

/* Leaderboard */
.leaderboard-tabs {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.leaderboard-tabs .data-btn {
    min-height: 44px; /* Minimum height for touch targets */
    padding: var(--spacing-sm) var(--spacing-md); /* More padding */
    flex: 1; /* Equal width buttons */
}

.leaderboard-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-sm);
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: var(--border-radius-md);
    gap: 12px;
}

.leaderboard-item.is-current-user {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), rgba(218, 165, 32, 0.05));
    border-color: var(--gold);
}

.leaderboard-rank {
    width: 40px;
    text-align: center;
    font-weight: bold;
    color: var(--gold);
    flex-shrink: 0;
}

.leaderboard-player {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.leaderboard-address {
    font-family: monospace;
    opacity: 0.9;
    font-size: 0.9em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-stats {
    display: flex;
    gap: 8px;
    font-size: 0.85em;
    opacity: 0.7;
}

.leaderboard-stats .prestige-badge {
    background: var(--gold);
    color: var(--dark);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

.leaderboard-prestige {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
    min-width: 120px;
}

.prestige-level-display {
    font-weight: bold;
    color: var(--gold);
    padding: 6px 12px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(218, 165, 32, 0.1));
    border: 1px solid var(--gold);
    border-radius: var(--border-radius-sm);
    white-space: nowrap;
    font-size: 0.95em;
}

.leaderboard-loading, .leaderboard-empty, .leaderboard-error {
    text-align: center;
    padding: var(--spacing-lg);
    opacity: 0.7;
}

.leaderboard-note {
    margin-top: var(--spacing-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.stat-card {
    background: var(--surface-light);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-lg);
}

.stat-card h3 {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--primary-light);
    margin-bottom: var(--spacing-md);
    text-align: center;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-xs) 0;
    border-bottom: 1px solid var(--surface);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    color: var(--text-secondary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999; /* ensure topmost */
    justify-content: center;
    align-items: center;
}

/* How to Play Modal Styling */
#howto-modal .modal-content {
    max-width: 550px;
    background: linear-gradient(to bottom, #1a2430, #0d1218);
    border: 2px solid var(--gold);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.2);
}

#howto-modal .modal-header {
    background: linear-gradient(45deg, #1a2430, #2a3440);
    border-bottom: 2px solid var(--gold);
}

#howto-modal h3 {
    color: var(--gold);
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
    font-size: 1.5rem;
}

#howto-modal ol {
    counter-reset: howto-counter;
    list-style-type: none;
    padding: 0;
    margin: 1rem 0;
}

#howto-modal li {
    position: relative;
    padding: 12px 0 12px 50px;
    margin-bottom: 15px;
    font-size: 1.1rem;
    border-radius: 8px;
    background: rgba(0,0,0,0.2);
    border-left: 3px solid var(--gold);
}

#howto-modal li:before {
    content: counter(howto-counter);
    counter-increment: howto-counter;
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background: var(--gold);
    color: #1a2430;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

#howto-modal li:last-child {
    margin-bottom: 0;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--surface-light);
}

.modal-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.close-modal {
    background: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
}

.modal-body {
    padding: var(--spacing-lg);
}

/* Session overlay greys out the game when paused */
.session-paused-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    display: none;
}

body.session-paused .session-paused-overlay {
    display: block;
}

.setting-group {
    margin-bottom: var(--spacing-lg);
}

/* Data Management Styles */
.data-management-controls {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.data-btn {
    background: linear-gradient(45deg, #5d4037, #8d6e63);
    border: 2px solid var(--gold);
    color: var(--gold);
    padding: 8px 16px;
    border-radius: 4px;
    font-family: 'Cinzel', serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.data-btn:hover {
    background: linear-gradient(45deg, #8d6e63, #a1887f);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.export-btn {
    background: linear-gradient(45deg, #2e7d32, #4caf50);
}

.export-btn:hover {
    background: linear-gradient(45deg, #4caf50, #66bb6a);
}

.import-btn {
    background: linear-gradient(45deg, #1565c0, #42a5f5);
}

.import-btn:hover {
    background: linear-gradient(45deg, #42a5f5, #64b5f6);
}

.data-note {
    font-size: 0.9em;
    color: #aaa;
    font-style: italic;
    margin-top: var(--spacing-sm);
}

.setting-group h4 {
    margin-bottom: var(--spacing-md);
    color: var(--primary-light);
}

.setting {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    margin-left: var(--spacing-xs);
}

.toggle-switch.small {
    width: 30px;
    height: 16px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #3c2a0e;
    transition: var(--transition-normal);
    border-radius: 34px;
    border: 1px solid rgba(201, 162, 39, 0.5);
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 2px;
    background: linear-gradient(to bottom, #e6c158, var(--gold));
    transition: var(--transition-normal);
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.toggle-switch.small .toggle-slider:before {
    height: 10px;
    width: 10px;
}

input:checked + .toggle-slider {
    background-color: #1a1306;
}

input:checked + .toggle-slider:before {
    transform: translateX(16px);
}

.toggle-switch.small input:checked + .toggle-slider:before {
    transform: translateX(14px);
}

.toggle-label {
    margin-left: 5px;
    white-space: nowrap;
    color: var(--gold);
    font-size: 0.7rem;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
}

.mini-label {
    color: var(--gold);
    font-size: 0.7rem;
    opacity: 0.8;
    margin-right: 2px;
}

/* Mobile Help Banner */
.mobile-help-banner {
    position: fixed;
    bottom: 10px; /* Move to bottom to be less intrusive */
    left: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    color: white;
    padding: 10px 14px;
    z-index: 10001;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    border-radius: 10px;
}

.mobile-help-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.mobile-help-content i {
    font-size: 1.2em;
    color: #ffd700;
}

.mobile-help-content span {
    flex: 1;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
}

.close-mobile-help {
    background: none;
    border: none;
    color: white;
    font-size: 14px; /* Smaller, less intrusive */
    cursor: pointer;
    padding: 6px 10px;
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.close-mobile-help:hover {
    background-color: rgba(255,255,255,0.2);
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Notifications */
.notifications {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    z-index: 1000;
}

.notification {
    background: var(--surface);
    color: var(--text);
    padding: var(--spacing-md);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-md);
    animation: slideIn 0.3s ease forwards;
    max-width: 300px;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.notification i {
    font-size: 1.2rem;
}

.notification.success {
    border-left: 4px solid var(--success);
}

.notification.success i {
    color: var(--success);
}

.notification.error {
    border-left: 4px solid var(--error);
}

.notification.error i {
    color: var(--error);
}

.notification.info {
    border-left: 4px solid var(--primary);
}

.notification.info i {
    color: var(--primary);
}

.notification.warning {
    border-left: 4px solid var(--warning);
}

.notification.warning i {
    color: var(--warning);
}

.notification.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Connect Button */
.connect-btn {
    background: linear-gradient(to bottom, var(--gold), #8B4513);
    color: var(--surface);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    border: 2px solid var(--gold);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    font-weight: bold;
    min-width: 120px;
    justify-content: center;
}

/* Reset Button */
.reset-btn {
    background: linear-gradient(to bottom, #8B0000, #5c0000);
    color: var(--gold);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    border: 2px solid var(--gold);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    font-weight: bold;
    min-width: 120px;
    justify-content: center;
}

/* Settings Button */
.settings-btn {
    background: rgba(26, 36, 48, 0.8);
    color: var(--gold);
    font-size: 1.2rem;
    padding: 8px;
    border: 2px solid var(--gold);
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

/* Animations */
.pulse-animation {
    animation: pulse 2s infinite;
    will-change: transform;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(106, 77, 255, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(106, 77, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(106, 77, 255, 0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

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

.bounce {
    animation: bounce 0.5s ease;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.shake {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    20%, 60% {
        transform: translateX(-5px);
    }
    40%, 80% {
        transform: translateX(5px);
    }
}

.spin {
    animation: spin 1s linear infinite;
}

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

.game-section {
    animation: fadeIn 0.3s ease-in-out;
}

.sidebar-section:hover i {
    animation: bounce 0.5s ease;
}

.quick-action-btn:hover i {
    animation: bounce 0.5s ease;
}

.mine-btn:active i {
    animation: spin 0.5s linear;
}

/* Username Settings */
.setting-description {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin: var(--spacing-xs) 0 var(--spacing-md) 0;
    line-height: 1.4;
}

.username-input-group {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.username-input {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--surface-dark);
    border: 2px solid var(--surface-light);
    border-radius: var(--border-radius-sm);
    color: var(--text);
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.username-input:focus {
    outline: none;
    border-color: var(--gold);
}

.save-username-btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    background: linear-gradient(135deg, var(--gold), #daa520);
    color: var(--dark);
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    white-space: nowrap;
}

.save-username-btn:hover {
    background: linear-gradient(135deg, #daa520, var(--gold));
    transform: translateY(-2px);
}

.username-status {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm);
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid var(--gold);
    border-radius: var(--border-radius-sm);
    margin: 0;
}

.status-label {
    font-weight: bold;
    color: var(--gold);
}

.status-value {
    color: var(--text);
    font-family: monospace;
}

.username-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm);
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: var(--border-radius-sm);
    margin: var(--spacing-md) 0 0 0;
    font-size: 0.85em;
    color: var(--text-secondary);
    line-height: 1.4;
}

.username-disclaimer i {
    color: #ffc107;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Snapshot management styles */
.snapshot-controls {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    flex-wrap: wrap;
}

.snapshots-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg-secondary);
}

.snapshots-list {
    padding: var(--spacing-sm);
}

.snapshots-loading {
    text-align: center;
    padding: var(--spacing-lg);
    color: var(--color-text-secondary);
    font-style: italic;
}

.snapshot-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    transition: all 0.2s;
}

.snapshot-item:hover {
    background: var(--color-bg-hover);
    border-color: var(--color-primary);
}

.snapshot-item:last-child {
    margin-bottom: 0;
}

.snapshot-info {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--spacing-sm);
    align-items: center;
}

.snapshot-stat {
    text-align: center;
}

.snapshot-stat-label {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    margin-bottom: 2px;
}

.snapshot-stat-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text);
}

.snapshot-date {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    margin-top: 4px;
}

.snapshot-actions {
    display: flex;
    gap: var(--spacing-xs);
}

.snapshot-restore-btn {
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--color-success);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s;
}

.snapshot-restore-btn:hover {
    background: var(--color-success-dark);
}

.snapshot-restore-btn:disabled {
    background: var(--color-text-secondary);
    cursor: not-allowed;
}

.snapshots-empty {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--color-text-secondary);
    font-style: italic;
}

.snapshots-error {
    text-align: center;
    padding: var(--spacing-lg);
    color: var(--color-error);
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
    border-radius: 4px;
    margin: var(--spacing-sm);
}

/* Activity Toast Notifications */
.activity-toast {
    position: fixed;
    bottom: 80px;
    right: 20px;
    padding: 12px 20px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.95), rgba(218, 165, 32, 0.95));
    color: var(--dark);
    border-radius: var(--border-radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    font-weight: 500;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s ease;
    z-index: 10000;
    max-width: 300px;
}

.activity-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.activity-toast.info {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.95), rgba(41, 128, 185, 0.95));
    color: white;
}

/* Video Ad Modal - Using inline styles for guaranteed compatibility */


.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--surface-light);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: var(--spacing-sm);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--primary-light));
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.video-status {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

.video-status.complete {
    color: var(--success);
    font-weight: bold;
}

#claim-buff-btn {
    width: 100%;
    margin-top: var(--spacing-md);
    padding: var(--spacing-md);
    font-size: 1.1rem;
}

#claim-buff-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Buffs Section */
.buffs-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
}

@media (min-width: 768px) {
    .buffs-container {
        grid-template-columns: 1fr 2fr;
    }
}

.active-buffs,
.available-buffs {
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-lg);
}

.active-buffs h3,
.available-buffs h3 {
    margin: 0 0 var(--spacing-md) 0;
    color: var(--gold);
    font-size: 1.1rem;
}

.buffs-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.no-buffs {
    opacity: 0.6;
    font-style: italic;
    text-align: center;
    padding: var(--spacing-md);
}

.active-buff {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm);
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid var(--gold);
    border-radius: var(--border-radius-sm);
}

.buff-name {
    font-weight: bold;
    color: var(--gold);
}

.buff-timer {
    font-family: monospace;
    color: var(--text-secondary);
}

.buff-card {
    background: var(--surface-dark);
    border: 1px solid var(--surface-light);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.buff-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.buff-header i {
    font-size: 1.5rem;
    color: var(--gold);
}

.buff-header h4 {
    margin: 0;
    color: var(--text);
}

.buff-description {
    color: var(--text-secondary);
    margin: 0 0 var(--spacing-md) 0;
    font-size: 0.9em;
}

.buff-actions {
    display: grid;
    grid-template-columns: 1fr; /* Single action: Watch Ad */
    gap: var(--spacing-sm);
}

.btn-watch-ad,
.btn-buy-dgn {
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
}

.btn-watch-ad {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: white;
}

.btn-watch-ad:hover {
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
    transform: translateY(-2px);
}

.btn-buy-dgn {
    background: linear-gradient(135deg, var(--gold), #daa520);
    color: var(--dark);
}

.btn-buy-dgn:hover {
    background: linear-gradient(135deg, #daa520, var(--gold));
    transform: translateY(-2px);
}

/* Disable animations if user prefers reduced motion or setting is off */
@media (prefers-reduced-motion) {
    .pulse-animation, .fade-in, .bounce, .shake, .spin,
    .sidebar-section:hover i, .quick-action-btn:hover i, .mine-btn:active i {
        animation: none !important;
    }
}

body.animations-disabled .pulse-animation,
body.animations-disabled .fade-in,
body.animations-disabled .bounce,
body.animations-disabled .shake,
body.animations-disabled .spin,
body.animations-disabled .sidebar-section:hover i,
body.animations-disabled .quick-action-btn:hover i,
body.animations-disabled .mine-btn:active i {
    animation: none !important;
}

/* Make sure clickable items are always clickable */
.upgrade-item,
.adventurer-item,
.dungeon-item {
    pointer-events: auto !important;
}

/* Desktop / tablet adjustments */
@media (min-width: 768px) {
    :root {
        --spacing-md: 16px;
        --spacing-lg: 24px;
        --spacing-xl: 32px;
    }
    
    .game-layout {
        flex-direction: row;
        gap: var(--spacing-lg);
        padding: 0 var(--spacing-md);
    }
    
    .top-controls-strip {
        padding: 0 var(--spacing-lg);
    }
}
    
@media (min-width: 768px) {
    /* Show text labels on tablet and up */
    .sidebar-section span {
        display: inline;
    }
    
    .game-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: var(--spacing-md) var(--spacing-xl);
    }
    
    .logo {
        margin-top: 0;
        margin-right: auto;
        align-self: center;
    }
    
    .resource-bar {
        margin-top: 0;
        margin-left: auto;
        align-self: center;
    }
    
    .logo h1 {
        font-size: 2.5rem;
    }
    
    .logo i {
        font-size: 2.2rem;
    }
}
@media (min-width: 1024px) {
    .stats-grid-small,
    .quick-actions-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .resource-bar {
        padding: var(--spacing-sm) var(--spacing-xl);
    }
    
    .resource-bar i {
        font-size: 1.2rem;
    }
    
    #balance, #dgn-per-second {
        font-size: 1.3rem;
    }
    
    .logo h1 {
        font-size: 3rem;
    }
    
    .logo i {
        font-size: 2.6rem;
    }
}


@media (min-width: 1024px) {
    .stats-grid-small,
    .quick-actions-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .game-header {
        padding: var(--spacing-md) var(--spacing-xl);
        min-height: 140px; /* Taller header on desktop */
    }
    
    .resource-bar {
        padding: var(--spacing-sm) var(--spacing-xl);
        min-width: 350px;
    }
    
    .resource-bar i {
        font-size: 1.1rem;
    }
    
    #balance, #dgn-per-second {
        font-size: 1.1rem;
    }
    
    .logo h1 {
        font-size: 2.8rem;
    }
    
    .logo i {
        font-size: 2.5rem;
    }
}

@media (min-width: 1200px) {
    .game-header {
        padding-left: var(--spacing-xl);
        padding-right: var(--spacing-xl);
    }
}

@media (min-width: 768px) {
    .game-sidebar {
        position: static;
        height: auto;
        width: 240px;
        display: flex;
        flex-direction: column;
        padding: var(--spacing-lg);
        gap: var(--spacing-md);
        margin-bottom: 0;
    }
    
    .game-content {
        padding-bottom: 0;
    }
    
    .section-header {
        margin-bottom: var(--spacing-lg);
        padding-bottom: var(--spacing-md);
    }
    
    .dashboard-card {
        padding: var(--spacing-lg);
        margin-bottom: var(--spacing-lg);
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-lg);
    }
    
    .game-section {
        padding: var(--spacing-xl);
        margin-bottom: var(--spacing-lg);
    }

    .sidebar-section {
        flex-direction: column;
        padding: var(--spacing-sm);
        text-align: center;
    }

    .sidebar-section i {
        margin-bottom: var(--spacing-xs);
    }

    .notification-badge {
        top: 0;
        right: 0;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .main-mining {
        grid-row: auto;
    }

    .prestige-stats,
    .staking-stats {
        grid-template-columns: 1fr;
    }

    .staking-buttons {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {
    .game-header {
        flex-wrap: wrap;
        gap: var(--spacing-md);
    }

    .logo {
        order: 1;
        flex: 1;
    }

    .resource-display {
        order: 3;
        width: 100%;
        justify-content: space-around;
        margin: var(--spacing-md) 0 0 0;
    }

    .controls {
        order: 2;
        flex: 1;
        justify-content: flex-end;
    }
}

@media (max-width: 768px) {
    .game-header {
        flex-direction: column;
        gap: var(--spacing-md);
        padding: var(--spacing-sm);
        min-height: auto;
    }

    .logo {
        order: 1;
        align-self: center;
    }
    
    .logo h1 {
        font-size: 1.8rem;
        letter-spacing: 1px;
    }
    
    .logo i {
        font-size: 1.6rem;
    }

    .resource-display {
        order: 2;
        width: 100%;
        justify-content: space-around;
    }
    
    .resource-bar {
        padding: var(--spacing-xs) var(--spacing-md);
        gap: var(--spacing-sm);
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .resource-bar i {
        font-size: 0.9rem;
    }
    
    #balance, #dgn-per-second {
        font-size: 0.9rem;
        white-space: nowrap;
    }
    
    .resource-divider {
        margin: 0 var(--spacing-xs);
    }

    .controls {
        order: 3;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }

    .stats-grid,
    .upgrades-grid,
    .adventurers-grid,
    .dungeons-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid-small {
        grid-template-columns: 1fr 1fr;
    }
    
    /* Reduce section header size on mobile */
    .section-header h2 {
        font-size: 1.3rem;
        letter-spacing: 1px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .section-header h2 i {
        font-size: 1.2rem;
    }
    
    /* Buffs section mobile improvements */
    .buffs-container {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    
    .active-buffs,
    .available-buffs {
        padding: var(--spacing-md);
    }
    
    .active-buffs h3,
    .available-buffs h3 {
        font-size: 1rem;
    }
    
    .buff-card {
        padding: var(--spacing-sm);
        margin-bottom: var(--spacing-sm);
    }
    
    .buff-header h4 {
        font-size: 0.95rem;
    }
    
    .buff-description {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    /* Mobile header adjustments */
    .main-title-header {
        height: 48px;
        padding: 6px 0;
    }
    
    .main-title-header i {
        font-size: 1.4rem;
    }
    
    .main-title-header h1 {
        font-size: 1.3rem;
        letter-spacing: 2px;
    }
    
    .top-controls-strip {
        height: 44px;
        padding: 0 var(--spacing-sm);
        grid-template-columns: auto 1fr auto;
        gap: var(--spacing-xs);
    }
    
    .chain-selector select {
        font-size: 0.85rem;
        padding: 4px 8px;
        min-height: 32px;
    }
    
    .wallet-connect-btn {
        font-size: 0.85rem;
        padding: 6px 12px;
        min-height: 32px;
    }
    
    #wallet-address-text {
        font-size: 0.8rem;
        padding: 4px 8px;
        max-width: 140px;
    }
    
    .mini-btn {
        font-size: 1rem;
        padding: 6px;
        height: 32px;
        min-height: 32px;
        min-width: 32px;
    }
    
    .resource-bar.resource-bar-global {
        top: 92px; /* Adjusted for smaller header heights (48px + 44px) */
        padding: 0 var(--spacing-md);
        height: 44px;
    }
    
    body {
        padding-top: 136px; /* Adjusted for smaller header heights (48px + 44px + 44px) */
    }
    
    .game-container {
        min-height: calc(100vh - 136px);
    }
    
    .stats-grid-small,
    .quick-actions-grid {
        grid-template-columns: 1fr;
    }
    
    /* Mobile mining operations adjustments */
    .mining-header {
        margin-bottom: var(--spacing-md);
        padding-bottom: var(--spacing-sm);
    }
    
    .mining-header h3 {
        font-size: 1.2rem;
    }
    
    .help-btn {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }
    
    .mining-stats {
        padding: var(--spacing-md);
        gap: var(--spacing-sm);
    }
    
    .mining-stats .stat {
        padding: var(--spacing-xs);
    }
    
    .mining-stats .stat i {
        font-size: 1rem;
        width: 16px;
    }
    
    .mining-stats .stat-label {
        font-size: 0.9rem;
    }
    
    .mining-stats .stat-sublabel {
        font-size: 0.75rem;
    }
    
    .mining-stats .stat-value {
        font-size: 1rem;
    }
    
    /* Fix for upgrade items on mobile */
    .item-header {
        padding-right: 0;
        padding-top: 40px; /* Move content below the status badge */
    }
    
    .item-status {
        top: 5px;
        right: 5px;
    }

    .modal-content {
        width: 95%;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    
    .connect-btn,
    .reset-btn {
        width: 100%;
        margin-bottom: var(--spacing-sm);
        min-height: 50px; /* Taller buttons */
    }
    
    .settings-btn {
        align-self: center;
    }
    
    /* Improved spacing for mobile */
    .game-section {
        padding: var(--spacing-md);
    }
    
    /* Larger close buttons in modals */
    .close-modal {
        width: 44px;
        height: 44px;
        font-size: 1.8rem;
    }
    
    /* Improve form elements */
    input, select, .max-btn {
        min-height: 44px;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
    
    /* Make notification badges more visible */
    .notification-badge {
        width: 24px;
        height: 24px;
        font-size: 0.8rem;
    }
    
    /* Further reduce header elements on small mobile */
    .game-header {
        padding: var(--spacing-xs);
    }
    
    .logo h1 {
        font-size: 1.5rem;
        letter-spacing: 0.5px;
    }
    
    .logo i {
        font-size: 1.3rem;
    }
    
    .resource-bar {
        padding: var(--spacing-xs) var(--spacing-sm);
        gap: var(--spacing-xs);
    }
    
    .resource-bar i {
        font-size: 0.8rem;
    }
    
    #balance, #dgn-per-second {
        font-size: 0.8rem;
    }
    
    /* Further reduce section header on small mobile */
    .section-header h2 {
        font-size: 1.1rem;
        letter-spacing: 0.5px;
    }
    
    .section-header h2 i {
        font-size: 1rem;
    }
    
    /* Smaller buffs titles on small mobile */
    .active-buffs h3,
    .available-buffs h3 {
        font-size: 0.9rem;
    }
    
    /* Reduce buff card title size */
    .buff-header {
        gap: var(--spacing-xs);
    }
    
    .buff-header i {
        font-size: 1.2rem;
    }
    
    .buff-header h4 {
        font-size: 0.85rem;
        margin: 0;
        line-height: 1.2;
    }
    
    .buff-description {
        font-size: 0.8rem;
        line-height: 1.3;
    }
    
    /* Prevent overflow on active buffs */
    .active-buff {
        padding: var(--spacing-xs) var(--spacing-sm);
        flex-wrap: wrap;
    }
    
    .buff-name {
        font-size: 0.85rem;
        flex: 1;
        min-width: 0;
    }
    
    .buff-timer {
        font-size: 0.8rem;
        flex-shrink: 0;
    }
    
    /* Adjust buff button sizes */
    .buff-actions {
        gap: var(--spacing-xs);
        flex-wrap: wrap;
    }
    
    .btn-watch-ad,
    .btn-buy-dgn {
        font-size: 0.75rem;
        padding: var(--spacing-xs) var(--spacing-sm);
    }
}

/* Pixel Sprite Equipment Display */
.equipped-items {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
}

.equipped-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
}

/* Old pixel sprite classes removed - now using img elements with equipment-image class */

.item-name, .equipment-name {
    font-size: 1.1rem; /* Restored to original size */
    color: #D2B48C; /* Tan color like in the reference image */
    text-align: center;
    max-width: 12rem; /* Restored to original size */
    margin-bottom: 0.25rem; /* Restored to original size */
    word-wrap: break-word;
}

.equipment-stats {
    font-size: 1.2rem; /* Restored to original size */
    color: var(--accent-gold);
    font-weight: bold;
    text-align: center;
}

/* New simplified equipment grid */
.equipment-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--spacing-xl);
    align-items: start;
    padding: var(--spacing-md);
    margin: var(--spacing-sm) 0;
}

/* Keep side-by-side down to typical mobile widths */
@media (max-width: 576px) {
    .equipment-grid {
        gap: var(--spacing-md);
    }
}

/* Only stack on very narrow screens */
@media (max-width: 420px) {
    .equipment-grid {
        grid-template-columns: 1fr;
    }
}


.equipment-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    text-align: center;
    width: 100%; /* Fill grid column */
    box-sizing: border-box;
}

/* Make cards smaller on mobile */
@media (max-width: 768px) {
    .equipment-card { padding: var(--spacing-sm); }
}

@media (max-width: 576px) {
    .equipment-card { padding: var(--spacing-xs); }
}

.equipment-image-container {
    width: 100%;
    height: 12rem;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible; /* Changed to visible to show full image */
    padding: var(--spacing-md); /* Add padding around the image container */
}

.equipment-image {
    max-width: 90%; /* Reduced from 100% to add margin */
    max-height: 90%; /* Reduced from 100% to add margin */
    width: auto;
    height: auto;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    transform: scale(1.0); /* Reduced scale to ensure full visibility */
    margin: var(--spacing-sm); /* Add explicit margin around the image */
}

.equipment-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    width: 100%;
}

.svg-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.equipment-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: auto;
    padding-top: var(--spacing-md); /* Add padding to create better vertical spacing */
}

.mining-display {
    margin: var(--spacing-sm) 0; /* Reduced from lg to sm */
}

/* Unlocked status styling */
.item-status.unlocked {
    background: var(--accent-gold);
    color: var(--bg-primary);
    font-weight: bold;
}

.item-unlocked {
    color: var(--accent-gold);
    font-weight: bold;
    font-size: 0.9rem;
}
