/* ===== CSS Variables & Reset ===== */
:root {
    /* Color Palette - Deep Space Theme */
    --primary: #818cf8;
    /* Soft Indigo */
    --primary-glow: rgba(129, 140, 248, 0.5);
    --secondary: #f472b6;
    /* Soft Pink */
    --accent: #c084fc;
    /* Soft Purple */

    --bg-base: #0f172a;
    /* Slate 900 */
    --surface: rgba(30, 41, 59, 0.4);
    /* Slate 800 with transparency */
    --surface-hover: rgba(51, 65, 85, 0.5);

    --border: rgba(255, 255, 255, 0.1);
    --border-bright: rgba(255, 255, 255, 0.25);

    --text: #f1f5f9;
    /* Slate 100 */
    --text-muted: #94a3b8;
    /* Slate 400 */

    /* Sentiment Colors */
    --positive: #ff4b4b;
    /* Vibrant Red */
    --negative: #3b82f6;
    /* Vibrant Blue */
    --neutral: #fbbf24;
    /* Amber */

    /* Spacing & Radius */
    --radius-lg: 16px;
    /* Reduced */
    --radius-md: 12px;
    --radius-sm: 8px;

    /* Effects */
    --shadow-glass: 0 4px 16px 0 rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 10px rgba(99, 102, 241, 0.1);
    --transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    /* Smoother easing */
}

/* Score Card Selected State */
.score-card {
    transition: var(--transition);
    cursor: pointer;
}

/* ===== Ranking List Styles ===== */
.ranking-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

.ranking-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.rank-number {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 24px;
    text-align: center;
}

.rank-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.rank-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-symbol {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

.rank-score-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.rank-score-val {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
}

/* Full Screen Detail Modal */
.detail-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-base);
    z-index: 2000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    z-index: 2001;
    height: 72px;
    flex-shrink: 0;
}

.detail-header-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.detail-title {
    font-size: 1.35rem;
    font-weight: 900;
    color: #fff;
    margin: 0;
    line-height: 1.2;
    letter-spacing: -0.01em;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    max-width: 90%;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-subtitle {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    opacity: 0.9;
}

.header-fav-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.header-fav-btn:active {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(0.9);
}

.back-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.detail-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 80px;
    /* Space for bottom elements */
}

/* Detail Outlook Text */
.detail-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-top: 16px;
    line-height: 1.6;
}

.detail-text {
    font-size: 0.95rem;
    color: #cbd5e1;
    white-space: pre-line;
    /* Handle newlines from AI */
}



/* Section Title (Unified) */
.section-title {
    font-size: 0.92rem !important;
    font-weight: 700 !important;
    margin: 0 0 16px 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    color: #fff !important;
}

.section-title svg {
    color: var(--primary);
    opacity: 0.9;
}

/* ===== AI Ranking Section (Harmonious Redesign) ===== */
.ranking-section {
    width: 100% !important;
    margin-top: 0 !important;
    margin-bottom: 24px !important;
    border-radius: var(--radius-lg) !important;
    overflow: hidden !important;
    background: rgba(30, 41, 59, 0.4) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow-glass) !important;
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    max-height: 650px !important;
}

.ranking-tabs {
    display: flex !important;
    background: rgba(0, 0, 0, 0.2) !important;
    padding: 0 !important;
    justify-content: stretch !important;
    gap: 0 !important;
    border-bottom: 1px solid var(--border) !important;
}

/* Ranking Disclaimer - Smaller */
.ranking-disclaimer {
    font-size: 0.65rem !important;
    color: var(--text-muted) !important;
    padding: 8px 16px !important;
    text-align: center !important;
    opacity: 0.7 !important;
    margin-top: auto !important;
    /* Push to bottom if needed */
    border-top: 1px solid var(--border) !important;
}

.ranking-tab {
    flex: 1 !important;
    padding: 16px 4px !important;
    font-size: 0.9rem !important;
    font-weight: 700 !important;
    color: var(--text-muted) !important;
    cursor: pointer !important;
    background: transparent !important;
    border: none !important;
    text-align: center !important;
    transition: all 0.2s ease !important;
    border-bottom: 2px solid transparent !important;
}

.ranking-tab:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.03) !important;
}

.ranking-tab.active {
    color: var(--primary) !important;
    border-bottom: 2px solid var(--primary) !important;
    background: rgba(129, 140, 248, 0.05) !important;
}

.ranking-card {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
}

.ranking-list {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
    overflow-y: auto !important;
    max-height: 500px !important;
    /* Cap the height */
    scrollbar-width: thin;
    scrollbar-color: rgba(129, 140, 248, 0.3) transparent;
}

/* Custom Scrollbar for Webkit */
.ranking-list::-webkit-scrollbar {
    width: 6px;
}

.ranking-list::-webkit-scrollbar-track {
    background: transparent;
}

.ranking-list::-webkit-scrollbar-thumb {
    background: rgba(129, 140, 248, 0.2);
    border-radius: 10px;
}

.ranking-list::-webkit-scrollbar-thumb:hover {
    background: rgba(129, 140, 248, 0.4);
}

/* Remove media query wrapper for max-height since we use flex/calc now */

.ranking-item {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 14px 20px !important;
    background: transparent !important;
    border-bottom: 1px solid var(--border) !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
}

.ranking-item:hover {
    background: rgba(255, 255, 255, 0.03) !important;
}

.rank-number {
    display: block !important;
    width: 24px !important;
    font-size: 0.8rem !important;
    font-weight: 800 !important;
    color: var(--primary) !important;
    opacity: 0.6 !important;
}

.rank-info {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
}

.rank-name {
    font-size: 1rem !important;
    font-weight: 700 !important;
    color: #fff !important;
}

.rank-symbol {
    font-size: 0.75rem !important;
    color: var(--text-muted) !important;
    font-weight: 500 !important;
}

.rank-score-container {
    text-align: right !important;
}

.rank-score-val {
    font-size: 1.1rem !important;
    font-weight: 800 !important;
    color: var(--primary) !important;
}

.rank-score-label {
    display: block !important;
    font-size: 0.65rem !important;
    color: var(--text-muted) !important;
    margin-top: 1px !important;
    font-weight: 600 !important;
}

.empty-ranks,
.loading-ranks {
    padding: 60px 20px !important;
    text-align: center !important;
    color: var(--text-muted) !important;
    background: transparent !important;
}

.loading-ranks {
    color: var(--primary) !important;
}




.score-card.selected {
    background: rgba(129, 140, 248, 0.15) !important;
    border: 2px solid var(--primary) !important;
    box-shadow: 0 0 20px rgba(129, 140, 248, 0.3);
    transform: scale(1.02);
}

.score-card.selected .score-value {
    font-weight: 700;
}

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

body {
    background-color: var(--bg-base);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.1), transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(236, 72, 153, 0.1), transparent 40%);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 16px;
    /* Reduced for mobile-friendly initial view */
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    /* Prevent horizontal scroll */
}

@media (min-width: 768px) {
    body {
        padding: 24px;
    }
}

.container {
    width: 100%;
    max-width: 640px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* Further reduced from 12px */
    padding: 0 4px;
    margin: 0 auto;
}

@media (min-width: 992px) {
    .container {
        max-width: 1200px;
        gap: 12px;
        /* Further reduced from 16px */
    }
}

/* Main Content Grid */
.main-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    /* Further reduced from 16px */
    align-items: center;
    /* Center children */
    width: 100%;
}

@media (min-width: 992px) {
    .main-grid {
        display: grid;
        grid-template-columns: 1.6fr 1fr;
        align-items: stretch;
        /* Changed from start to stretch to ensure alignment control */
    }
}

/* ===== Components ===== */

.glass-card {
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-top: 1px solid var(--border-bright);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    /* Reduced from 20px */
    box-shadow: var(--shadow-glass);
    transition: var(--transition);
    height: auto;
    min-height: min-content;
}

@media (min-width: 768px) {
    .glass-card {
        padding: 16px 20px;
        /* Reduced from 24px */
    }
}

/* Header & Logo */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}

.branding {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-logo {
    width: 52px;
    /* Reduced from 64px */
    height: 52px;
    object-fit: contain;
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

.brand-text h1 {
    font-size: 1.4rem;
    /* Reduced from 1.8rem to fit one line */
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
    background: linear-gradient(to bottom right, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ticker-sub {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 4px;
    -webkit-text-fill-color: var(--text-muted);
    /* Reset text fill for span */
}

.brand-text p {
    display: none;
    /* Hidden per user request */
}

/* Search Section */
.search-container {
    position: relative;
    display: flex;
    gap: 8px;
    margin: 0 0 8px 0;
    /* Tightened from 4px top, 15px bottom */
    z-index: 100;
    width: 100%;
    /* Ensure full width when panel is removed */
}

.search-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px 48px 16px 20px;
    color: white;
    font-size: 1rem;
    font-weight: 500;
    outline: none;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--primary);
    background: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.2);
}

.clear-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    display: none;
    padding: 0;
    line-height: 1;
    transition: var(--transition);
}

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

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    width: 130%;
    /* Reduced from 135% */
    max-width: 600px;
    /* Cap maximum width */
    background: #1e293b;
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-md);
    margin-top: 8px;
    max-height: 320px;
    /* Increased from 240px */
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
}

.search-item {
    padding: 8px 12px;
    /* Reduced from 12px 16px */
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border);
}

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

.search-item:hover {
    background: var(--surface-hover);
}

.search-item .symbol {
    font-weight: 700;
    color: var(--primary);
    margin-right: 8px;
    font-size: 0.8rem;
    /* Reduced from default */
}

.search-item .name {
    font-size: 0.75rem;
    /* Reduced from 0.85rem */
    color: var(--text);
}

/* Search Tabs Styling */
.search-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid var(--border);
    padding: 0 8px;
}

.search-tab {
    flex: 1;
    padding: 8px 0;
    /* Reduced from 10px */
    font-size: 0.7rem;
    /* Reduced from 0.75rem */
    font-weight: 700;
    color: var(--text-muted);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 2px solid transparent;
}

.search-tab:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.02);
}

.search-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: rgba(129, 140, 248, 0.05);
}

.search-empty-state {
    padding: 20px 16px;
    /* Reduced from 30px 20px */
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    /* Reduced from 0.85rem */
}

.btn-search {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    border-radius: var(--radius-md);
    padding: 0 16px;
    /* Reduced from 24px for icon focus */
    color: white;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transition: var(--transition);
}

.btn-search:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.5);
    filter: brightness(1.1);
}

/* Panel removed per user request */
.search-card-redundant {
    display: none;
}

/* News items layout */
@media (min-width: 992px) {
    .news-section {
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    .news-section .glass-card {
        flex: 1;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .news-list {
        flex: 1;
        overflow-y: auto;
        max-height: 800px;
    }
}

.stat-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    padding: 6px 10px;
    /* Reduced from 8px 12px */
    border: 1px solid var(--border);
}

.stat-label {
    font-size: 0.6rem;
    /* Reduced from 0.7rem */
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 2px;
    /* Reduced from 4px */
    display: block;
}

.stat-value {
    font-size: 0.95rem;
    /* Reduced from 1.1rem */
    font-weight: 700;
}

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

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

/* Main Price Card */
.price-display {
    text-align: center;
    padding: 0;
    /* Reduced from 4px 0 */
}

.price-main {
    font-size: 2rem;
    /* Reduced from 2.5rem */
    font-weight: 800;
    letter-spacing: -0.05em;
}

.price-change {
    font-size: 0.9rem;
    font-weight: 600;
}

/* AI Insights */
.ai-section {
    max-width: 420px;
    /* Smartphone width */
    width: 100%;
}

@media (min-width: 992px) {
    .ai-section {
        max-width: none;
        /* Remove constraint on desktop grid */
    }
}

.ai-section h2 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-section h2::before {
    content: '✦';
    color: var(--secondary);
}

.prompt-box {
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-md);
    padding: 16px;
    font-size: 0.8rem;
    color: #cbd5e1;
    line-height: 1.6;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border);
}

/* News List */
.news-title {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 12px;
    padding-left: 4px;
}

.news-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.news-item {
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.news-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.news-link {
    text-decoration: none;
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 500;
    display: block;
    line-height: 1.4;
    margin-bottom: 4px;
}

.news-meta {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-bright);
    border-radius: 10px;
}

/* AI Model Cards Container */
.carousel-container {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 24px;
}

.model-carousel {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 20px 0 12px 0;
    /* Added to prevent clipping of hover effects */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
    scroll-behavior: smooth;
    padding-bottom: 24px;
    margin-bottom: 0;
}

.model-carousel::-webkit-scrollbar {
    display: none;
}

.tier-toggle-container {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 8px;
    /* Reduced from 15px */
    border: 1px solid var(--border-bright);
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.tier-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 6px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.tier-btn:hover {
    color: #fff;
}

.tier-btn.active {
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#tier-standard-btn.active {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
}

#tier-premium-btn.active {
    background: linear-gradient(135deg, #fbbf24, #d97706);
    color: #000;
    /* Darker text for better contrast on gold */
}

.tier-icon {
    width: 22px;
    height: 22px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
}

#tier-standard-btn.active .tier-icon {
    background: rgba(255, 255, 255, 0.2);
}

#tier-premium-btn.active .tier-icon {
    background: rgba(0, 0, 0, 0.1);
    color: #000;
}

.tier-description {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: -4px 0 12px 0;
    /* Tightened from -8px 0 16px 0 */
    text-align: center;
    line-height: 1.6;
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
}

/* Premium Model Cards */
.model-card.model-premium {
    border: 1px solid rgba(251, 191, 36, 0.2);
    background: rgba(251, 191, 36, 0.03);
}

.model-card.model-premium.selected {
    border-color: #fbbf24 !important;
    background: rgba(251, 191, 36, 0.1) !important;
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.2);
}

.model-card.model-premium .model-provider {
    color: #fbbf24;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tier-content {
    animation: slideIn 0.4s ease-out;
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.nav-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.nav-btn.left {
    left: -16px;
}

.nav-btn.right {
    right: -16px;
}

@media (max-width: 768px) {
    .nav-btn {
        display: none;
        /* Hide on mobile to allow native swiping */
    }

    .model-carousel {
        padding-left: 10px;
        padding-right: 10px;
    }
}

.model-card {
    min-width: 120px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    text-align: center;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.model-card:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-bright);
}

.model-card.selected {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

/* Llama - Meta Blue/Cyberpunk Blue */
.model-card.model-llama {
    --brand-color: #0668E1;
}

/* Gemma - Google Blue/Gemini Gradient */
.model-card.model-gemma {
    --brand-color: #4da6ff;
}

/* Mistral - Sunset Gold/Orange */
.model-card.model-mistral {
    --brand-color: #fb923c;
}

/* Qwen - Alibaba Purple/Indigo */
.model-card.model-qwen {
    --brand-color: #8b5cf6;
}

/* Phi - Microsoft Teal/Cyan */
.model-card.model-phi {
    --brand-color: #2dd4bf;
}

/* Base Styles using variables */
.model-card {
    min-width: 120px;
    background: rgba(30, 41, 59, 0.6);
    /* Slightly darker base */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Smoother */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Subtle glow on top edge */
.model-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--brand-color, rgba(255, 255, 255, 0.3)), transparent);
    opacity: 0.5;
    transition: opacity 0.3s;
}

.model-card:hover {
    transform: translateY(-4px);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
    border-color: var(--brand-color);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.3),
        0 0 15px var(--brand-color);
    /* Brand glow */
}

.model-card.selected {
    background: linear-gradient(180deg, rgba(var(--brand-color), 0.15) 0%, rgba(30, 41, 59, 0.8) 100%) !important;
    border-color: var(--brand-color) !important;
    box-shadow: 0 0 25px var(--brand-color), inset 0 0 20px rgba(0, 0, 0, 0.2) !important;
}

/* Override background for selected state specifically to handle rgba conversion if possible, 
   but since we can't easily decompose hex in pure CSS without preprocessor, 
   we will use a trick or just simple opacity overlay */
.model-card.model-llama.selected {
    background: linear-gradient(180deg, rgba(6, 104, 225, 0.2), rgba(6, 104, 225, 0.05)) !important;
}

.model-card.model-gemma.selected {
    background: linear-gradient(180deg, rgba(77, 166, 255, 0.2), rgba(77, 166, 255, 0.05)) !important;
}

.model-card.model-mistral.selected {
    background: linear-gradient(180deg, rgba(251, 146, 60, 0.2), rgba(251, 146, 60, 0.05)) !important;
}

.model-card.model-qwen.selected {
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.2), rgba(139, 92, 246, 0.05)) !important;
}

.model-card.model-phi.selected {
    background: linear-gradient(180deg, rgba(45, 212, 191, 0.2), rgba(45, 212, 191, 0.05)) !important;
}

.model-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    margin-bottom: 4px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

.model-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
}

.model-provider {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Stats Grid - Horizontal Layout */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    /* Reduced from 12px */
    margin-top: 12px;
    /* Reduced from 20px */
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
}

/* Score Cards */
.score-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    /* Reduced from 12px */
    margin-bottom: 16px;
    /* Reduced from 24px */
}

/* Standard Model Cards */
.model-card.model-standard {
    border: 1px solid rgba(59, 130, 246, 0.2);
    background: rgba(59, 130, 246, 0.03);
}

.model-card.model-standard.selected {
    border-color: #3b82f6 !important;
    background: rgba(59, 130, 246, 0.1) !important;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

.score-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px 8px;
    /* Reduced from 20px 12px */
    text-align: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    /* Reduced from 8px */
    position: relative;
    overflow: hidden;
}

.score-card:hover {
    transform: translateY(-6px);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.6);
    border-color: rgba(255, 255, 255, 0.2);
}

.score-header {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.score-value {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    margin: 4px 0;
}

.score-label {
    font-size: 0.8rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.2);
}

/* Specific hovers handled by .short, .mid, .long classes injected previously? 
   Actually, let's redefine them here cleanly and remove the old definition at the end of the file or index.html */
.score-card.short:hover {
    border-color: var(--positive);
    box-shadow: 0 0 20px rgba(244, 63, 94, 0.2);
}

.score-card.mid:hover {
    border-color: var(--neutral);
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.2);
}

/* Using amber for mid/neutral as per logic */
.score-card.long:hover {
    border-color: var(--negative);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
}

/* Or green? Let's stick to the color logic used in JS */
/* Wait, JS logic: >=80 Red(Buy), <=20 Blue(Sell). 
   The hover colors in previous index.html were: short(Red), mid(Blue/Sky), long(Green).
   Let's standardise hovers to match the "Timeframe" concept or just use a generic Accent hover.
   Let's keep the user's previous preference for Short=Red, Mid=Blueish, Long=Greenish for distinctness.
*/
.score-card.short:hover {
    border-color: #ff9f9f;
}

.score-card.mid:hover {
    border-color: #9fcfff;
}

.score-card.long:hover {
    border-color: #a5ffba;
}


/* Detail Box */
.stat-item {
    background: rgba(15, 23, 42, 0.6);
    padding: 8px 10px;
    /* Reduced from 14px 10px */
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    text-align: center;
}

.detail-box {
    background: rgba(15, 23, 42, 0.6);
    padding: 20px 16px;
    /* Reduced for mobile */
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

@media (min-width: 768px) {
    .detail-box {
        padding: 24px;
    }
}

.detail-title {
    margin-top: 0;
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.detail-text {
    line-height: 1.8;
    color: var(--text);
    font-size: 0.95rem;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Help Button */
.btn-help {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: var(--transition);
}

.btn-help:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
    border-color: var(--border-bright);
    transform: scale(1.1);
}

/* Modal */
.modal-overlay {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

.modal-content {
    background: #1e293b;
    border: 1px solid var(--border-bright);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Mobile-Specific Overrides for Narrow Screens */
@media (max-width: 768px) {
    .glass-card {
        padding: 16px;
    }

    .score-grid {
        gap: 8px;
    }

    .score-card {
        padding: 16px 8px;
    }

    .score-value {
        font-size: 1.6rem;
    }

    .score-header {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .glass-card {
        padding: 14px;
    }

    .model-card {
        min-width: 100px;
        padding: 12px;
    }

    .model-icon {
        font-size: 2rem;
    }

    .score-value {
        font-size: 1.5rem;
    }
}

.disclosure-badge {
    background: #ef4444;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Consensus Card */
.consensus-card {
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.consensus-card.standard {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(37, 99, 235, 0.05));
    border: 1px solid rgba(59, 130, 246, 0.3);
    box-shadow: 0 10px 30px -10px rgba(59, 130, 246, 0.2);
}

.consensus-card.premium {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(217, 119, 6, 0.05));
    border: 1px solid rgba(251, 191, 36, 0.3);
    box-shadow: 0 10px 30px -10px rgba(251, 191, 36, 0.2);
}

.consensus-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, transparent 70%);
    pointer-events: none;
}

.consensus-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.consensu.stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    margin-top: 4px;
}

.consensus-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.consensus-badge {
    background: rgba(255, 255, 255, 0.1);
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 12px;
    color: var(--accent);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.consensus-content {
    display: flex;
    gap: 20px;
    align-items: center;
}

.consensus-score-box {
    text-align: center;
    min-width: 80px;
    position: relative;
}

#consensus-score {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(to bottom, #fff, #cbd5e1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
}



#consensus-sentiment {
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 4px;
}

.consensus-summary {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    border-left: 2px solid rgba(255, 255, 255, 0.1);
    padding-left: 20px;
}

@media (max-width: 480px) {
    .consensus-content {
        flex-direction: column;
        text-align: left;
        /* Better readability */
        gap: 12px;
    }

    .consensus-score-box {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding-bottom: 12px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    #consensus-score {
        font-size: 2rem;
    }

    #consensus-sentiment {
        margin-top: 0;
        font-size: 1rem;
    }

    .consensus-summary {
        border-left: none;
        border-top: none;
        /* Handled by score-box border */
        padding-left: 0;
        padding-top: 0;
    }
}

/* Info Modal Styles */
.guide-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.guide-step {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.step-num {
    width: 28px;
    height: 28px;
    background: rgba(129, 140, 248, 0.2);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.step-text {
    font-size: 0.95rem;
    color: #cbd5e1;
    line-height: 1.4;
    padding-top: 4px;
}

.btn-primary-action {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    border-radius: var(--radius-md);
    padding: 14px;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary-action:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.info-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

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

.info-value {
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ===== Expert Summary Modal ===== */
#expert-summary-modal .modal-content {
    animation: modalSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.9) translateY(20px);
        opacity: 0;
    }

    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

#summary-content-area::-webkit-scrollbar {
    width: 6px;
}

#summary-content-area::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

#summary-content-area::-webkit-scrollbar-thumb {
    background: rgba(129, 140, 248, 0.2);
    border-radius: 10px;
}

#summary-content-area::-webkit-scrollbar-thumb:hover {
    background: rgba(129, 140, 248, 0.4);
}

/* AI Status UI Improvements */
.ai-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
}

.ai-status-card-new {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem 2rem;
    background: rgba(30, 41, 59, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.ai-status-card-new.clickable {
    cursor: pointer;
}

.ai-status-card-new.clickable:hover {
    transform: translateY(-4px) scale(1.02);
    background: rgba(30, 41, 59, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.4);
}

.ai-provider-logo-container {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 12px;
}

.ai-provider-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    position: relative;
}

.status-ok .status-indicator {
    background: #10b981;
    box-shadow: 0 0 12px #10b981;
    animation: pulse-green 2s infinite;
}

.status-error .status-indicator {
    background: #f43f5e;
    box-shadow: 0 0 12px #f43f5e;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-green {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

@keyframes pulse-red {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(244, 63, 94, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(244, 63, 94, 0);
    }
}

.ai-model-info {
    flex: 1;
}

.ai-model-provider {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.ai-model-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 0.25rem;
}

.ai-model-status {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
}

.error-detail {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.2);
    border-radius: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: #fca5a5;
    word-break: break-all;
}

/* Admin Log Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 5000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.admin-modal-content {
    background: #1e293b;
    margin: 10% auto;
    border-radius: 20px;
    border: 1px solid var(--border-bright);
    width: 90%;
    max-width: 800px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: modalFadeIn 0.3s ease-out;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.modal-title {
    margin: 0;
    font-size: 1.25rem;
    color: #fff;
}

.close-btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.close-btn-icon:hover {
    color: #fff;
}

.admin-table-container {
    background: rgba(15, 23, 42, 0.3);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    margin-top: 15px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    color: #f1f5f9;
}

.admin-table th {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 15px;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.admin-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge.premium {
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.badge.standard {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge.system {
    background: rgba(100, 116, 139, 0.2);
    color: #cbd5e1;
    border: 1px solid rgba(100, 116, 139, 0.3);
}

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

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(129, 140, 248, 0.1);
    border-left-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
}

/* Developer Info Card (Match Source Image) */
.dev-info-card {
    background: #f8f9fa;
    border-radius: var(--radius-lg);
    padding: 24px;
    margin: 0 auto 24px;
    max-width: 320px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dev-info-row {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 16px;
    text-align: left;
}

.dev-label {
    min-width: 40px;
    font-size: 0.8rem;
    color: #64748b;
    font-weight: 400;
}

.dev-value {
    font-size: 0.8rem;
    color: #1e293b;
    font-weight: 600;
}

.dev-app-description {
    color: #64748b;
    font-size: 0.85rem;
    line-height: 1.6;
    margin-bottom: 24px;
    padding: 0 16px;
    text-align: center;
    word-break: keep-all;
}

.copyright-text-updated {
    color: #94a3b8;
    font-size: 0.75rem;
    margin-top: 16px;
}