:root {
    --navy: #0a0e27;
    --navy-light: #111638;
    --navy-lighter: #1a1f4a;
    --teal: #2a9d8f;
    --teal-dim: #1e7068;
    --red: #e63946;
    --gold: #e9c46a;
    --orange: #f4a261;
    --text: #e0e0e0;
    --text-dim: #8a8fa8;
    --text-bright: #ffffff;
    --card-bg: rgba(26, 31, 74, 0.6);
    --border: rgba(42, 157, 143, 0.2);
    --radius: 12px;
}

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

body {
    background: var(--navy);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--text-bright); }

/* Nav */
.nav {
    background: var(--navy-light);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-brand {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--teal);
}
.nav-links { display: flex; gap: 1.5rem; }
.nav-links a { color: var(--text-dim); font-size: 0.95rem; }
.nav-links a:hover, .nav-links a.active { color: var(--teal); }

/* Container */
.container { max-width: 800px; margin: 0 auto; padding: 2rem 1rem; }
.container-wide { max-width: 1000px; margin: 0 auto; padding: 2rem 1rem; }

/* Hero */
.hero {
    text-align: center;
    padding: 4rem 1rem;
}
.hero h1 {
    font-size: 3rem;
    color: var(--text-bright);
    margin-bottom: 1rem;
    line-height: 1.1;
}
.hero p {
    font-size: 1.2rem;
    color: var(--text-dim);
    max-width: 600px;
    margin: 0 auto 2rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.9rem 2.5rem;
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-primary {
    background: var(--teal);
    color: var(--navy);
}
.btn-primary:hover {
    background: var(--text-bright);
    color: var(--navy);
    transform: translateY(-2px);
}
.btn-outline {
    background: transparent;
    border: 2px solid var(--teal);
    color: var(--teal);
}
.btn-outline:hover {
    background: var(--teal);
    color: var(--navy);
}
.btn-sm {
    padding: 0.5rem 1.2rem;
    font-size: 0.9rem;
}

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

/* Stats row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
}
.stat-num {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--teal);
}
.stat-label {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-top: 0.3rem;
}

/* Quiz specific */
.quiz-container { max-width: 700px; margin: 0 auto; }

.progress-bar-wrap {
    background: var(--navy-lighter);
    border-radius: 20px;
    height: 8px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: var(--teal);
    border-radius: 20px;
    transition: width 0.4s ease;
    width: 0%;
}
.progress-text {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

/* Cope meter */
.cope-meter-wrap {
    margin-bottom: 2rem;
}
.cope-meter-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 0.3rem;
}
.cope-meter {
    background: var(--navy-lighter);
    border-radius: 20px;
    height: 14px;
    overflow: hidden;
    position: relative;
}
.cope-meter-fill {
    height: 100%;
    border-radius: 20px;
    transition: width 0.5s ease, background 0.5s ease;
    width: 0%;
    background: #2a9d8f;
}

/* Question card */
.question-card {
    opacity: 0;
    transform: translateX(40px);
    transition: all 0.4s ease;
    display: none;
}
.question-card.active {
    display: block;
    opacity: 1;
    transform: translateX(0);
}
.question-card.exit {
    opacity: 0;
    transform: translateX(-40px);
}

.question-num {
    color: var(--teal);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.question-text {
    font-size: 1.4rem;
    color: var(--text-bright);
    margin-bottom: 1.5rem;
    line-height: 1.3;
}

/* Answer buttons */
.answer-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 1rem 1.2rem;
    margin-bottom: 0.6rem;
    background: var(--navy-lighter);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}
.answer-btn:hover {
    border-color: var(--teal);
    background: rgba(42, 157, 143, 0.1);
}
.answer-btn.selected {
    border-color: var(--teal);
    background: rgba(42, 157, 143, 0.2);
    color: var(--text-bright);
}
.answer-btn.selected .cope-tag {
    display: inline-block;
}
.cope-tag {
    display: none;
    font-size: 0.7rem;
    background: rgba(42, 157, 143, 0.3);
    color: var(--teal);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* Optional sections */
.optional-section {
    display: none;
    max-width: 700px;
    margin: 0 auto;
}
.optional-section.active {
    display: block;
    animation: fadeIn 0.4s ease;
}
.optional-section h2 {
    color: var(--text-bright);
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
}
.optional-section p.subtitle {
    color: var(--text-dim);
    margin-bottom: 1.5rem;
}
.skip-btn {
    display: block;
    margin: 1rem auto 0;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
}
.skip-btn:hover { color: var(--text); }

/* Form inputs */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.8rem;
    background: var(--navy-lighter);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
}
.form-group textarea { resize: vertical; min-height: 100px; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--teal);
}
.range-wrap {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.range-wrap input[type="range"] {
    flex: 1;
    accent-color: var(--teal);
}
.range-val {
    color: var(--teal);
    font-weight: 700;
    min-width: 2rem;
    text-align: center;
}

/* Results page */
.results-hero {
    text-align: center;
    padding: 2rem 0;
}
.score-big {
    font-size: 5rem;
    font-weight: 800;
    color: var(--teal);
    line-height: 1;
}
.score-label {
    color: var(--text-dim);
    font-size: 1rem;
}

/* Spectrum bar */
.spectrum-bar-wrap { margin: 2rem 0; }
.spectrum-bar {
    height: 24px;
    border-radius: 12px;
    background: linear-gradient(to right, #2a9d8f, #e9c46a, #f4a261, #e63946);
    position: relative;
}
.spectrum-marker {
    position: absolute;
    top: -8px;
    width: 4px;
    height: 40px;
    background: var(--text-bright);
    border-radius: 2px;
    transform: translateX(-50%);
    box-shadow: 0 0 10px rgba(255,255,255,0.5);
    transition: left 1s ease;
}
.spectrum-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-dim);
}

/* Figure card */
.figure-card {
    text-align: center;
    padding: 2rem;
    margin: 2rem 0;
    background: var(--card-bg);
    border: 2px solid var(--teal);
    border-radius: var(--radius);
}
.figure-card h2 {
    font-size: 2rem;
    color: var(--text-bright);
    margin-bottom: 0.3rem;
}
.figure-card .figure-desc {
    color: var(--teal);
    font-size: 1.1rem;
    font-style: italic;
}
.figure-card .match-label {
    color: var(--text-dim);
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

/* Chart container */
.chart-container {
    max-width: 350px;
    margin: 2rem auto;
}

/* Oracle */
.oracle-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.oracle-section h3 {
    color: var(--teal);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}
.oracle-text {
    line-height: 1.7;
}
.oracle-text h2 {
    color: var(--teal);
    font-size: 1.15rem;
    margin: 1.2rem 0 0.5rem;
}
.oracle-text h3 {
    color: var(--text-bright);
    font-size: 1rem;
    margin: 1rem 0 0.4rem;
}
.oracle-text p {
    margin-bottom: 0.8rem;
}
.oracle-text strong {
    color: var(--text-bright);
}
.oracle-text hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1rem 0;
}
.oracle-loading {
    text-align: center;
    color: var(--text-dim);
    padding: 2rem;
}
.oracle-loading .spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--teal);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 0.5rem;
    vertical-align: middle;
}

/* Argue chat */
.argue-section { margin-top: 1.5rem; }
.argue-messages {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 1rem;
}
.argue-msg {
    margin-bottom: 0.8rem;
    padding: 0.8rem 1rem;
    border-radius: var(--radius);
    max-width: 85%;
}
.argue-msg.user {
    background: rgba(42, 157, 143, 0.15);
    border: 1px solid rgba(42, 157, 143, 0.3);
    margin-left: auto;
    text-align: right;
}
.argue-msg.oracle {
    background: var(--navy-lighter);
    border: 1px solid var(--border);
}
.argue-msg .role {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-bottom: 0.2rem;
}
.argue-input-wrap {
    display: flex;
    gap: 0.5rem;
}
.argue-input-wrap input {
    flex: 1;
    padding: 0.8rem;
    background: var(--navy-lighter);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
}
.argue-input-wrap input:focus { outline: none; border-color: var(--teal); }

/* Collapsible */
.collapsible-header {
    cursor: pointer;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.collapsible-header:hover { color: var(--teal); }
.collapsible-body {
    display: none;
    padding: 0 1rem 1rem;
}
.collapsible-body.open { display: block; }
.answer-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.answer-row .pts { color: var(--teal); font-weight: 600; }

/* Share card */
.share-card {
    text-align: center;
    padding: 1.5rem;
    margin: 1.5rem 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.share-buttons {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    flex-wrap: wrap;
}
.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--navy-lighter);
    color: var(--text);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.share-btn:hover {
    border-color: var(--teal);
    color: var(--text-bright);
    transform: translateY(-1px);
}
.share-btn svg { flex-shrink: 0; }
.share-x:hover { background: rgba(255,255,255,0.08); }
.share-li:hover { background: rgba(0,119,181,0.15); }
.share-wa:hover { background: rgba(37,211,102,0.12); }
.share-rd:hover { background: rgba(255,69,0,0.12); }
.share-copy:hover { background: rgba(42,157,143,0.12); }
.share-row {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

/* Leaderboard */
.lb-table {
    width: 100%;
    border-collapse: collapse;
}
.lb-table th {
    text-align: left;
    padding: 0.7rem;
    border-bottom: 2px solid var(--border);
    color: var(--teal);
    font-size: 0.85rem;
}
.lb-table td {
    padding: 0.7rem;
    border-bottom: 1px solid rgba(42, 157, 143, 0.1);
    font-size: 0.9rem;
}
.lb-table tr:hover td { background: rgba(42, 157, 143, 0.05); }

/* Feed */
.feed-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.6rem;
}
.feed-score { font-size: 1.3rem; font-weight: 700; color: var(--teal); }
.feed-figure { color: var(--text-dim); font-size: 0.9rem; }
.feed-date { color: var(--text-dim); font-size: 0.8rem; }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}
.pagination a, .pagination span {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
}
.pagination a { background: var(--navy-lighter); border: 1px solid var(--border); }
.pagination a:hover { border-color: var(--teal); }
.pagination .current { background: var(--teal); color: var(--navy); font-weight: 600; }

/* Footer */
.site-footer {
    margin-top: 4rem;
    padding: 2rem 1rem;
    border-top: 1px solid var(--border);
    text-align: center;
}
.footer-network {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.8rem 1.5rem;
    margin-bottom: 1rem;
}
.footer-network a {
    color: var(--text-dim);
    font-size: 0.8rem;
}
.footer-network a:hover { color: var(--teal); }
.footer-copy {
    color: var(--text-dim);
    font-size: 0.75rem;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Mobile */
@media (max-width: 600px) {
    .hero h1 { font-size: 2rem; }
    .hero p { font-size: 1rem; }
    .score-big { font-size: 3.5rem; }
    .question-text { font-size: 1.2rem; }
    .figure-card h2 { font-size: 1.5rem; }
    .spectrum-labels { font-size: 0.6rem; }
    .nav { padding: 0.8rem; }
    .nav-links { gap: 1rem; }
}


/* Oracle Debug Chat */
.oracle-debug-container {
    max-width: 700px;
    margin: 2rem auto;
    padding: 0 1rem;
}
.oracle-debug-intro {
    color: #888;
    margin-bottom: 1.5rem;
}
.oracle-chat {
    border: 1px solid #333;
    border-radius: 8px;
    overflow: hidden;
    background: #1a1a2e;
}
.chat-messages {
    min-height: 200px;
    max-height: 500px;
    overflow-y: auto;
    padding: 1rem;
}
.chat-msg {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 6px;
}
.chat-msg-user {
    background: #16213e;
    border-left: 3px solid #e94560;
}
.chat-msg-oracle {
    background: #0f3460;
    border-left: 3px solid #00d2ff;
}
.chat-msg strong {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.chat-msg-user strong { color: #e94560; }
.chat-msg-oracle strong { color: #00d2ff; }
.chat-msg-body { color: #ccc; line-height: 1.5; }
.chat-msg-body p { margin: 0.3em 0; }
.chat-input-wrap {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    border-top: 1px solid #333;
    background: #111;
}
.chat-input-wrap textarea {
    flex: 1;
    background: #1a1a2e;
    border: 1px solid #333;
    color: #eee;
    padding: 0.5rem;
    border-radius: 4px;
    resize: none;
    font-family: inherit;
    font-size: 0.95rem;
}
.chat-input-wrap textarea:focus {
    outline: none;
    border-color: #e94560;
}
.chat-status {
    display: none;
    padding: 0.75rem;
    text-align: center;
    color: #888;
    font-style: italic;
    border-top: 1px solid #333;
}

/* Oracle thinking animation */
.thinking-indicator {
    opacity: 0.85;
    animation: fadeInThinking 0.3s ease-in;
}
.thinking-body {
    display: flex;
    align-items: center;
    gap: 0;
}
.thinking-text {
    color: #00d2ff;
    font-style: italic;
    animation: pulseGlow 2s ease-in-out infinite;
}
.thinking-dots {
    display: inline-flex;
    gap: 2px;
    font-size: 1.5rem;
    line-height: 1;
    color: #00d2ff;
    margin-left: 2px;
}
.thinking-dots span {
    animation: dotPulse 1.4s infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotPulse {
    0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1.2); }
}
@keyframes pulseGlow {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; text-shadow: 0 0 8px rgba(0, 210, 255, 0.4); }
}
@keyframes fadeInThinking {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 0.85; transform: translateY(0); }
}

/* Go Back button */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 1rem;
    padding: 0.6rem 1.4rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-dim);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}
.back-btn:hover {
    border-color: var(--teal);
    color: var(--teal);
    background: rgba(42, 157, 143, 0.08);
}
