/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-card: #22263a;
    --bg-card-hover: #2a2f47;
    --bg-hover: var(--bg-card-hover);
    --bg-main: var(--bg-secondary);
    --bg-input: #181b25;
    --border: #2e3348;
    --border-light: #3a3f58;
    --text-primary: #e8e9ed;
    --text-secondary: #9ca0b0;
    --text-muted: #6b6f82;
    --accent: #c8aa6e;
    --accent-hover: #dfc08a;
    --green: #2ecc71;
    --green-bg: rgba(46, 204, 113, 0.1);
    --red: #e74c3c;
    --red-bg: rgba(231, 76, 60, 0.1);
    --blue: #3b82f6;
    --blue-bg: rgba(59, 130, 246, 0.1);
    --yellow: #f1c40f;
    --yellow-bg: rgba(241, 196, 15, 0.1);
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --transition: 0.2s ease;
}

/* Page visibility is controlled by the inlined script and app.js to avoid flashes of content */

/* ===== PRICE CHANGE INDICATORS ===== */
.price-change-indicator {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    min-height: 1em;
    margin-top: 2px;
    transition: opacity 0.3s ease;
}
.price-change-indicator:empty {
    display: none;
}
.price-change-indicator.price-increased {
    color: var(--green);
    text-shadow: 0 0 6px rgba(46, 204, 113, 0.5);
}
.price-change-indicator.price-decreased {
    color: var(--red);
    text-shadow: 0 0 6px rgba(231, 76, 60, 0.5);
}

/* Compact bond display used on mobile when moved next to settings */
.bond-compact {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    border-radius: 6px;
    background: transparent;
}
.bond-compact .bond-label { display:none; }
.bond-compact #bondPrice { font-size: 0.85rem; }
.bond-compact img { width:18px;height:18px;margin:0;padding:0; }

/* Bond price widget */
.bond-price {
    display: flex;
    align-items: center;
    margin-left: 8px;
}
.bond-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    margin-right: 8px;
}
.bond-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}
.bond-label {
    font-size: 11px;
    color: var(--text-muted);
}

@media (max-width: 720px) {
    /* Ensure header actions are compact and bond fits */
    .header .header-stats { display: flex; gap: 6px; align-items: center; }
    .header .header-stats .ge-radio { display: none; }
    .header-actions { display: flex; gap: 6px; align-items: center; }
}

/* ===== SEASONAL THEMES ===== */
[data-season="christmas"] {
    --accent: #c0392b;
    --accent-hover: #e74c3c;
}
[data-season="halloween"] {
    --accent: #e67e22;
    --accent-hover: #f39c12;
}
[data-season="leagues"] {
    --accent: #8e44ad;
    --accent-hover: #9b59b6;
}
[data-season="dmm"] {
    --accent: #c0392b;
    --accent-hover: #e74c3c;
}

.seasonal-banner {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #fff;
    text-align: center;
    padding: 8px 40px 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    position: relative;
    letter-spacing: 0.3px;
    z-index: 100;
}
.seasonal-banner .seasonal-emoji {
    margin: 0 4px;
}
.seasonal-banner .seasonal-close {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    opacity: 0.8;
    line-height: 1;
    padding: 4px;
}
.seasonal-banner .seasonal-close:hover {
    opacity: 1;
}

/* ===== ITEM SPOTLIGHT BANNER ===== */
.spotlight-banner {
    display: none;
    flex: 1;
    min-width: 250px;
    max-width: 400px;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    position: relative;
    overflow: hidden;
}
.spotlight-banner.visible {
    display: flex !important;
}
.filters-row.collapsed .spotlight-banner {
    display: none !important;
}
.spotlight-inner {
    display: contents;
}
.spotlight-glow {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    background: radial-gradient(circle, rgba(200, 170, 110, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}
.spotlight-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    filter: drop-shadow(0 0 4px rgba(200, 170, 110, 0.4));
    flex-shrink: 0;
}
.spotlight-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-width: 0;
}
.spotlight-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--accent);
    font-weight: 700;
}
.spotlight-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.spotlight-lore {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.spotlight-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.spotlight-price {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
}
.spotlight-view-btn {
    padding: 6px 14px;
    background: var(--accent);
    color: var(--bg-primary);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
    white-space: nowrap;
}
.spotlight-view-btn:hover {
    background: var(--accent-hover);
}
.spotlight-close {
    position: absolute;
    right: 4px;
    top: 2px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    transition: color var(--transition);
}
.spotlight-close:hover {
    color: var(--text-primary);
}
@media (max-width: 600px) {
    .spotlight-banner { min-width: 180px; }
    .spotlight-lore { display: none; }
}

/* Hide any remaining spotlight markup site-wide (feature removed) */
.spotlight-banner,
.spotlight-icon,
.spotlight-text,
.spotlight-stats,
.spotlight-view-btn,
.spotlight-close,
.spotlight-label,
.spotlight-name,
.spotlight-lore {
    display: none !important;
}

/* Budget controls removed */

/* ===== LIGHT THEME ===== */
[data-theme="light"] {
    --bg-primary: #f5ebe0;
    --bg-secondary: #ede0d0;
    --bg-card: #fdf8f0;
    --bg-card-hover: #f7eed8;
    --bg-input: #ede0d0;
    --border: #d4c4a8;
    --border-light: #c4b494;
    --text-primary: #2c2416;
    --text-secondary: #5c4f3a;
    --text-muted: #8a7e6a;
    --accent: #8b6914;
    --accent-hover: #a47d1a;
    --green: #1e8449;
    --green-bg: rgba(30, 132, 73, 0.12);
    --red: #c0392b;
    --red-bg: rgba(192, 57, 43, 0.12);
    --blue: #2563eb;
    --blue-bg: rgba(37, 99, 235, 0.12);
    --yellow: #b7950b;
    --yellow-bg: rgba(183, 149, 11, 0.12);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
}

/* ===== BLOOD MOON THEME ===== */
[data-theme="blood-moon"] {
    --bg-primary: #1a0a0a;
    --bg-secondary: #2a1010;
    --bg-card: #3d1111;
    --bg-card-hover: #4d1a1a;
    --bg-input: #1f0c0c;
    --border: #5a2020;
    --border-light: #6e2a2a;
    --text-primary: #f0d0d0;
    --text-secondary: #b08080;
    --text-muted: #7a5050;
    --accent: #e63946;
    --accent-hover: #ff4d5a;
    --green: #4ecdc4;
    --green-bg: rgba(78, 205, 196, 0.12);
    --red: #ff6b6b;
    --red-bg: rgba(255, 107, 107, 0.12);
    --blue: #6ca0dc;
    --blue-bg: rgba(108, 160, 220, 0.12);
    --yellow: #f4a261;
    --yellow-bg: rgba(244, 162, 97, 0.12);
    --shadow: 0 4px 24px rgba(120, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(120, 0, 0, 0.5);
}
[data-theme="blood-moon"] .header {
    background: linear-gradient(180deg, #2a1010 0%, #1a0a0a 100%);
}

/* ===== DARK FOREST THEME ===== */
[data-theme="dark-green"] {
    --bg-primary: #0a1410;
    --bg-secondary: #0f1f18;
    --bg-card: #132e1f;
    --bg-card-hover: #1a3d2a;
    --bg-input: #0c1812;
    --border: #1e4a32;
    --border-light: #28603f;
    --text-primary: #d0f0d8;
    --text-secondary: #80b090;
    --text-muted: #507a5a;
    --accent: #2ecc71;
    --accent-hover: #45d98a;
    --green: #55efc4;
    --green-bg: rgba(85, 239, 196, 0.12);
    --red: #e17055;
    --red-bg: rgba(225, 112, 85, 0.12);
    --blue: #74b9ff;
    --blue-bg: rgba(116, 185, 255, 0.12);
    --yellow: #ffeaa7;
    --yellow-bg: rgba(255, 234, 167, 0.12);
    --shadow: 0 4px 24px rgba(0, 60, 20, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 60, 20, 0.5);
}
[data-theme="dark-green"] .header {
    background: linear-gradient(180deg, #0f1f18 0%, #0a1410 100%);
}

/* ===== OCEAN DEPTHS THEME ===== */
[data-theme="ocean"] {
    --bg-primary: #0a1628;
    --bg-secondary: #0f2240;
    --bg-card: #142d4f;
    --bg-card-hover: #1a3860;
    --bg-input: #0c1a30;
    --border: #1e4070;
    --border-light: #285090;
    --text-primary: #d0e0f0;
    --text-secondary: #80a0c0;
    --text-muted: #506a88;
    --accent: #00b4d8;
    --accent-hover: #20d0f0;
    --green: #00f5d4;
    --green-bg: rgba(0, 245, 212, 0.12);
    --red: #f07167;
    --red-bg: rgba(240, 113, 103, 0.12);
    --blue: #48cae4;
    --blue-bg: rgba(72, 202, 228, 0.12);
    --yellow: #fee440;
    --yellow-bg: rgba(254, 228, 64, 0.12);
    --shadow: 0 4px 24px rgba(0, 20, 60, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 20, 60, 0.6);
}
[data-theme="ocean"] .header {
    background: linear-gradient(180deg, #0f2240 0%, #0a1628 100%);
}

/* ===== ROYAL PURPLE THEME ===== */
[data-theme="royal-purple"] {
    --bg-primary: #140a1e;
    --bg-secondary: #1e1030;
    --bg-card: #2a1540;
    --bg-card-hover: #351c52;
    --bg-input: #180c24;
    --border: #3e2060;
    --border-light: #502a80;
    --text-primary: #e0d0f0;
    --text-secondary: #a080c0;
    --text-muted: #6a5088;
    --accent: #a855f7;
    --accent-hover: #c084fc;
    --green: #4ade80;
    --green-bg: rgba(74, 222, 128, 0.12);
    --red: #fb7185;
    --red-bg: rgba(251, 113, 133, 0.12);
    --blue: #818cf8;
    --blue-bg: rgba(129, 140, 248, 0.12);
    --yellow: #fbbf24;
    --yellow-bg: rgba(251, 191, 36, 0.12);
    --shadow: 0 4px 24px rgba(40, 0, 80, 0.4);
    --shadow-lg: 0 8px 40px rgba(40, 0, 80, 0.6);
}
[data-theme="royal-purple"] .header {
    background: linear-gradient(180deg, #1e1030 0%, #140a1e 100%);
}

/* ===== SUNSET THEME ===== */
[data-theme="sunset"] {
    --bg-primary: #1a1008;
    --bg-secondary: #2a1c0e;
    --bg-card: #3d2810;
    --bg-card-hover: #4d3418;
    --bg-input: #1f140a;
    --border: #5a3c18;
    --border-light: #6e4c22;
    --text-primary: #f0e0c8;
    --text-secondary: #c0a070;
    --text-muted: #887050;
    --accent: #f97316;
    --accent-hover: #fb923c;
    --green: #84cc16;
    --green-bg: rgba(132, 204, 22, 0.12);
    --red: #ef4444;
    --red-bg: rgba(239, 68, 68, 0.12);
    --blue: #38bdf8;
    --blue-bg: rgba(56, 189, 248, 0.12);
    --yellow: #facc15;
    --yellow-bg: rgba(250, 204, 21, 0.12);
    --shadow: 0 4px 24px rgba(60, 30, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(60, 30, 0, 0.6);
}
[data-theme="sunset"] .header {
    background: linear-gradient(180deg, #2a1c0e 0%, #1a1008 100%);
}

/* ===== ARCTIC THEME ===== */
[data-theme="arctic"] {
    --bg-primary: #0d1f2d;
    --bg-secondary: #132840;
    --bg-card: #1a3350;
    --bg-card-hover: #224060;
    --bg-input: #0f2235;
    --border: #1e4870;
    --border-light: #285a8a;
    --text-primary: #e8f4ff;
    --text-secondary: #90b8d8;
    --text-muted: #5a82a0;
    --accent: #56d0f0;
    --accent-hover: #80e0ff;
    --green: #64ffda;
    --green-bg: rgba(100, 255, 218, 0.12);
    --red: #ff6b8a;
    --red-bg: rgba(255, 107, 138, 0.12);
    --blue: #7ec8e3;
    --blue-bg: rgba(126, 200, 227, 0.12);
    --yellow: #ffe066;
    --yellow-bg: rgba(255, 224, 102, 0.12);
    --shadow: 0 4px 24px rgba(0, 40, 80, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 40, 80, 0.6);
}
[data-theme="arctic"] .header {
    background: linear-gradient(180deg, #132840 0%, #0d1f2d 100%);
}

/* ===== VOLCANIC THEME ===== */
[data-theme="volcanic"] {
    --bg-primary: #121212;
    --bg-secondary: #1c1c1c;
    --bg-card: #262626;
    --bg-card-hover: #303030;
    --bg-input: #161616;
    --border: #3a3020;
    --border-light: #504030;
    --text-primary: #f0ece0;
    --text-secondary: #b0a080;
    --text-muted: #706050;
    --accent: #ff6a00;
    --accent-hover: #ff8c30;
    --green: #a8ff3e;
    --green-bg: rgba(168, 255, 62, 0.12);
    --red: #ff3030;
    --red-bg: rgba(255, 48, 48, 0.12);
    --blue: #6a9fff;
    --blue-bg: rgba(106, 159, 255, 0.12);
    --yellow: #ffd200;
    --yellow-bg: rgba(255, 210, 0, 0.12);
    --shadow: 0 4px 24px rgba(80, 30, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(80, 30, 0, 0.6);
}
[data-theme="volcanic"] .header {
    background: linear-gradient(180deg, #1c1c1c 0%, #121212 100%);
}

/* ===== VOID KNIGHT THEME ===== */
[data-theme="void"] {
    --bg-primary: #050508;
    --bg-secondary: #0a0a14;
    --bg-card: #10101e;
    --bg-card-hover: #18182a;
    --bg-input: #080810;
    --border: #1e1e38;
    --border-light: #2a2a50;
    --text-primary: #d8d8ff;
    --text-secondary: #8888cc;
    --text-muted: #505088;
    --accent: #7b7bff;
    --accent-hover: #a0a0ff;
    --green: #00ffcc;
    --green-bg: rgba(0, 255, 204, 0.12);
    --red: #ff4466;
    --red-bg: rgba(255, 68, 102, 0.12);
    --blue: #5090ff;
    --blue-bg: rgba(80, 144, 255, 0.12);
    --yellow: #ffee44;
    --yellow-bg: rgba(255, 238, 68, 0.12);
    --shadow: 0 4px 24px rgba(0, 0, 30, 0.6);
    --shadow-lg: 0 8px 40px rgba(0, 0, 30, 0.8);
}
[data-theme="void"] .header {
    background: linear-gradient(180deg, #0a0a14 0%, #050508 100%);
}

/* ===== DESERT THEME ===== */
[data-theme="desert"] {
    --bg-primary: #1e1608;
    --bg-secondary: #2c2010;
    --bg-card: #3c2e18;
    --bg-card-hover: #4a3a22;
    --bg-input: #221a0c;
    --border: #5a4828;
    --border-light: #705e38;
    --text-primary: #fdf0c8;
    --text-secondary: #c8a860;
    --text-muted: #907840;
    --accent: #e8a020;
    --accent-hover: #f0b840;
    --green: #78c850;
    --green-bg: rgba(120, 200, 80, 0.12);
    --red: #e85030;
    --red-bg: rgba(232, 80, 48, 0.12);
    --blue: #60a8e0;
    --blue-bg: rgba(96, 168, 224, 0.12);
    --yellow: #ffd040;
    --yellow-bg: rgba(255, 208, 64, 0.12);
    --shadow: 0 4px 24px rgba(50, 30, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(50, 30, 0, 0.6);
}
[data-theme="desert"] .header {
    background: linear-gradient(180deg, #2c2010 0%, #1e1608 100%);
}

/* ===== COSMIC THEME ===== */
[data-theme="cosmic"] {
    --bg-primary: #07040f;
    --bg-secondary: #100820;
    --bg-card: #180e32;
    --bg-card-hover: #221440;
    --bg-input: #0d0618;
    --border: #2a1c50;
    --border-light: #3a2870;
    --text-primary: #e0d8ff;
    --text-secondary: #9070d0;
    --text-muted: #604890;
    --accent: #c060ff;
    --accent-hover: #d880ff;
    --green: #40ffb0;
    --green-bg: rgba(64, 255, 176, 0.12);
    --red: #ff4488;
    --red-bg: rgba(255, 68, 136, 0.12);
    --blue: #4080ff;
    --blue-bg: rgba(64, 128, 255, 0.12);
    --yellow: #ffcc00;
    --yellow-bg: rgba(255, 204, 0, 0.12);
    --shadow: 0 4px 24px rgba(30, 0, 60, 0.5);
    --shadow-lg: 0 8px 40px rgba(30, 0, 60, 0.7);
}
[data-theme="cosmic"] .header {
    background: linear-gradient(180deg, #100820 0%, #07040f 100%);
}

/* ===== TOXIC THEME ===== */
[data-theme="toxic"] {
    --bg-primary: #080e08;
    --bg-secondary: #0e180e;
    --bg-card: #142014;
    --bg-card-hover: #1c2c1c;
    --bg-input: #0a120a;
    --border: #1e3a1e;
    --border-light: #284c28;
    --text-primary: #d0f0a0;
    --text-secondary: #80b040;
    --text-muted: #507828;
    --accent: #7fff00;
    --accent-hover: #aaff30;
    --green: #00ff88;
    --green-bg: rgba(0, 255, 136, 0.12);
    --red: #ff6600;
    --red-bg: rgba(255, 102, 0, 0.12);
    --blue: #00ddcc;
    --blue-bg: rgba(0, 221, 204, 0.12);
    --yellow: #ccff00;
    --yellow-bg: rgba(204, 255, 0, 0.12);
    --shadow: 0 4px 24px rgba(0, 40, 0, 0.5);
    --shadow-lg: 0 8px 40px rgba(0, 40, 0, 0.7);
}
[data-theme="toxic"] .header {
    background: linear-gradient(180deg, #0e180e 0%, #080e08 100%);
}

/* ===== GOLDEN THEME ===== */
[data-theme="golden"] {
    --bg-primary: #16100a;
    --bg-secondary: #211808;
    --bg-card: #2e2010;
    --bg-card-hover: #3c2c18;
    --bg-input: #1a130a;
    --border: #50380e;
    --border-light: #6a4e18;
    --text-primary: #fff8e0;
    --text-secondary: #d4a840;
    --text-muted: #987030;
    --accent: #f0c020;
    --accent-hover: #f8d848;
    --green: #68d868;
    --green-bg: rgba(104, 216, 104, 0.12);
    --red: #e84040;
    --red-bg: rgba(232, 64, 64, 0.12);
    --blue: #60b0e8;
    --blue-bg: rgba(96, 176, 232, 0.12);
    --yellow: #ffd700;
    --yellow-bg: rgba(255, 215, 0, 0.12);
    --shadow: 0 4px 24px rgba(60, 40, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(60, 40, 0, 0.6);
}
[data-theme="golden"] .header {
    background: linear-gradient(180deg, #211808 0%, #16100a 100%);
}

/* ===== MIDNIGHT THEME ===== */
[data-theme="midnight"] {
    --bg-primary: #080a10;
    --bg-secondary: #0e1220;
    --bg-card: #141830;
    --bg-card-hover: #1c2240;
    --bg-input: #0a0d18;
    --border: #1e2848;
    --border-light: #283460;
    --text-primary: #d0d8f0;
    --text-secondary: #7888b8;
    --text-muted: #485880;
    --accent: #3a7bff;
    --accent-hover: #608cff;
    --green: #34d058;
    --green-bg: rgba(52, 208, 88, 0.12);
    --red: #f85149;
    --red-bg: rgba(248, 81, 73, 0.12);
    --blue: #58a6ff;
    --blue-bg: rgba(88, 166, 255, 0.12);
    --yellow: #e3b341;
    --yellow-bg: rgba(227, 179, 65, 0.12);
    --shadow: 0 4px 24px rgba(0, 10, 30, 0.5);
    --shadow-lg: 0 8px 40px rgba(0, 10, 30, 0.7);
}
[data-theme="midnight"] .header {
    background: linear-gradient(180deg, #0e1220 0%, #080a10 100%);
}
/* ===== MARKETPLACE DASHBOARD THEME ===== */
[data-theme="marketplace-dashboard"] {
    --bg-primary: #07080a;
    --bg-secondary: #0e1215;
    --bg-card: #0f1720;
    --bg-card-hover: #131826;
    --bg-input: #0b0f13;
    --border: #1e2730;
    --border-light: #2b3942;
    --text-primary: #dce3ea;
    --text-secondary: #9aa7b4;
    --text-muted: #7b8790;
    --accent: #00d1b2;
    --accent-hover: #35e6c6;
    --green: #4cd964;
    --green-bg: rgba(76,217,100,0.06);
    --red: #ff6b6b;
    --red-bg: rgba(255,107,107,0.06);
    --blue: #3aa0ff;
    --blue-bg: rgba(58,160,255,0.06);
    --yellow: #f3c623;
    --shadow: 0 2px 0 rgba(0,0,0,0.6);
    --shadow-lg: 0 6px 0 rgba(0,0,0,0.6);
}
[data-theme="marketplace-dashboard"] .header {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-bottom: 1px solid var(--border);
}

/* Terminal / panel-heavy styles */
[data-theme="marketplace-dashboard"] body,
[data-theme="marketplace-dashboard"] .header,
[data-theme="marketplace-dashboard"] .card,
[data-theme="marketplace-dashboard"] .panel {
    font-family: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
    /* Slightly reduce base font-size for monospaced theme to match other themes
       and avoid overflow/scale issues on mobile */
    font-size: 0.95rem;
    line-height: 1.45;
}

[data-theme="marketplace-dashboard"] .card,
[data-theme="marketplace-dashboard"] .panel {
    background: linear-gradient(180deg, var(--bg-card) 0%, rgba(12,18,24,0.6) 100%);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    border-radius: 4px;
}

[data-theme="marketplace-dashboard"] .panel--big {
    border: 2px solid var(--border-light);
    padding: 18px;
}

[data-theme="marketplace-dashboard"] button,
[data-theme="marketplace-dashboard"] .btn,
[data-theme="marketplace-dashboard"] .header-action-btn {
    background: linear-gradient(180deg, #0f1720 0%, #0b131a 100%);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    padding: 8px 12px;
    border-radius: 3px;
    box-shadow: none;
    font-weight: 700;
}

[data-theme="marketplace-dashboard"] .controls-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

[data-theme="marketplace-dashboard"] .metric {
    background: linear-gradient(180deg, #0b0f13 0%, #0f1317 100%);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: 2px;
    color: var(--text-secondary);
}

/* Mobile adjustments specifically for marketplace theme to prevent text overflow */
@media (max-width: 600px) {
    [data-theme="marketplace-dashboard"] body,
    [data-theme="marketplace-dashboard"] .header,
    [data-theme="marketplace-dashboard"] .card,
    [data-theme="marketplace-dashboard"] .panel {
        font-size: 0.88rem;
        line-height: 1.35;
    }
    [data-theme="marketplace-dashboard"] .card-fav-btn {
        width: 28px;
        height: 28px;
    }
}

/* (Favorites use base styles; no theme overrides) */

html {
    scroll-behavior: smooth;
}

/* Ensure favorite button uses base styles under marketplace-dashboard theme */
[data-theme="marketplace-dashboard"] .card-fav-btn {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    z-index: 2;
    padding: 0;
}

[data-theme="marketplace-dashboard"] .card-fav-btn svg {
    width: 15px;
    height: 15px;
}

[data-theme="marketplace-dashboard"] .card-fav-btn .fav-outline {
    color: var(--text-muted);
}

[data-theme="marketplace-dashboard"] .card-fav-btn .fav-filled {
    display: none;
    color: #e74c3c;
}

[data-theme="marketplace-dashboard"] .card-fav-btn.is-fav {
    border-color: #e74c3c;
    background: var(--red-bg);
}

[data-theme="marketplace-dashboard"] .card-fav-btn:hover {
    border-color: #e74c3c;
    background: var(--red-bg);
    transform: scale(1.15);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ===== HEADER ===== */
.header {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-bottom: 1px solid var(--border);
    padding: 20px 24px;
    position: sticky;
    top: 0;
    z-index: 1050;
    backdrop-filter: blur(12px);
    transition: background 0.4s ease;
}

[data-theme="light"] .header {
    background: linear-gradient(180deg, #ede0d0 0%, #f5ebe0 100%);
}

.header-inner {
    max-width: 1800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

/* Header action buttons */
.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Header view placement: toggle next to header actions (left of flip pick) */
.header-view {
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 250;
}
.header-view .view-toggle {
    display: flex;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px;
    align-items: center;
}
.header-view .view-btn {
    padding: 6px 8px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.header-view .view-btn.active {
    background: var(--accent);
    color: var(--bg-primary);
    border-radius: 6px;
}
.header-view .view-btn:not(.active):hover {
    color: var(--accent);
}

/* Hide the header view on small screens — filters keep theirs in the filters-row */
@media (max-width: 768px) {
    .header-view { display: none; }
    /* ensure filters-row view-toggle is shown on small screens (in case other pages still have it) */
    .filters-row .view-toggle { display: flex !important; }
}

.header-action-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.header-action-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.header-action-btn svg {
    flex-shrink: 0;
}

/* ===== HAMBURGER MENU ===== */
.hamburger-menu {
    position: relative;
}

.hamburger-btn {
    padding: 7px 10px !important;
    color: var(--accent);
}

.hamburger-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0px;
    min-width: 160px;
    width: 240px;
    max-width: 320px;
    max-height: 80vh;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) transparent;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1100;
    padding: 6px;
    animation: themeDropdownIn 0.15s ease-out;
}

.hamburger-menu.open .hamburger-dropdown {
    display: block;
}

.hamburger-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.hamburger-menu-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.hamburger-menu-item svg {
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: color var(--transition);
}

.hamburger-menu-item:hover svg {
    color: var(--accent);
}

/* Make sidebar headers inside hamburger match the menu item style */
.hamburger-dropdown .sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    border-radius: var(--radius-sm);
}
.hamburger-dropdown .sidebar-header h3 {
    margin: 0;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}
.hamburger-dropdown .sidebar-header svg {
    flex-shrink: 0;
}

/* When a sidebar header is used as a hamburger menu item, match the menu item's weight/size */
.hamburger-dropdown .sidebar-header.hamburger-menu-item {
    font-weight: 600;
    color: var(--text-muted);
    padding: 8px 12px;
}

/* Make hamburger rows skinnier and consistent */
.hamburger-dropdown .hamburger-menu-item,
.hamburger-dropdown .sidebar-header.hamburger-menu-item,
.hamburger-dropdown .sidebar-header {
    padding: 8px 12px;
    min-height: 36px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    align-items: center;
}

.hamburger-dropdown .hamburger-menu-item svg,
.hamburger-dropdown .sidebar-header svg {
    width: 16px;
    height: 16px;
}
.hamburger-dropdown .sidebar-header .sidebar-header-hint {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-left: auto;
    font-weight: 400;
}
.hamburger-dropdown .sidebar-header:hover {
    background: var(--bg-hover);
    color: var(--accent);
}
.hamburger-dropdown .sidebar-header:hover svg {
    color: var(--accent);
}

/* Hide the "click to expand" hint for Feedback and News when shown in the hamburger */
.hamburger-dropdown .hamburger-feedback .sidebar-header .sidebar-header-hint,
.hamburger-dropdown .hamburger-news .sidebar-header .sidebar-header-hint {
    display: none;
}

@media (max-width: 640px) {
    .hamburger-dropdown {
        /* full-width-ish on narrow screens */
        position: fixed;
        left: 16px;
        right: 16px;
        width: auto;
        max-width: none;
    }
    .hamburger-dropdown .hamburger-feedback .feedback-message,
    .hamburger-dropdown .hamburger-feedback .feedback-name {
        max-width: 100%;
    }
}

/* Ensure hamburger dropdown expands from the right on tablet sizes (601-768px)
   Some tablet layouts place the hamburger button towards the left; forcing
   a fixed right-aligned dropdown keeps the menu opening on the right side. */
@media (min-width: 601px) and (max-width: 768px) {
    .hamburger-dropdown {
        position: absolute;
        top: calc(100% + 6px);
        right: 0;
        left: auto;
        width: 240px;
        min-width: 160px;
        max-width: 320px;
        z-index: 9999;
    }
}
/* ===== LIVE STATS PANEL ===== */
.hamburger-dropdown .hamburger-stats .sidebar-header .sidebar-header-hint {
    display: none;
}

.stats-live-badge {
    margin-left: auto;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    color: var(--green);
    border: 1px solid var(--green);
    border-radius: 4px;
    padding: 1px 5px;
    opacity: 0.85;
    flex-shrink: 0;
}

.stats-panel {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 6px;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 6px);
    padding: 8px 10px;
}

.stat-card-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}

.stat-card-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    word-break: break-word;
}

.stat-card-bond-row {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.bond-icon-sm {
    width: 20px;
    height: 20px;
    object-fit: contain;
    image-rendering: pixelated;
    flex-shrink: 0;
}

.stat-card-value.stat-card-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
}

.stat-card-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.stat-sparkline {
    display: block;
    width: 100%;
    height: 52px;
    margin-top: 6px;
    border-radius: 4px;
}

.sparkline-tooltip {
    position: fixed;
    display: none;
    background: var(--bg-card, #1e1e1e);
    border: 1px solid var(--border, #333);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
    pointer-events: none;
    z-index: 9999;
    transform: translateX(-50%);
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    text-align: center;
    line-height: 1.4;
}

.sparkline-tooltip-time {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 400;
}

/* Player graph expanded modal */
.player-graph-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.72);
    backdrop-filter: blur(4px);
    z-index: 1300;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.player-graph-modal-overlay.active {
    display: flex;
}
.player-graph-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 820px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
}
.player-graph-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 10px;
    border-bottom: 1px solid var(--border);
}
.player-graph-modal-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}
.player-graph-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    transition: color var(--transition);
}
.player-graph-modal-close:hover { color: var(--text-primary); }
.player-graph-modal-body {
    position: relative;
    padding: 16px 18px 18px;
}

.player-graph-tz-note {
    margin-top: 6px;
    font-size: 0.68rem;
    color: var(--text-muted);
    text-align: right;
    opacity: 0.7;
}

/* Day-of-week tab bar */
.player-graph-day-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.player-graph-day-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 4px;
    padding: 3px 11px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    line-height: 1.6;
}
.player-graph-day-btn:hover {
    color: var(--text-primary);
    border-color: var(--green);
}
.player-graph-day-btn.active {
    background: var(--green);
    color: #fff;
    border-color: var(--green);
}
#playerGraphExpanded {
    display: block;
    width: 100%;
    height: 280px;
    border-radius: 6px;
}
.player-graph-expanded-tooltip {
    position: absolute;
    background: var(--bg-card, #1e1e1e);
    border: 1px solid var(--border, #333);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    text-align: center;
    line-height: 1.4;
}

.stats-loading-dots {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 400;
    animation: stats-dots 1.2s ease-in-out infinite;
}

@keyframes stats-dots {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ===== DEATH'S COFFER OVERLAY ===== */
.coffer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    z-index: 1000;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
    overflow-y: auto;
    backdrop-filter: blur(2px);
}

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

.coffer-panel {
    width: 100%;
    max-width: 900px;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 24px;
    animation: modalIn 0.25s ease-out;
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
}

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

.coffer-title-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.coffer-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    margin: 0;
}

.coffer-item-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.coffer-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.6rem;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.coffer-close:hover {
    color: var(--red);
    background: rgba(255, 80, 80, 0.1);
}

.coffer-divider {
    height: 1px;
    background: var(--border);
    margin: 12px 0;
}

.coffer-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0 0 16px;
    line-height: 1.5;
}

.coffer-link {
    color: var(--accent);
    text-decoration: none;
}

.coffer-link:hover {
    text-decoration: underline;
}

.coffer-sort-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.coffer-controls-row {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.coffer-filter-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.coffer-filter-input {
    padding: 6px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-family: inherit;
    width: 130px;
    transition: border-color var(--transition);
}

.coffer-filter-input:focus {
    outline: none;
    border-color: var(--accent);
}

.coffer-filter-input::placeholder {
    color: var(--text-muted, var(--text-secondary));
}

.coffer-sort-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.coffer-sort-select {
    padding: 6px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
}

.coffer-list {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) transparent;
}

.coffer-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    padding: 40px 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.coffer-table {
    width: 100%;
    border-collapse: collapse;
}

.coffer-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-main);
}

.coffer-table th {
    text-align: left;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    white-space: nowrap;
}

.coffer-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.82rem;
    color: var(--text-primary);
    vertical-align: middle;
}

.coffer-table tbody tr {
    transition: background var(--transition);
    cursor: pointer;
}

.coffer-table tbody tr:hover {
    background: var(--bg-hover);
}

.coffer-item-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.coffer-item-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 4px;
    background: rgba(255,255,255,0.05);
    flex-shrink: 0;
}

.coffer-item-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.coffer-savings {
    color: var(--green);
    font-weight: 600;
}

.coffer-coffer-val {
    color: var(--accent);
}

.coffer-empty {
    text-align: center;
    padding: 40px 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

@media (max-width: 600px) {
    .coffer-panel {
        padding: 16px;
    }
    .coffer-title {
        font-size: 1.2rem;
    }
    .coffer-item-name {
        max-width: 120px;
    }
    .coffer-table th:nth-child(3),
    .coffer-table td:nth-child(3) {
        display: none;
    }
}

/* ============================================
   MARKET HEATMAP
   ============================================ */
.heatmap-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    z-index: 1000;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
    overflow-y: auto;
    backdrop-filter: blur(2px);
}

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

.heatmap-panel {
    width: 100%;
    max-width: 1200px;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 24px;
    animation: modalIn 0.25s ease-out;
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
}

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

.heatmap-title-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.heatmap-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    margin: 0;
}

.heatmap-item-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.heatmap-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.6rem;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.heatmap-close:hover {
    color: var(--red);
    background: rgba(255, 80, 80, 0.1);
}

.heatmap-divider {
    height: 1px;
    background: var(--border);
    margin: 12px 0;
}

.heatmap-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0 0 12px;
    line-height: 1.5;
}

.heatmap-controls-row {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.heatmap-filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.heatmap-filter-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.heatmap-filter-input {
    padding: 6px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-family: inherit;
    width: 110px;
    transition: border-color var(--transition);
}

.heatmap-filter-input:focus {
    outline: none;
    border-color: var(--accent);
}

.heatmap-filter-input::placeholder {
    color: var(--text-secondary);
}

.heatmap-select {
    padding: 6px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
}

.heatmap-select:focus {
    outline: none;
    border-color: var(--accent);
}

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    font-size: 0.76rem;
}

.heatmap-legend-label {
    color: var(--text-secondary);
    margin-right: 2px;
}

.heatmap-legend-swatch {
    padding: 2px 8px;
    border-radius: 3px;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 500;
}

.heatmap-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    overflow-y: auto;
    flex: 1;
    align-content: flex-start;
    padding: 4px 2px;
}

.heatmap-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    padding: 4px;
    box-sizing: border-box;
    overflow: hidden;
    transition: filter 0.15s, transform 0.1s;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.heatmap-cell:hover {
    filter: brightness(1.4);
    transform: scale(1.05);
    z-index: 2;
    border-color: rgba(255, 255, 255, 0.28);
}

.heatmap-cell-icon {
    width: 26px;
    height: 26px;
    object-fit: contain;
    image-rendering: pixelated;
    flex-shrink: 0;
}

.heatmap-cell-name {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.88);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    line-height: 1.2;
    margin-top: 2px;
}

.heatmap-cell-margin {
    font-size: 0.68rem;
    font-weight: 700;
    margin-top: 1px;
    letter-spacing: 0.01em;
}

.heatmap-cell.small-tile .heatmap-cell-icon,
.heatmap-cell.small-tile .heatmap-cell-name {
    display: none;
}

.heatmap-empty,
.heatmap-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 60px;
    width: 100%;
    justify-content: center;
}

.heatmap-tooltip {
    position: fixed;
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 0.78rem;
    color: var(--text-primary);
    pointer-events: none;
    z-index: 9999;
    max-width: 280px;
    box-shadow: var(--shadow-lg);
    white-space: pre-line;
    line-height: 1.6;
}

@media (max-width: 640px) {
    .heatmap-panel {
        padding: 16px;
    }
    .heatmap-title {
        font-size: 1.2rem;
    }
    .heatmap-controls-row {
        gap: 12px;
    }
}

/* ===== THEME SELECTOR DROPDOWN ===== */
.theme-selector,
.theme-effects-selector {
    position: relative;
}

.theme-chevron,
.theme-effects-chevron {
    transition: transform 0.2s ease;
}

.theme-selector.open .theme-chevron,
.theme-effects-selector.open .theme-effects-chevron {
    transform: rotate(180deg);
}

.theme-dropdown,
.theme-effects-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 200px;
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    padding: 6px;
    animation: themeDropdownIn 0.15s ease-out;
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) transparent;
}

.theme-dropdown::-webkit-scrollbar {
    width: 6px;
}
.theme-dropdown::-webkit-scrollbar-track {
    background: transparent;
}
.theme-dropdown::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}
.theme-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.theme-selector.open .theme-dropdown,
.theme-effects-selector.open .theme-effects-dropdown {
    display: block;
}

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

.theme-dropdown-header {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 6px 10px 4px;
    font-weight: 600;
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
}

.theme-option:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.theme-option.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--bg-card-hover);
    font-weight: 600;
}

.theme-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border-light);
    flex-shrink: 0;
}

.theme-option.active .theme-swatch {
    border-color: var(--accent);
    box-shadow: 0 0 8px rgba(200, 170, 110, 0.3);
}

.theme-option-name {
    flex: 1;
    text-align: left;
}

/* Theme transition */
body.theme-transitioning,
body.theme-transitioning *,
body.theme-transitioning *::before,
body.theme-transitioning *::after {
    transition: background 0.4s ease, color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease !important;
}

/* Confetti particle */
.confetti-particle {
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    animation: confettiFall 0.8s ease-out forwards;
}

.confetti-particle.square {
    border-radius: 2px;
    width: 7px;
    height: 7px;
}

@keyframes confettiFall {
    0% { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); }
    100% { opacity: 0; transform: translate(var(--cx), var(--cy)) rotate(var(--cr)) scale(0.3); }
}

.effects-off .confetti-particle {
    display: none !important;
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-img {
    height: 42px;
    width: auto;
    filter: drop-shadow(0 2px 6px rgba(200, 170, 110, 0.3));
}

.logo-text h1,
.logo-text .logo-heading {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.5px;
    line-height: 1.2;
}

/* Shining sweep effect for the site title */
@keyframes logoShine {
    0% { left: -75%; }
    100% { left: 125%; }
}

.logo-text h1 {
    position: relative;
    overflow: hidden;
}

.logo-text h1::before {
    content: "";
    position: absolute;
    top: 0;
    left: -75%;
    height: 100%;
    width: 50%;
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.65) 50%, rgba(255,255,255,0) 100%);
    transform: skewX(-25deg);
    filter: blur(0.4px);
    mix-blend-mode: overlay;
    pointer-events: none;
    animation: logoShine 3s ease-in-out infinite;
}

/* Gold shimmer for author name (e.g. "Zoomie") */
@keyframes goldShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.author-name {
    display: inline-block;
    background: linear-gradient(90deg, #ffd66b 0%, #fff4c2 50%, #ffd66b 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: goldShimmer 2.5s linear infinite;
    text-shadow: 0 1px 0 rgba(0,0,0,0.35), 0 6px 18px rgba(255,200,80,0.06);
}

/* Visually hidden SEO H1 for item pages - accessible to search engines and screen readers */
.seo-item-title {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.seo-fallback {
    max-width: 900px;
    margin: 40px auto;
    padding: 20px;
    font-family: system-ui, sans-serif;
    color: #e0e0e0;
}
.seo-fallback h1 { color: #f5c842; }
.seo-fallback h2 { color: #f5c842; margin-top: 24px; }
.seo-fallback a { color: #7cb3ff; }
.seo-fallback ul { columns: 2; list-style: none; padding: 0; }
.seo-fallback li { padding: 2px 0; break-inside: avoid; }

.logo-text .subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.header-stats {
    display: flex;
    gap: 16px;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2px 6px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    min-width: 48px;
    min-height: 48px;
    font-size: 0.82rem;
    justify-content: center;
}

.stat-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent);
}

.favorites-stat {
    cursor: pointer;
    transition: all var(--transition);
}

.favorites-stat:hover {
    border-color: var(--accent);
}

/* Portfolio Value Stat */
/* Portfolio stat removed */

/* ===== TOOLBAR ===== */
.toolbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    position: sticky;
    top: 83px;
    z-index: 99;
}

.toolbar-inner {
    max-width: 1800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Search */
.search-container {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    pointer-events: none;
}

#searchInput {
    width: 100%;
    padding: 12px 40px 12px 44px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

#searchInput:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(200, 170, 110, 0.15);
}

#searchInput::placeholder {
    color: var(--text-muted);
}

.clear-search {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    display: none;
    transition: color var(--transition);
}

.clear-search:hover {
    color: var(--text-primary);
}

.clear-search.visible {
    display: block;
}

/* Filters */
.filters-row {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    z-index: 98;
    max-height: 200px;
    overflow: hidden;
    opacity: 1;
    transition: max-height 0.14s ease, opacity 0.08s ease, padding 0.14s ease;
}

.filters-row.collapsed {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    pointer-events: none;
    border-bottom: none;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 500;
}

.filter-group select,
.filter-group input[type="number"],
.filter-group input[type="text"] {
    padding: 4px 6px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition);
    min-width: 95px;
}

.filter-group select:focus,
.filter-group input[type="number"]:focus,
.filter-group input[type="text"]:focus {
    border-color: var(--accent);
}

.filter-group select {
    cursor: pointer;
    appearance: auto;
}

.filter-group input[type="number"],
.filter-group input[type="text"] {
    width: 78px;
}

.filter-group input[type="number"]::placeholder,
.filter-group input[type="text"]::placeholder {
    color: var(--text-muted);
}

/* Tablet (iPad) layout: stack filters vertically between 601px and 768px
   Keeps mobile (<=600px) rules untouched. */
@media (min-width: 601px) and (max-width: 768px) {
    .filters-row {
        position: relative;
        top: 0;
        left: 0;
        right: 0;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px 16px;
        max-height: none;
        overflow: visible;
    }

    .filters-row .filter-group {
        width: 100%;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .filters-row .filter-group select,
    .filters-row .filter-group input[type="number"],
    .filters-row .filter-group input[type="text"] {
        width: 100%;
        min-width: 0;
    }

    /* Align action controls to the end on tablet sizes */
    .filters-row .view-toggle { align-self: flex-end; }
    .filters-row .save-filters-btn,
    .filters-row .filter-toggle,
    .filters-row .split-btn { align-self: flex-end; }

    /* Two item cards per row on tablet (iPad) */
    .items-grid {
        /* Force two equal columns that can shrink to fit the viewport */
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        align-items: start;
        justify-items: stretch;
    }

    /* Reduce side padding on tablet so grid has more room */
    .main-content {
        padding-left: 8px;
        padding-right: 8px;
    }

    /* Slightly reduce card padding on tablet to help fit two columns */
    .item-card {
        padding: 10px;
    }

    /* Reduce header, toolbar and filters padding to free horizontal space */
    .header {
        padding: 12px 12px;
    }

    .toolbar {
        padding: 10px 12px;
    }

    .filters-row {
        padding: 8px 10px;
    }

    .item-card-header { gap: 8px; }
    .item-icon { width: 36px; height: 36px; }

    /* Collapse the sidebar under the items area to free horizontal space */
    .content-with-sidebar {
        flex-direction: column;
        gap: 20px;
    }

    .items-area { order: 1; }

    .sidebar-column {
        width: 100%;
        flex-shrink: 0;
        order: 2;
        position: static; /* disable sticky positioning on tablet */
        top: auto;
        align-self: stretch;
    }

    /* Ensure items-area and grid occupy full width; hide large sidebar to free space */
    .items-area {
        width: 100%;
        min-width: 0;
    }

    .items-grid {
        width: 100%;
        max-width: none;
    }

    /* Temporarily hide the sidebar on tablet so two cards fit side-by-side */
    .sidebar-column { display: none; }
}

/* View Toggle */
.view-toggle {
    display: flex;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.view-btn {
    padding: 7px 10px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.view-btn:hover {
    color: var(--text-primary);
}

.view-btn.active {
    background: var(--accent);
    color: #0f1117;
}

/* Hide the static list view button to prevent brief flash before JS toggles */
.view-btn[data-view="list"] {
    display: none !important;
}

/* Hide the static favorites button so the All button can be reused as the toggle
   (JS swaps the icon so the visible button shows the heart when in All view). */
.filter-toggle-btn[data-filter="favorites"] {
    display: none !important;
}

.save-filters-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    align-self: flex-end;
}

.save-filters-btn:hover {
    background: var(--accent);
    color: #0f1117;
}

.save-filters-btn.saved {
    border-color: var(--green);
    color: var(--green);
}

/* When moved into the header, adjust spacing and alignment */
/* No header placement styles: Save Filters remains inside `.filters-row`. */

.reset-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    align-self: flex-end;
}

.reset-btn:hover {
    border-color: var(--red);
    color: var(--red);
}

/* Hide the static Reset All button by default to avoid flash-of-content
   before JS switches the Save button into reset mode. JS controls
   whether reset is available via the save button, so keep the static
   reset markup hidden site-wide. */
.reset-btn {
    display: none !important;
}

/* Split-button for Save Filters + menu */
.split-btn {
    display: inline-flex;
    align-items: stretch;
    gap: 0;
    position: relative;
}

.split-btn .save-filters-btn {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.split-toggle {
    padding: 8px 10px;
    background: transparent;
    border: 1px solid var(--accent);
    border-left: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--accent);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.split-toggle:hover {
    background: var(--accent);
    color: #0f1117;
}

.split-menu {
    position: absolute;
    margin-top: 6px;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    box-shadow: 0 6px 20px rgba(12,14,18,0.25);
    border-radius: var(--radius-sm);
    display: none;
    min-width: 140px;
    z-index: 40;
    overflow: hidden;
}

.split-menu.open {
    display: block;
}

.split-menu .split-menu-item {
    display: block;
    width: 100%;
    padding: 8px 12px;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
}

.split-menu .split-menu-item:hover {
    background: var(--muted-bg);
    color: var(--text-primary);
}

/* Favorites Filter Toggle */
.filter-toggle {
    display: flex;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    align-self: flex-end;
}

.filter-toggle-btn {
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.filter-toggle-btn:hover {
    color: var(--text-primary);
}

.filter-toggle-btn.active {
    background: var(--accent);
    color: #0f1117;
}

/* Hide the primary 'Show' (All) button visually per user request.
   Kept in DOM for JS logic but removed from display. */
#filterAll { display: none !important; }

/* Hide the supporting 'Show' label for the filter-toggle control while
    preserving other filter labels. Uses :has() to target the group that
    contains the toggle so other labels remain visible. */
.filter-group:has(.filter-toggle) > label { display: none !important; }

/* ===== LOADING ===== */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 100px 24px;
    gap: 16px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.loading-subtext {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ===== ERROR ===== */
.error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 100px 24px;
    gap: 12px;
    text-align: center;
}

.error-icon {
    font-size: 3rem;
}

.error-container h2 {
    color: var(--red);
}

.error-container p {
    color: var(--text-secondary);
    max-width: 400px;
}

.retry-btn {
    margin-top: 8px;
    padding: 10px 28px;
    background: var(--accent);
    color: #0f1117;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background var(--transition);
}

.retry-btn:hover {
    background: var(--accent-hover);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    max-width: 1800px;
    margin: 0 auto;
    padding: 24px;
    /* Reduced top padding so items sit directly under the (now thinner) filters row */
    padding-top: 100px;
    transition: padding-top 0.3s ease;
}

.main-content.filters-hidden {
    padding-top: 24px;
}

/* Sidebar Layout */
.content-with-sidebar {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.items-area {
    flex: 1;
    min-width: 0;
}

/* ===== NEWS SIDEBAR ===== */
.sidebar-column {
    width: 380px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-self: flex-start;
    position: sticky;
    /* Match the reduced main-content top padding so sidebar starts beneath filters */
    top: 140px;
}

.news-sidebar {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-height: calc(50vh - 100px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.changelog-sidebar {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-height: calc(50vh - 100px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap:5px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    flex-shrink: 0;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.sidebar-header:hover {
    background: var(--bg-secondary);
}

.sidebar-header.collapsed {
    border-bottom: none;
}

.sidebar-header-hint {
    margin-left: auto;
    font-size: 0.68rem;
    color: var(--text-muted);
    opacity: 0.5;
    font-weight: 400;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.sidebar-collapsible {
    transition: max-height 0.18s ease, opacity 0.12s ease;
    overflow: hidden;
}

.sidebar-collapsible.collapsed {
    max-height: 0 !important;
    opacity: 0;
    pointer-events: none;
}

.sidebar-header .news-icon {
    color: var(--accent);
}

.sidebar-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.news-refresh-btn {
    margin-left: 8px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, border-color 0.2s, transform 0.3s;
}
.news-refresh-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}
.news-refresh-btn.spinning svg {
    animation: spin-refresh 0.6s ease;
}
@keyframes spin-refresh {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.sidebar-feed {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* When news is inside the hamburger dropdown, limit height and ensure scrolling */
.hamburger-dropdown .sidebar-feed {
    /* cap height so the dropdown doesn't grow too tall; reduced per UX */
    max-height: min(320px, calc(100vh - 220px));
    overflow-y: auto;
    padding: 6px 4px;
}

@media (max-width: 640px) {
    .hamburger-dropdown .sidebar-feed {
        /* tighter on mobile as well */
        max-height: calc(100vh - 140px);
    }
}

.sidebar-feed .feed-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* News cards */
.news-card {
    display: block;
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
    overflow: hidden;
}

.news-card:hover {
    background: var(--bg-card);
}

.news-thumb {
    width: 100%;
    height: 140px;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-primary);
}

.news-card-body {
    padding: 14px 18px;
}

.news-date {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.news-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 4px 0 0;
    line-height: 1.35;
}

.news-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 6px 0 0;
    line-height: 1.45;
}

.news-error {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.news-error-link {
    display: inline-block;
    margin-top: 12px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.news-error-link:hover {
    text-decoration: underline;
}

/* ===== FEEDBACK SIDEBAR ===== */
.feedback-sidebar {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    /* Float like the donation button on larger screens */
    position: fixed;
    bottom: 86px;
    right: 75px;
    width: 320px;
    max-width: calc(100% - 32px);
    z-index: 1001;
    box-shadow: 0 8px 28px rgba(0,0,0,0.12);
}

.feedback-sidebar .feedback-icon {
    color: var(--accent);
}

.feedback-sidebar .sidebar-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.feedback-content {
    overflow: hidden;
    transition: max-height 0.18s ease, opacity 0.12s ease;
}

.feedback-content.collapsed {
    max-height: 0 !important;
    opacity: 0;
    pointer-events: none;
}

.feedback-form {
    padding: 16px 18px;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px;
}

.feedback-type-row {
    display: flex;
    flex-direction: row;
    gap: 12px;
    width: 100%;
}

.feedback-type-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
}

.feedback-type-label input[type="radio"] {
    accent-color: var(--accent);
}

.feedback-sidebar .feedback-name,
.feedback-sidebar .feedback-message {
    display: block;
    width: 100%;
    background: var(--bg-primary, #181b25);
    border: 1px solid var(--border, #2e3348);
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--text-primary, #e8e6e3);
    font-size: 0.82rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.feedback-sidebar .feedback-name:focus,
.feedback-sidebar .feedback-message:focus {
    outline: none;
    border-color: var(--accent);
}

.feedback-actions {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.feedback-char-count {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.feedback-submit {
    padding: 7px 18px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
}

.feedback-submit:hover {
    opacity: 0.85;
}

.feedback-submit:active {
    transform: scale(0.97);
}

.feedback-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.feedback-status {
    font-size: 0.78rem;
    text-align: center;
    min-height: 1.2em;
}

.feedback-status.success {
    color: var(--green);
}

.feedback-status.error {
    color: #e74c3c;
}

/* ===== HAMBURGER MENU FEEDBACK ADJUSTMENTS ===== */
.hamburger-feedback .sidebar-header h3 {
    font-size: 0.88rem;
}

.hamburger-feedback .feedback-name,
.hamburger-feedback .feedback-message {
    display: block;
    width: 100%;
    background: var(--bg-primary, #181b25);
    border: 1px solid var(--border, #2e3348);
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--text-primary, #e8e6e3);
    font-size: 0.82rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.hamburger-feedback .feedback-name:focus,
.hamburger-feedback .feedback-message:focus {
    outline: none;
    border-color: var(--accent);
}

.hamburger-feedback .feedback-actions {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 8px;
}

/* ===== FOOTER ADMIN LINK ===== */
.footer-manage {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.65rem;
    color: var(--text-muted, #666);
    opacity: 0.25;
    cursor: pointer;
    transition: opacity 0.3s;
    user-select: none;
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
}

.footer-manage:hover {
    opacity: 0.6;
}

/* ===== ADMIN OVERLAY ===== */
.admin-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.admin-overlay.active {
    display: flex !important;
}

.admin-modal {
    background: var(--bg-secondary, #1a1d27);
    border: 1px solid var(--border, #2e3348);
    border-radius: 12px;
    padding: 32px;
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.admin-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted, #888);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    z-index: 1;
}

.admin-close:hover {
    color: var(--text-primary, #e8e6e3);
}

.admin-login h3,
.admin-panel-header h3 {
    margin: 0 0 18px;
    font-size: 1.05rem;
    color: var(--text-primary, #e8e6e3);
}

.admin-login {
    display: flex;
    flex-direction: column;
}

.admin-overlay .admin-input {
    display: block;
    width: 100%;
    padding: 10px 14px;
    margin-bottom: 10px;
    background: var(--bg-primary, #0f1117);
    border: 1px solid var(--border, #2e3348);
    border-radius: 6px;
    color: var(--text-primary, #e8e6e3);
    font-size: 0.88rem;
    font-family: inherit;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.admin-overlay .admin-input:focus {
    outline: none;
    border-color: var(--accent);
}

.admin-overlay .admin-btn {
    display: inline-block;
    padding: 9px 22px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
}

.admin-btn:hover {
    opacity: 0.85;
}

.admin-btn-sm {
    padding: 5px 14px;
    font-size: 0.75rem;
    margin-top: 0;
}

.admin-btn-danger {
    background: #c0392b;
    color: #fff;
}
.admin-btn-danger:hover {
    background: #e74c3c;
}

.admin-error {
    margin-top: 10px;
    color: #e74c3c;
    font-size: 0.82rem;
    min-height: 1.2em;
}

.admin-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-right: 40px;
}

.admin-panel-header h3 {
    margin: 0;
}

.admin-feedback-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-loading {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.admin-fb-card {
    background: var(--bg-primary, #0f1117);
    border: 1px solid var(--border, #2e3348);
    border-radius: 8px;
    padding: 14px 16px;
}

.admin-fb-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    min-width: 0;
    overflow: hidden;
}

.admin-fb-type {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
}

.admin-fb-type.suggestion {
    background: rgba(52, 152, 219, 0.15);
    color: #3498db;
}

.admin-fb-type.bug {
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
}

.admin-fb-name {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
}

.admin-fb-date {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-left: auto;
    white-space: nowrap;
    flex-shrink: 0;
}

.admin-fb-msg {
    font-size: 0.82rem;
    color: var(--text-primary);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.admin-fb-delete {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.7rem;
    padding: 3px 8px;
    margin-left: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.admin-fb-delete:hover {
    color: #e74c3c;
    border-color: #e74c3c;
}

/* Admin section labels + pending highlights */
.admin-section-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 6px 0 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-section-label-mt {
    margin-top: 24px;
}

.admin-highlights-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-hl-card {
    background: var(--bg-primary, #0f1117);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.admin-hl-img {
    width: 72px;
    height: 72px;
    /* Show the full image inside the admin thumbnail (letterbox) so
       uploads preserved at original resolution are visible without
       cropping the bottom of tall screenshots. */
    object-fit: contain;
    object-position: center center;
    border-radius: 6px;
    flex-shrink: 0;
    background: var(--bg-card);
}

.admin-hl-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.admin-hl-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}

.admin-hl-caption {
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-hl-date {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.admin-hl-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.admin-hl-approve {
    padding: 4px 12px;
    font-size: 0.75rem;
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid var(--green);
    color: var(--green);
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.admin-hl-approve:hover {
    background: rgba(34, 197, 94, 0.3);
}

.admin-hl-deny {
    padding: 4px 12px;
    font-size: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--red);
    color: var(--red);
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.admin-hl-deny:hover {
    background: rgba(239, 68, 68, 0.25);
}

/* ============================================
   PLAYER HIGHLIGHTS
   ============================================ */
.highlight-overlay,
.highlight-submit-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    /* Ensure highlights sit above floating feedback/donation buttons */
    z-index: 1102;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
    overflow-y: auto;
    backdrop-filter: blur(2px);
}

.highlight-overlay.active,
.highlight-submit-overlay.active {
    display: flex;
}

.highlight-panel {
    width: 100%;
    max-width: 1000px;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 24px;
    animation: modalIn 0.25s ease-out;
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
}

.highlight-submit-panel {
    width: 100%;
    max-width: 560px;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 28px;
    animation: modalIn 0.25s ease-out;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}

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

.highlight-title-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.highlight-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    margin: 0;
}

.highlight-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.highlight-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.6rem;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.highlight-close:hover {
    color: var(--red);
    background: rgba(255, 80, 80, 0.1);
}

.highlight-divider {
    height: 1px;
    background: var(--border);
    margin: 12px 0;
}

.highlight-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
.header-stats {
    display: flex;
    gap: 10px;
}
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
    flex: 1;
}

.highlight-submit-open-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity var(--transition);
}

.highlight-submit-open-btn:hover {
    opacity: 0.85;
}

.highlight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    overflow-y: auto;
    flex: 1;
}

.highlight-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: default;
    transition: border-color var(--transition), box-shadow var(--transition);
}

/* Use a column flex layout so media and body stack reliably and the
   title area cannot be overlapped by the image on small viewports. */
.highlight-card {
    display: flex;
    flex-direction: column;
}

.highlight-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.highlight-card-media {
    position: relative;
    flex: 1 1 auto;
    /* Fixed media area so all cards remain the same height
       regardless of the original image aspect ratio. Overflow
       is hidden and images are cropped via object-fit: cover. */
    height: 220px;
    overflow: hidden;
}

.highlight-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: var(--bg-main);
}

.hod-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    font-size: 16px;
    color: #1b1b1b;
    background: linear-gradient(180deg,#ffd966,#f2c94c);
    border-radius: 50%;
    box-shadow: 0 6px 18px rgba(0,0,0,0.35);
    border: 2px solid rgba(255,255,255,0.15);
    line-height: 1;
    pointer-events: none;
}

.hod-badge svg {
    width: 18px;
    height: 18px;
    display: block;
    fill: #111111;
}

/* Ensure HOD badge contrasts on dark backgrounds when card background overlaps */
.highlight-card.dark-theme .hod-badge svg,
.highlight-card.dark .hod-badge svg {
    fill: #ffffff;
}

.highlight-card-body {
    padding: 10px 12px;
}

.highlight-card-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent);
}

/* Prevent player names from clipping: allow wrapping and clamp to two lines
   so long names don't overflow card bounds. Also ensure the body has
   enough minimum height to contain two lines on most viewports. */
.highlight-card-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: break-word;
}

.highlight-card-body {
    /* Reserve space for two lines of title + caption without overlapping */
    min-height: 72px;
    flex: 0 0 auto;
    overflow: visible;
}

@media (max-width: 600px) {
    .highlight-card-name { font-size: 0.86rem; }
    .highlight-card-body { min-height: 48px; }
    .highlight-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

.highlight-card-caption {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 3px;
    line-height: 1.4;
}

.highlight-card-date {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 5px;
}

.highlight-empty,
.highlight-loading {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 60px 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Submit form */
.highlight-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.highlight-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.highlight-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}

.highlight-req {
    color: var(--red);
}

.highlight-opt {
    color: var(--text-muted);
    font-weight: 400;
}

.highlight-input {
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    transition: border-color var(--transition);
    width: 100%;
    box-sizing: border-box;
}

.highlight-input:focus {
    outline: none;
    border-color: var(--accent);
}

.highlight-input::placeholder {
    color: var(--text-secondary);
}

.highlight-drop-zone {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color var(--transition), background var(--transition);
    cursor: pointer;
    overflow: hidden;
}

.highlight-drop-zone.drag-over {
    border-color: var(--accent);
    background: rgba(var(--accent-rgb, 99,179,237), 0.07);
}

.highlight-drop-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.5;
    pointer-events: none;
}

.highlight-drop-inner svg {
    color: var(--text-muted);
}

.highlight-file-label {
    color: var(--accent);
    cursor: pointer;
    pointer-events: all;
    text-decoration: underline;
}

.highlight-drop-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin: 0;
}

.highlight-preview {
    width: 100%;
    max-height: 280px;
    object-fit: contain;
    display: block;
}

.highlight-clear-img {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.65);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.highlight-clear-img:hover {
    background: rgba(239,68,68,0.8);
}

.highlight-url-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.highlight-url-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.highlight-url-input {
    flex: 1;
    min-width: 180px;
}

.highlight-submit-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 4px;
}

.highlight-submit-form-btn {
    padding: 9px 22px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity var(--transition);
}

.highlight-submit-form-btn:hover {
    opacity: 0.85;
}

.highlight-submit-form-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.highlight-status {
    font-size: 0.82rem;
    min-height: 1.2em;
}

.highlight-status.success {
    color: var(--green);
}

.highlight-status.error {
    color: var(--red);
}

@media (max-width: 600px) {
    .highlight-panel,
    .highlight-submit-panel {
        padding: 16px;
    }
    .highlight-title {
        font-size: 1.2rem;
    }
    .highlight-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    .highlight-card-media { height: 130px; }
}

/* Tablet adjustments (601-768px): reduce image height so the bottom
   caption/name area is always visible and allow an extra title line. */
@media (min-width: 601px) and (max-width: 768px) {
    .highlight-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
    .highlight-card-media {
        height: 220px;
    }
    .highlight-card-body {
        min-height: 84px;
    }
    .highlight-card-name {
        -webkit-line-clamp: 3;
    }

    /* Show only two highlight rows/tiles at once on tablet — enable scrolling
       Calculate from the image + body min-heights so approximately two
       full cards are visible before scrolling. */
    .highlight-grid {
        max-height: calc(2 * (220px + 84px) + 16px); /* ~620px */
        overflow-y: auto;
    }
}

/* Small/mobile: cap to two cards tall (single column on narrow phones) */
@media (max-width: 420px) {
    .highlight-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        /* Fallback cap for narrow phones — special-case 375px below */
        max-height: 420px; /* approx. 2 * (130px image + body) */
        overflow-y: auto;
    }
    .highlight-card-media { height: 130px; }
    .highlight-card-body { min-height: 48px; }
    .highlight-card-name { -webkit-line-clamp: 3; }
}

/* Target small phones (e.g. 375px width) so only two highlight images are
   visible before scrolling. Uses the image + body min-heights for a tighter cap. */
@media (max-width: 375px) {
    .highlight-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        max-height: calc(2 * (130px + 48px) + 12px); /* ~368px */
        overflow-y: auto;
    }
    .highlight-card-media { height: 130px; }
    .highlight-card-body { min-height: 48px; }
}

.sidebar-feed .feed-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===== GRID VIEW ===== */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.item-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    overflow: hidden;
    /* Limit style-recalc scope and skip off-screen paint/layout */
    contain: layout style;
    content-visibility: auto;
    contain-intrinsic-size: 0 200px;
}

.item-card:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow);
}

/* Price pulse animations */
@keyframes pricePulseGreen {
    0% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.5); }
    50% { box-shadow: 0 0 16px 4px rgba(46, 204, 113, 0.3); border-color: var(--green); }
    100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}

@keyframes pricePulseRed {
    0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.5); }
    50% { box-shadow: 0 0 16px 4px rgba(231, 76, 60, 0.3); border-color: var(--red); }
    100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

.item-card.pulse-green {
    animation: pricePulseGreen 1s ease;
}

.item-card.pulse-red {
    animation: pricePulseRed 1s ease;
}

.effects-off .item-card.pulse-green,
.effects-off .item-card.pulse-red {
    animation: none !important;
}

/* Item Rarity Glow */
.item-card.rarity-uncommon {
    border-color: #2ecc71;
    box-shadow: 0 0 8px rgba(46, 204, 113, 0.15), inset 0 0 8px rgba(46, 204, 113, 0.04);
}
.item-card.rarity-uncommon:hover {
    box-shadow: 0 0 14px rgba(46, 204, 113, 0.3), var(--shadow);
}
.item-card.rarity-rare {
    border-color: #3b82f6;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2), inset 0 0 8px rgba(59, 130, 246, 0.05);
}
.item-card.rarity-rare:hover {
    box-shadow: 0 0 18px rgba(59, 130, 246, 0.35), var(--shadow);
}
.item-card.rarity-legendary {
    border-color: #f1c40f;
    box-shadow: 0 0 12px rgba(241, 196, 15, 0.25), inset 0 0 8px rgba(241, 196, 15, 0.06);
}
.item-card.rarity-legendary:hover {
    box-shadow: 0 0 22px rgba(241, 196, 15, 0.45), var(--shadow);
}
.item-card.rarity-mythic {
    border-color: #e74c3c;
    box-shadow: 0 0 14px rgba(231, 76, 60, 0.3), inset 0 0 10px rgba(231, 76, 60, 0.07);
}
.item-card.rarity-mythic:hover {
    box-shadow: 0 0 26px rgba(231, 76, 60, 0.55), var(--shadow);
}

.effects-off .item-card.rarity-uncommon,
.effects-off .item-card.rarity-rare,
.effects-off .item-card.rarity-legendary,
.effects-off .item-card.rarity-mythic {
    animation: none !important;
    box-shadow: none !important;
    border-color: var(--border) !important;
}

/* Favorite button on card */
.card-fav-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    z-index: 2;
    padding: 0;
}

.card-fav-btn:hover {
    border-color: #e74c3c;
    background: var(--red-bg);
    transform: scale(1.15);
}

.card-fav-btn svg {
    width: 15px;
    height: 15px;
}

.card-fav-btn .fav-outline {
    color: var(--text-muted);
}

.card-fav-btn .fav-filled {
    display: none;
    color: #e74c3c;
}

.card-fav-btn.is-fav .fav-outline {
    display: none;
}

.card-fav-btn.is-fav .fav-filled {
    display: block;
}

.card-fav-btn.is-fav {
    border-color: #e74c3c;
    background: var(--red-bg);
}

.item-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.item-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    image-rendering: pixelated;
    flex-shrink: 0;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 4px;
}

.item-icon.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-muted);
}

.item-name {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.last-trade {
    font-size: 0.72rem;
    color: var(--text-dim, #9aa0a6);
    margin-left: auto;
    white-space: nowrap;
}

.item-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.badge {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 100px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-members {
    background: var(--yellow-bg);
    color: var(--yellow);
    border: 1px solid rgba(241, 196, 15, 0.2);
    position: relative;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Disabled glimmer/shimmer effect for badge-members (was a moving highlight band) */
.badge-members::before {
    display: none;
}

@keyframes glimmer {
    0% { left: -150%; }
    60% { left: 150%; }
    100% { left: 150%; }
}

.badge-f2p {
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid rgba(46, 204, 113, 0.2);
}

.item-prices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.price-box {
    display: flex;
    flex-direction: column;
    padding: 8px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.price-box .label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 500;
}

.price-box .value {
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 2px;
}

.price-box .value.buy-price {
    color: var(--green);
}

.price-box .value.sell-price {
    color: var(--red);
}

.price-box .value.positive {
    color: var(--green);
}

.price-box .value.negative {
    color: var(--red);
}

.price-box .value.neutral {
    color: var(--text-muted);
}

.item-margin {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.margin-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 500;
}

.margin-value {
    font-size: 0.88rem;
    font-weight: 700;
}

.margin-value.positive {
    color: var(--green);
}

.margin-value.negative {
    color: var(--red);
}

.margin-value.neutral {
    color: var(--text-muted);
}

.item-volume {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.volume-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 500;
}

.volume-value {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text);
}

/* Animated card entry */
@keyframes cardDealIn {
    0% {
        opacity: 0;
        transform: translateY(24px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
.item-card.card-enter {
    animation: cardDealIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.effects-off .item-card.card-enter {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
}

/* ===== LIST VIEW ===== */
.items-grid.list-view {
    grid-template-columns: 1fr;
    gap: 4px;
}

.list-view .item-card {
    flex-direction: row;
    align-items: center;
    padding: 12px 16px;
    gap: 16px;
}

.list-view .item-card-header {
    flex: 1;
    min-width: 180px;
}

.list-view .item-margin {
    min-width: 140px;
    flex-shrink: 0;
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 32px 0 16px;
}

.page-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.page-btn:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-info {
    font-size: 0.88rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

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

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    position: relative;
    animation: modalIn 0.2s ease;
}

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

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    z-index: 1;
}

.modal-close:hover {
    color: var(--text-primary);
    border-color: var(--accent);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--border);
}

.modal-header-text {
    flex: 1;
    min-width: 0;
}

/* Modal Favorite Button */
.modal-fav-btn {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    position: absolute;
    display: flex;
    align-items: center;
    right: 48px;
    justify-content: center;
    transition: all var(--transition);
    padding: 0;
}

.modal-fav-btn:hover {
    border-color: #e74c3c;
    background: var(--red-bg);
    transform: scale(1.1);
}

.modal-fav-btn .fav-icon-outline {
    color: var(--text-muted);
}

.modal-fav-btn .fav-icon-filled {
    display: none;
    color: #e74c3c;
}

.modal-fav-btn.is-fav .fav-icon-outline {
    display: none;
}

.modal-fav-btn.is-fav .fav-icon-filled {
    display: block;
}

.modal-fav-btn.is-fav {
    border-color: #e74c3c;
    background: var(--red-bg);
}

/* Mobile: nudge modal favorite button higher, smaller, and left enough to avoid close button */
@media (max-width: 600px) {
    .modal-fav-btn {
        top: 9px;
        right: 240px; /* move left from the close button */
        z-index: 3;
        width: 32px;
        height: 32px;
    }
    .modal-fav-btn .fav-icon-outline,
    .modal-fav-btn .fav-icon-filled {
        width: 18px;
        height: 18px;
    }
    .modal-close {
        left: 12px;
        right: auto;
        top: 9px;
        z-index: 4;
    }

    .modal-header {
        padding-right: 30px; /* ensure header text doesn't flow underneath the icon and close button */
        padding-left: 30px; /* make space for the close button on the left */
    }
}
.modal-icon {
    width: 56px;
    height: 56px;
    object-fit: contain;
    image-rendering: pixelated;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 6px;
    flex-shrink: 0;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.3;
}

.modal-examine {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 2px;
}

.modal-body {
    padding: 20px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.modal-prices {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

.modal-price-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 10px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.modal-price-card.buy {
    background: var(--green-bg);
    border: 1px solid rgba(46, 204, 113, 0.2);
}

.modal-price-card.sell {
    background: var(--red-bg);
    border: 1px solid rgba(231, 76, 60, 0.2);
}

.modal-price-card.margin {
    background: var(--blue-bg);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.modal-price-card .price-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    font-weight: 500;
}

.modal-price-card .price-value {
    font-size: 1.05rem;
    font-weight: 700;
    margin-top: 4px;
}

.modal-price-card.buy .price-value { color: var(--green); }
.modal-price-card.sell .price-value { color: var(--red); }
.modal-price-card.margin .price-value { color: var(--blue); }

.modal-price-card .price-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.modal-details {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row:nth-child(even) {
    background: var(--bg-card);
}

.detail-row span:first-child {
    color: var(--text-secondary);
}

.detail-row span:last-child {
    font-weight: 600;
    color: var(--text-primary);
}

.wiki-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition);
}

.wiki-link:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}

/* ===== FLIP SENTIMENT VOTE ===== */


/* ===== HISTORY CHARTS ===== */
.history-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.history-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.history-tabs {
    display: flex;
    gap: 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.history-tab {
    padding: 5px 10px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.history-tab:hover {
    color: var(--text-primary);
}

/* Mobile: stack history header and left-align tabs to prevent right-shift */
@media (max-width: 600px) {
    .history-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .history-tabs {
        align-self: flex-start;
    }
}

.history-tab.active {
    background: var(--accent);
    color: #0f1117;
}

.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
}

.reset-zoom-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    padding: 3px 9px;
    font-size: 11px;
    font-family: inherit;
    background: rgba(30, 33, 50, 0.85);
    color: #9ca0b0;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.reset-zoom-btn:hover {
    background: var(--accent);
    color: #fff;
}

.chart-container.volume-chart {
    height: 180px;
}

/* Trending line overlay for price charts — increased visibility */
.chart-container:not(.volume-chart)::after,
.price-chart-container::after {
    content: "";
    position: absolute;
    left: 8px;
    right: 8px;
    top: 8px;
    bottom: 8px;
    pointer-events: none;
    border-radius: calc(var(--radius-sm) - 2px);
    /* thicker, slightly colored diagonal line for clearer visibility */
    background-image: linear-gradient(
        90deg,
        transparent calc(50% - 1px),
        rgba(99,179,237,0.14) 50%,
        transparent calc(50% + 1px)
    );
    background-size: 100% 2px;
    background-repeat: no-repeat;
    transform: rotate(-8deg);
    transform-origin: center;
    opacity: 1;
    z-index: 9999;
    box-shadow: 0 0 6px rgba(99,179,237,0.03);
    mix-blend-mode: normal;
}

/* Reduce visibility even further in dark themes */
:root[data-theme="dark"] .chart-container:not(.volume-chart)::after,
:root[data-theme="dark"] .price-chart-container::after {
    background-image: linear-gradient(
        90deg,
        transparent calc(50% - 1px),
        rgba(255,255,255,0.12) 50%,
        transparent calc(50% + 1px)
    );
    box-shadow: 0 0 6px rgba(255,255,255,0.02);
}

.history-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.history-loading .loading-spinner.small {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.history-error {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.82rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.history-section .chart-container.hidden,
.history-loading.hidden {
    display: none;
}

/* ===== BACK TO TOP ===== */
.back-to-top {
    position: fixed;
    bottom: 115px;
    right: 24px;
    width: 36px;
    height: 36px;
    background: var(--accent);
    color: #0f1117;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
    box-shadow: var(--shadow);
    z-index: 50;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

/* ===== FOOTER ===== */
.footer {
    text-align: center;
    padding: 24px;
    border-top: 1px solid var(--border);
    margin-top: 24px;
    contain: layout style;
}

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

.footer a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    text-decoration-color: color-mix(in srgb, var(--accent) 50%, transparent);
}

.footer a:hover {
    text-decoration: underline;
    text-decoration-color: var(--accent);
}



/* ===== VISITOR STATS BAR ===== */
.visitor-stats-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 28px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    min-height: 24px;
}

.visitor-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.visitor-stat strong {
    color: var(--text-primary);
    font-weight: 600;
}

.visitor-stat svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.visitor-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 6px rgba(46, 204, 113, 0.6);
    animation: visitor-pulse 2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes visitor-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 6px rgba(46, 204, 113, 0.6); }
    50% { opacity: 0.6; box-shadow: 0 0 12px rgba(46, 204, 113, 0.9); }
}

/* ===== DONATION FLOATING BUTTON ===== */
.donation-float-btn {
    position: fixed;
    bottom: 22px;
    right: 75px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #FFD700 0%, #FFC700 100%);
    border: none;
    border-radius: 50px;
    color: #000;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 4px 16px rgba(255, 215, 0, 0.3);
    z-index: 999;
    font-family: inherit;
}

.donation-float-btn:hover {
    background: linear-gradient(135deg, #FFED4E 0%, #FFD700 100%);
    box-shadow: 0 6px 24px rgba(255, 215, 0, 0.5);
    transform: translateY(-2px);
}

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

.donation-float-btn svg {
    flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

@media (max-width: 640px) {
    .donation-float-btn {
        right: 8px;
        padding: 8px 12px;
        font-size: 0.75rem;
    }

    .donation-float-btn svg {
        width: 16px;
        height: 16px;
    }
}

/* Floating feedback placed above the donation button */
.main-feedback {
    position: fixed;
    right: 75px;
    bottom: 90px;
    z-index: 1001;
    width: 320px;
    max-width: calc(100% - 40px);
    background: var(--panel-bg, #0f1117);
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    color: var(--text-color, #e6edf3);
}

.main-feedback .feedback-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.main-feedback .feedback-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Style feedback inputs to match site darker inputs */
.main-feedback .feedback-name,
.main-feedback .feedback-message {
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-family: inherit;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.main-feedback .feedback-message {
    min-height: 80px;
    resize: vertical;
}

.main-feedback .feedback-name:focus,
.main-feedback .feedback-message:focus {
    outline: none;
    border-color: var(--accent);
}

.main-feedback .feedback-name::placeholder,
.main-feedback .feedback-message::placeholder {
    color: var(--text-secondary);
}

.main-feedback .feedback-submit {
    padding: 8px 14px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}

.main-feedback .feedback-submit:disabled {
    opacity: 0.6;
    cursor: default;
}

@media (max-width: 640px) {
    .main-feedback {
        right: 8px;
        width: 280px;
    }
}

/* Close button inside floating feedback */
.main-feedback .feedback-close-btn {
    position: absolute;
    top: 6px;
    right: 8px;
    background: transparent;
    border: none;
    color: var(--text-color, #e6edf3);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
}

/* Small toggle button shown when feedback is closed */

.feedback-toggle-btn {
    position: fixed;
    right: 75px;
    bottom: 66px;
    z-index: 1002;
    display: none;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #FFD700 0%, #FFC700 100%);
    box-shadow: 0 6px 20px rgba(0,0,0,0.35);
    cursor: pointer;
    padding: 8px 12px;
    border: none;
    border-radius: 50px;
    color: #000;
    font-weight: 700;
    font-size: 0.85rem;
}

@media (max-width: 640px) {
    .feedback-toggle-btn, .main-feedback { right: 8px; }
}

/* (removed mobile swap overrides) */

/* Remove feedback from the hamburger menu (keeps floating version) */
#hamburgerFeedback,
.hamburger-feedback {
    display: none !important;
}

/* ===== NO RESULTS ===== */
.no-results {
    text-align: center;
    padding: 60px 24px;
    grid-column: 1 / -1;
}

.no-results-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.no-results h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.no-results p {
    font-size: 0.88rem;
    color: var(--text-muted);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
    .sidebar-column {
        width: 320px;
    }
}

@media (max-width: 900px) {
    .content-with-sidebar {
        flex-direction: column;
    }

    .sidebar-column {
        width: 100%;
        position: static;
    }

    .news-sidebar {
        max-height: 500px;
    }

    .feedback-sidebar {
        max-height: 400px;
        /* revert floating on small screens */
        position: static;
        bottom: auto;
        right: auto;
        width: 100%;
        max-width: none;
        box-shadow: none;
        z-index: auto;
    }

    .header-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-stats {
        width: 100%;
        justify-content: flex-start;
    }

    .toolbar {
        top: 0;
        position: relative;
    }

    .filters-row {
        position: relative;
        top: auto;
        max-height: none;
        overflow: visible;
        flex-direction: column;
        align-items: stretch;
        padding: 14px 16px;
    }

    .main-content {
        padding-top: 24px;
    }

    .main-content.filters-hidden {
        padding-top: 24px;
    }

    .filter-group select,
    .filter-group input[type="number"],
    .filter-group input[type="text"] {
        width: 100%;
        min-width: unset;
    }

    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }

    /* Improve touch targets and card density on tablet */
    .item-card {
        padding: 14px;
    }

    .item-icon {
        width: 44px;
        height: 44px;
    }

    .card-fav-btn {
        width: 36px;
        height: 36px;
    }

    .list-view .item-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .list-view .item-card-header {
        min-width: unset;
    }

    .list-view .item-prices {
        width: 100%;
    }

    .list-view .item-margin {
        width: 100%;
        min-width: unset;
    }

    .modal-prices {
        grid-template-columns: 1fr;
    }

    /* Modal becomes full-width-ish on tablet for easier interaction */
    .modal {
        max-width: 720px;
    }
}

/* ===== MOBILE LAYOUT (≤ 600px) ===== */
@media (max-width: 600px) {
    /* Header: compact 2-row grid — logo + actions on top, scrollable stats strip below */
    .header {
        padding: 10px 14px;
    }
    .header-inner {
        display: grid;
        grid-template-areas: "logo actions" "stats stats";
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: 8px;
    }
    .logo {
        grid-area: logo;
        min-width: 0;
    }
    .logo-text h1, .logo-text .logo-heading {
        font-size: 1.1rem;
    }
    .logo-text .subtitle {
        font-size: 0.72rem;
    }
    .header-stats {
        grid-area: stats;
        width: auto;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap;
        gap: 8px;
        justify-content: flex-start;
        padding-bottom: 2px;
    }
    .header-stats::-webkit-scrollbar { display: none; }
    .stat-box {
        flex-shrink: 0;
        min-width: 58px;
        min-height: 42px;
        padding: 4px 8px;
    }
    .header-actions {
        grid-area: actions;
        gap: 6px;
    }
    /* Icon-only header buttons — text hidden to save space */
    .header-action-btn > span:not(.effects-status-dot) {
        display: none;
    }
    .header-action-btn {
        padding: 8px 10px;
    }
    .theme-effects-chevron {
        display: none;
    }
    /* Hide the compact bond price from header on mobile — too cramped */
    .bond-compact {
        display: none !important;
    }
    /* Compact toolbar and search bar */
    .toolbar {
        padding: 10px 14px;
    }
    #searchInput {
        font-size: 0.9rem;
        padding: 10px 38px 10px 42px;
    }
    /* Filters in-flow on mobile */
    .filters-row {
        position: relative;
        top: auto;
        max-height: none;
        overflow: visible;
        padding: 10px 14px;
        border-bottom: none;
    }
    .main-content {
        padding: 14px;
        padding-top: 16px;
    }
    .main-content.filters-hidden {
        padding-top: 16px;
    }
}

@media (max-width: 500px) {
    .header {
        padding: 10px 14px;
    }

    .toolbar {
        padding: 12px 16px;
    }

    .main-content {
        padding: 16px;
    }

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

    /* Make modal fullscreen-like on phones for readability */
    .modal-overlay {
        padding: 12px;
        align-items: flex-start;
        overflow-y: auto;
    }

    .modal {
        margin: 6px 0;
        width: 100%;
        max-width: 100%;
        border-radius: 8px;
        max-height: calc(100vh - 20px);
    }

    .logo-text h1,
    .logo-text .logo-heading {
        font-size: 1.2rem;
    }

    .stat-box {
        padding: 4px 8px;
        min-width: 54px;
        min-height: 40px;
    }
    .page-btn {
        padding: 8px 14px;
        font-size: 0.82rem;
    }

    /* Mobile-specific card/tap improvements */
    .item-card {
        padding: 12px;
        gap: 8px;
    }

    .item-name { font-size: 0.98rem; }

    .card-fav-btn {
        width: 40px;
        height: 40px;
    }

    .price-box .value { font-size: 1rem; }

    .price-box .label, .margin-label, .volume-label { font-size: 0.68rem; }

    /* Ensure charts and canvases are touch-friendly */
    .price-chart-container, .volume-chart-container, canvas {
        width: 100% !important;
        height: auto !important;
    }

    /* Make sure the canvas stays behind decorative overlays */
    .chart-container canvas {
        position: relative;
        z-index: 1;
    }
}

/* ===== SMALL PHONE (≤ 480px) ===== */
@media (max-width: 480px) {
    /* Sidebars and GE Radio hidden to maximise content area */
    .news-sidebar, .feedback-sidebar, .sidebar-column { display: none !important; }
    .sidebar-feed, .feedback-short, .news-short { display: none !important; }
    .ge-radio { display: none !important; }
    .favoritesStatBox, .favorites-count { display: none; }

    /* Filters: always in document flow */
    .filters-row {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 10px 14px;
        position: relative;
        top: auto;
        max-height: none;
        overflow: visible;
        pointer-events: auto;
        background: transparent;
        border-bottom: none;
        box-shadow: none;
    }
    .filters-row .filter-group,
    .filters-row input,
    .filters-row select {
        width: 100%;
        min-width: 0;
    }
    .filters-row .view-toggle,
    .filters-row .save-filters-btn,
    .filters-row .filter-toggle {
        width: 100%;
        align-self: stretch;
    }
    .filters-row .view-toggle { display: flex; gap: 8px; }

    /* Items: single column */
    .items-grid { grid-template-columns: 1fr; gap: 10px; }
    .item-card { padding: 12px; border-radius: 8px; }

    /* Modal */
    .modal { margin: 6px; border-radius: 8px; }
}

/* Fine-grained phone breakpoints for common viewport widths
   Reference: small phones 320px, standard 360px, mid-range 375px, large 412-428px */
@media (max-width: 420px) {
    .item-card { padding: 10px; }
    .item-icon { width: 40px; height: 40px; }
    .card-fav-btn { width: 36px; height: 36px; }
    .header-actions { gap: 6px; }
}

@media (max-width: 375px) {
    .items-grid { grid-template-columns: 1fr; gap: 10px; }
    .item-card { padding: 10px; gap: 6px; }
    .price-box .value { font-size: 0.96rem; }
}

@media (max-width: 360px) {
    .items-grid { grid-template-columns: 1fr; }
    .item-card { flex-direction: column; align-items: flex-start; }
    .item-card .item-card-header { min-width: 0; }
    .card-fav-btn { top: 6px; right: 6px; }
    .logo-text h1, .logo-text .logo-heading { font-size: 1.05rem; }
}

@media (max-width: 320px) {
    :root { --radius: 8px; }
    .header { padding: 10px 12px; }
    .toolbar { padding: 8px 12px; }
    .filters-row { padding: 8px 12px; }
    .item-icon { width: 36px; height: 36px; }
    .card-fav-btn { width: 40px; height: 40px; }
    .item-name { font-size: 0.9rem; }
    .price-box .value { font-size: 0.9rem; }
    .pagination { padding: 20px 8px; }
}

/* (mobile filter layout handled by ≤ 480px block above) */

/* ===== GE RADIO (Header-Inline Compact) ===== */
.ge-radio {
    position: relative;
    display: flex;
    align-items: center;
}

.ge-radio-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    height: 100%;
}
.ge-radio-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.ge-radio-toggle.playing {
    border-color: var(--accent);
    color: var(--accent);
}
.ge-radio-toggle.playing .ge-radio-icon {
    display: none;
}
.ge-radio-toggle:not(.playing) .ge-radio-bars {
    display: none;
}

.ge-radio-label {
    font-weight: 500;
}

/* Audio bars animation (compact) */
.ge-radio-bars {
    display: flex;
    align-items: flex-end;
    gap: 1.5px;
    height: 14px;
}
.ge-radio-bars span {
    display: block;
    width: 2.5px;
    background: var(--accent);
    border-radius: 1px;
    animation: radio-bar 1.2s ease-in-out infinite;
}
.ge-radio-bars span:nth-child(1) { height: 5px; animation-delay: 0s; }
.ge-radio-bars span:nth-child(2) { height: 10px; animation-delay: 0.15s; }
.ge-radio-bars span:nth-child(3) { height: 7px; animation-delay: 0.3s; }

@keyframes radio-bar {
    0%, 100% { transform: scaleY(0.4); }
    50%      { transform: scaleY(1.0); }
}

/* Dropdown Panel */
.ge-radio-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    animation: radio-dd-in 0.2s ease;
}
.ge-radio-dropdown.open {
    display: flex;
}

@keyframes radio-dd-in {
    from { opacity: 0; transform: translateY(-6px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.ge-radio-dd-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.ge-radio-now-playing {
    padding: 6px 12px;
    font-size: 0.76rem;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-bottom: 1px solid var(--border);
}
.ge-radio-dropdown.playing .ge-radio-now-playing {
    color: var(--accent);
    font-style: normal;
    font-weight: 600;
}

.ge-radio-dd-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
}
.ge-radio-dd-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
.ge-radio-dd-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-light);
    background: var(--bg-card);
}
.ge-radio-dd-btn.ge-radio-dd-play {
    width: 36px;
    height: 36px;
    border-color: var(--accent);
    color: var(--accent);
}
.ge-radio-dd-btn.ge-radio-dd-play:hover {
    background: rgba(200, 170, 110, 0.1);
    transform: scale(1.06);
}

.ge-radio-dd-vol {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
    color: var(--text-muted);
}
.ge-radio-vol-slider {
    width: 60px;
    -webkit-appearance: none;
    appearance: none;
    height: 3px;
    border-radius: 2px;
    background: var(--border);
    outline: none;
    cursor: pointer;
}
.ge-radio-vol-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
}
.ge-radio-vol-slider::-moz-range-thumb {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
}

.ge-radio-dd-opts {
    display: flex;
    justify-content: center;
    padding: 4px 12px;
    border-top: 1px solid var(--border);
}
.ge-radio-dd-shuffle {
    font-size: 0.7rem;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    user-select: none;
}
.ge-radio-dd-shuffle input {
    accent-color: var(--accent);
    cursor: pointer;
    width: 13px;
    height: 13px;
}

.ge-radio-dd-tracklist {
    padding: 6px 12px 10px;
    border-top: 1px solid var(--border);
}
.ge-radio-track-select {
    width: 100%;
    padding: 5px 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.73rem;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}
.ge-radio-track-select:hover,
.ge-radio-track-select:focus {
    border-color: var(--accent);
}
.ge-radio-track-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .ge-radio-label {
        display: none;
    }
    .ge-radio-dropdown {
        width: 250px;
        right: -40px;
    }

    /* Make sure action buttons and toggles wrap and are easy to tap */
    .filters-row { display: flex !important; flex-direction: column; }
    .filters-row { justify-content: flex-start; }
    .filters-row .filter-group { width: 100% !important; }
    .filters-row .filter-toggle,
    .filters-row .view-toggle { align-self: flex-start; width: 100%; display: flex; gap: 8px; }
    .filters-row .filter-toggle { justify-content: flex-start; }
    .filters-row .view-toggle { justify-content: flex-start; }

    /* Make Save / Reset buttons full-width and stacked for mobile */
    .save-filters-btn, .reset-btn {
        width: 100% !important;
        padding: 10px 12px !important;
        box-sizing: border-box !important;
        align-self: stretch !important;
        text-align: center !important;
        margin-top: 6px;
    }
}
@media (max-width: 500px) {
    .ge-radio-dropdown {
        position: fixed;
        top: auto;
        bottom: 60px;
        right: 16px;
        left: 16px;
        width: auto;
    }
}

/* ===== PET COMPANION ===== */
.pet-companion {
    position: fixed;
    z-index: 1000;
    pointer-events: auto;
    image-rendering: pixelated;
    transition: none;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    opacity: 0.7;
    cursor: pointer;
    user-select: none;
}
.pet-companion:hover {
    opacity: 0.9;
}
.pet-companion img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    image-rendering: pixelated;
}
.pet-companion.walking {
    pointer-events: none;
    opacity: 0.5;
}
.effects-off .pet-companion {
    display: none !important;
}

/* Effects & Pet Combined Dropdown */
.effects-selector,
.theme-effects-selector {
    position: relative;
}
.effects-chevron,
.theme-effects-chevron {
    transition: transform 0.2s ease;
}
.effects-selector.open .effects-chevron,
.theme-effects-selector.open .theme-effects-chevron {
    transform: rotate(180deg);
}
.effects-dropdown,
.theme-effects-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 200px;
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) transparent;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    padding: 6px;
    animation: effectsDropdownIn 0.15s ease-out;
    flex-direction: column;
}
.effects-selector.open .effects-dropdown,
.theme-effects-selector.open .theme-effects-dropdown {
    display: flex;
}
@keyframes effectsDropdownIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.effects-dropdown::-webkit-scrollbar,
.theme-effects-dropdown::-webkit-scrollbar {
    width: 6px;
}
.effects-dropdown::-webkit-scrollbar-track,
.theme-effects-dropdown::-webkit-scrollbar-track {
    background: transparent;
}
.effects-dropdown::-webkit-scrollbar-thumb,
.theme-effects-dropdown::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}
.effects-dropdown::-webkit-scrollbar-thumb:hover,
.theme-effects-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}
.effects-dropdown-section {
    display: flex;
    flex-direction: column;
}
.effects-dropdown-header {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 6px 10px 4px;
    font-weight: 600;
}

/* Collapsible section toggle button */
.effects-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
}
.effects-dropdown-toggle .effects-dropdown-header {
    pointer-events: none;
}
.effects-dropdown-toggle .effects-section-chevron {
    color: var(--text-muted);
    transition: transform 0.2s ease;
    margin-right: 10px;
    flex-shrink: 0;
}
.effects-dropdown-toggle.expanded .effects-section-chevron {
    transform: rotate(180deg);
}
.effects-dropdown-toggle:hover .effects-dropdown-header {
    color: var(--text-primary);
}
.effects-dropdown-toggle:hover .effects-section-chevron {
    color: var(--text-primary);
}

/* Collapsible body */
.effects-section-body {
    overflow: hidden;
    max-height: 2000px;
    transition: max-height 0.18s ease;
}
.effects-section-body.collapsed {
    max-height: 0;
}
.effects-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 6px;
}
.effects-toggle-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
}
.effects-toggle-option:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}
.effects-toggle-option.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--bg-card-hover);
    font-weight: 600;
}
.effects-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: auto;
    flex-shrink: 0;
    background: var(--gain);
    transition: background 0.2s ease;
}
.effects-status-dot.off {
    background: var(--loss);
}
/* Cursor list in effects dropdown */
.effects-dropdown .cursor-list,
.theme-effects-dropdown .cursor-list {
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    max-height: 25vh;
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) transparent;
}
.effects-dropdown .cursor-list::-webkit-scrollbar,
.theme-effects-dropdown .cursor-list::-webkit-scrollbar {
    width: 6px;
}
.effects-dropdown .cursor-list::-webkit-scrollbar-track,
.theme-effects-dropdown .cursor-list::-webkit-scrollbar-track {
    background: transparent;
}
.effects-dropdown .cursor-list::-webkit-scrollbar-thumb,
.theme-effects-dropdown .cursor-list::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}
.effects-dropdown .cursor-list::-webkit-scrollbar-thumb:hover,
.theme-effects-dropdown .cursor-list::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}
.cursor-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
}
.cursor-option:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}
.cursor-option.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--bg-card-hover);
    font-weight: 600;
}
.cursor-option-preview {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.cursor-option-preview svg {
    width: 20px;
    height: 20px;
}
.cursor-default-icon {
    color: var(--text-muted);
}
.cursor-option.active .cursor-default-icon {
    color: var(--accent);
}
.cursor-option-name {
    flex: 1;
    text-align: left;
}

.effects-dropdown .pet-list,
.theme-effects-dropdown .pet-list {
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    flex: 1;
    min-height: 0;
    max-height: 40vh;
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) transparent;
}
.effects-dropdown .pet-list::-webkit-scrollbar,
.theme-effects-dropdown .pet-list::-webkit-scrollbar {
    width: 6px;
}
.effects-dropdown .pet-list::-webkit-scrollbar-track,
.theme-effects-dropdown .pet-list::-webkit-scrollbar-track {
    background: transparent;
}
.effects-dropdown .pet-list::-webkit-scrollbar-thumb,
.theme-effects-dropdown .pet-list::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}
.effects-dropdown .pet-list::-webkit-scrollbar-thumb:hover,
.theme-effects-dropdown .pet-list::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}
.pet-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
}
.pet-option:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}
.pet-option.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--bg-card-hover);
    font-weight: 600;
}
.pet-option-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    image-rendering: pixelated;
    flex-shrink: 0;
}
.pet-option-name {
    flex: 1;
    text-align: left;
}

/* Theme options within combined dropdown */
.theme-dropdown-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 10px 10px;
}

/* Mobile override: force show/view/save controls to stack below inputs
   Ensures the toggle buttons and Save/Reset occupy their own full-width row
   below the Max Buy Limit on small phones. */
@media (max-width: 480px) {
    .filters-row .filter-toggle,
    .filters-row .view-toggle,
    .save-filters-btn,
    .reset-btn {
        order: 999;
        width: 100% !important;
        align-self: stretch !important;
        margin-top: 6px !important;
        box-sizing: border-box !important;
    }

    .filters-row .view-toggle,
    .filters-row .filter-toggle {
        display: flex !important;
        justify-content: flex-start !important;
        gap: 8px !important;
    }
}

/* ===== LIVE STATS — header dropdown ===== */
.stats-header-wrap {
    position: relative;
}
.stats-header-wrap.open .stats-header-btn {
    background: var(--bg-card-hover);
    border-color: var(--green);
    color: var(--green);
}
.stats-header-btn {
    color: var(--green);
}
.stats-header-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 280px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1100;
    display: none;
    overflow: hidden;
}
.stats-header-wrap.open .stats-header-dropdown {
    display: block;
}

/* ===== FLIP SUGGESTER — header dropdown ===== */
.flip-header-wrap {
    position: relative;
}

/* Active state when dropdown is open */
.flip-header-wrap.open .flip-header-btn {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    color: var(--accent);
}

.flip-header-btn {
    /* inherits .header-action-btn styles */
    color: var(--accent);
}

.theme-effects-selector .header-action-btn {
    color: var(--accent);
}

/* Dropdown panel */
.flip-header-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: auto;
    width: 240px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1100;
    display: none;
    flex-direction: column;
    overflow: hidden;
}
.flip-header-wrap.open .flip-header-dropdown {
    display: flex;
}

/* On mobile, centre both dropdowns across the full screen width */
@media (max-width: 640px) {
    .stats-header-dropdown,
    .flip-header-dropdown {
        position: fixed;
        top: 75px;
        left: 14px;
        right: 14px;
        width: auto;
        max-width: none;
    }
    .stats-header-dropdown {
        max-height: 55vh;
        overflow-y: auto;
    }
}

/* Body */
.flip-panel-body {
    padding: 12px;
    flex: 1;
}

.flip-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 0;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.flip-no-results {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    padding: 12px 4px;
    line-height: 1.5;
}

.flip-suggestion-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.flip-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.flip-item-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
    filter: drop-shadow(0 1px 4px rgba(0,0,0,0.4));
}

.flip-item-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    word-break: break-word;
}

.flip-stats {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.flip-stat {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 4px;
}

.flip-stat-wide {
    flex-direction: column;
    gap: 1px;
}

.flip-stat-label {
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.flip-stat-value {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
}
.flip-stat-value.positive { color: var(--green); }
.flip-stat-value.neutral-flip { color: var(--yellow); }
.flip-stat-value.weak-flip { color: var(--text-secondary); }
.flip-stat-unit {
    font-size: 0.6rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Action buttons */
.flip-panel-actions {
    display: flex;
    flex-direction: row;
    gap: 6px;
    padding: 0 12px 12px;
}

.flip-action-btn {
    flex: 1;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    letter-spacing: 0.3px;
}

.flip-view-btn {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}
.flip-view-btn:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.flip-skip-btn {
    background: var(--bg-input);
    color: var(--text-secondary);
    border-color: var(--border);
}
.flip-skip-btn:hover {
    border-color: var(--border-light);
    color: var(--text-primary);
}

.flip-block-btn {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}
.flip-block-btn:hover {
    background: var(--red-bg);
    border-color: var(--red);
    color: var(--red);
}

/* Footer */
.flip-panel-footer {
    padding: 8px 12px 10px;
    border-top: 1px solid var(--border);
}

.flip-blocklist-btn {
    background: none;
    border: none;
    font-size: 0.65rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s;
    width: 100%;
    text-align: left;
}
.flip-blocklist-btn:hover { color: var(--text-secondary); }

/* ===== FLIP BLOCK LIST MODAL ===== */
.flip-blocklist-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    backdrop-filter: blur(3px);
}
.flip-blocklist-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.flip-blocklist-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: min(420px, 90vw);
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transform: scale(0.96) translateY(8px);
    transition: transform 0.2s ease;
}
.flip-blocklist-overlay.active .flip-blocklist-modal {
    transform: scale(1) translateY(0);
}

.flip-blocklist-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.flip-blocklist-modal-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}
.flip-blocklist-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}
.flip-blocklist-close:hover { color: var(--text-primary); }

.flip-blocklist-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 12px 18px 8px;
    flex-shrink: 0;
}

.flip-blocklist-items {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px 12px;
}

.flip-blocklist-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 24px 0;
}

.flip-blocklist-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    transition: background 0.12s;
}
.flip-blocklist-row:hover { background: var(--bg-card); }

.flip-blocklist-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex-shrink: 0;
}

.flip-blocklist-name {
    flex: 1;
    font-size: 0.82rem;
    color: var(--text-primary);
}

.flip-blocklist-remove {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.72rem;
    padding: 3px 7px;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.flip-blocklist-remove:hover {
    background: var(--red-bg);
    border-color: var(--red);
    color: var(--red);
}

