/* CelebDAQ Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


/* CSS for tutorial tooltip positioning assistance */
:root{
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

/* CSS Variables for Light/Dark Theme */
:root {
    /* Light Theme (Default) */
    --bg-gradient-start: #667eea;
    --bg-gradient-end: #764ba2;
    --card-bg: rgba(255, 255, 255, 0.95);
    --card-bg-secondary: rgba(255, 255, 255, 0.9);
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --border-color: rgba(102, 126, 234, 0.2);
    --border-hover: rgba(102, 126, 234, 0.4);
    --celeb-card-bg: #f7fafc;
    --portfolio-item-bg: #edf2f7;
    --portfolio-border: rgba(160, 174, 192, 0.2);
    --portfolio-border-hover: rgba(160, 174, 192, 0.4);
    --shadow-color: rgba(0, 0, 0, 0.1);
    --shadow-hover: rgba(0, 0, 0, 0.15);
    --ticker-bg: rgba(0, 0, 0, 0.9);
}

[data-theme="dark"] {
    /* Dark Theme */
    --bg-gradient-start: #1a202c;
    --bg-gradient-end: #2d3748;
    --card-bg: rgba(45, 55, 72, 0.95);
    --card-bg-secondary: rgba(45, 55, 72, 0.9);
    --text-primary: #f7fafc;
    --text-secondary: #e2e8f0;
    --text-muted: #a0aec0;
    --border-color: rgba(74, 85, 104, 0.3);
    --border-hover: rgba(74, 85, 104, 0.5);
    --celeb-card-bg: #2d3748;
    --portfolio-item-bg: #4a5568;
    --portfolio-border: rgba(113, 128, 150, 0.2);
    --portfolio-border-hover: rgba(113, 128, 150, 0.4);
    --shadow-color: rgba(0, 0, 0, 0.3);
    --shadow-hover: rgba(0, 0, 0, 0.4);
    --ticker-bg: rgba(0, 0, 0, 0.95);
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    box-shadow: 0 4px 12px var(--shadow-color);
    backdrop-filter: blur(10px);
}




/* Scroll to Top Button */
.scroll-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    box-shadow: 0 4px 12px var(--shadow-color);
    backdrop-filter: blur(10px);
    opacity: 0;
    transform: translateY(20px);
}

.scroll-to-top.visible {
    opacity: 1;
    transform: translateY(0);
}

.scroll-to-top:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-hover);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.scroll-to-top:hover .scroll-icon {
    color: white;
    transform: translateY(-2px);
}

.scroll-icon {
    transition: all 0.3s ease;
    color: var(--text-secondary);
    font-weight: bold;
}

/* Base font size that scales with viewport */
html {
    font-size: clamp(14px, 2.5vw, 16px);
    scroll-behavior: smooth;
}

/* Ticker Styles */
.ticker-container {
    background: var(--ticker-bg);
    color: white;
    padding: 0;
    position: sticky;
    position: -webkit-sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    overflow: hidden;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    height: clamp(45px, 8vw, 55px);
    display: flex;
    align-items: center;
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ticker {
    display: flex;
    align-items: center;
    font-weight: bold;
    font-size: clamp(0.85em, 2.2vw, 1em);
    animation: scroll-ticker 45s linear infinite;
    animation-play-state: running;
    will-change: transform;
    white-space: nowrap;
    height: 100%;
    min-width: 100%;
    padding: clamp(8px, 2vw, 12px) 0;
}

@keyframes scroll-ticker {
    0% { 
        transform: translateX(100%); 
    }
    100% { 
        transform: translateX(-100%); 
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.ticker-item {
    display: inline-flex;
    margin-right: clamp(15px, 3vw, 25px);
    padding: clamp(4px, 1vw, 6px) clamp(6px, 1.5vw, 10px);
    border-radius: clamp(8px, 2vw, 12px);
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    height: auto;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.ticker-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.ticker-item:focus-visible {
    outline: 2px solid #667eea; /* NEW: keyboard focus visible */
    outline-offset: 2px;
}

.ticker-item.positive {
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.ticker-item.negative {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.ticker-name { color: #ffffff; }
.ticker-price { color: #e2e8f0; }
.ticker-change { font-weight: bold; }
.ticker-change.positive { color: #22c55e; }
.ticker-change.negative { color: #ef4444; }

/* Layout Styles */
body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    line-height: 1.4;
    transition: all 0.3s ease;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content-wrapper {
    flex: 1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: clamp(10px, 3vw, 20px);
}

/* Header Styles */
.header {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: clamp(15px, 3vw, 20px);
    padding: clamp(20px, 4vw, 30px);
    margin-bottom: clamp(15px, 3vw, 20px);
    text-align: center;
    box-shadow: 0 8px 32px var(--shadow-color);
    border: 1px solid var(--border-color);
}

.header h1 {
    font-size: clamp(2em, 6vw, 3em);
    color: var(--text-secondary);
    margin-bottom: clamp(5px, 2vw, 10px);
    text-shadow: 2px 2px 4px var(--shadow-color);
}

.header p {
    color: var(--text-muted);
    font-size: clamp(1em, 2.5vw, 1.2em);
}

/* Navigation Bar Styles */
.main-nav {
    background: var(--card-bg-secondary);
    backdrop-filter: blur(10px);
    border-radius: clamp(10px, 2.5vw, 15px);
    padding: clamp(10px, 2.5vw, 15px) clamp(15px, 3vw, 20px);
    margin-bottom: clamp(15px, 3vw, 20px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 16px var(--shadow-color);
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: clamp(10px, 2vw, 15px);
}

.nav-left, .nav-right {
    display: flex;
    align-items: center;
    gap: clamp(8px, 2vw, 12px);
    flex-wrap: wrap;
}

.nav-link {
    background: none;
    border: 2px solid transparent;
    border-radius: clamp(8px, 2vw, 12px);
    padding: clamp(8px, 2vw, 10px) clamp(12px, 3vw, 16px);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: clamp(0.9em, 2.2vw, 1em);
    color: var(--text-secondary);
    white-space: nowrap;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: clamp(4px, 1vw, 6px);
}

.nav-link:hover {
    border-color: var(--border-hover);
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    transform: translateY(-1px);
}

.nav-link.portfolio-link {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: transparent;
}

.nav-link.portfolio-link:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Content Modal Styles */
.content-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1002;
    padding: clamp(10px, 3vw, 20px);
}

.content-modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: clamp(10px, 2.5vw, 15px);
    max-width: clamp(600px, 90vw, 800px);
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px var(--shadow-hover);
}

.content-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(15px, 3vw, 20px);
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg-secondary);
    border-radius: clamp(10px, 2.5vw, 15px) clamp(10px, 2.5vw, 15px) 0 0;
}

.content-modal-title {
    margin: 0;
    font-size: clamp(1.3em, 3vw, 1.6em);
    color: var(--text-primary);
    font-weight: bold;
}

.close-content-modal {
    background: none;
    border: none;
    font-size: clamp(22px, 4vw, 26px);
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
    width: clamp(32px, 6vw, 36px);
    height: clamp(32px, 6vw, 36px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-content-modal:hover {
    color: var(--text-secondary);
    background: var(--border-color);
}

.content-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: clamp(20px, 4vw, 30px);
    line-height: 1.6;
}

.content-modal-body h3 {
    color: var(--text-primary);
    font-size: clamp(1.1em, 2.5vw, 1.3em);
    margin-bottom: clamp(10px, 2vw, 15px);
    margin-top: clamp(20px, 4vw, 25px);
}

.content-modal-body h3:first-child {
    margin-top: 0;
}

.content-modal-body p {
    color: var(--text-secondary);
    margin-bottom: clamp(12px, 2.5vw, 15px);
    font-size: clamp(0.9em, 2.2vw, 1em);
}

.content-modal-body ul {
    color: var(--text-secondary);
    margin-bottom: clamp(12px, 2.5vw, 15px);
    padding-left: clamp(20px, 4vw, 25px);
}

.content-modal-body li {
    margin-bottom: clamp(6px, 1.5vw, 8px);
    font-size: clamp(0.9em, 2.2vw, 1em);
}

.content-modal-body pre {
    background: var(--celeb-card-bg);
    border: 1px solid var(--border-color);
    border-radius: clamp(6px, 1.5vw, 8px);
    padding: clamp(12px, 2.5vw, 15px);
    margin: clamp(10px, 2vw, 15px) 0;
    font-family: 'Courier New', monospace;
    font-size: clamp(0.8em, 2vw, 0.9em);
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-x: auto;
}

.content-modal-footer {
    padding: clamp(15px, 3vw, 20px);
    border-top: 1px solid var(--border-color);
    background: var(--card-bg-secondary);
    text-align: center;
    border-radius: 0 0 clamp(10px, 2.5vw, 15px) clamp(10px, 2.5vw, 15px);
}
/* Settings Content Styling */
.settings-section {
    margin-bottom: clamp(24px, 5vw, 32px);
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section-title {
    font-size: clamp(1.1em, 2.5vw, 1.3em);
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: clamp(16px, 3vw, 20px);
    padding-bottom: clamp(8px, 2vw, 12px);
    border-bottom: 2px solid #667eea;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(16px, 3vw, 20px);
    background: var(--celeb-card-bg);
    border: 1px solid var(--border-color);
    border-radius: clamp(8px, 2vw, 12px);
    margin-bottom: clamp(12px, 2.5vw, 16px);
    transition: all 0.3s ease;
}

.settings-item:hover {
    border-color: var(--border-hover);
    box-shadow: 0 2px 8px var(--shadow-color);
}

.settings-item:last-child {
    margin-bottom: 0;
}

.settings-item-info {
    flex: 1;
    margin-right: clamp(12px, 3vw, 20px);
}

.settings-label {
    font-size: clamp(1em, 2.5vw, 1.1em);
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: clamp(4px, 1vw, 6px);
    display: block;
}

.settings-description {
    font-size: clamp(0.85em, 2vw, 0.9em);
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}

.settings-control {
    flex-shrink: 0;
}

.settings-select {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: clamp(6px, 1.5vw, 8px);
    padding: clamp(8px, 2vw, 10px) clamp(12px, 3vw, 16px);
    font-size: clamp(0.9em, 2.2vw, 1em);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: clamp(140px, 30vw, 180px);
}

.settings-select:hover {
    border-color: var(--border-hover);
}

.settings-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.btn-settings {
    padding: clamp(8px, 2vw, 12px) clamp(16px, 3vw, 20px);
    border: none;
    border-radius: clamp(8px, 2vw, 10px);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: clamp(0.9em, 2.2vw, 1em);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: clamp(6px, 1.5vw, 8px);
    min-width: clamp(140px, 30vw, 180px);
    justify-content: center;
}

.btn-export {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.btn-export:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-import {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.btn-import:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-reset {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

.btn-reset:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

/* Mobile responsiveness for settings */
@media (max-width: 768px) {
    .settings-item {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
        gap: clamp(12px, 3vw, 16px);
    }

#next-update-timer {
    top: 15px !important;
    left: 15px !important;
}

#next-update-timer div:first-child {
    width: 45px !important;
    height: 45px !important;
}
    
    .settings-item-info {
        margin-right: 0;
        width: 100%;
    }
    
    .settings-control {
        width: 100%;
    }
    
    .settings-select,
    .btn-settings {
        width: 100%;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .settings-modal-body {
        padding: clamp(16px, 4vw, 20px);
    }
    
    .settings-item {
        padding: clamp(12px, 3vw, 16px);
        gap: clamp(10px, 2.5vw, 12px);
    }
}


/* User Info Styles */
.user-info {
    background: var(--card-bg-secondary);
    backdrop-filter: blur(10px);
    border-radius: clamp(10px, 2.5vw, 15px);
    padding: clamp(15px, 3vw, 20px);
    margin-bottom: clamp(20px, 4vw, 30px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 16px var(--shadow-color);
    flex-wrap: wrap;
    gap: clamp(10px, 2vw, 15px);
    border: 1px solid var(--border-color);
}

.trading-days {
    font-size: clamp(1em, 2.5vw, 1.1em);
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
}

@media (max-width: 768px) {
    .trading-days {
        margin-top: 8px;
    }
}

.user-controls {
    display: flex;
    gap: clamp(8px, 2vw, 10px);
    align-items: center;
    flex-wrap: wrap;
}

.currency-switch, .reset-button {
    border: none;
    border-radius: clamp(20px, 4vw, 25px);
    padding: clamp(8px, 2vw, 10px) clamp(15px, 3vw, 20px);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: clamp(0.9em, 2vw, 1em);
    white-space: nowrap;
}

.currency-switch {
    background: #667eea;
    color: white;
}

.currency-switch:hover {
    background: #764ba2;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}


.balance {
    font-size: clamp(1.2em, 3vw, 1.5em);
    font-weight: bold;
    color: var(--text-primary);
}

.portfolio-value {
    font-size: clamp(1.2em, 3vw, 1.5em);
    font-weight: bold;
    color: var(--text-primary);
    cursor: pointer;
    transition: color 0.3s ease;
    text-decoration: none;
}

.portfolio-value:hover {
    color: #667eea;
    text-decoration: underline;
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(20px, 4vw, 30px);
}

.celeb-market, .portfolio {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: clamp(10px, 2.5vw, 15px);
    padding: clamp(15px, 3vw, 25px);
    box-shadow: 0 8px 32px var(--shadow-color);
    border: 1px solid var(--border-color);
}

/* Market Tabs */
.market-tabs {
    display: flex;
    margin-bottom: clamp(15px, 3vw, 25px);
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
    flex-wrap: wrap;
    gap: clamp(2px, 1vw, 5px);
}

.tab-button {
    background: none;
    border: none;
    padding: clamp(8px, 2vw, 12px) clamp(10px, 2.5vw, 16px);
    cursor: pointer;
    font-weight: bold;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-size: clamp(0.7em, 2vw, 0.85em);
}

.tab-button:hover {
    color: var(--text-secondary);
    background: rgba(102, 126, 234, 0.1);
}

.tab-button.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

/* Sort Controls */
.sort-controls {
    display: flex;
    align-items: center;
    gap: clamp(12px, 3vw, 20px);
    margin-bottom: clamp(15px, 3vw, 20px);
    padding: clamp(8px, 2vw, 12px) 0;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.search-container {
    display: flex;
    align-items: center;
    gap: clamp(6px, 1.5vw, 8px);
    position: relative;
    flex: 1;
    min-width: clamp(200px, 40vw, 250px);
}

.search-label {
    font-size: clamp(0.85em, 2vw, 0.9em);
    font-weight: bold;
    color: var(--text-secondary);
    white-space: nowrap;
}

.search-input {
    background: var(--celeb-card-bg);
    border: 2px solid var(--border-color);
    border-radius: clamp(6px, 1.5vw, 8px);
    padding: clamp(6px, 1.5vw, 8px) clamp(12px, 2.5vw, 16px);
    font-size: clamp(0.8em, 2vw, 0.9em);
    color: var(--text-primary);
    transition: all 0.3s ease;
    flex: 1;
    min-width: 0;
}

.search-input:hover {
    border-color: var(--border-hover);
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.clear-search {
    position: absolute;
    right: clamp(8px, 2vw, 12px);
    background: none;
    border: none;
    font-size: clamp(16px, 3vw, 18px);
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    border-radius: 50%;
    width: clamp(20px, 4vw, 24px);
    height: clamp(20px, 4vw, 24px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.clear-search:hover {
    background: var(--border-color);
    color: var(--text-secondary);
}

.sort-container {
    display: flex;
    align-items: center;
    gap: clamp(6px, 1.5vw, 8px);
    flex-shrink: 0;
}

.sort-label {
    font-size: clamp(0.85em, 2vw, 0.9em);
    font-weight: bold;
    color: var(--text-secondary);
    white-space: nowrap;
}

.sort-dropdown {
    background: var(--celeb-card-bg);
    border: 2px solid var(--border-color);
    border-radius: clamp(6px, 1.5vw, 8px);
    padding: clamp(6px, 1.5vw, 8px) clamp(12px, 2.5vw, 16px);
    font-size: clamp(0.8em, 2vw, 0.9em);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: clamp(140px, 30vw, 180px);
}

.sort-dropdown:hover {
    border-color: var(--border-hover);
}

.sort-dropdown:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.top-mover-badge {
    background: linear-gradient(45deg, #f59e0b, #eab308);
    color: white;
    padding: clamp(1px, 0.5vw, 2px) clamp(4px, 1vw, 6px);
    border-radius: clamp(6px, 1.5vw, 8px);
    font-size: clamp(0.6em, 1.4vw, 0.7em);
    font-weight: bold;
    margin-right: clamp(6px, 1.5vw, 8px);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: clamp(20px, 4vw, 24px);
    height: clamp(18px, 3.5vw, 20px);
}

.section-title {
    font-size: clamp(1.4em, 3.5vw, 1.8em);
    margin-bottom: clamp(15px, 3vw, 20px);
    color: var(--text-primary);
    border-bottom: 3px solid #667eea;
    padding-bottom: clamp(5px, 2vw, 10px);
}

/* Celebrity Cards */
.celeb-card {
    background: var(--celeb-card-bg);
    border-radius: clamp(8px, 2vw, 12px);
    padding: clamp(12px, 2.5vw, 20px);
    margin-bottom: clamp(8px, 2vw, 15px);
    border-left: 4px solid #667eea;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    cursor: pointer;
}

.celeb-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--shadow-hover);
    border-left-color: #764ba2;
    border-color: var(--border-hover);
}

.celeb-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: clamp(8px, 2vw, 15px);
    flex-wrap: wrap;
    gap: clamp(8px, 2vw, 10px);
}

.celeb-details {
    flex: 1;
    min-width: 0;
}

.celeb-name-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: clamp(2px, 0.5vw, 4px);
    flex-wrap: wrap;
    gap: clamp(4px, 1vw, 8px);
}

.celeb-name-left {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.celeb-category-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: clamp(4px, 1vw, 8px);
}

.celeb-name {
    font-size: clamp(1em, 2.5vw, 1.3em);
    font-weight: bold;
    color: var(--text-primary);
    cursor: pointer;
    transition: color 0.3s ease;
    margin-right: clamp(4px, 1vw, 8px);
    text-align: left;
}

.celeb-name:hover {
    color: #667eea;
    text-decoration: underline;
}

.celeb-price {
    font-size: clamp(1em, 2.5vw, 1.2em);
    font-weight: bold;
    color: #38a169;
    white-space: nowrap;
}

.price-change {
    font-size: clamp(0.7em, 1.8vw, 0.85em);
    padding: clamp(2px, 0.5vw, 3px) clamp(4px, 1vw, 6px);
    border-radius: clamp(8px, 2vw, 10px);
    font-weight: bold;
    white-space: nowrap;
}

.price-up {
    background: #c6f6d5;
    color: #22543d;
}

.price-down {
    background: #fed7d7;
    color: #742a2a;
}

.celeb-category {
    font-size: clamp(0.75em, 1.8vw, 0.85em);
    color: var(--text-muted);
    margin-right: clamp(4px, 1vw, 8px);
}

/* Trade Buttons */
.trade-buttons {
    display: flex;
    gap: clamp(8px, 2vw, 10px);
    flex-wrap: wrap;
}

.btn {
    padding: clamp(6px, 1.5vw, 8px) clamp(12px, 3vw, 16px);
    border: none;
    border-radius: clamp(6px, 1.5vw, 8px);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: clamp(0.8em, 2vw, 0.9em);
    white-space: nowrap;
}

.btn-buy {
    background: #48bb78;
    color: white;
}

.btn-buy:hover {
    background: #38a169;
    transform: translateY(-1px);
}

.btn-sell {
    background: #ed8936;
    color: white;
}

.btn-sell:hover {
    background: #dd6b20;
    transform: translateY(-1px);
}

.btn-history {
    background: #4299e1;
    color: white;
}

.btn-history:hover {
    background: #3182ce;
    transform: translateY(-1px);
}

/* Modal Styles */
.trade-modal, .history-modal, .wiki-modal, .trade-history-modal, .content-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1002;
    padding: clamp(10px, 3vw, 20px);
}

.modal-content, .history-modal-content, .wiki-modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: clamp(10px, 2.5vw, 15px);
    padding: clamp(20px, 4vw, 30px);
    max-width: clamp(350px, 90vw, 400px);
    width: 100%;
    text-align: center;
}

.history-modal-content {
    max-width: clamp(350px, 95vw, 1100px);
    max-height: clamp(400px, 85vh, 80vh);
    overflow-y: auto;
    position: relative;
}

.wiki-modal-content {
    max-width: clamp(400px, 90vw, 450px);
}

.modal-title, .wiki-modal-title {
    font-size: clamp(1.3em, 3vw, 1.5em);
    margin-bottom: clamp(15px, 3vw, 20px);
    color: var(--text-primary);
}

.wiki-modal-title {
    font-size: clamp(1.2em, 3vw, 1.4em);
    margin-bottom: clamp(12px, 2.5vw, 15px);
}

.wiki-modal-text {
    color: var(--text-muted);
    margin-bottom: clamp(20px, 4vw, 25px);
    line-height: 1.5;
    font-size: clamp(0.9em, 2.2vw, 1em);
}

.trade-input {
    width: 100%;
    padding: clamp(10px, 2.5vw, 12px);
    border: 2px solid var(--border-color);
    border-radius: clamp(6px, 1.5vw, 8px);
    margin-bottom: clamp(12px, 2.5vw, 15px);
    font-size: clamp(1em, 2.5vw, 1.1em);
    background: var(--celeb-card-bg);
    color: var(--text-primary);
}

.max-button {
    background: #a0aec0;
    color: white;
    border: none;
    border-radius: clamp(5px, 1.2vw, 6px);
    padding: clamp(5px, 1.2vw, 6px) clamp(10px, 2.5vw, 12px);
    font-size: clamp(0.8em, 2vw, 0.9em);
    cursor: pointer;
    margin-bottom: clamp(12px, 2.5vw, 15px);
    transition: all 0.3s ease;
}

.max-button:hover {
    background: #718096;
}

.modal-buttons, .wiki-modal-buttons {
    display: flex;
    gap: clamp(12px, 3vw, 15px);
    justify-content: center;
    flex-wrap: wrap;
}

.btn-confirm {
    background: #667eea;
    color: white;
    padding: clamp(10px, 2.5vw, 12px) clamp(20px, 4vw, 24px);
}

.btn-cancel {
    background: #a0aec0;
    color: white;
    padding: clamp(10px, 2.5vw, 12px) clamp(20px, 4vw, 24px);
}

/* NEW: Trade History Modal Styles */
.trade-history-modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: clamp(10px, 2.5vw, 15px);
    max-width: clamp(500px, 90vw, 700px);
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.trade-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(15px, 3vw, 20px);
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg-secondary);
}

.trade-history-header .modal-title {
    margin: 0;
    font-size: clamp(1.2em, 3vw, 1.4em);
    color: var(--text-primary);
}

.close-trade-history {
    background: none;
    border: none;
    font-size: clamp(20px, 4vw, 24px);
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.close-trade-history:hover {
    color: var(--text-secondary);
    background: var(--border-color);
}

.trade-history-body {
    flex: 1;
    overflow-y: auto;
    padding: clamp(15px, 3vw, 20px);
}

.trade-history-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: clamp(15px, 3vw, 20px);
    padding-bottom: clamp(10px, 2vw, 15px);
    border-bottom: 1px solid var(--border-color);
}

.btn-download {
    background: #667eea;
    color: white;
    border: none;
    border-radius: clamp(6px, 1.5vw, 8px);
    padding: clamp(8px, 2vw, 10px) clamp(16px, 3vw, 20px);
    font-size: clamp(0.85em, 2vw, 0.9em);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-download:hover {
    background: #764ba2;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.trade-history-list {
    max-height: 400px;
    overflow-y: auto;
}

.trade-history-item {
    background: var(--celeb-card-bg);
    border: 1px solid var(--border-color);
    border-radius: clamp(6px, 1.5vw, 8px);
    padding: clamp(12px, 2.5vw, 15px);
    margin-bottom: clamp(8px, 2vw, 12px);
    transition: all 0.3s ease;
}

.trade-history-item:hover {
    border-color: var(--border-hover);
    box-shadow: 0 2px 8px var(--shadow-color);
}

.trade-info {
    display: flex;
    flex-direction: column;
    gap: clamp(4px, 1vw, 6px);
}

.trade-main-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: clamp(2px, 0.5vw, 4px);
}

.celebrity-name {
    font-weight: bold;
    color: var(--text-primary);
    font-size: clamp(1em, 2.5vw, 1.1em);
}

.trade-action {
    padding: clamp(2px, 0.5vw, 3px) clamp(6px, 1.5vw, 8px);
    border-radius: clamp(4px, 1vw, 6px);
    font-size: clamp(0.7em, 1.8vw, 0.8em);
    font-weight: bold;
    text-transform: uppercase;
}

.buy-action {
    background: #c6f6d5;
    color: #22543d;
}

.sell-action {
    background: #fed7d7;
    color: #742a2a;
}

.trade-details-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: clamp(0.8em, 2vw, 0.9em);
}

.trade-pnl-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: clamp(4px, 1vw, 6px);
    padding-top: clamp(6px, 1.5vw, 8px);
    border-top: 1px solid var(--border-color);
}

.total-value {
    font-weight: bold;
    color: var(--text-secondary);
    font-size: clamp(0.85em, 2.2vw, 0.95em);
}

.profit-loss {
    font-weight: bold;
    font-size: clamp(0.85em, 2.2vw, 0.95em);
}

.no-pnl {
    color: var(--text-muted);
    font-style: italic;
    font-size: clamp(0.85em, 2.2vw, 0.95em);
}

.trade-history-footer {
    padding: clamp(15px, 3vw, 20px);
    border-top: 1px solid var(--border-color);
    background: var(--card-bg-secondary);
    text-align: center;
}

/* Portfolio Actions Container */
.portfolio-actions {
    display: flex;
    flex-direction: column;
    gap: clamp(10px, 2.5vw, 12px);
    margin-top: clamp(15px, 3vw, 20px);
    padding-top: clamp(15px, 3vw, 20px);
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.trade-history-btn {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    border: none;
    border-radius: clamp(20px, 4vw, 25px);
    padding: clamp(10px, 2.5vw, 12px) clamp(20px, 4vw, 24px);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: clamp(0.9em, 2.2vw, 1em);
    box-shadow: 0 4px 16px rgba(66, 153, 225, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.trade-history-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(66, 153, 225, 0.4);
    background: linear-gradient(135deg, #3182ce 0%, #2c5282 100%);
}

.trade-history-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 16px rgba(66, 153, 225, 0.3);
}

.btn-pnl-chart {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border: none;
    border-radius: clamp(20px, 4vw, 25px);
    padding: clamp(10px, 2.5vw, 12px) clamp(20px, 4vw, 24px);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: clamp(0.9em, 2.2vw, 1em);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-pnl-chart:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
}

.btn-pnl-chart:active {
    transform: translateY(0);
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.3);
}



/* FIXED: Chart Styles with Mobile Support */
.history-chart {
    width: 100%;
    height: clamp(320px, 50vh, 650px);
    margin: clamp(10px, 2vw, 20px) 0;
    border: 2px solid var(--border-color);
    border-radius: clamp(6px, 1.5vw, 12px);
    position: relative;
    background: linear-gradient(135deg, var(--celeb-card-bg) 0%, rgba(102, 126, 234, 0.02) 100%);
    overflow: hidden;
    box-shadow: 0 4px 16px var(--shadow-color);
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Prevent pull-to-refresh on mobile */
    overscroll-behavior: contain;
    /* Improve scrolling performance */
    -webkit-overflow-scrolling: touch;
}

/* FIXED: SVG should be fully responsive */
.history-chart svg {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

/* Ensure chart text is readable in both themes */
.history-chart svg text {
    fill: var(--text-muted);
    font-family: 'Arial', sans-serif;
    font-weight: 500;
}

.history-chart svg .chart-axis-label {
    fill: var(--text-primary) !important;
    font-weight: bold;
}

.history-chart svg .chart-baseline-label {
    fill: #667eea !important;
    font-weight: bold;
}

.price-line {
    stroke: #667eea;
    stroke-width: 4;
    fill: none;
    filter: drop-shadow(0 2px 4px rgba(102, 126, 234, 0.3));
    transition: all 0.3s ease;
}

.price-point {
    cursor: pointer;
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.price-point:hover {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    transform: scale(1.1);
}

.chart-axis {
    stroke: var(--text-muted);
    stroke-width: 2;
    opacity: 0.7;
}

.chart-label {
    font-size: clamp(10px, 2vw, 12px);
    fill: var(--text-muted);
    font-weight: 500;
}

/* Enhanced chart grid lines */
.chart-grid {
    stroke: var(--border-color);
    stroke-width: 1;
    opacity: 0.4;
    stroke-dasharray: 2,2;
}

/* Enhanced chart text labels */
.chart-text {
    font-family: 'Arial', sans-serif;
    font-size: clamp(9px, 1.8vw, 11px);
    fill: var(--text-muted);
    font-weight: 500;
}

.chart-axis-label {
    font-family: 'Arial', sans-serif;
    font-size: clamp(11px, 2.5vw, 14px);
    font-weight: bold;
    fill: var(--text-primary);
    text-shadow: 0 1px 2px var(--shadow-color);
}

.chart-baseline-label {
    font-family: 'Arial', sans-serif;
    font-size: clamp(10px, 2.2vw, 12px);
    font-weight: bold;
    fill: #667eea;
    text-shadow: 0 1px 2px rgba(102, 126, 234, 0.2);
}

.close-history {
    position: absolute;
    top: clamp(8px, 2vw, 15px);
    right: clamp(12px, 3vw, 20px);
    background: var(--card-bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    font-size: clamp(20px, 4vw, 24px);
    cursor: pointer;
    color: var(--text-muted);
    width: clamp(28px, 6vw, 32px);
    height: clamp(28px, 6vw, 32px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-history:hover {
    color: var(--text-secondary);
    background: var(--border-color);
}

/* FIXED: Custom tooltip styles */
#chart-tooltip {
    position: fixed !important;
    background: rgba(45, 55, 72, 0.95) !important;
    color: white !important;
    padding: 8px 12px !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
    white-space: pre-line !important;
    z-index: 10000 !important;
    pointer-events: none !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    backdrop-filter: blur(10px) !important;
    max-width: 200px !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    animation: tooltipFadeIn 0.2s ease-out;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ensure chart is interactive on mobile */
.history-chart svg circle {
    cursor: pointer;
    /* Improve touch target size on mobile */
    touch-action: manipulation;
}

/* Portfolio Styles */
.portfolio-item {
    background: var(--portfolio-item-bg);
    border-radius: clamp(8px, 2vw, 10px);
    padding: clamp(10px, 2vw, 15px);
    margin-bottom: clamp(6px, 1.5vw, 15px);
    border: 1px solid var(--portfolio-border);
    transition: all 0.3s ease;
}

.portfolio-item:hover {
    border-color: var(--portfolio-border-hover);
    box-shadow: 0 2px 8px var(--shadow-color);
}

.portfolio-info {
    margin-bottom: clamp(8px, 2vw, 12px);
}

.portfolio-name-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: clamp(2px, 0.5vw, 4px);
    flex-wrap: wrap;
    gap: clamp(4px, 1vw, 8px);
}

.portfolio-details-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: clamp(4px, 1vw, 8px);
}

.portfolio-name {
    font-weight: bold;
    color: var(--text-primary);
    cursor: pointer;
    transition: color 0.3s ease;
    font-size: clamp(1em, 2.5vw, 1.1em);
    text-align: left;
}

.portfolio-name:hover {
    color: #667eea;
    text-decoration: underline;
}

.portfolio-shares {
    color: var(--text-muted);
    font-size: clamp(0.75em, 1.8vw, 0.9em);
    text-align: left;
}

.portfolio-buttons {
    display: flex;
    gap: clamp(6px, 1.5vw, 10px);
    flex-wrap: wrap;
    width: auto;
    max-width: none;
    justify-content: flex-start;
}

.portfolio-buttons .btn {
    padding: clamp(6px, 1.5vw, 8px) clamp(12px, 3vw, 16px);
    font-size: clamp(0.8em, 2vw, 0.9em);
    flex: 0 0 auto;
    min-width: auto;
    width: auto;
    max-width: none;

}

.current-value {
    font-weight: bold;
    color: var(--text-primary);
    font-size: clamp(1em, 2.5vw, 1.1em);
    text-align: right;
}

.profit-loss {
    font-size: clamp(0.75em, 1.8vw, 0.9em);
    text-align: right;
}

.profit {
    color: #38a169;
}

.loss {
    color: #e53e3e;
}

/* Portfolio Share Button */
.share-portfolio-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: clamp(20px, 4vw, 25px);
    padding: clamp(10px, 2.5vw, 12px) clamp(20px, 4vw, 24px);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: clamp(0.9em, 2.2vw, 1em);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.share-portfolio-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.share-portfolio-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

/* Footer Styles */
.footer {
    background: var(--card-bg-secondary);
    backdrop-filter: blur(10px);
    border-radius: clamp(10px, 2.5vw, 15px);
    padding: clamp(15px, 3vw, 20px);
    margin: clamp(15px, 3vw, 20px);
    text-align: center;
    box-shadow: 0 4px 16px var(--shadow-color);
    color: var(--text-muted);
    font-size: clamp(0.8em, 2vw, 0.9em);
    line-height: 1.6;
    margin-top: auto;
    border: 1px solid var(--border-color);
}

.footer .version {
    font-weight: bold;
    color: var(--text-secondary);
    margin-bottom: clamp(8px, 2vw, 10px);
    font-size: clamp(0.9em, 2.2vw, 1em);
}

.footer .disclaimer {
    margin-bottom: clamp(12px, 2.5vw, 15px);
}

.footer .support {
    margin-top: clamp(8px, 2vw, 10px);
}

.footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* Container for trade input and max buttons */
.trade-input-container {
    position: relative;
    width: 100%;
}

/* Container for the max buttons */
.max-buttons-container {
    display: flex;
    gap: clamp(8px, 2vw, 12px);
    margin-top: clamp(8px, 2vw, 12px);
    justify-content: center;
    align-items: center;
}

/* Base styles for max buttons */
.max-button {
    background: #a0aec0;
    color: white;
    border: none;
    border-radius: clamp(6px, 1.5vw, 8px);
    padding: clamp(6px, 1.5vw, 8px) clamp(12px, 3vw, 16px);
    font-size: clamp(0.8em, 2vw, 0.9em);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: clamp(4px, 1vw, 6px);
    min-width: clamp(90px, 20vw, 120px);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

/* Buy Max Button Styles */
.buy-max-button {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.2);
}

.buy-max-button:hover {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
}

.buy-max-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.3);
}

/* Sell Max Button Styles */
.sell-max-button {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    box-shadow: 0 2px 8px rgba(237, 137, 54, 0.2);
}

.sell-max-button:hover {
    background: linear-gradient(135deg, #dd6b20 0%, #c05621 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(237, 137, 54, 0.4);
}

.sell-max-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(237, 137, 54, 0.3);
}

/* Loading state for max buttons */
.max-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Animation for button state changes */
@keyframes buttonFeedback {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.max-button.feedback {
    animation: buttonFeedback 0.3s ease-in-out;
}

/* Trade Cost Display Styles */
.trade-cost-display {
    background: var(--celeb-card-bg);
    border: 2px solid var(--border-color);
    border-radius: clamp(6px, 1.5vw, 8px);
    padding: clamp(8px, 2vw, 12px) clamp(12px, 3vw, 16px);
    margin: clamp(8px, 2vw, 12px) 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    font-size: clamp(0.9em, 2.2vw, 1em);
}

.trade-cost-display.buy-mode {
    border-color: #48bb78;
    background: rgba(72, 187, 120, 0.05);
}

.trade-cost-display.sell-mode {
    border-color: #ed8936;
    background: rgba(237, 137, 54, 0.05);
}

.cost-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.cost-amount {
    color: var(--text-primary);
    font-weight: bold;
    font-size: clamp(1em, 2.5vw, 1.1em);
}

.trade-cost-display.buy-mode .cost-amount {
    color: #38a169;
}

.trade-cost-display.sell-mode .cost-amount {
    color: #dd6b20;
}

/* Animation for cost updates */
.cost-amount.updating {
    animation: costUpdate 0.3s ease-in-out;
}

@keyframes costUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Watchlist Navigation Button */
.nav-link.watchlist-link {
    background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
    color: white;
    border-color: transparent;
}

.nav-link.watchlist-link:hover {
    background: linear-gradient(135deg, #a855f7 0%, #8b5cf6 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

/* Watchlist Button on Celebrity Cards */
.btn-watchlist {
    background: #6b7280;
    color: white;
    padding: clamp(6px, 1.5vw, 8px) clamp(8px, 2vw, 12px);
    font-size: clamp(0.8em, 2vw, 0.9em);
    min-width: clamp(32px, 8vw, 40px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-watchlist:hover {
    background: #4b5563;
    transform: translateY(-1px);
}

.btn-watchlist.watching {
    background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.btn-watchlist.watching:hover {
    background: linear-gradient(135deg, #a855f7 0%, #8b5cf6 100%);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.btn-watchlist.not-watching {
    background: #6b7280;
    opacity: 0.7;
}

.btn-watchlist.not-watching:hover {
    background: #8b5cf6;
    opacity: 1;
}

.watchlist-celeb-name:hover {
    color: #667eea;
    text-decoration: underline;
}

.watchlist-remove:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.watchlist-change.profit {
    background: #c6f6d5;
    color: #22543d;
}

.watchlist-change.loss {
    background: #fed7d7;
    color: #742a2a;
}

.btn-compact.btn-buy {
    background: #48bb78;
    color: white;
}

.btn-compact.btn-buy:hover {
    background: #38a169;
    transform: translateY(-1px);
}

.btn-compact.btn-sell {
    background: #ed8936;
    color: white;
}

.btn-compact.btn-sell:hover {
    background: #dd6b20;
    transform: translateY(-1px);
}

.watchlist-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.watchlist-counter {
    color: var(--text-muted);
    font-size: 0.9em;
    margin: 0;
    font-weight: 500;
}

/* Watchlist celebrity cards container */
.watchlist-celebrity-cards {
    display: flex;
    flex-direction: column;
    gap: clamp(8px, 2vw, 15px);
}

/* Watchlist cards use same styling as main cards */
.watchlist-card {
    /* Inherits all celeb-card styles */
    margin-bottom: 0; /* Override the default margin since we use gap */
}

/* Ensure watchlist cards work properly in modal */
.content-modal-body .celeb-card {
    margin-bottom: 0; /* Remove default margins in modal */
}

/* Prevent scrolling issues on mobile when interacting with chart */
.history-modal.no-scroll {
    overflow: hidden;
}

/* ================================ */
/* WATCHLIST BUTTON CONSISTENCY FIXES */
/* ================================ */

/* ONLY target watchlist buttons in modal - match main celebrity cards exactly */
.content-modal-body .watchlist-card .trade-buttons {
    display: flex;
    gap: clamp(8px, 2vw, 10px);
    flex-wrap: wrap;
}

.content-modal-body .watchlist-card .btn {
    padding: clamp(6px, 1.5vw, 8px) clamp(12px, 3vw, 16px);
    border: none;
    border-radius: clamp(6px, 1.5vw, 8px);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: clamp(0.8em, 2vw, 0.9em);
    white-space: nowrap;
}

.content-modal-body .watchlist-card .btn-buy {
    background: #48bb78;
    color: white;
}

.content-modal-body .watchlist-card .btn-buy:hover {
    background: #38a169;
    transform: translateY(-1px);
}

.content-modal-body .watchlist-card .btn-sell {
    background: #ed8936;
    color: white;
}

.content-modal-body .watchlist-card .btn-sell:hover {
    background: #dd6b20;
    transform: translateY(-1px);
}

.content-modal-body .watchlist-card .btn-history {
    background: #4299e1;
    color: white;
}

.content-modal-body .watchlist-card .btn-history:hover {
    background: #3182ce;
    transform: translateY(-1px);
}

.content-modal-body .watchlist-card .btn-watchlist {
    background: #6b7280;
    color: white;
    padding: clamp(6px, 1.5vw, 8px) clamp(8px, 2vw, 12px);
    font-size: clamp(0.8em, 2vw, 0.9em);
    min-width: clamp(32px, 8vw, 40px);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: clamp(6px, 1.5vw, 8px);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.content-modal-body .watchlist-card .btn-watchlist:hover {
    background: #4b5563;
    transform: translateY(-1px);
}

.content-modal-body .watchlist-card .btn-watchlist.watching {
    background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.content-modal-body .watchlist-card .btn-watchlist.watching:hover {
    background: linear-gradient(135deg, #a855f7 0%, #8b5cf6 100%);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

/* Responsive Design - UPDATED with Mobile Chart Fixes */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .user-info {
        flex-direction: column;
        text-align: center;
    }
    
    .user-controls {
        justify-content: center;
        width: 100%;
    }
    
    .currency-switch, .reset-button {
        flex: 1;
        min-width: 120px;
    }
    
    /* Navigation responsive adjustments */
    .main-nav {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .nav-left, .nav-right {
        justify-content: center;
        width: 100%;
        gap: 8px;
    }
    
    .nav-right {
        order: -1; /* Put nav-right links above portfolio link on mobile */
    }
    
    .nav-link {
        flex: 1;
        justify-content: center;
        min-width: clamp(70px, 20vw, 90px);
        font-size: clamp(0.8em, 2vw, 0.9em);
        padding: clamp(6px, 1.5vw, 8px) clamp(8px, 2vw, 12px);
    }
    
    .nav-link.portfolio-link,
    .nav-link.watchlist-link {
        width: 100%;
        max-width: 150px;
    }
    
    .trade-buttons {
        justify-content: flex-start;
    }
    
    .market-tabs {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    /* Content Modal responsive adjustments */
    .content-modal {
        padding-top: 80px;
        align-items: flex-start;
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .content-modal-content {
        max-height: calc(100vh - 100px);
        margin-top: 10px;
        width: calc(100vw - 20px);
        max-width: none;
    }
    
    .content-modal-body {
        padding: clamp(15px, 3vw, 20px);
    }
    
    .content-modal-title {
        font-size: clamp(1.2em, 3vw, 1.4em);
    }
    
    /* Watchlist modal button fixes for mobile */
    .content-modal-body .watchlist-card .trade-buttons {
        gap: clamp(6px, 1.5vw, 8px);
    }
    
    .content-modal-body .watchlist-card .btn {
        flex: 0 0 auto;
        min-width: auto;
        padding: clamp(6px, 1.5vw, 8px) clamp(12px, 3vw, 16px);
        font-size: clamp(0.8em, 2vw, 0.9em);
    }
    
    .content-modal-body .watchlist-card .btn-watchlist {
        flex: 0 0 auto;
        min-width: clamp(32px, 8vw, 40px);
        padding: clamp(6px, 1.5vw, 8px);
    }
    
    /* FIXED: Mobile modal and chart improvements */
    .history-modal {
        padding: 8px;
        align-items: flex-start;
        padding-top: 80px;
    }
    
    .history-modal-content {
        margin: 10px 0;
        max-height: calc(100vh - 100px);
        width: calc(100vw - 16px);
        max-width: none;
    }
    
    .history-chart {
        height: clamp(280px, 45vh, 380px);
        margin: 8px 0;
        border-radius: 8px;
        width: 100%;
        min-width: 0;
        border-width: 2px;
    }
    
    .history-chart svg circle {
        /* Larger touch targets on mobile */
        r: 6px !important;
    }
    
    .history-chart svg circle:hover,
    .history-chart svg circle:active {
        r: 8px !important;
    }
    
    /* Mobile tooltip adjustments */
    #chart-tooltip {
        font-size: 11px !important;
        padding: 6px 10px !important;
        max-width: 180px !important;
    }
    
    /* Modal title adjustments for mobile */
    .modal-title {
        font-size: clamp(1.1em, 4vw, 1.3em);
        line-height: 1.2;
        margin-bottom: 12px;
    }
    
    /* Close button improvements for mobile */
    .close-history {
        top: 8px;
        right: 12px;
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
    
    /* Compact sort controls on mobile */
    .sort-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px 0;
    }
    
    .search-container {
        min-width: auto;
        width: 100%;
    }
    
    .sort-container {
        width: 100%;
    }
    
    .sort-dropdown {
        width: 100%;
        min-width: auto;
    }
    
    /* Adjust scroll-to-top button for mobile */
    .scroll-to-top {
        bottom: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
    }
    
    .theme-toggle {
        top: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
    }
    
    /* Trade History Modal on Mobile */
    .trade-history-modal {
        padding-top: 80px;
        align-items: flex-start;
    }
    
    .trade-history-modal-content {
        max-height: calc(100vh - 100px);
        margin-top: 10px;
        width: calc(100vw - 20px);
    }
    
    .trade-main-row,
    .trade-details-row,
    .trade-pnl-row {
        flex-wrap: wrap;
        gap: clamp(4px, 1vw, 8px);
    }
    
    .trade-history-controls {
        justify-content: center;
    }
    
    .portfolio-actions {
        gap: 8px;
    }
    
    .trade-history-btn,
    .share-portfolio-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* More compact celebrity cards on mobile */
    .celeb-card {
        padding: 10px;
        margin-bottom: 8px;
    }
    
    .celeb-name-row, .celeb-category-row {
        flex-wrap: nowrap;
        overflow: hidden;
    }
    
    .celeb-name-left {
        flex: 1;
        min-width: 0;
        overflow: hidden;
    }
    
    .celeb-name {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        text-align: left;
    }
    
    /* Compact portfolio on mobile */
    .portfolio-item {
        padding: 10px;
        margin-bottom: 8px;
    }
    
    .portfolio-name-row, .portfolio-details-row {
        flex-wrap: nowrap;
        overflow: hidden;
    }
    
    .portfolio-name, .portfolio-shares {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .watchlist-celebrity-cards {
        gap: 8px;
    }
    
    /* Responsive design for mobile devices */
    .max-buttons-container {
        flex-direction: column;
        gap: clamp(6px, 1.5vw, 8px);
        margin-top: clamp(10px, 2.5vw, 15px);
    }
    
    .max-button {
        width: auto;
        flex: 0 0 auto;
        min-width: auto;
        padding: clamp(8px, 2vw, 10px) clamp(16px, 4vw, 20px);
        font-size: clamp(0.85em, 2.2vw, 0.95em);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

#next-update-timer {
    top: 15px !important;
    left: 15px !important;
}
    
    .header {
        padding: 15px;
    }
    
    .celeb-market, .portfolio {
        padding: 12px;
    }
    
    .modal-content, .history-modal-content, .wiki-modal-content, .trade-history-modal-content {
        padding: 20px;
        margin: 10px;
    }
    
    .footer {
        margin: 10px;
        padding: 15px;
    }
    
    .content-modal {
        padding-top: 70px;
        padding-left: 8px;
        padding-right: 8px;
    }
    
    .content-modal-content {
        margin-top: 5px;
        max-height: calc(100vh - 85px);
        width: calc(100vw - 16px);
        border-radius: 12px;
    }
    
    .content-modal-body {
        padding: 16px;
        max-height: calc(100vh - 200px);
        overflow-y: auto;
    }
    
    /* Watchlist modal button fixes for very small screens */
    .content-modal-body .watchlist-card .trade-buttons {
        gap: 6px;
    }
    
    .content-modal-body .watchlist-card .btn {
        padding: clamp(6px, 1.5vw, 8px) clamp(10px, 2.5vw, 16px);
        font-size: clamp(0.75em, 1.8vw, 0.85em);
    }
    
    .content-modal-body .watchlist-card .btn-watchlist {
        min-width: clamp(28px, 7vw, 36px);
        padding: clamp(5px, 1.2vw, 7px);
    }
    
    /* FIXED: Very small mobile devices */
    .history-modal {
        padding: 4px;
        padding-top: 70px;
    }
    
    .history-modal-content {
        margin: 5px 0;
        width: calc(100vw - 8px);
        border-radius: 8px;
        padding: clamp(12px, 3vw, 20px);
        max-height: calc(100vh - 90px);
    }
    
    .history-chart {
        height: clamp(240px, 40vh, 320px);
        margin: 6px 0;
        border-width: 1px;
        min-height: 240px;
    }
    
    /* Mobile tooltip adjustments for very small screens */
    #chart-tooltip {
        font-size: 10px !important;
        padding: 6px 8px !important;
        max-width: 160px !important;
    }
    
    .close-history {
        top: 6px;
        right: 8px;
        width: 28px;
        height: 28px;
        font-size: 18px;
    }
    
    /* Extra compact on very small screens */
    .celeb-card {
        padding: 8px;
        margin-bottom: 6px;
    }
    
    .portfolio-item {
        padding: 8px;
        margin-bottom: 6px;
    }
    
    .portfolio-name {
        font-size: 0.9em;
    }
    
    .portfolio-shares {
        font-size: 0.7em;
    }
    
    .current-value {
        font-size: 0.9em;
    }
    
    .profit-loss {
        font-size: 0.7em;
    }
    
    .trade-buttons {
        gap: 6px;
    }
    
    .btn {
        padding: 6px 10px;
        font-size: 0.75em;
    }
    
    .portfolio-buttons .btn {
        padding: 6px 8px;
        font-size: 0.7em;
        flex: 0 0 auto;
        min-width: auto;
    	width: auto;
        max-width: none;

    }
    
    /* Trade History Mobile Optimization */
    .trade-history-item {
        padding: 8px;
    }
    
    .celebrity-name {
        font-size: 0.9em;
    }
    
    .trade-details-row {
        font-size: 0.75em;
    }
    
    .total-value,
    .profit-loss {
        font-size: 0.8em;
    }

    .watchlist-celebrity-cards {
        gap: 6px;
    }
    
    .max-buttons-container {
        gap: 6px;
        margin-top: 8px;
    }
    
    .max-button {
        padding: 8px 12px;
        font-size: 0.8em;
        min-height: 36px;
    }
    
    /* Mobile responsive adjustments */
    .trade-cost-display {
        flex-direction: column;
        gap: 4px;
        text-align: center;
        padding: clamp(8px, 2vw, 10px);
    }
    
    .cost-label {
        font-size: clamp(0.8em, 2vw, 0.9em);
    }
    
    .cost-amount {
        font-size: clamp(1.1em, 3vw, 1.2em);
    }
}

/* FIXED: Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .content-modal,
    .history-modal,
    .trade-modal,
    .wiki-modal,
    .trade-history-modal {
        padding-top: 60px;
    }
    
    .content-modal-content,
    .modal-content,
    .history-modal-content,
    .wiki-modal-content,
    .trade-history-modal-content {
        max-height: calc(100vh - 80px);
    }
    
    .history-chart {
        height: clamp(220px, 60vh, 300px);
    }
}

/* FIXED: Ensure modal content doesn't get cut off on very small screens */
@media (max-height: 500px) {
    .history-modal-content {
        max-height: 95vh;
        overflow-y: auto;
    }
    
    .history-chart {
        height: clamp(200px, 35vh, 250px);
        min-height: 200px;
    }
}

/* FIXED: Desktop-specific chart improvements */
@media (min-width: 1024px) {
    .history-chart {
        height: clamp(450px, 50vh, 500px);
        max-width: none;
    }
    
    .chart-text {
        font-size: 11px;
    }
    
    .chart-axis-label {
        font-size: 14px;
    }
    
    .chart-baseline-label {
        font-size: 12px;
    }
    
    .price-line {
        stroke-width: 4;
    }
}

/* FIXED: Tablet adjustments */
@media (min-width: 768px) and (max-width: 1023px) {
    .history-chart {
        height: clamp(380px, 55vw, 450px);
    }
    
    .chart-text {
        font-size: 10px;
    }
    
    .chart-axis-label {
        font-size: 13px;
    }
    
    .chart-baseline-label {
        font-size: 11px;
    }
    
    .price-line {
        stroke-width: 3.5;
    }
}

/* Dark theme support */
[data-theme="dark"] .max-button {
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .buy-max-button {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
}

[data-theme="dark"] .sell-max-button {
    background: linear-gradient(135deg, #dd6b20 0%, #c05621 100%);
}

[data-theme="dark"] .btn-watchlist.watching {
    background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%);
}

[data-theme="dark"] .nav-link.watchlist-link {
    background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%);
}

[data-theme="dark"] .watchlist-change.profit {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

[data-theme="dark"] .watchlist-change.loss {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}


/* Settings Toggle Button */
.settings-toggle {
    position: fixed;
    top: 20px;  /* Changed from 80px to 20px - same as theme toggle was */
    right: 20px;
    z-index: 10000;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 50px;   /* Same size as theme toggle was */
    height: 50px;  /* Same size as theme toggle was */
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;  /* Same as theme toggle was */
    box-shadow: 0 4px 12px var(--shadow-color);
    backdrop-filter: blur(10px);
}

.settings-toggle:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-hover);
}

.settings-toggle .icon {
    transition: transform 0.3s ease;
}

.settings-toggle:hover .icon {
    transform: rotate(45deg);
}

/* Settings Modal */
.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1002;
    padding: clamp(10px, 3vw, 20px);
}

.settings-modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: clamp(10px, 2.5vw, 15px);
    max-width: clamp(400px, 90vw, 600px);
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px var(--shadow-hover);
}

.settings-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(15px, 3vw, 20px);
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg-secondary);
    border-radius: clamp(10px, 2.5vw, 15px) clamp(10px, 2.5vw, 15px) 0 0;
}

.settings-modal-header .modal-title {
    margin: 0;
    font-size: clamp(1.3em, 3vw, 1.6em);
    color: var(--text-primary);
    font-weight: bold;
}

.close-settings-modal {
    background: none;
    border: none;
    font-size: clamp(22px, 4vw, 26px);
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
    width: clamp(32px, 6vw, 36px);
    height: clamp(32px, 6vw, 36px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-settings-modal:hover {
    color: var(--text-secondary);
    background: var(--border-color);
}

.settings-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: clamp(20px, 4vw, 30px);
    line-height: 1.6;
}

.settings-modal-footer {
    padding: clamp(15px, 3vw, 20px);
    border-top: 1px solid var(--border-color);
    background: var(--card-bg-secondary);
    text-align: center;
    border-radius: 0 0 clamp(10px, 2.5vw, 15px) clamp(10px, 2.5vw, 15px);
}

@media (max-width: 768px) {
    /* Add this to your existing mobile styles */
    .settings-toggle {
        top: 15px; /* Same as where theme toggle was on mobile */
        right: 15px;
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 480px) {
    /* Add this to your existing small mobile styles */
    .settings-toggle {
        top: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
    }
}

/* === Tutorial Overlay / Tooltip === */
#cdq-tutorial-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
  z-index: 10040;
}

/* Tutorial Tooltip Styles */
#cdq-tutorial-tooltip {
  position: fixed;
  z-index: 10050;        /* higher than .content-modal (1002) */
  max-width: min(360px, 92vw);
  word-wrap: break-word;
}

#cdq-tutorial-tooltip .cdq-tutorial-content {
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: clamp(8px, 2vw, 12px);
  padding: clamp(14px, 3vw, 18px);
  box-shadow: 0 18px 60px var(--shadow-hover);
}

#cdq-tutorial-tooltip h3 {
  margin: 0 0 8px 0;
  color: var(--text-primary);
  font-size: clamp(1.05em, 2.6vw, 1.2em);
}

#cdq-tutorial-tooltip p {
  margin: 0 0 12px 0;
  color: var(--text-secondary);
  font-size: clamp(0.9em, 2.2vw, 1em);
  line-height: 1.45;
}

#cdq-tutorial-tooltip .cdq-tutorial-cta {
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
}

.cdq-tutorial-spotlight {
  position: relative;
  z-index: 10050 !important;
  outline: 3px solid #667eea;
  box-shadow: 0 0 0 6px rgba(102, 126, 234, 0.25);
  border-radius: 8px;
}

@media (max-width: 640px) {
  #cdq-tutorial-tooltip .cdq-tutorial-content { padding: 12px; }
  #cdq-tutorial-tooltip .cdq-tutorial-cta { gap: 6px; }
}

/* Flash the found card so it's obvious */
@keyframes cdq-flash {
  0%   { box-shadow: 0 0 0 0 rgba(102,126,234,0.75); transform: scale(1); }
  50%  { box-shadow: 0 0 0 6px rgba(102,126,234,0.35); transform: scale(1.01); }
  100% { box-shadow: 0 0 0 0 rgba(102,126,234,0); transform: scale(1); }
}
.flash-highlight {
  animation: cdq-flash 0.8s ease-out 0s 2;
  border-radius: 12px;
}

.ticker-name { 
    color: #ffffff !important; 
    margin-right: 8px;
}
.ticker-price { 
    color: #e2e8f0 !important; 
    margin-right: 8px;
}
.ticker-change { 
    font-weight: bold !important;
}
.ticker-change.positive { 
    color: #22c55e !important; 
}
.ticker-change.negative { 
    color: #ef4444 !important; 
}

/* Category Toggle Styles */
.category-toggle-container {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.category-toggle-container input {
    opacity: 0;
    width: 0;
    height: 0;
}

.category-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.category-toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.category-toggle-container input:checked + .category-toggle-slider {
    background-color: #667eea;
}

.category-toggle-container input:checked + .category-toggle-slider:before {
    transform: translateX(26px);
}

.category-toggle-container input:disabled + .category-toggle-slider {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Optional: Add visual indicator when modal is open */
@media (max-width: 768px) {
    body.modal-open {
        overflow: hidden; /* Prevent scrolling when modal is open */
    }
}