:root {
    --bg: #0d0f2b;
    --bg-raised: #1a1a45;
    --card-bg: rgba(35,30,80,0.55);
    --border: rgba(255,255,255,0.14);
    --border-soft: rgba(255,255,255,0.08);
    --text: #f2f1fb;
    --text-muted: #b9b4dd;
    --text-dim: #8680b3;
    --accent: #7c6cf0;
    --accent-soft: rgba(124,108,240,0.18);
    --accent2: #e04fa8;
    --green: #4fd68c;
    --green-soft: rgba(79,214,140,0.16);
    --red: #f0567a;
    --red-soft: rgba(240,86,122,0.16);

    --font-display: 'Space Grotesk', 'Inter', sans-serif;
    --font-mono: 'IBM Plex Mono', 'SF Mono', monospace;
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background-color: var(--bg);
    background-image:
        linear-gradient(160deg, #0a0d2e 0%, #1c1650 30%, #4a2270 62%, #7a2f66 85%, #8a3560 100%),
        radial-gradient(circle, rgba(255,255,255,0.10) 1px, transparent 1px);
    background-size: 100% 100%, 26px 26px;
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--font-ui);
    line-height: 1.5;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 32px;
    border-bottom: 1px solid var(--border-soft);
    background: rgba(13,15,43,0.7);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar .logo {
    font-family: 'Fraunces', serif;
    font-weight: 900;
    font-size: 1.15rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}
.topbar nav {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    padding: 6px 8px;
}
.topbar nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.78rem;
    letter-spacing: 0.01em;
    padding: 7px 13px;
    border-radius: 999px;
    transition: color 0.15s ease, background 0.15s ease;
}
.topbar nav a:hover, .topbar nav a:focus-visible { color: var(--text); background: rgba(255,255,255,0.06); }
.topbar .username { color: var(--accent); font-size: 0.78rem; font-family: var(--font-mono); padding: 0 6px; }

.page-landing .topbar { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; border-bottom: none; }

.nav-dropdown { position: relative; }
.nav-dropdown summary {
    color: var(--text-muted); font-size: 0.78rem; padding: 7px 13px; border-radius: 999px;
    cursor: pointer; list-style: none; transition: color 0.15s ease, background 0.15s ease;
}
.nav-dropdown summary::-webkit-details-marker { display: none; }
.nav-dropdown summary:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.nav-dropdown[open] summary { color: var(--accent); }
.nav-dropdown-panel {
    position: absolute; top: calc(100% + 12px); left: 50%; transform: translateX(-50%);
    background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px;
    padding: 10px; width: 480px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.45); z-index: 20;
}
.nav-dropdown-panel a {
    display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 8px;
    text-decoration: none; color: var(--text); text-transform: none; letter-spacing: normal;
}
.nav-dropdown-panel a:hover { background: rgba(255,255,255,0.05); }
.nav-dropdown-panel a strong { font-size: 0.84rem; font-weight: 600; }
.nav-dropdown-panel a span { font-size: 0.72rem; color: var(--text-dim); }
@media (max-width: 640px) {
    .nav-dropdown-panel { width: 260px; grid-template-columns: 1fr; left: auto; right: 0; transform: none; }
}

.container { max-width: 1100px; margin: 0 auto; padding: 40px 24px 60px; }

h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 24px;
    color: var(--text);
}
h2 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0 0 4px;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 26px;
    margin-bottom: 20px;
}
.card-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }

.summary-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { display: flex; flex-direction: column; gap: 8px; }
.stat-label {
    color: var(--text-dim);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}
.stat-value {
    font-family: var(--font-mono);
    font-size: 1.7rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}
.positive { color: var(--green); }
.negative { color: var(--red); }

.data-table { width: 100%; border-collapse: collapse; margin-top: 14px; font-family: var(--font-mono); font-size: 0.86rem; }
.data-table th {
    text-align: left;
    padding: 8px 10px;
    color: var(--text-dim);
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border-soft);
    font-variant-numeric: tabular-nums;
}
.data-table th:not(:first-child), .data-table td:not(:first-child) { text-align: right; }
.data-table th:last-child, .data-table td:last-child { text-align: center; }
.data-table tr:last-child td { border-bottom: none; }

.muted { color: var(--text-muted); font-size: 0.78rem; font-family: var(--font-ui); }
.badge {
    background: var(--bg-raised);
    color: var(--text-muted);
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-family: var(--font-ui);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid var(--border);
}
.badge-ok { background: var(--green-soft); color: var(--green); border-color: transparent; }
.badge-warn { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge-error { background: var(--red-soft); color: var(--red); border-color: transparent; }

.btn {
    background: var(--bg-raised); color: var(--text); border: 1px solid var(--border);
    padding: 9px 18px; border-radius: 7px; cursor: pointer; font-size: 0.86rem;
    font-family: var(--font-ui); font-weight: 500; text-decoration: none; display: inline-block;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #14161c; font-weight: 600; }
.btn-primary:hover { background: #d8b25f; border-color: #d8b25f; }
.btn-danger { background: var(--red-soft); border-color: rgba(201,105,79,0.4); color: var(--red); }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }

form label { display: block; margin-bottom: 16px; font-size: 0.82rem; color: var(--text-muted); font-weight: 500; }
form input, form select, form textarea {
    display: block; width: 100%; margin-top: 7px; padding: 10px 12px; border-radius: 7px;
    border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 0.92rem;
    font-family: var(--font-ui);
}
form input:focus, form select:focus, form textarea:focus {
    outline: none; border-color: var(--accent);
}
.small-input { width: 140px !important; display: inline-block !important; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.auth-card { max-width: 420px; margin: 60px auto; }
.auth-card h1 { text-align: center; }

.auth-layout {
    display: flex; align-items: center; justify-content: center; gap: 40px;
    max-width: 1180px; margin: 40px auto; padding: 0 24px; flex-wrap: wrap;
}
.auth-layout .auth-card { margin: 0; }

.hero-graphic { position: relative; width: 460px; height: 460px; flex-shrink: 0; }
.hero-center-dot {
    position: absolute; top: 50%; left: 50%; width: 14px; height: 14px;
    margin-top: -7px; margin-left: -7px; border-radius: 50%;
    background: var(--accent);
    animation: heroPulseGlow 3.2s ease-in-out infinite;
}

.hero-lines { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-lines path {
    fill: none; stroke: var(--border); stroke-width: 1.5;
}
.orbit-node {
    position: absolute; width: 54px; height: 54px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-mono); font-size: 0.95rem; font-weight: 600;
    background: var(--card-bg); border: 1px solid var(--border);
    animation: heroFloat 4.5s ease-in-out infinite;
}
.orbit-node.n1 { top: 2%; left: 50%; margin-left: -27px; color: var(--accent); animation-delay: 0s; }
.orbit-node.n2 { top: 24%; right: 0%; color: var(--green); animation-delay: 0.6s; }
.orbit-node.n3 { bottom: 4%; right: 16%; color: var(--accent2); animation-delay: 1.2s; }
.orbit-node.n4 { bottom: 4%; left: 16%; color: var(--red); animation-delay: 1.8s; }
.orbit-node.n5 { top: 24%; left: 0%; color: var(--text-muted); animation-delay: 2.4s; }

.float-badge {
    position: absolute; display: flex; align-items: center; gap: 6px;
    background: var(--card-bg); border: 1px solid var(--border); border-radius: 999px;
    padding: 7px 14px; font-family: var(--font-mono); font-size: 0.78rem; font-weight: 600;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    animation: heroFloat 5s ease-in-out infinite;
}
.float-badge.b1 { top: 4%; left: -8%; color: var(--green); animation-delay: 0.3s; }
.float-badge.b2 { bottom: 16%; right: -12%; color: var(--red); animation-delay: 1.5s; }
.float-badge.b3 { top: 58%; left: -14%; color: var(--accent); animation-delay: 2.6s; }
.float-badge.b4 { top: 40%; right: -16%; color: var(--green); animation-delay: 1.9s; }
.float-badge.b5 { bottom: -2%; left: 30%; color: var(--text-muted); animation-delay: 0.9s; }

.hero-tagline { max-width: 320px; text-align: center; }
.hero-tagline h2 { font-size: 1.4rem; margin-bottom: 8px; }
.hero-tagline p { color: var(--text-muted); font-size: 0.9rem; }
.hero-column { display: flex; flex-direction: column; align-items: center; gap: 8px; }

.feature-list { display: flex; flex-direction: column; gap: 22px; max-width: 340px; }
.feature-item { display: flex; gap: 14px; align-items: flex-start; text-align: left; }
.feature-icon {
    flex-shrink: 0; width: 40px; height: 40px; border-radius: 10px;
    background: var(--card-bg); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
}
.feature-item h3 { font-family: var(--font-display); font-size: 1rem; margin: 0 0 4px; }
.feature-item p { color: var(--text-muted); font-size: 0.84rem; margin: 0; line-height: 1.5; }

@keyframes heroSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes heroDonutFloat { 0%, 100% { margin-top: -95px; } 50% { margin-top: -107px; } }
@keyframes heroPulseGlow {
    0%, 100% { box-shadow: 0 0 0px 0px rgba(124,108,240,0); }
    50% { box-shadow: 0 0 30px 8px rgba(124,108,240,0.5); }
}
@keyframes heroFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) {
    .hero-center-dot, .orbit-node, .float-badge { animation: none; }
}
@media (max-width: 900px) {
    .hero-graphic { transform: scale(0.75); margin: -50px -50px; }
}
@media (max-width: 640px) {
    .hero-graphic { transform: scale(0.62); margin: -85px -85px; }
    .feature-list { display: none; }
}

.particle-field { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.particle {
    position: absolute; bottom: -20px; border-radius: 50%;
    animation-name: particleFloat; animation-timing-function: linear; animation-iteration-count: infinite;
}
@keyframes particleFloat {
    0% { transform: translate(0, 0) rotate(var(--rotate, 0deg)); opacity: 0; }
    8% { opacity: 1; }
    92% { opacity: 1; }
    100% { transform: translate(var(--drift), -115vh) rotate(calc(var(--rotate, 0deg) + 180deg)); opacity: 0; }
}
.container, .topbar, .auth-layout { position: relative; z-index: 1; }
@media (prefers-reduced-motion: reduce) { .particle { animation: none; display: none; } }

/* ---- Landing page (pre-login) ---- */
.landing-nav {
    position: fixed; left: 32px; top: 50%; transform: translateY(-50%);
    display: flex; flex-direction: column; gap: 16px; z-index: 5;
}
.landing-nav a {
    display: flex; align-items: center; gap: 10px; color: var(--text-dim);
    text-decoration: none; font-size: 0.82rem; font-weight: 500;
}
.landing-nav a::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--text-dim); flex-shrink: 0; }
.landing-nav a:hover, .landing-nav a.active { color: var(--text); }
.landing-nav a:hover::before, .landing-nav a.active::before { background: var(--accent2); }
@media (max-width: 900px) { .landing-nav { display: none; } }

.landing-section { max-width: 1100px; margin: 0 auto; padding: 100px 24px; scroll-margin-top: 40px; }
.landing-section h2 { font-size: 1.8rem; margin-bottom: 12px; }
.landing-section > p.section-lede { color: var(--text-muted); max-width: 640px; margin-bottom: 40px; }

.landing-hero { text-align: center; padding: 80px 24px 40px; }
.landing-hero .eyebrow {
    display: inline-flex; align-items: center; gap: 8px; background: var(--card-bg); backdrop-filter: blur(14px);
    border: 1px solid var(--border); border-radius: 999px; padding: 8px 16px; font-size: 0.8rem; margin-bottom: 24px;
}
.landing-hero .eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.landing-hero h1 {
    font-size: clamp(2.2rem, 6vw, 4rem); font-weight: 700; line-height: 1.1; margin-bottom: 16px;
    background: linear-gradient(100deg, var(--accent2), var(--accent) 60%, #fff);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.landing-hero .subhead { color: var(--text-muted); max-width: 560px; margin: 0 auto 40px; font-size: 1.05rem; }
.landing-stats { display: flex; justify-content: center; gap: 60px; margin-bottom: 50px; flex-wrap: wrap; }
.landing-stats .stat { text-align: center; }
.landing-stats .stat .num { font-family: var(--font-display); font-size: 2rem; font-weight: 700; }
.landing-stats .stat .label { color: var(--text-dim); font-size: 0.8rem; }

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 800px) { .feature-grid { grid-template-columns: 1fr; } }
.feature-card {
    background: var(--card-bg); backdrop-filter: blur(14px); border: 1px solid var(--border);
    border-radius: 14px; padding: 24px;
}
.feature-card .icon {
    width: 44px; height: 44px; border-radius: 12px; margin-bottom: 16px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    display: flex; align-items: center; justify-content: center; font-size: 1.2rem; color: #fff;
}
.feature-card h3 { font-family: var(--font-display); font-size: 1.05rem; margin: 0 0 8px; }
.feature-card p { color: var(--text-muted); font-size: 0.88rem; margin: 0; line-height: 1.5; }

.news-preview-list { display: flex; flex-direction: column; gap: 2px; }
.news-preview-list .item { padding: 16px 0; border-bottom: 1px solid var(--border-soft); }
.news-preview-list .item:last-child { border-bottom: none; }

.calc-card { max-width: 480px; }
.calc-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.calc-row label { flex: 1; min-width: 140px; margin-bottom: 0; }
.calc-result { font-family: var(--font-mono); font-size: 1.4rem; font-weight: 600; color: var(--accent2); }

.faq-item { border-bottom: 1px solid var(--border-soft); padding: 18px 0; }
.faq-item summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; color: var(--accent2); font-size: 1.2rem; }
.faq-item[open] summary::after { content: "−"; }
.faq-item p { color: var(--text-muted); margin: 12px 0 0; font-size: 0.92rem; }

.landing-footer { text-align: center; padding: 60px 24px; color: var(--text-dim); font-size: 0.85rem; }

.alert { padding: 13px 16px; border-radius: 8px; margin-bottom: 18px; font-size: 0.88rem; border: 1px solid transparent; }
.alert-error { background: var(--red-soft); color: var(--red); border-color: rgba(201,105,79,0.3); }
.alert-success { background: var(--green-soft); color: var(--green); border-color: rgba(111,174,130,0.3); }
.alert-warning { background: var(--accent-soft); color: var(--accent); border-color: rgba(201,162,75,0.3); }
.hint { color: var(--text-muted); font-size: 0.84rem; margin: -12px 0 16px; }
.footer { text-align: center; color: var(--text-dim); font-size: 0.78rem; padding: 30px; font-family: var(--font-mono); }

.modal { display: none; position: fixed; inset: 0; background: rgba(10,11,16,0.75); align-items: center; justify-content: center; z-index: 50; }
.modal.open { display: flex; }
.modal-content { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 26px; width: 90%; max-width: 480px; max-height: 85vh; overflow-y: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }
.coin-result { padding: 9px; cursor: pointer; border-bottom: 1px solid var(--border-soft); font-size: 0.85rem; }
.coin-result:hover { background: var(--bg-raised); }
code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: 0.85rem; font-family: var(--font-mono); }

.charts-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; margin-bottom: 20px; }
@media (max-width: 720px) { .charts-row { grid-template-columns: 1fr; } }
.chart-wrap { position: relative; height: 220px; }
