:root {
    --canvas: #f7f5f0;
    --canvas-2: #fbfaf7;
    --surface: #ffffff;
    --surface-soft: #f5f3ee;
    --border: #e5e1d8;
    --border-strong: #d6d0c2;
    --ink: #142033;
    --ink-soft: #3d4a5c;
    --muted: #6b7686;
    --accent: #b0571f;
    --accent-soft: #e08b3c;
    --accent-pale: #fbf0e2;
    --verified: #1d4ed8;
    --verified-pale: #eaf0ff;
    --pref: #7c3aed;
    --pref-pale: #f2ecff;
    --fun: #b0571f;
    --fun-pale: #fbf0e2;
    --bonus: #0f766e;
    --ok-bg: #ecfdf5;
    --error-bg: #fdf0ee;
    --shadow: 0 18px 40px -30px rgba(20, 32, 51, .55);
    --shadow-lg: 0 28px 60px -34px rgba(20, 32, 51, .6);
    --radius: 1.35rem;
}

.dark {
    --canvas: #0d1524;
    --canvas-2: #111c2e;
    --surface: #16233a;
    --surface-soft: #1b2942;
    --border: #2b3a53;
    --border-strong: #3b4d68;
    --ink: #f3f6fb;
    --ink-soft: #cdd7e5;
    --muted: #93a2b6;
    --accent: #f0a95c;
    --accent-soft: #e08b3c;
    --accent-pale: #3a2a1b;
    --verified: #7ea6ff;
    --verified-pale: #1b2b4d;
    --pref: #c4b5fd;
    --pref-pale: #2a2350;
    --fun: #f0a95c;
    --fun-pale: #3a2a1b;
    --bonus: #5eead4;
    --ok-bg: #06342a;
    --error-bg: #431a17;
    --shadow: 0 18px 40px -30px rgba(0, 0, 0, .8);
    --shadow-lg: 0 28px 60px -34px rgba(0, 0, 0, .85);
}

html { color-scheme: light; }
html.dark { color-scheme: dark; }
body { background: var(--canvas); color: var(--ink); }

:focus-visible {
    outline: 3px solid var(--accent-soft);
    outline-offset: 3px;
    border-radius: 6px;
}

.skip-link {
    position: absolute; left: -9999px; top: 0; z-index: 100;
    background: var(--accent); color: #fff; padding: .7rem 1.1rem;
    border-radius: 0 0 .6rem 0; font-weight: 700;
}
.skip-link:focus { left: 0; }

.page-shell { width: 100%; max-width: 78rem; margin: 0 auto; padding: 0 1.25rem; }
@media (min-width: 640px) { .page-shell { padding: 0 2rem; } }

.site-head {
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}
.brand {
    font-weight: 900; letter-spacing: -.06em; font-size: 1.4rem;
    color: var(--ink); text-decoration: none;
}
.brand em { color: var(--accent); font-style: normal; }
.brand-badge {
    font-size: .62rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase;
    color: var(--accent); border: 1px solid var(--border-strong);
    padding: .2rem .5rem; border-radius: 999px;
}

.nav-link {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .5rem .75rem; border-radius: .7rem;
    font-size: .875rem; font-weight: 650; color: var(--muted);
    text-decoration: none; white-space: nowrap;
    transition: color .25s ease, background-color .25s ease, transform .25s ease;
}
.nav-link:hover { color: var(--accent); background: var(--accent-pale); }
.nav-link:active { transform: translateY(1px); }
.nav-link-active { color: var(--accent); background: var(--accent-pale); font-weight: 800; }
.nav-sep { width: 1px; height: 1.25rem; background: var(--border); margin: 0 .35rem; }

.icon-button {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.35rem; height: 2.35rem; border: 1px solid var(--border);
    border-radius: .75rem; background: var(--surface); color: var(--ink);
    font-size: 1rem; cursor: pointer;
    transition: border-color .25s ease, transform .25s ease, background-color .25s ease;
}
.icon-button:hover { border-color: var(--accent); background: var(--accent-pale); }
.icon-button:active { transform: scale(.95); }

.transparency-bar {
    background: var(--accent-pale);
    border-bottom: 1px solid var(--border);
    color: var(--ink-soft); font-size: .8rem; line-height: 1.5;
}

.hero {
    position: relative; overflow: hidden;
    background: linear-gradient(135deg, var(--surface) 0%, var(--canvas-2) 55%, var(--accent-pale) 100%);
    border: 1px solid var(--border); border-radius: 1.75rem;
    padding: 2.5rem 1.75rem; box-shadow: var(--shadow);
}
.hero::after {
    content: ""; position: absolute; right: -6rem; top: -8rem;
    width: 22rem; height: 22rem; border-radius: 999px;
    background: radial-gradient(circle, color-mix(in srgb, var(--accent-soft) 22%, transparent), transparent 68%);
    pointer-events: none;
}
.hero-eyebrow {
    font-size: .7rem; font-weight: 800; letter-spacing: .2em; text-transform: uppercase;
    color: var(--accent);
}
.hero-title {
    font-size: clamp(2.1rem, 5vw, 3.4rem); font-weight: 900;
    letter-spacing: -.045em; line-height: 1.05; color: var(--ink);
    margin-top: .7rem; max-width: 34ch;
}
.hero-lead {
    font-size: 1rem; line-height: 1.75; color: var(--ink-soft);
    max-width: 62ch; margin-top: 1rem;
}
.hero-meta { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.6rem; }

.section-head { margin-bottom: 1.5rem; }
.section-num {
    display: inline-block; font-size: .7rem; font-weight: 900; letter-spacing: .18em;
    text-transform: uppercase; color: var(--accent); margin-bottom: .5rem;
}
.section-title {
    font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 900;
    letter-spacing: -.035em; line-height: 1.15; color: var(--ink);
}
.section-lead {
    font-size: .95rem; line-height: 1.7; color: var(--muted);
    max-width: 70ch; margin-top: .55rem;
}

.section-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 1.6rem; transition: box-shadow .3s ease, border-color .3s ease, transform .3s ease;
}
.section-card:hover { box-shadow: var(--shadow-lg); }
.card-title {
    font-size: 1.05rem; font-weight: 850; letter-spacing: -.015em;
    color: var(--ink); margin-bottom: .35rem;
}
.card-lead { font-size: .84rem; line-height: 1.65; color: var(--muted); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }

.tag {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .28rem .65rem; border-radius: 999px; border: 1px solid transparent;
    font-size: .68rem; font-weight: 850; letter-spacing: .05em; text-transform: uppercase;
    white-space: nowrap;
}
.tag-stat { background: var(--verified-pale); color: var(--verified); border-color: color-mix(in srgb, var(--verified) 25%, transparent); }
.tag-pref { background: var(--pref-pale); color: var(--pref); border-color: color-mix(in srgb, var(--pref) 25%, transparent); }
.tag-fun { background: var(--fun-pale); color: var(--fun); border-color: color-mix(in srgb, var(--fun) 25%, transparent); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    padding: .75rem 1.25rem; border-radius: .85rem; font-weight: 750; font-size: .9rem;
    border: 1px solid transparent; cursor: pointer; text-decoration: none;
    transition: background-color .25s ease, border-color .25s ease, transform .25s ease, box-shadow .25s ease;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 12px 24px -16px rgba(20, 32, 51, .8); }
.btn:not(:disabled):active { transform: translateY(0); }
.btn-primary { background: var(--accent); color: #fff; }
.dark .btn-primary { color: #142033; }
.btn-primary:not(:disabled):hover { background: color-mix(in srgb, var(--accent) 85%, #000); }
.btn-outline { background: var(--surface); border-color: var(--border-strong); color: var(--ink); }
.btn-outline:not(:disabled):hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:not(:disabled):hover { color: var(--accent); background: var(--accent-pale); }
.btn-sm { padding: .5rem .85rem; font-size: .8rem; border-radius: .7rem; }

.field {
    width: 100%; padding: .7rem .85rem; border-radius: .75rem;
    border: 1px solid var(--border-strong); background: var(--canvas-2);
    color: var(--ink); font-size: .9rem;
    transition: border-color .25s ease, box-shadow .25s ease;
}
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-soft) 22%, transparent); outline: none; }
.field[type="file"] { padding: .42rem .5rem; cursor: pointer; }
.field[type="file"]::file-selector-button {
    margin-right: .65rem; padding: .35rem .7rem; border: 1px solid var(--border-strong);
    border-radius: .5rem; background: var(--surface); color: var(--ink);
    font-weight: 700; cursor: pointer;
}
.label { display: block; font-size: .76rem; font-weight: 750; color: var(--muted); margin-bottom: .4rem; }
.help { font-size: .76rem; color: var(--muted); margin-top: .35rem; line-height: 1.6; }

.ball {
    display: inline-flex; align-items: center; justify-content: center;
    width: 3rem; height: 3rem; border-radius: 999px;
    font-weight: 850; font-variant-numeric: tabular-nums; font-size: 1rem;
    color: #fff; border: 2px solid rgba(255, 255, 255, .4);
    box-shadow: 0 8px 18px -10px rgba(20, 32, 51, .9), inset 0 -4px 10px rgba(0, 0, 0, .16);
    flex-shrink: 0;
}
.ball-sm { width: 2.2rem; height: 2.2rem; font-size: .74rem; }
.ball-lg { width: 3.5rem; height: 3.5rem; font-size: 1.1rem; }
.ball-main { background: linear-gradient(150deg, #3b6fe0, #1d4ed8); }
.ball-star { background: linear-gradient(150deg, #e0a13c, #b0571f); border-radius: .9rem; transform: rotate(45deg); }
.ball-star > span { transform: rotate(-45deg); }
.ball-bonus { background: linear-gradient(150deg, #17a398, #0f766e); border-style: dashed; }
.ball-neutral { background: var(--surface-soft); color: var(--ink); border-color: var(--border); }
.ball-label { font-size: .7rem; font-weight: 700; color: var(--muted); text-align: center; margin-top: .45rem; }
.ball-row { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; }

.freq-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(3.1rem, 1fr));
    gap: .5rem;
}
.freq-cell {
    position: relative; border: 1px solid var(--border); border-radius: .8rem;
    background: var(--canvas-2); padding: .55rem .2rem .45rem; text-align: center;
    overflow: hidden;
}
.freq-cell-num { font-weight: 850; font-variant-numeric: tabular-nums; font-size: .9rem; position: relative; z-index: 1; }
.freq-cell-count { font-size: .65rem; color: var(--muted); position: relative; z-index: 1; }
.freq-cell-fill {
    position: absolute; left: 0; right: 0; bottom: 0;
    background: color-mix(in srgb, var(--verified) 20%, transparent);
    z-index: 0;
}

.hbar { height: .55rem; border-radius: 999px; background: var(--surface-soft); overflow: hidden; border: 1px solid var(--border); }
.hbar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--verified), #5b8def); border-radius: 999px; }
.hbar-accent > span { background: linear-gradient(90deg, var(--accent-soft), var(--accent)); }

.stat-tile {
    background: var(--canvas-2); border: 1px solid var(--border);
    border-radius: 1rem; padding: 1.1rem 1.2rem;
}
.stat-value { font-size: 1.6rem; font-weight: 900; letter-spacing: -.03em; color: var(--ink); line-height: 1.1; }
.stat-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .45rem; }

.data-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.data-table th, .data-table td { padding: .6rem .75rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.data-table th {
    position: sticky; top: 0; z-index: 1; background: var(--surface);
    font-size: .68rem; text-transform: uppercase; letter-spacing: .07em;
    color: var(--muted); font-weight: 850;
}
.data-table tbody tr:hover { background: var(--canvas-2); }
.data-table td { overflow-wrap: anywhere; }
.table-wrap { max-height: 22rem; overflow: auto; border: 1px solid var(--border); border-radius: 1rem; }

.note {
    display: flex; align-items: flex-start; gap: .8rem;
    border-radius: 1rem; padding: 1rem 1.15rem; font-size: .86rem; line-height: 1.7;
    border: 1px solid var(--border);
}
.note-icon { font-weight: 900; font-size: 1rem; line-height: 1.4; }
.note-info { background: var(--verified-pale); color: var(--ink-soft); border-color: color-mix(in srgb, var(--verified) 20%, transparent); }
.note-fun { background: var(--accent-pale); color: var(--ink-soft); border-color: color-mix(in srgb, var(--accent) 22%, transparent); }
.note-warn { background: var(--error-bg); color: var(--ink-soft); border-color: color-mix(in srgb, #ef4444 25%, transparent); }

.flash {
    display: flex; align-items: flex-start; gap: .75rem;
    padding: .9rem 1.1rem; border-radius: 1rem; border: 1px solid var(--border);
    font-size: .88rem; line-height: 1.6;
}
.flash-ok { background: var(--ok-bg); border-color: color-mix(in srgb, #10b981 35%, transparent); }
.flash-error { background: var(--error-bg); border-color: color-mix(in srgb, #ef4444 35%, transparent); }

.result-card {
    background: var(--canvas-2); border: 1px solid var(--border);
    border-radius: 1.1rem; padding: 1.25rem;
}
.empty-state {
    border: 1px dashed var(--border-strong); border-radius: 1.2rem;
    padding: 2.5rem 1.5rem; text-align: center; background: var(--canvas-2);
}
.skeleton { position: relative; overflow: hidden; background: var(--surface-soft); border-radius: .8rem; }
.skeleton::after {
    content: ""; position: absolute; inset: 0; transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent-soft) 16%, transparent), transparent);
    animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

.divider { height: 1px; background: var(--border); }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.kicker { font-size: .7rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.pill {
    display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .7rem;
    border-radius: 999px; background: var(--canvas-2); border: 1px solid var(--border);
    font-size: .76rem; font-weight: 700; color: var(--ink-soft);
}
.eyebrow { font-size: .68rem; font-weight: 850; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }

.site-foot { border-top: 1px solid var(--border); background: var(--surface); }
.foot-link { color: var(--muted); text-decoration: none; font-size: .85rem; transition: color .25s ease; }
.foot-link:hover { color: var(--accent); }

@media (max-width: 640px) {
    .section-card { padding: 1.1rem; border-radius: 1.1rem; }
    .data-table th, .data-table td { padding: .5rem .55rem; }
    .ball { width: 2.55rem; height: 2.55rem; font-size: .85rem; }
    .ball-sm { width: 2rem; height: 2rem; font-size: .66rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
