/* ── Theme Variables ── */
:root {
    --bg-dark: #0f0f0f;
    --card-bg: #1a1a1a;
    --card-border: rgba(255,255,255,0.08);
    --card-hover-glow: rgba(139,92,246,0.25);
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --nav-bg: rgba(15,15,15,0.95);
    --nav-border: rgba(255,255,255,0.06);
    --gradient-purple: linear-gradient(135deg, #a855f7 0%, #6366f1 100%);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; background: var(--bg-dark); color: var(--text-primary); line-height: 1.6; min-height: 100vh; }
h1,h2,h3,h4,h5,h6 { font-family: 'Space Grotesk', -apple-system, sans-serif; font-weight: 600; line-height: 1.3; }
a { color: inherit; text-decoration: none; transition: color 0.2s ease; }
a:hover { color: #a78bfa; }
.container { max-width: 1280px; margin: 0 auto; padding: 0 1rem; }

/* ── Nav ── */
.nav { position: fixed; top: 0; left: 0; right: 0; background: var(--nav-bg); border-bottom: 1px solid var(--nav-border); z-index: 1000; height: 64px; display: flex; align-items: center; }
.nav-content { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.nav-logo { font-family: 'Space Grotesk', sans-serif; font-size: 1.5rem; font-weight: 700; background: var(--gradient-purple); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; display: flex; align-items: center; gap: 0.6rem; }
.nav-logo::before { content: ''; display: block; width: 32px; height: 32px; background: url('/img/sv-logo.svg') no-repeat center / contain; flex-shrink: 0; }
.nav-links { display: flex; gap: 2rem; list-style: none; }
.nav-links a { font-size: 0.9rem; font-weight: 500; color: var(--text-secondary); }
.nav-links a:hover, .nav-links a.active { color: var(--text-primary); }
.mobile-menu-btn { display: none; background: none; border: none; color: var(--text-primary); font-size: 1.5rem; cursor: pointer; }
@media (max-width: 768px) {
    .nav-links { display: none; position: absolute; top: 64px; left: 0; right: 0; background: var(--nav-bg); border-bottom: 1px solid var(--nav-border); flex-direction: column; padding: 1rem; gap: 0; }
    .nav-links.active { display: flex; }
    .nav-links a { padding: 0.75rem 1rem; display: block; border-bottom: 1px solid var(--card-border); }
    .nav-links a:last-child { border-bottom: none; }
    .mobile-menu-btn { display: block; }
}

/* ── Footer ── */
footer { border-top: 1px solid var(--card-border); padding: 2rem 0; text-align: center; }
.footer-content { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.footer-logo { font-family: 'Space Grotesk', sans-serif; font-size: 1.25rem; font-weight: 700; background: var(--gradient-purple); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; display: flex; align-items: center; gap: 0.5rem; }
.footer-logo::before { content: ''; display: block; width: 26px; height: 26px; background: url('/img/sv-logo.svg') no-repeat center / contain; flex-shrink: 0; }
.wubrg-dots { display: flex; gap: 0.5rem; }
.mana-dot { width: 12px; height: 12px; border-radius: 50%; }
.footer-text { color: var(--text-muted); font-size: 0.8rem; max-width: 500px; }
.footer-links { list-style: none; display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: center; }
.footer-links a { color: var(--text-muted); font-size: 0.8rem; }
.footer-links a:hover { color: #a78bfa; }

/* ── Main ── */
main { margin-top: 64px; min-height: calc(100vh - 64px); padding-bottom: 2rem; }

/* ── Breadcrumb ── */
.breadcrumb { padding: 1.25rem 0 0; font-size: 0.85rem; color: var(--text-muted); }
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: #a78bfa; }
.breadcrumb span { margin: 0 0.4rem; }

/* ── Hero ── */
.hero-section { padding: 2rem 0 2.5rem; text-align: center; }
.hero-section h1 { font-size: 2.5rem; margin-bottom: 0.5rem; background: var(--gradient-purple); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero-section .subtitle { color: var(--text-secondary); font-size: 1.05rem; max-width: 640px; margin: 0 auto; }

/* ── Calculator Layout ── */
.calc-layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 1.5rem; }
@media (max-width: 960px) {
    .calc-layout { grid-template-columns: minmax(0, 1fr); }
}

/* ── Panels ── */
.panel { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 12px; padding: 1.5rem; }
.panel h2 { font-size: 1.15rem; margin-bottom: 1.25rem; display: flex; align-items: center; gap: 0.5rem; }
.panel h2 .icon { font-size: 1.1rem; }

/* ── Input Groups ── */
.input-group { margin-bottom: 1.25rem; }
.input-group label { display: block; font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.4rem; font-weight: 500; }
.input-group .label-hint { font-size: 0.75rem; color: var(--text-muted); font-weight: 400; }
.input-group input[type="number"] {
    width: 100%;
    padding: 0.6rem 0.85rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 600;
    font-family: inherit;
    text-align: center;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    -moz-appearance: textfield;
}
.input-group input[type="number"]::-webkit-inner-spin-button,
.input-group input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.input-group input[type="number"]:focus { outline: none; border-color: rgba(168,85,247,0.5); background: rgba(168,85,247,0.08); }

/* ── Presets ── */
.presets { display: flex; gap: 0.4rem; margin-top: 0.4rem; }
.preset-btn {
    padding: 0.3rem 0.7rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.preset-btn:hover { border-color: rgba(139,92,246,0.4); color: var(--text-primary); }
.preset-btn.active { background: rgba(168,85,247,0.15); border-color: rgba(168,85,247,0.5); color: var(--text-primary); }

/* ── Calculate Button ── */
.calc-btn {
    display: block; width: 100%; padding: 0.85rem;
    background: var(--gradient-purple); border: none; border-radius: 10px;
    font-size: 1rem; font-weight: 600; color: white; cursor: pointer;
    font-family: 'Space Grotesk', sans-serif; transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-top: 0.5rem;
}
.calc-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(139,92,246,0.4); }
.calc-btn:active { transform: translateY(0); }

/* ── Share Button ── */
.share-btn {
    display: block; width: 100%; padding: 0.65rem;
    background: rgba(255,255,255,0.04); border: 1px solid var(--card-border); border-radius: 10px;
    font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); cursor: pointer;
    font-family: inherit; transition: border-color 0.2s ease, color 0.2s ease;
    margin-top: 0.5rem;
}
.share-btn:hover { border-color: rgba(139,92,246,0.4); color: var(--text-primary); }

/* ── Results ── */
.results-empty { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.results-empty .empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.3; }
.results-empty p { font-size: 0.9rem; }

/* ── Big Result ── */
.result-hero {
    text-align: center;
    padding: 1.75rem 1rem;
    margin-bottom: 1.5rem;
    background: rgba(168,85,247,0.06);
    border: 1px solid rgba(168,85,247,0.15);
    border-radius: 12px;
}
.result-hero .result-label { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.35rem; }
.result-hero .result-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 3.5rem;
    font-weight: 700;
    background: var(--gradient-purple);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
}
.result-hero .result-detail { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.35rem; }

/* ── Distribution Table ── */
.dist-section { margin-bottom: 1.75rem; }
.dist-section h3 { font-size: 1rem; margin-bottom: 1rem; color: var(--text-secondary); }
.dist-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.dist-row:last-child { border-bottom: none; }
.dist-label {
    width: 65px;
    flex-shrink: 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: right;
}
.dist-bar-wrap {
    flex: 1;
    height: 26px;
    background: rgba(255,255,255,0.03);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}
.dist-bar {
    height: 100%;
    background: var(--gradient-purple);
    border-radius: 5px;
    transition: width 0.4s ease;
    min-width: 0;
}
.dist-pct {
    width: 62px;
    flex-shrink: 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.dist-cumulative {
    width: 70px;
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ── Turn Table ── */
.turn-section { margin-bottom: 1.75rem; }
.turn-section h3 { font-size: 1rem; margin-bottom: 1rem; color: var(--text-secondary); }
.turn-table-wrap { overflow-x: auto; }
.turn-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.turn-table th {
    padding: 0.55rem 0.7rem;
    text-align: center;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--card-border);
    white-space: nowrap;
    background: rgba(255,255,255,0.02);
}
.turn-table th:first-child { text-align: left; }
.turn-table td {
    padding: 0.5rem 0.7rem;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}
.turn-table td:first-child { font-weight: 600; color: var(--text-primary); text-align: left; }
.turn-table tr:hover td { background: rgba(168,85,247,0.05); }
.prob-good { color: #4ade80; font-weight: 600; }
.prob-ok { color: #facc15; font-weight: 600; }
.prob-bad { color: #f87171; font-weight: 600; }
.turn-table .highlight-row td { background: rgba(168,85,247,0.08); }

/* ── Info Box ── */
.info-box {
    background: rgba(168,85,247,0.08);
    border: 1px solid rgba(168,85,247,0.2);
    border-radius: 10px;
    padding: 1.25rem;
    margin-top: 1.5rem;
}
.info-box h3 { font-size: 0.95rem; margin-bottom: 0.5rem; color: #a78bfa; }
.info-box p { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.65; margin-bottom: 0.5rem; }
.info-box p:last-child { margin-bottom: 0; }
.info-box code { background: rgba(255,255,255,0.08); padding: 0.15rem 0.4rem; border-radius: 4px; font-size: 0.78rem; color: #c4b5fd; }

/* ── Responsive ── */
@media (max-width: 640px) {
    .hero-section h1 { font-size: 1.75rem; }
    .result-hero .result-value { font-size: 2.5rem; }
    .dist-cumulative { display: none; }
    .dist-label { width: 55px; font-size: 0.78rem; }
    .dist-pct { width: 55px; font-size: 0.78rem; }
    .presets { flex-wrap: wrap; }
}

/* Educational content section */
.tool-guide { max-width: 800px; margin: 3rem auto; padding: 0 1.5rem; }
.tool-guide h2 { font-family: 'Space Grotesk', sans-serif; font-size: 1.5rem; color: #e5e7eb; margin: 2.5rem 0 1rem; border-bottom: 1px solid rgba(168,85,247,0.2); padding-bottom: 0.5rem; }
.tool-guide h3 { font-size: 1.15rem; color: #d1d5db; margin: 1.5rem 0 0.75rem; }
.tool-guide p, .tool-guide li { color: #9ca3af; line-height: 1.7; margin-bottom: 1rem; }
.tool-guide a { color: #a855f7; text-decoration: none; }
.tool-guide a:hover { text-decoration: underline; }
.tool-guide code { background: rgba(168,85,247,0.1); padding: 0.15rem 0.4rem; border-radius: 3px; font-size: 0.9em; color: #c4b5fd; }
.faq-section { margin-top: 1.5rem; }
.faq-item { border: 1px solid #2a2a2e; border-radius: 8px; margin-bottom: 0.75rem; overflow: hidden; }
.faq-q { padding: 1rem 1.25rem; cursor: pointer; font-weight: 600; color: #e5e7eb; display: flex; justify-content: space-between; align-items: center; background: #1a1a1e; }
.faq-q::after { content: '+'; font-size: 1.25rem; color: #a855f7; transition: transform 0.2s; }
.faq-item.open .faq-q::after { content: '\2212'; }
.faq-a { max-height: 0; overflow: hidden; transition: max-height 0.3s ease, padding 0.3s ease; }
.faq-item.open .faq-a { max-height: 800px; padding: 0 1.25rem 1rem; }
.faq-a p { margin: 0.5rem 0; }
.related-links { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1rem; }
.related-links a { display: inline-block; padding: 0.5rem 1rem; background: rgba(168,85,247,0.1); border: 1px solid rgba(168,85,247,0.2); border-radius: 6px; color: #a855f7; font-size: 0.9rem; transition: background-color 0.2s, border-color 0.2s; }
.related-links a:hover { background: rgba(168,85,247,0.2); border-color: rgba(168,85,247,0.4); text-decoration: none; }
/* Card images in guide content */
.tool-guide img { max-width: 265px; border-radius: 12px; margin: 1rem 0; box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
.tool-guide .card-examples { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1.5rem 0; }
.tool-guide .card-examples img { max-width: 220px; }
@media (max-width: 640px) { .tool-guide img { max-width: 200px; } .tool-guide .card-examples img { max-width: 160px; } }

/* ── Probability Curve Chart ── */
.chart-section { margin-top: 1.5rem; }
.chart-section h3 { font-size: 1rem; margin-bottom: 0.25rem; }
.chart-wrap { height: 260px; }
