/* ==========================================================================
   TourneyHub design system
   ========================================================================== */
:root {
    --bg: #f5f6fb;
    --surface: #ffffff;
    --surface-2: #f1f3f9;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e4e7f0;
    --primary: #6366f1;
    --primary-2: #8b5cf6;
    --primary-soft: rgba(99, 102, 241, .1);
    --success: #10b981;
    --warn: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
    --shadow-lg: 0 20px 50px rgba(15, 23, 42, .14);
    --radius: 16px;
    --radius-sm: 10px;
    --nav-h: 64px;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #0a0f1f;
    --surface: #121a30;
    --surface-2: #19223d;
    --text: #e8ecf8;
    --muted: #93a0bd;
    --border: #25305a;
    --primary: #818cf8;
    --primary-2: #a78bfa;
    --primary-soft: rgba(129, 140, 248, .14);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .28);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, .5);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.02em; }
h1 { font-size: 1.9rem; font-weight: 800; }
h2 { font-size: 1.3rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.right { text-align: right; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 1rem; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }
main.container { flex: 1; padding-top: 32px; padding-bottom: 56px; }

/* ---------- Navbar ---------- */
.nav {
    position: sticky; top: 0; z-index: 50; height: var(--nav-h);
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
}
.nav .container { display: flex; align-items: center; height: 100%; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; color: var(--text); letter-spacing: -.03em; }
.brand:hover { text-decoration: none; }
.brand-logo {
    width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-size: 1.05rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 6px 16px rgba(99, 102, 241, .45);
}
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-links a {
    color: var(--muted); font-weight: 600; font-size: .92rem; padding: 8px 14px; border-radius: 10px; transition: .15s;
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-links a.active { color: var(--primary); background: var(--primary-soft); }
.nav-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.icon-btn {
    width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
    color: var(--text); cursor: pointer; display: grid; place-items: center; font-size: 1.05rem; transition: .15s;
}
.icon-btn:hover { background: var(--surface-2); }
.menu-btn { display: none; }

.dropdown { position: relative; }
.dropdown-toggle {
    display: flex; align-items: center; gap: 10px; background: none; border: 1px solid var(--border); border-radius: 999px;
    padding: 4px 12px 4px 4px; cursor: pointer; color: var(--text); font: inherit; font-weight: 600; font-size: .9rem;
}
.dropdown-toggle:hover { background: var(--surface-2); }
.dropdown-menu {
    position: absolute; right: 0; top: calc(100% + 10px); min-width: 230px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 14px; box-shadow: var(--shadow-lg); padding: 8px; display: none;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu .who { padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dropdown-menu a, .dropdown-menu button {
    display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px; color: var(--text); font: inherit; font-size: .92rem;
    background: none; border: 0; cursor: pointer;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); text-decoration: none; }
.dropdown-menu .danger { color: var(--danger); }

.avatar {
    border-radius: 50%; object-fit: cover; display: inline-grid; place-items: center; color: #fff; font-weight: 700; flex: none;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 11px; border: 1px solid transparent;
    font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; transition: transform .12s, box-shadow .15s, background .15s; white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: 0 6px 18px rgba(99, 102, 241, .35); }
.btn-primary:hover { box-shadow: 0 10px 24px rgba(99, 102, 241, .45); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn-danger-ghost:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn-sm { padding: 6px 12px; font-size: .84rem; border-radius: 9px; }
.btn-block { width: 100%; }
.btn-lg { padding: 13px 26px; font-size: 1rem; }

/* ---------- Cards / layout ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-main { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.stack > * + * { margin-top: 20px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head h1 { margin: 0 0 4px; }
.page-head p { margin: 0; color: var(--muted); }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--muted); }

/* ---------- Stat tiles ---------- */
.stat { display: flex; align-items: center; gap: 16px; padding: 20px; }
.stat-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.4rem; flex: none; }
.stat-value { font-size: 1.8rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.stat-label { color: var(--muted); font-size: .85rem; font-weight: 500; margin-top: 4px; }
.tone-indigo { background: rgba(99, 102, 241, .14); } .tone-green { background: rgba(16, 185, 129, .15); }
.tone-amber { background: rgba(245, 158, 11, .16); } .tone-pink { background: rgba(236, 72, 153, .14); }
.tone-blue { background: rgba(59, 130, 246, .15); } .tone-purple { background: rgba(168, 85, 247, .15); }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; letter-spacing: .01em;
    background: var(--surface-2); color: var(--muted);
}
.badge-info { background: rgba(59, 130, 246, .14); color: var(--info); }
.badge-success { background: rgba(16, 185, 129, .15); color: var(--success); }
.badge-warn { background: rgba(245, 158, 11, .16); color: #d97706; }
.badge-danger { background: rgba(239, 68, 68, .14); color: var(--danger); }
.badge-live { background: rgba(239, 68, 68, .14); color: var(--danger); }
.badge-live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .6); } 70% { box-shadow: 0 0 0 7px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }
.badge-glass { background: rgba(255, 255, 255, .2); color: #fff; backdrop-filter: blur(6px); }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; }
.input, select.input, textarea.input {
    width: 100%; padding: 11px 14px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
    font: inherit; font-size: .95rem; transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
textarea.input { resize: vertical; min-height: 110px; }
.hint { font-size: .8rem; color: var(--muted); margin-top: 6px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-error { color: var(--danger); font-size: .88rem; min-height: 1.2em; margin-bottom: 10px; }
input[type="file"].input { padding: 9px 12px; }
input[type="datetime-local"].input, input[type="date"].input { min-height: 44px; }

.rating-input { display: inline-flex; flex-direction: row-reverse; gap: 4px; }
.rating-input input { display: none; }
.rating-input label { font-size: 1.7rem; color: var(--border); cursor: pointer; transition: .1s; margin: 0; line-height: 1; }
.rating-input label:hover, .rating-input label:hover ~ label, .rating-input input:checked ~ label { color: #f5b301; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th {
    text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700;
    padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap;
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.table .num { text-align: center; font-variant-numeric: tabular-nums; }
.table .pts { font-weight: 800; color: var(--primary); }
.table-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- Tournament cards ---------- */
.t-card { display: flex; flex-direction: column; overflow: hidden; padding: 0; transition: transform .2s, box-shadow .2s; color: inherit; }
.t-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); text-decoration: none; }
.banner { position: relative; height: 150px; overflow: hidden; color: #fff; background-size: cover; background-position: center; }
.banner::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(circle at 85% 15%, rgba(255, 255, 255, .28), transparent 45%), radial-gradient(circle at 10% 110%, rgba(0, 0, 0, .35), transparent 55%);
}
.banner .sport { position: absolute; right: 20px; bottom: -8px; color: rgba(255, 255, 255, .92); filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .28)); transform: rotate(-12deg); transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.banner .sport svg { width: 112px; height: 112px; stroke-width: 1.3; }
.t-card:hover .banner .sport { transform: rotate(0deg) scale(1.1) translateY(-6px); }
.banner .corner { position: absolute; left: 16px; top: 16px; display: flex; gap: 8px; }
.banner-lg { height: 260px; border-radius: var(--radius); }
.banner-lg .sport { right: 44px; bottom: -14px; }
.banner-lg .sport svg { width: 200px; height: 200px; stroke-width: 1.1; }
.banner img.cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.t-card .body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.t-card h3 { margin: 0; font-size: 1.08rem; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: .84rem; }
.meta span { display: inline-flex; align-items: center; gap: 5px; }
.t-card .foot { margin-top: auto; padding-top: 14px; border-top: 1px dashed var(--border); display: flex; align-items: center; justify-content: space-between; font-size: .85rem; }
.progress { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--primary-2)); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    padding: 7px 14px; border-radius: 999px; font-size: .86rem; font-weight: 600; color: var(--muted); background: var(--surface);
    border: 1px solid var(--border); cursor: pointer; transition: .15s;
}
.chip:hover { color: var(--text); text-decoration: none; border-color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.searchbar { position: relative; flex: 1; min-width: 240px; }
.searchbar .input { padding-left: 42px; }
.searchbar::before { content: ''; position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") center / contain no-repeat; }

/* ---------- Match cards / scoreboard ---------- */
.match { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; padding: 16px 18px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.match + .match { margin-top: 12px; }
.match .team { font-weight: 700; display: flex; align-items: center; gap: 10px; min-width: 0; }
.match .team.right { justify-content: flex-end; text-align: right; }
.match .team span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match .team.win { color: var(--success); }
.match .center-col { text-align: center; min-width: 110px; }
.score { font-size: 1.35rem; font-weight: 800; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.match .when { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.crest { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: .8rem; flex: none; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px; overflow-x: auto; }
.tab { padding: 12px 18px; border: 0; background: none; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Reviews ---------- */
.stars { color: #f5b301; letter-spacing: 2px; font-size: 1rem; }
.stars .off { color: var(--border); }
.review { display: flex; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--border); }
.review:last-child { border-bottom: 0; }
.review-score { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.review-score .big { font-size: 3rem; font-weight: 800; line-height: 1; letter-spacing: -.04em; }
.bars { flex: 1; min-width: 200px; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: .8rem; color: var(--muted); margin: 3px 0; }
.bar-row .progress { flex: 1; }

/* ---------- Charts ---------- */
.hbar { display: grid; grid-template-columns: 96px 1fr 34px; align-items: center; gap: 12px; margin: 12px 0; font-size: .88rem; }
.hbar .track { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 99px; }
.hbar .val { text-align: right; font-weight: 700; }
.vbars { display: flex; align-items: flex-end; gap: 14px; height: 240px; padding-top: 10px; }
.vbars .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 8px; font-size: .78rem; color: var(--muted); }
.vbars .col b { color: var(--text); font-size: .85rem; }
.vbars .col i { display: block; width: 100%; max-width: 44px; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, var(--primary-2), var(--primary)); min-height: 4px; }
.donut-wrap { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.donut { width: 150px; height: 150px; border-radius: 50%; position: relative; flex: none; }
.donut::after { content: ''; position: absolute; inset: 24px; background: var(--surface); border-radius: 50%; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; z-index: 1; text-align: center; font-weight: 800; font-size: 1.6rem; line-height: 1; }
.donut-center small { display: block; font-size: .7rem; font-weight: 600; color: var(--muted); margin-top: 4px; }
.legend { display: grid; gap: 8px; font-size: .88rem; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; }

/* ---------- Lists ---------- */
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; padding-bottom: 0; }
.list-item:first-child { padding-top: 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 26px; }
.timeline li::before { content: ''; position: absolute; left: 4px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.timeline li::after { content: ''; position: absolute; left: 8.5px; top: 20px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline li:last-child { padding-bottom: 0; }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .big { font-size: 2.6rem; margin-bottom: 8px; }
.empty h3 { color: var(--text); }

.info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.info-grid .k { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.info-grid .v { font-weight: 600; margin-top: 2px; }

.pill-list { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px; border-radius: 999px; background: var(--surface-2); font-size: .85rem; font-weight: 600; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: grid; gap: 10px; width: min(380px, calc(100vw - 40px)); }
.toast {
    display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border);
    box-shadow: var(--shadow-lg); border-left: 4px solid var(--primary); animation: slide-in .3s ease; font-size: .92rem;
}
.toast.success { border-left-color: var(--success); } .toast.error { border-left-color: var(--danger); }
.toast .x { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1.1rem; line-height: 1; }
@keyframes slide-in { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

/* ---------- Confirm dialog ---------- */
dialog { border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--text); padding: 28px; width: min(420px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(8, 12, 28, .55); backdrop-filter: blur(3px); }
dialog h3 { margin-bottom: 8px; }
dialog .row { justify-content: flex-end; margin-top: 22px; }

/* ---------- Landing ---------- */
.hero {
    position: relative; overflow: hidden; color: #fff; padding: 96px 0 120px;
    background: radial-gradient(900px 500px at 85% -10%, rgba(139, 92, 246, .75), transparent 60%), radial-gradient(700px 420px at 0% 35%, rgba(59, 130, 246, .5), transparent 70%), #0b1020;
}
.hero { -webkit-mask-image: linear-gradient(#000 84%, transparent 100%); mask-image: linear-gradient(#000 84%, transparent 100%); }
.hero::after { content: ''; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, .08) 1px, transparent 1px); background-size: 26px 26px; mask-image: linear-gradient(to bottom, #000, transparent 85%); -webkit-mask-image: linear-gradient(to bottom, #000, transparent 85%); }
.hero .container { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; }
.hero h1 { font-size: clamp(2.3rem, 5vw, 3.8rem); font-weight: 800; letter-spacing: -.04em; margin-bottom: 20px; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, #a5b4fc, #f0abfc); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 1.15rem; color: #c7d0ea; max-width: 520px; margin-bottom: 30px; }
.hero .btn-ghost { background: rgba(255, 255, 255, .08); color: #fff; border-color: rgba(255, 255, 255, .22); }
.hero .btn-ghost:hover { background: rgba(255, 255, 255, .16); }
.hero-tag { display: inline-flex; gap: 8px; align-items: center; padding: 6px 14px; border-radius: 999px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); font-size: .84rem; font-weight: 600; margin-bottom: 22px; color: #e0e7ff; }
.hero-card { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16); border-radius: 22px; padding: 22px; backdrop-filter: blur(14px); box-shadow: 0 30px 60px rgba(0, 0, 0, .35); }
.hero-card .match { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .12); color: #fff; }
.hero-card .when { color: #aab4d4; }
.hero-card .match { padding: 14px; gap: 10px; }
.hero-card .match .team { font-size: .9rem; line-height: 1.25; }
.hero-card .match .team span { white-space: normal; }
.hero-card .match .center-col { min-width: 84px; }
.nav.transparent { position: absolute; left: 0; right: 0; background: transparent; border-bottom-color: rgba(255, 255, 255, .1); backdrop-filter: none; }
.nav.transparent .brand, .nav.transparent .nav-links a { color: #fff; }
.nav.transparent .nav-links a:hover { background: rgba(255, 255, 255, .1); }
.nav.transparent .icon-btn { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .2); color: #fff; }
.stats-strip { margin-top: -56px; position: relative; z-index: 2; }
.stats-strip .card { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; text-align: center; padding: 28px 16px; }
.stats-strip .stat-value { font-size: 2.2rem; }
.section { padding-top: 64px; padding-bottom: 0; }
.section-title { text-align: center; max-width: 620px; margin: 0 auto 36px; }
.section-title h2 { font-size: 1.9rem; font-weight: 800; }
.feature { padding: 26px; }
.feature .stat-icon { margin-bottom: 14px; }
.feature p { color: var(--muted); margin: 0; font-size: .93rem; }
.cta { margin: 72px 0 0; padding: 56px 24px; border-radius: 26px; text-align: center; color: #fff; background: linear-gradient(135deg, #4f46e5, #9333ea); box-shadow: 0 30px 60px rgba(99, 102, 241, .35); }
.cta h2 { font-size: 2rem; font-weight: 800; }
.cta .btn { background: #fff; color: #4f46e5; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-art {
    position: relative; overflow: hidden; color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
    background: radial-gradient(520px 420px at 65% 5%, rgba(168, 85, 247, .7), transparent 70%), radial-gradient(520px 420px at 25% 95%, rgba(59, 130, 246, .6), transparent 70%), #0b1020;
}
.auth-art .brand { color: #fff; }
.auth-art h2 { font-size: 2.3rem; font-weight: 800; letter-spacing: -.03em; max-width: 440px; }
.auth-art p { color: #c7d0ea; max-width: 420px; }
.auth-art .floaty { position: absolute; font-size: 7rem; opacity: .16; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-box { width: min(420px, 100%); }
.auth-box h1 { font-size: 1.7rem; }
.demo-box { margin-top: 22px; padding: 16px; border-radius: 14px; border: 1px dashed var(--border); background: var(--surface); }
.demo-box .btn { margin: 4px 6px 0 0; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 26px 0; color: var(--muted); font-size: .86rem; }
.footer .container { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer a { color: var(--muted); margin-left: 18px; }
.faq details { border: 1px solid var(--border); border-radius: 14px; padding: 16px 20px; background: var(--surface); }
.faq details + details { margin-top: 12px; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq details[open] summary { color: var(--primary); margin-bottom: 8px; }
.faq details p { margin: 0; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-main { grid-template-columns: 1fr; }
    .hero .container { grid-template-columns: 1fr; }
    .hero-card { display: none; }
    .stats-strip .card { grid-template-columns: repeat(2, 1fr); row-gap: 22px; }
    .auth { grid-template-columns: 1fr; }
    .auth-art { display: none; }
}
@media (max-width: 760px) {
    .menu-btn { display: grid; }
    .nav-links { display: none; position: absolute; top: var(--nav-h); left: 0; right: 0; flex-direction: column; background: var(--surface); padding: 12px 16px; border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
    .nav.open .nav-links { display: flex; }
    .nav .container { gap: 12px; }
    .dropdown-toggle .uname { display: none; }
    .dropdown-toggle { padding: 3px; }
    .grid-2, .grid-3, .grid-4, .form-grid, .info-grid { grid-template-columns: 1fr; }
    .container { padding: 0 16px; }
    main.container { padding-top: 22px; }
    .match { grid-template-columns: 1fr; text-align: center; }
    .match .team, .match .team.right { justify-content: center; text-align: center; }
    .banner-lg { height: 190px; }
    .banner-lg .sport svg { width: 120px; height: 120px; }
    .hero { padding: 84px 0 96px; }
    h1 { font-size: 1.55rem; }
}


/* ==========================================================================
   Icons
   ========================================================================== */
svg.icon { flex: none; vertical-align: -.14em; }
.btn svg.icon, .chip svg.icon, .meta svg.icon, .badge svg.icon { vertical-align: middle; }
.chip { display: inline-flex; align-items: center; gap: 7px; }
.stat-icon svg { width: 24px; height: 24px; }
.stat-icon { transition: transform .3s cubic-bezier(.2, .7, .2, 1); }
.stat:hover .stat-icon, .feature:hover .stat-icon { transform: scale(1.1) rotate(-6deg); }
.tone-indigo { color: var(--primary); } .tone-green { color: var(--success); } .tone-amber { color: var(--warn); }
.tone-pink { color: #ec4899; } .tone-blue { color: var(--info); } .tone-purple { color: #a855f7; }
.hbar > span:first-child { display: flex; align-items: center; gap: 7px; }
.meta .prize, .row svg.icon { vertical-align: middle; }
.empty .big { color: var(--primary); opacity: .75; animation: float 5s ease-in-out infinite; }
.toast-icon { display: inline-flex; color: var(--primary); margin-top: 1px; }
.toast.success .toast-icon { color: var(--success); } .toast.error .toast-icon { color: var(--danger); }
.floaty svg { width: 1em; height: 1em; stroke-width: 1.1; }
.t-sun { display: none; }
:root[data-theme="dark"] .t-sun { display: inline; }
:root[data-theme="dark"] .t-moon { display: none; }
#themeToggle svg { transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
#themeToggle:hover svg { transform: rotate(35deg) scale(1.1); }
.pill svg, .timeline svg { vertical-align: middle; }

/* ==========================================================================
   Motion
   ========================================================================== */
@property --sweep { syntax: '<percentage>'; inherits: false; initial-value: 100%; }
@keyframes fade-up { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(var(--r, 0deg)); } 50% { transform: translateY(-14px) rotate(calc(var(--r, 0deg) + 5deg)); } }
@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes grow-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shine { to { background-position: 200% center; } }
@keyframes drift { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(60px, 40px) scale(1.15); } }
@keyframes sweep { from { --sweep: 0%; } to { --sweep: 100%; } }
@keyframes shrink { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes ring { 0% { transform: scale(.8); opacity: .6; } 100% { transform: scale(2); opacity: 0; } }
@keyframes bar-slide { 0% { transform: translateX(-120%); } 100% { transform: translateX(320%); } }
@keyframes logo-bob { 0% { transform: translateY(0) scale(1); } 100% { transform: translateY(-8px) scale(1.06); } }

/* Page entrance */
main.container, .hero .container > *, .auth-box, .stats-strip { animation: fade-up .6s cubic-bezier(.2, .7, .2, 1) backwards; }
.hero .container > *:nth-child(2) { animation-delay: .12s; }
.tab-panel.active { animation: fade-up .4s cubic-bezier(.2, .7, .2, 1) backwards; }
.dropdown.open .dropdown-menu { animation: pop .18s ease both; }
dialog[open] { animation: pop .22s ease both; }
.toast { animation: slide-in .35s cubic-bezier(.2, .7, .2, 1) both; position: relative; overflow: hidden; }
.toast.out { animation: toast-out .3s ease forwards; }
.toasts .toast::after { content: ''; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; transform-origin: left; background: var(--primary); animation: shrink 5.5s linear forwards; }
.toasts .toast.success::after { background: var(--success); } .toasts .toast.error::after { background: var(--danger); }

/* Scroll reveal (only when JS is on) */
.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity .65s ease, transform .65s cubic-bezier(.2, .7, .2, 1); transition-delay: calc(var(--i, 0) * 70ms); }
.js .reveal.in { opacity: 1; transform: none; }

/* Data-viz entrances */
.progress > i, .hbar .fill { transform-origin: left; animation: grow-x 1s cubic-bezier(.2, .7, .2, 1) .25s both; }
.vbars .col i { transform-origin: bottom; animation: grow-y .9s cubic-bezier(.2, .7, .2, 1) .3s both; }
.vbars .col:nth-child(2) i { animation-delay: .38s; } .vbars .col:nth-child(3) i { animation-delay: .46s; }
.vbars .col:nth-child(4) i { animation-delay: .54s; } .vbars .col:nth-child(5) i { animation-delay: .62s; }
.vbars .col:nth-child(6) i { animation-delay: .7s; } .vbars .col:nth-child(7) i { animation-delay: .78s; }
.donut { -webkit-mask: conic-gradient(#000 var(--sweep), transparent 0); mask: conic-gradient(#000 var(--sweep), transparent 0); animation: sweep 1.2s cubic-bezier(.2, .7, .2, 1) .3s both; }

/* Micro-interactions */
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::before { content: ''; position: absolute; top: 0; left: -80%; width: 50%; height: 100%; background: linear-gradient(110deg, transparent, rgba(255, 255, 255, .38), transparent); transform: skewX(-20deg); transition: left .7s ease; }
.btn-primary:hover::before { left: 140%; }
.btn:active { transform: translateY(0) scale(.97); }
.match { transition: border-color .2s, transform .2s, box-shadow .2s; }
.match:hover { border-color: var(--primary); transform: translateX(3px); box-shadow: var(--shadow); }
.list-item { transition: transform .2s; } a.list-item:hover { transform: translateX(4px); text-decoration: none; }
.chip { transition: .2s; } .chip:hover { transform: translateY(-1px); }
.rating-input label { transition: transform .15s, color .15s; } .rating-input label:hover { transform: scale(1.25); }
.avatar { transition: transform .2s; } .dropdown-toggle:hover .avatar { transform: scale(1.08); }
.nav-links a { position: relative; }
.card { transition: box-shadow .25s, border-color .25s; }
.stat:hover, .feature:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); box-shadow: var(--shadow-lg); }
.table tbody tr { transition: background .15s; }

/* Hero atmosphere */
.hero .blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5; animation: drift 14s ease-in-out infinite alternate; z-index: 0; }
.hero .blob.b1 { width: 420px; height: 420px; background: #7c3aed; top: -120px; right: 5%; }
.hero .blob.b2 { width: 360px; height: 360px; background: #2563eb; bottom: -140px; left: 8%; animation-delay: -6s; }
.hero-floaters { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.hero-floaters span { position: absolute; color: rgba(255, 255, 255, .13); font-size: 64px; animation: float 8s ease-in-out infinite; animation-delay: var(--d, 0s); }
.hero-floaters svg { stroke-width: 1.2; }
.hero h1 em { background-size: 200% auto; animation: shine 6s linear infinite; background-image: linear-gradient(90deg, #a5b4fc, #f0abfc, #93c5fd, #a5b4fc); }
.auth-art .floaty { animation: float 9s ease-in-out infinite; }
.auth-art .floaty:nth-of-type(2) { animation-delay: -3s; --r: 8deg; } .auth-art .floaty:nth-of-type(3) { animation-delay: -6s; --r: -10deg; }
.brand-logo { transition: transform .4s cubic-bezier(.2, .7, .2, 1); } .brand:hover .brand-logo { transform: rotate(-10deg) scale(1.08); }
.brand-logo svg { width: 18px; height: 18px; }

/* Top progress bar */
#topbar { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 400; opacity: 0; pointer-events: none; background: linear-gradient(90deg, var(--primary), var(--primary-2), #ec4899); box-shadow: 0 0 12px var(--primary); }
#topbar.run { opacity: 1; width: 82%; transition: width 9s cubic-bezier(.1, .7, .2, 1); }
#topbar.done { opacity: 0; width: 100%; transition: width .2s ease, opacity .45s ease .2s; }
main.leaving { opacity: .45; transform: translateY(4px); transition: opacity .25s, transform .25s; }

/* Button loading state */
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading svg { opacity: 0; }
.btn.loading::after { content: ''; position: absolute; width: 18px; height: 18px; left: calc(50% - 9px); top: calc(50% - 9px); border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--primary); animation: spin .7s linear infinite; }
.btn-primary.loading::after, .btn-danger.loading::after { border-color: rgba(255, 255, 255, .35); border-top-color: #fff; }
.btn.loading::before { display: none; }

/* Skeleton loaders */
.sk-line, .sk-banner, .sk-pill { background: linear-gradient(100deg, var(--surface-2) 30%, color-mix(in srgb, var(--surface-2) 40%, var(--surface)) 50%, var(--surface-2) 70%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.sk-banner { height: 150px; }
.sk-line { height: 12px; border-radius: 6px; margin-bottom: 12px; }
.sk-pill { height: 6px; border-radius: 99px; }
.t-card.sk { pointer-events: none; }
.t-card.sk:hover { transform: none; box-shadow: var(--shadow); }
.inline-loader { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--primary); animation: spin .7s linear infinite; vertical-align: -3px; }

/* Splash screen (first visit per session) */
#splash { display: none; position: fixed; inset: 0; z-index: 500; place-items: center; align-content: center; background: var(--bg); transition: opacity .55s ease, visibility .55s; }
html.splash #splash { display: grid; }
#splash.hide { opacity: 0; visibility: hidden; }
.splash-logo { position: relative; width: 76px; height: 76px; margin: 0 auto; border-radius: 24px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 18px 40px rgba(99, 102, 241, .5); animation: logo-bob .9s ease-in-out infinite alternate; }
.splash-logo svg { width: 38px; height: 38px; }
.splash-logo::before, .splash-logo::after { content: ''; position: absolute; inset: 0; border-radius: 24px; border: 2px solid var(--primary); animation: ring 1.6s ease-out infinite; }
.splash-logo::after { animation-delay: .8s; }
.splash-name { text-align: center; margin-top: 22px; font-weight: 800; font-size: 1.25rem; letter-spacing: -.03em; }
.splash-bar { width: 150px; height: 4px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 18px auto 0; }
.splash-bar i { display: block; height: 100%; width: 40%; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--primary-2)); animation: bar-slide 1.1s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
    .js .reveal { opacity: 1; transform: none; }
    html.splash #splash { display: none; }
}
