:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    --radius: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
}

.top-bar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar .container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.app-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
    background: var(--primary);
    color: white;
}

.content {
    padding-top: 1.5rem;
    padding-bottom: 2rem;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.15s;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    opacity: 0.9;
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

th {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-positive {
    background: #d1fae5;
    color: #065f46;
}

.badge-negative {
    background: #fee2e2;
    color: #991b1b;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.participant-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: var(--bg);
    border-radius: var(--radius);
}

.participant-row select {
    flex: 1;
}

.participant-row input[type="number"] {
    width: 4rem;
}

.inline-form {
    display: flex;
    gap: 0.5rem;
    align-items: end;
}

.inline-form input {
    flex: 1;
}

.match-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.match-game {
    font-weight: 600;
}

.match-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.badge-phantom {
    background: #fef3c7;
    color: #92400e;
}

.badge-regular {
    background: #dbeafe;
    color: #1e40af;
}

.badge-pending {
    background: #fce7f3;
    color: #9d174d;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

.modal-content h3 {
    margin-bottom: 0.5rem;
}

.modal-content p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

/* Error alert */
.error-alert {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-left: 4px solid var(--danger);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.error-alert-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--danger);
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
}

.error-icon {
    font-size: 1rem;
}

.error-message {
    color: #991b1b;
    font-size: 0.875rem;
    margin: 0;
}

.error-correlation {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 0.35rem;
}

.error-correlation code {
    background: #fee2e2;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-size: 0.7rem;
    word-break: break-all;
    user-select: all;
}

#blazor-error-ui {
    display: none;
}

/* ================= Landing page ================= */

html {
    scroll-behavior: smooth;
}

html,
body {
    overflow-x: clip;
}

.landing {
    margin-top: -1.5rem;
    margin-bottom: -2rem;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

.landing-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Hero */
.landing-hero {
    background:
        radial-gradient(900px 500px at 85% -10%, rgba(129, 140, 248, 0.35), transparent 60%),
        radial-gradient(700px 500px at -10% 20%, rgba(244, 114, 182, 0.18), transparent 55%),
        linear-gradient(160deg, #171532 0%, #312e81 48%, #4f46e5 100%);
    color: #fff;
    padding: 4.5rem 0 5rem;
    overflow: hidden;
    position: relative;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 3rem;
    align-items: center;
}

.hero-copy {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    animation: fadeUp 0.6s ease both;
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    width: fit-content;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #c7d2fe;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    backdrop-filter: blur(6px);
}

.hero-title {
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0;
}

.grad {
    background: linear-gradient(90deg, #fcd34d 0%, #f59e0b 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-sub {
    font-size: 1.125rem;
    line-height: 1.6;
    color: #c7d2fe;
    max-width: 34rem;
    margin: 0;
}

.hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.btn-hero {
    background: #fff;
    color: #312e81;
    font-weight: 700;
    font-size: 1rem;
    padding: 0.85rem 1.75rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-hero:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.32);
    background: #fff;
    color: #312e81;
}

.btn-hero-ghost {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.4);
    font-weight: 600;
    font-size: 1rem;
    padding: 0.85rem 1.75rem;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.15s ease;
}

.btn-hero-ghost:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.hero-note {
    font-size: 0.85rem;
    color: #a5b4fc;
    margin: 0;
}

/* Hero visual */
.hero-visual {
    position: relative;
    animation: fadeUp 0.7s 0.1s ease both;
}

.mock-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 16px;
    padding: 1.25rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.mock-head {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.9rem;
    color: #e0e7ff;
}

.mock-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.65rem;
    border-radius: 10px;
    margin-bottom: 0.4rem;
    background: rgba(255, 255, 255, 0.06);
}

.mock-pos {
    font-weight: 800;
    width: 1.5rem;
    text-align: center;
    border-radius: 999px;
    padding: 0.15rem 0;
    font-size: 0.85rem;
}

.pos-1 { background: #f59e0b; color: #451a03; }
.pos-2 { background: #94a3b8; color: #0f172a; }
.pos-3 { background: #b45309; color: #fffbeb; }

.mock-avatar { font-size: 1.15rem; }

.mock-name {
    flex: 1;
    font-weight: 600;
    color: #fff;
}

.mock-elo {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: #e0e7ff;
}

.mock-delta {
    font-size: 0.8rem;
    font-weight: 700;
    min-width: 2.5rem;
    text-align: right;
}

.mock-delta.up { color: #34d399; }
.mock-delta.down { color: #f87171; }

.mock-match {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    max-width: 22rem;
    animation: float 5s ease-in-out infinite;
}

.mock-match-icon { font-size: 1.6rem; }
.mock-match-sub { display: block; color: #c7d2fe; font-size: 0.8rem; }
.mock-match-check {
    margin-left: auto;
    background: #34d399;
    color: #052e1b;
    font-weight: 800;
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Stats */
.landing-stats {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 2.5rem 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.stat-label {
    display: block;
    margin-top: 0.4rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Sections */
.landing-section {
    padding: 4rem 0;
}

.section-title {
    font-size: clamp(1.75rem, 3vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    text-align: center;
    margin-bottom: 0.75rem;
}

.grad-dark {
    background: linear-gradient(90deg, #6366f1 0%, #a855f7 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.section-sub {
    text-align: center;
    color: var(--text-muted);
    max-width: 36rem;
    margin: 0 auto 2.5rem;
    font-size: 1.05rem;
}

/* Features */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.75rem 1.5rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(79, 70, 229, 0.14);
}

.feature-icon {
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #eef2ff, #f5f3ff);
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.1rem;
    margin: 0 0 0.5rem;
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.55;
    margin: 0;
}

/* How it works */
.landing-how {
    background: #f1f5f9;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.step {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.75rem 1.5rem;
    text-align: center;
}

.step-num {
    width: 2.5rem;
    height: 2.5rem;
    margin: 0 auto 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: #fff;
    font-weight: 800;
}

.step h3 {
    font-size: 1.05rem;
    margin: 0 0 0.4rem;
}

.step p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

/* CTA */
.landing-cta {
    background:
        radial-gradient(800px 400px at 50% 120%, rgba(129, 140, 248, 0.35), transparent 60%),
        linear-gradient(160deg, #171532, #4f46e5);
    color: #fff;
    padding: 4rem 0;
    text-align: center;
}

.cta-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.landing-cta h2 {
    font-size: clamp(1.6rem, 3vw, 2.3rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0;
}

.landing-cta p {
    color: #c7d2fe;
    margin: 0 0 0.75rem;
    font-size: 1.05rem;
}

/* Footer */
.landing-footer {
    background: #0f0d26;
    color: #a5b4fc;
    padding: 2.5rem 0;
    text-align: center;
}

.footer-brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    margin: 0 0 0.3rem;
}

.footer-tag {
    font-size: 0.9rem;
    margin: 0;
}

/* Animations */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* Responsive */
@media (max-width: 860px) {
    .hero-grid { grid-template-columns: 1fr; gap: 2.5rem; }
    .hero-visual { max-width: 26rem; margin: 0 auto; width: 100%; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .features-grid { grid-template-columns: repeat(2, 1fr); }
    .steps-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
    .features-grid { grid-template-columns: 1fr; }
    .hero-cta { flex-direction: column; }
    .btn-hero, .btn-hero-ghost { width: 100%; text-align: center; justify-content: center; }
}

/* Language selector */
.lang-selector {
    margin-left: auto;
}

.lang-selector select {
    width: auto;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
}
