:root {
    --bg: #070b12;
    --bg-soft: #0d1420;
    --panel: #111a29;
    --panel-2: #162234;
    --line: #24344b;
    --line-soft: #1a2638;
    --text: #eef4ff;
    --muted: #8fa1ba;
    --muted-2: #6f829d;
    --accent: #c8f560;
    --accent-ink: #16220a;
    --blue: #6cb8ff;
    --amber: #ffc857;
    --red: #ff7b7b;
    --green: #6ee7a8;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
    --font: "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    background:
        radial-gradient(1100px 600px at 82% -10%, rgba(108, 184, 255, 0.10), transparent 60%),
        radial-gradient(900px 500px at 10% 0%, rgba(200, 245, 96, 0.07), transparent 55%),
        var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5rem; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.5rem, 2.4vw, 2.1rem); }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.75rem; }
small { color: var(--muted); }

.hidden, .visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute;
    left: 12px;
    top: -60px;
    background: var(--accent);
    color: var(--accent-ink);
    padding: 10px 16px;
    border-radius: 8px;
    z-index: 100;
    font-weight: 700;
}
.skip-link:focus { top: 12px; }

.app-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 22px 16px;
    background: linear-gradient(180deg, #0a111c, #070b12 65%);
    border-right: 1px solid var(--line-soft);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 50%;
    background: radial-gradient(circle at 32% 30%, #f4ffcf, var(--accent) 55%, #7ea523);
    box-shadow: 0 0 30px rgba(200, 245, 96, 0.35);
}
.brand-text { display: flex; flex-direction: column; }
.brand-text strong { font-size: 0.98rem; letter-spacing: 0.12em; }
.brand-text span { font-size: 0.68rem; color: var(--muted); letter-spacing: 0.18em; text-transform: uppercase; }

.save-chip {
    display: block; padding: 12px; border-radius: var(--radius-sm);
    background: var(--panel); border: 1px solid var(--line-soft); color: var(--text);
}
.save-chip:hover { border-color: var(--line); text-decoration: none; }
.save-chip strong { display: block; font-size: 0.92rem; }
.save-chip span { display: block; font-size: 0.76rem; color: var(--muted); margin-top: 3px; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-label { font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted-2); padding: 10px 10px 4px; }
.nav a {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 9px 11px; border-radius: 9px; color: var(--muted); font-size: 0.9rem;
}
.nav a:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.nav a.active { background: rgba(200, 245, 96, 0.10); color: var(--accent); font-weight: 600; }
.nav .count { font-size: 0.7rem; background: var(--accent); color: var(--accent-ink); padding: 1px 7px; border-radius: 999px; font-weight: 700; }

.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.sidebar-footer form { margin: 0; }
.sidebar-footer .who { font-size: 0.78rem; color: var(--muted); padding: 0 10px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px;
    padding: 20px 28px 10px;
}
.topbar .crumb { color: var(--muted); font-size: 0.8rem; }
.topbar .date { font-size: 0.86rem; color: var(--muted); }
.topbar .date strong { color: var(--text); }

.content { padding: 12px 28px 48px; max-width: 1440px; width: 100%; margin: 0 auto; flex: 1; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 8px 0 20px; }
.page-head p { color: var(--muted); margin: 4px 0 0; max-width: 70ch; }
.eyebrow { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.16em; color: var(--accent); margin-bottom: 6px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-sidebar { grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row-between { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.spacer { flex: 1; }

.card {
    background: linear-gradient(180deg, rgba(22, 34, 52, 0.9), rgba(13, 20, 32, 0.95));
    border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 18px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.card.tight { padding: 14px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 14px; }
.card-head h2, .card-head h3 { margin: 0; }
.card-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); }

.stat { padding: 16px; border-radius: var(--radius-sm); background: var(--panel); border: 1px solid var(--line-soft); }
.stat .label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.stat .value { font-size: 1.55rem; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 0.78rem; color: var(--muted); margin-top: 4px; }
.stat.accent { border-color: rgba(200, 245, 96, 0.35); background: linear-gradient(160deg, rgba(200, 245, 96, 0.11), rgba(13, 20, 32, 0.9)); }

.badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
    font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
    border: 1px solid var(--line); color: var(--muted); background: rgba(255, 255, 255, 0.02);
    white-space: nowrap;
}
.badge.green { color: var(--green); border-color: rgba(110, 231, 168, 0.3); background: rgba(110, 231, 168, 0.08); }
.badge.amber { color: var(--amber); border-color: rgba(255, 200, 87, 0.3); background: rgba(255, 200, 87, 0.08); }
.badge.red { color: var(--red); border-color: rgba(255, 123, 123, 0.3); background: rgba(255, 123, 123, 0.08); }
.badge.blue { color: var(--blue); border-color: rgba(108, 184, 255, 0.3); background: rgba(108, 184, 255, 0.08); }
.badge.accent { color: var(--accent); border-color: rgba(200, 245, 96, 0.35); background: rgba(200, 245, 96, 0.09); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
    padding: 8px 13px; border-radius: 9px; cursor: pointer; font-size: 0.86rem; font-weight: 600;
    font-family: inherit; line-height: 1.2; text-decoration: none;
}
.btn:hover { border-color: var(--muted-2); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red); border-color: rgba(255, 123, 123, 0.35); background: rgba(255, 123, 123, 0.06); }
.btn.small { padding: 5px 9px; font-size: 0.76rem; border-radius: 7px; }
.btn.block { width: 100%; }

form.inline { display: inline; margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label, .label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
input, select, textarea {
    width: 100%; background: #0a111c; border: 1px solid var(--line); color: var(--text);
    padding: 8px 10px; border-radius: 8px; font: inherit; font-size: 0.88rem;
}
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--accent); }
select[multiple] { min-height: 110px; }
input::placeholder, textarea::placeholder { color: var(--muted-2); }
.hint { color: var(--muted-2); font-size: 0.76rem; }
.error-text { color: var(--red); font-size: 0.8rem; }

.alert { border-radius: var(--radius-sm); padding: 11px 14px; margin-bottom: 14px; border: 1px solid var(--line); background: var(--panel); font-size: 0.88rem; }
.alert.success { border-color: rgba(110, 231, 168, 0.35); background: rgba(110, 231, 168, 0.08); color: #c7ffe1; }
.alert.error { border-color: rgba(255, 123, 123, 0.35); background: rgba(255, 123, 123, 0.08); color: #ffd2d2; }
.alert.info { border-color: rgba(108, 184, 255, 0.35); background: rgba(108, 184, 255, 0.08); }

table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
th { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); font-weight: 600; }
tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
tr.highlight { background: rgba(200, 245, 96, 0.06); }
.table-wrap { overflow-x: auto; }
.table-wrap table { min-width: 640px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.positive { color: var(--green); }
td.negative { color: var(--red); }

.list { display: flex; flex-direction: column; gap: 2px; }
.list-item { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 160px; }
.list-item .title { font-weight: 600; }
.list-item .meta { color: var(--muted); font-size: 0.78rem; }

.avatar {
    width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(145deg, var(--panel-2), #0a111c); border: 1px solid var(--line);
    font-weight: 700; color: var(--accent); font-size: 0.78rem; flex: none;
}

.progress { height: 7px; border-radius: 999px; background: #0a111c; border: 1px solid var(--line-soft); overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--accent)); }
.progress.warn > span { background: linear-gradient(90deg, var(--amber), var(--red)); }

.muted { color: var(--muted); }
.tiny { font-size: 0.72rem; }
.mono { font-family: "Cascadia Code", Consolas, monospace; font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.right { text-align: right; }
.uppercase { text-transform: uppercase; letter-spacing: 0.1em; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pill-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.pill-tabs a { padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: 0.8rem; }
.pill-tabs a.active { color: var(--accent); border-color: rgba(200, 245, 96, 0.4); background: rgba(200, 245, 96, 0.08); }

.scoreboard { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; }
.scoreboard .score { font-family: "Cascadia Code", Consolas, monospace; font-size: 1.35rem; font-weight: 700; }
.set-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.set-chip { min-width: 54px; border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; text-align: center; font-size: 0.8rem; background: #0a111c; }

.bracket { display: flex; gap: 18px; overflow-x: auto; padding-bottom: 8px; }
.bracket-round { min-width: 220px; display: flex; flex-direction: column; gap: 8px; justify-content: space-around; }
.bracket-match { border: 1px solid var(--line-soft); border-radius: 8px; background: #0a111c; padding: 8px 10px; font-size: 0.8rem; }
.bracket-match .won { color: var(--accent); font-weight: 600; }
.bracket-match .lost { color: var(--muted-2); }

.hero { min-height: 100vh; display: grid; place-items: center; padding: 40px 20px; }
.hero-card { max-width: 980px; width: 100%; display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 30px; align-items: center; }
.hero h1 { font-size: clamp(2.4rem, 7vw, 4.6rem); line-height: 0.95; letter-spacing: -0.04em; }
.hero h1 span { color: var(--accent); }
.hero .lead { font-size: 1.02rem; color: var(--muted); max-width: 55ch; }
.hero-list { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 8px; color: var(--muted); font-size: 0.9rem; }
.hero-list li::before { content: "—"; color: var(--accent); margin-right: 8px; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 30px 18px; }
.auth-card { width: 100%; max-width: 430px; }
.auth-card .brand { padding: 0 0 6px; }

.phase-strip { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.condition-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; }
.condition-dot.warn { background: var(--amber); }
.condition-dot.bad { background: var(--red); }

.skill-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.skill { display: flex; flex-direction: column; gap: 4px; }
.skill .bar { height: 5px; border-radius: 999px; background: #0a111c; overflow: hidden; }
.skill .bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--accent)); }
.skill .name { display: flex; justify-content: space-between; font-size: 0.76rem; color: var(--muted); }

.empty { padding: 28px 18px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius-sm); }

.toast { position: sticky; top: 0; z-index: 20; }

footer.site { padding: 20px 28px 30px; color: var(--muted-2); font-size: 0.72rem; border-top: 1px solid var(--line-soft); }

@media (max-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-sidebar { grid-template-columns: 1fr; }
    .hero-card { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line-soft); flex-direction: column; }
    .nav { flex-direction: row; flex-wrap: wrap; }
    .nav-label { display: none; }
    .nav a { padding: 7px 10px; }
    .sidebar-footer { flex-direction: row; align-items: center; }
    .content, .topbar, footer.site { padding-left: 16px; padding-right: 16px; }
    .grid-3 { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
    .grid-4 { grid-template-columns: 1fr; }
    .topbar { align-items: flex-start; }
    .stat .value { font-size: 1.3rem; }
    .page-head { align-items: flex-start; }
}

@media (prefers-reduced-motion: no-preference) {
    .btn, .nav a, .card { transition: background 0.15s ease, border-color 0.15s ease, filter 0.15s ease; }
}
