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

:root {
    --primary-color: #22d3ee;
    --primary-dark: #06b6d4;
    --logo-navy: #1e3a5f;
    --polymarket-color: #7c3aed;
    --kalshi-color: #059669;
    --background: #faf9f7;
    --background-alt: #f1f0ee;
    --card-bg: #ffffff;
    --text-primary: #1e3a5f;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --positive: #2563eb;
    --negative: #d97706;
    --neutral: #6b7280;
    --ticker-bg: #1e3a5f;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Bloomberg-style Scrolling Ticker (Skybox) */
.ticker-bar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--ticker-bg);
    border-bottom: 2px solid var(--primary-color);
    overflow: hidden;
}

.ticker-track {
    display: flex;
    animation: scroll-ticker 30s linear infinite;
    width: max-content;
}

.ticker-track:hover {
    animation-play-state: paused;
}

@keyframes scroll-ticker {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

.ticker-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 2rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    border-right: 1px solid rgba(255,255,255,0.1);
    white-space: nowrap;
}

.ticker-label {
    color: #94a3b8;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ticker-price {
    color: #ffffff;
    font-size: 1.35rem;
    font-weight: 700;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

.ticker-change {
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

.ticker-change.positive {
    background: rgba(37, 99, 235, 0.25);
    color: #60a5fa;
}

.ticker-change.negative {
    background: rgba(217, 119, 6, 0.25);
    color: #fbbf24;
}

.ticker-change.neutral {
    background: rgba(107, 114, 128, 0.25);
    color: #9ca3af;
}

/* Newspaper-style Masthead */
header {
    background: var(--background);
    border-bottom: 4px double var(--text-primary);
    padding: 2.5rem 0 2rem;
    text-align: center;
}

.masthead {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.site-logo {
    width: 280px;
    height: 280px;
    border-radius: 50%;
    margin: -20px 0;
}

.masthead-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
}

.masthead-title .implied {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 5rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.masthead-title .news {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-top: -0.15em;
}

main {
    padding: 2rem 0;
}

section {
    margin-bottom: 3rem;
}

h2 {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--text-primary);
    padding-bottom: 0.5rem;
}

.loading {
    text-align: center;
    padding: 4rem 0;
}

.spinner {
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    text-align: center;
    padding: 2rem;
    color: var(--negative);
    background: #fffbeb;
    border: 1px solid var(--negative);
    border-radius: 4px;
}

.controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.snapshot-selector-container {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.view-toggle {
    display: flex;
    gap: 0.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.25rem;
}

.view-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s ease;
}

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

.view-btn.active {
    background: var(--logo-navy);
    color: white;
}

.view-btn svg {
    flex-shrink: 0;
}

.snapshot-selector-container label {
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
    font-size: 0.9rem;
}

.snapshot-selector-container select {
    flex: 1;
    max-width: 400px;
    padding: 0.4rem 0.75rem;
    background: var(--background);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.snapshot-selector-container select:hover,
.snapshot-selector-container select:focus {
    border-color: var(--primary-color);
    outline: none;
}

/* Market Table Styles */
.markets-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.markets-table thead {
    background: var(--background-alt);
    border-bottom: 2px solid var(--border-color);
}

.markets-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
}

.markets-table th.col-rank {
    width: 50px;
    text-align: center;
}

.markets-table th.col-market {
    width: auto;
}

.markets-table th.col-exchange {
    width: 110px;
}

.markets-table th.col-price {
    width: 100px;
    text-align: right;
}

.markets-table th.col-change {
    width: 120px;
    text-align: right;
}

.markets-table th.col-rvol {
    width: 100px;
    text-align: right;
}

.markets-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s ease;
}

.markets-table tbody tr:hover {
    background: var(--background-alt);
}

.markets-table tbody tr:last-child {
    border-bottom: none;
}

.markets-table td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
}

.markets-table td.col-rank {
    text-align: center;
    color: var(--text-secondary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
}

.markets-table td.col-market a {
    color: var(--text-primary);
    text-decoration: none;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-weight: 500;
    font-size: 1rem;
    line-height: 1.4;
}

.markets-table td.col-market a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.markets-table td.col-price {
    text-align: right;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.markets-table td.col-change {
    text-align: right;
    font-weight: 600;
}

.markets-table td.col-rvol {
    text-align: right;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.exchange-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.exchange-badge.polymarket {
    background: #ede9fe;
    color: #7c3aed;
}

.exchange-badge.kalshi {
    background: #d1fae5;
    color: #059669;
}

.price-change {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 3px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-weight: 600;
    font-size: 0.9rem;
}

.price-change.positive {
    background: #dbeafe;
    color: var(--positive);
}

.price-change.negative {
    background: #fef3c7;
    color: var(--negative);
}

.price-change.neutral {
    background: var(--background-alt);
    color: var(--neutral);
}

.last-updated {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-color);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

footer {
    background: var(--background-alt);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0;
    text-align: center;
    color: var(--text-secondary);
    margin-top: 2rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.9rem;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .ticker-item {
        padding: 0.6rem 1.25rem;
    }
    
    .ticker-label {
        font-size: 0.7rem;
    }
    
    .ticker-price {
        font-size: 1.1rem;
    }
    
    .masthead-title .implied,
    .masthead-title .news {
        font-size: 3.5rem;
    }
    
    .site-logo {
        width: 140px;
        height: 140px;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    .markets-table {
        font-size: 0.85rem;
    }
    
    .markets-table th,
    .markets-table td {
        padding: 0.5rem 0.75rem;
    }
    
    .markets-table th.col-rvol,
    .markets-table td.col-rvol {
        display: none;
    }
    
    .markets-table th.col-exchange,
    .markets-table td.col-exchange {
        display: none;
    }
}

@media (max-width: 480px) {
    .masthead-title .implied,
    .masthead-title .news {
        font-size: 2.5rem;
    }
    
    .site-logo {
        width: 100px;
        height: 100px;
    }
    
    .markets-table th.col-rank,
    .markets-table td.col-rank {
        display: none;
    }
}

/* Heatmap Styles */
.heatmap-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 1.5rem;
    margin-bottom: 3rem;
}

.heatmap-legend {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 3px;
}

.legend-down {
    background: linear-gradient(135deg, #1e40af, #3b82f6);
}

.legend-neutral {
    background: #9ca3af;
}

.legend-up {
    background: linear-gradient(135deg, #d97706, #fbbf24);
}

.legend-size {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
}

.heatmap-container {
    position: relative;
    width: 100%;
    min-height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#heatmap-canvas {
    max-width: 100%;
    cursor: pointer;
}

.heatmap-tooltip {
    position: fixed;
    background: var(--logo-navy);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.85rem;
    max-width: 300px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.heatmap-tooltip.visible {
    opacity: 1;
}

.heatmap-tooltip .tooltip-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.heatmap-tooltip .tooltip-stats {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.8rem;
    opacity: 0.9;
}

.heatmap-tooltip .tooltip-exchange {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
    margin-top: 0.5rem;
}

@media (max-width: 768px) {
    .controls-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .view-toggle {
        justify-content: center;
    }
    
    .heatmap-container {
        min-height: 400px;
    }
    
    .heatmap-legend {
        gap: 1rem;
    }
}
