/* ============================================================
   Elimly — electric indigo identity. Solid colors, no gradients.
   The bracket geometry IS the visual signature (see hero SVG).
   Mobile-first.
   ============================================================ */

:root {
    /* Brand — electric indigo (primary) + sky-cyan (accent for "ly") */
    --primary:        oklch(0.54 0.22 264);  /* electric indigo */
    --primary-hover:  oklch(0.47 0.22 264);
    --primary-deep:   oklch(0.32 0.18 264);  /* deep slate-indigo for high contrast */
    --primary-soft:   oklch(0.96 0.035 264); /* tinted bg for selected rows / chips */
    --primary-softer: oklch(0.93 0.05 264);

    --accent:         oklch(0.72 0.16 232);  /* sky-cyan for the wordmark "ly" + highlights */
    --accent-soft:    oklch(0.95 0.045 232);

    /* Neutrals — tinted toward brand hue, no warm-cream defaults */
    --bg:             oklch(1 0 0);
    --surface-2:      oklch(0.985 0.006 264); /* hero / alternating sections */
    --surface-3:      oklch(0.97 0.01 264);   /* input bg, hovered cells */
    --card-bg:        oklch(1 0 0);
    --border:         oklch(0.92 0.012 264);
    --border-strong:  oklch(0.84 0.018 264);

    --text-main:      oklch(0.20 0.018 264); /* deep slate with brand tint */
    --text-muted:     oklch(0.46 0.018 264);
    --text-faint:     oklch(0.62 0.015 264);
    --text-on-dark:   oklch(1 0 0);
    --text-on-dark-muted: oklch(0.88 0.04 264);

    /* Footer — deep slate, not pure black */
    --footer-bg:      oklch(0.20 0.018 264);
    --footer-text:    oklch(0.84 0.018 264);
    --footer-muted:   oklch(0.62 0.015 264);

    /* Semantic */
    --success:        oklch(0.55 0.16 155);
    --success-soft:   oklch(0.95 0.06 155);
    --success-ink:    oklch(0.30 0.13 155);
    --danger:         oklch(0.58 0.22 25);
    --danger-soft:    oklch(0.95 0.05 25);
    --danger-ink:     oklch(0.38 0.18 25);
    --warning:        oklch(0.72 0.16 75);
    --info:           oklch(0.62 0.15 232);
    --info-soft:      oklch(0.95 0.045 232);
    --info-ink:       oklch(0.38 0.13 232);

    /* Radii */
    --r-sm:  6px;
    --r:     10px;
    --r-lg:  14px;
    --r-xl:  18px;
    --r-input: 8px;

    /* Shadows — brand-tinted at low alpha, no neutral drops */
    --shadow-sm:    0 1px 2px 0 oklch(0.20 0.018 264 / 0.05);
    --shadow:       0 2px 6px -1px oklch(0.20 0.018 264 / 0.08), 0 1px 2px -1px oklch(0.20 0.018 264 / 0.04);
    --shadow-lg:    0 20px 40px -16px oklch(0.20 0.018 264 / 0.18), 0 6px 16px -8px oklch(0.20 0.018 264 / 0.08);
    --shadow-glow:  0 0 0 4px oklch(0.54 0.22 264 / 0.18);
    --shadow-card:  0 4px 16px -6px oklch(0.20 0.018 264 / 0.08);

    /* Motion */
    --ease:         cubic-bezier(0.16, 1, 0.3, 1);

    /* Layout */
    --container-w: 1200px;
    --nav-h: 64px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    background: var(--bg);
    color: var(--text-main);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif;
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
body { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5 { margin: 0 0 0.75rem; color: var(--text-main); }
h1 { font-size: 2.25rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
h2 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; }
h3 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
h4 { font-size: 1rem; font-weight: 600; }
p  { margin: 0 0 1rem; color: var(--text-main); }
a  { color: var(--primary-hover); text-decoration: none; }
a:hover { color: var(--primary); text-decoration: underline; }

.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-small { font-size: 0.875rem; }

/* ---------- Layout ---------- */
.container {
    width: 100%;
    max-width: var(--container-w);
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
    flex: 1;
}

.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-4 { margin-top: 1rem; }
.mt-8 { margin-top: 2rem; }
.flex { display: flex; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.items-center { align-items: center; }
.hidden { display: none !important; }
.w-full { width: 100%; }

.page { flex: 1; padding-bottom: 3rem; }

/* ============================================================
   Header (white, sticky)
   ============================================================ */
.main-nav {
    position: sticky; top: 0; z-index: 50;
    background: #FFFFFF;
    border-bottom: 1px solid var(--border);
}
.nav-container {
    max-width: var(--container-w);
    margin: 0 auto;
    padding: 0 1.25rem;
    display: flex; align-items: center; gap: 1.25rem;
    min-height: var(--nav-h);
}
.nav-brand {
    color: var(--text-main); font-weight: 700; font-size: 1.0625rem;
    letter-spacing: -0.01em; display: inline-flex; align-items: center; gap: 0.5rem;
    text-decoration: none;
}
.nav-brand:hover { color: var(--text-main); text-decoration: none; }
/* Geometric bracket mark: two short verticals connected to a single right-bound
   line. Reads as the actual bracket the product builds. Stroke-only, no fill. */
.nav-brand-mark {
    width: 1.625rem; height: 1.625rem;
    flex: 0 0 auto;
    border-radius: 7px;
    background: var(--primary);
    box-shadow: 0 1px 2px oklch(0.54 0.22 264 / 0.25);
    background-image:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'><path d='M6 6 L6 10 L11 10'/><path d='M6 18 L6 14 L11 14'/><path d='M11 10 L11 14'/><path d='M11 12 L18 12'/></svg>");
    background-position: center;
    background-size: 88%;
    background-repeat: no-repeat;
}
.nav-brand-mark { background-color: var(--primary); }

/* Wordmark — "Elim" in ink + "ly" in indigo. Reads as the elimination cut-off. */
.nav-brand-text { font-weight: 700; letter-spacing: -0.02em; font-size: 1.0625rem; }
.nav-brand-text-accent { color: var(--primary); }
/* On dark surfaces (footer) the indigo "ly" goes muddy — bump to cyan accent. */
.footer .nav-brand-text-accent { color: var(--accent); }

.nav-links { display: flex; align-items: center; gap: 0.25rem; margin-left: auto; }
.nav-links a {
    color: var(--text-main);
    padding: 0.5rem 0.875rem;
    border-radius: var(--r-sm);
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.nav-links a:hover { background: var(--surface-3); color: var(--text-main); text-decoration: none; }
.nav-links a.active { color: var(--primary-hover); background: var(--primary-soft); }
.nav-links a.nav-cta {
    background: var(--primary); color: #fff;
    padding: 0.5rem 1rem;
    margin-left: 0.5rem;
    border-radius: var(--r-input);
    border: 1px solid var(--primary);
    box-shadow: 0 1px 2px 0 oklch(0.54 0.22 264 / 0.20);
    transition: background 0.15s var(--ease), box-shadow 0.15s, transform 0.05s;
}
.nav-links a.nav-cta:hover {
    background: var(--primary-hover); border-color: var(--primary-hover); color: #fff;
    box-shadow: 0 4px 14px -4px oklch(0.54 0.22 264 / 0.35);
}
.nav-links a.nav-cta:active { transform: translateY(1px); }

/* Sign out — outlined secondary, sits opposite to Sign in. Subtle so we don't
   encourage logout, but always findable. */
.nav-links a.nav-signout {
    margin-left: 0.5rem;
    padding: 0.5rem 0.875rem;
    border: 1px solid var(--border-strong);
    color: var(--text-muted);
    background: var(--card-bg);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.nav-links a.nav-signout:hover {
    background: var(--surface-3);
    color: var(--text-main);
    border-color: var(--border-strong);
}

/* ---------- Create dropdown (primary "+ Create ▾" + panel) ---------- */
.nav-create-dropdown { position: relative; }

.nav-dropdown-trigger {
    display: inline-flex; align-items: center; gap: 0.375rem;
    background: var(--primary); color: #fff;
    border: 1px solid var(--primary);
    padding: 0.5rem 0.875rem 0.5rem 0.75rem;
    margin-right: 0.5rem;
    border-radius: var(--r-input);
    font: inherit; font-size: 0.9375rem; font-weight: 600;
    cursor: pointer;
    box-shadow: 0 1px 2px 0 oklch(0.54 0.22 264 / 0.20);
    transition: background 0.15s var(--ease), box-shadow 0.15s, transform 0.05s;
}
.nav-dropdown-trigger:hover {
    background: var(--primary-hover); border-color: var(--primary-hover);
    box-shadow: 0 4px 14px -4px oklch(0.54 0.22 264 / 0.35);
}
.nav-dropdown-trigger:active { transform: translateY(1px); }

.nav-dropdown-plus {
    display: inline-grid; place-items: center;
    width: 1.125rem; height: 1.125rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 0.875rem; font-weight: 700; line-height: 1;
}
.nav-dropdown-chev {
    width: 14px; height: 14px;
    transition: transform 0.18s ease-out;
}
.nav-dropdown-trigger[aria-expanded="true"] .nav-dropdown-chev {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    min-width: 240px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    padding: 0.375rem;
    z-index: 60;
    animation: navDropIn 0.16s cubic-bezier(0.2, 0.8, 0.2, 1);
    transform-origin: top left;
}
.nav-dropdown-menu[hidden] { display: none; }
.nav-links .nav-dropdown-menu a {
    display: flex; align-items: center; gap: 0.625rem;
    padding: 0.5625rem 0.75rem;
    border-radius: var(--r-sm);
    color: var(--text-main);
    font-size: 0.9375rem; font-weight: 500;
    text-decoration: none;
    transition: background 0.1s, color 0.1s;
    background: transparent;
}
.nav-links .nav-dropdown-menu a:hover,
.nav-links .nav-dropdown-menu a:focus-visible {
    background: var(--primary-soft);
    color: var(--primary-hover);
    text-decoration: none;
    outline: none;
}
.nav-links .nav-dropdown-menu a::before {
    content: '+';
    flex: 0 0 1rem;
    text-align: center;
    color: var(--primary);
    font-weight: 700;
    font-size: 1rem;
    line-height: 1;
}

@keyframes navDropIn {
    from { opacity: 0; transform: translateY(-4px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.nav-links a.nav-profile {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.25rem 0.625rem 0.25rem 0.375rem;
}
.nav-profile-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Avatar — circular, used in nav + profile page + (future) bracket header */
.avatar {
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--surface-3);
    color: var(--text-muted);
    object-fit: cover;
    overflow: hidden;
    font-weight: 700;
    flex: 0 0 auto;
    border: 1px solid var(--border);
}
.avatar-sm { width: 28px; height: 28px; font-size: 0.75rem; }
.avatar-lg { width: 88px; height: 88px; font-size: 1.875rem; }
.avatar-placeholder {
    background: var(--primary-soft);
    color: var(--primary-hover);
    border-color: transparent;
}

.profile-avatar-row {
    display: flex; align-items: center; gap: 1rem;
    margin-bottom: 0.5rem;
}

/* Action chips shown above the My brackets table (one per tournament type) */
.create-chips {
    display: flex; flex-wrap: wrap; gap: 0.5rem;
    margin-bottom: 1.5rem;
}
.create-chips a {
    display: inline-flex; align-items: center; gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-input);
    background: var(--card-bg);
    color: var(--text-main);
    font-size: 0.875rem; font-weight: 600;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.create-chips a:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary-hover);
    text-decoration: none;
}
.create-chips a::before {
    content: '+'; font-weight: 700; font-size: 1.125rem; line-height: 1;
    color: var(--primary);
}

.menu-toggle {
    display: none; margin-left: auto;
    background: transparent; border: 1px solid var(--border-strong); color: var(--text-main);
    width: 44px; height: 44px; border-radius: var(--r-sm); cursor: pointer;
    align-items: center; justify-content: center; font-size: 1.25rem;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.6875rem 1.25rem;
    background: var(--primary); color: #fff;
    border: 1px solid var(--primary); border-radius: var(--r-input);
    font: inherit; font-weight: 600; font-size: 0.9375rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s var(--ease), border-color 0.15s, box-shadow 0.2s var(--ease), transform 0.08s;
    min-height: 44px;
    line-height: 1.2;
    box-shadow: 0 1px 2px 0 oklch(0.54 0.22 264 / 0.20);
}
.btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; text-decoration: none; box-shadow: 0 6px 18px -5px oklch(0.54 0.22 264 / 0.40); transform: translateY(-1px); }
.btn:active { transform: translateY(0); box-shadow: 0 1px 2px 0 oklch(0.54 0.22 264 / 0.20); }
.btn:disabled { background: var(--border-strong); border-color: var(--border-strong); cursor: not-allowed; box-shadow: none; filter: grayscale(0.4); transform: none; }

.btn-secondary { background: var(--card-bg); color: var(--text-main); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--surface-3); color: var(--text-main); border-color: var(--border-strong); box-shadow: var(--shadow); }

.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface-3); color: var(--text-main); border-color: transparent; box-shadow: none; }

.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #DC2626; border-color: #DC2626; }

.btn-success { background: var(--success); border-color: var(--success); }
.btn-success:hover { background: #15803D; border-color: #15803D; }

.btn-sm { padding: 0.375rem 0.875rem; font-size: 0.8125rem; min-height: 36px; }
.btn-block { width: 100%; }

/* Google sign-in button — Google brand guidelines (white surface, dark text) */
.btn-google {
    background: #fff; color: #1F1F1F;
    border-color: #DADCE0; box-shadow: 0 1px 2px 0 rgba(60,64,67,0.1);
}
.btn-google:hover {
    background: #F8F9FA; color: #1F1F1F;
    border-color: #DADCE0; box-shadow: 0 1px 3px 0 rgba(60,64,67,0.15);
}
.btn-google svg { flex: 0 0 18px; }

/* Divider with "or" label between auth options */
.auth-divider {
    display: flex; align-items: center; gap: 0.75rem;
    color: var(--text-muted); font-size: 0.8125rem;
    margin: 1rem 0;
}
.auth-divider::before, .auth-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ============================================================
   HERO — light tinted surface + ambient bracket-line animation.
   Lines drift slowly in the background, derived from the actual
   bracket geometry the product builds.
   ============================================================ */
.hero {
    background: var(--surface-2);
    color: var(--text-main);
    padding: 4rem 0 3rem;
    position: relative;
    overflow: hidden;
    isolation: isolate;
    border-bottom: 1px solid var(--border);
}
/* Ambient bracket-line layer — sits behind hero content. The SVG itself
   carries the stroke-dash animation (see index.php hero). */
.hero-bg {
    position: absolute; inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0.9;
}
/* Soft radial wash to add ambient depth without a literal gradient bg.
   It's a single decorative orb, not a multi-stop garish blend. */
.hero-bg::after {
    content: '';
    position: absolute;
    top: -20%; right: -10%;
    width: 70%; height: 140%;
    background: radial-gradient(circle at center, oklch(0.72 0.16 232 / 0.10), transparent 60%);
    filter: blur(20px);
    pointer-events: none;
}
.hero-inner {
    position: relative;
    max-width: var(--container-w);
    margin: 0 auto;
    padding: 0 1.25rem;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    grid-template-areas:
        "text  types"
        "feats types";
    gap: 2.5rem 3rem;
    align-items: start;
}
.hero-text       { grid-area: text; }
.hero-features   { grid-area: feats; margin-top: -1rem; }
.hero-types-card { grid-area: types; }

.hero-eyebrow {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.3rem 0.7rem 0.3rem 0.55rem;
    background: var(--card-bg);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 0.75rem; font-weight: 600;
    letter-spacing: -0.005em;
    margin-bottom: 1.25rem;
}
.hero-eyebrow-dot {
    width: 6px; height: 6px; border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 0 3px oklch(0.72 0.16 232 / 0.20);
    animation: heroDotPulse 2.4s var(--ease) infinite;
}
@keyframes heroDotPulse {
    0%, 100% { box-shadow: 0 0 0 3px oklch(0.72 0.16 232 / 0.20); }
    50%      { box-shadow: 0 0 0 6px oklch(0.72 0.16 232 / 0); }
}

.hero-text h1 {
    color: var(--text-main);
    font-size: clamp(2rem, 2.6vw + 1rem, 3.25rem);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.035em;
    margin-bottom: 1rem;
    text-wrap: balance;
}
.hero-text h1 em {
    font-style: normal;
    color: var(--primary);
}
.hero-sub {
    color: var(--text-muted);
    font-size: 1.0625rem;
    max-width: 480px;
    margin-bottom: 1.75rem;
    line-height: 1.5;
}
.hero-features { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.875rem; }
.hero-features li {
    display: grid;
    grid-template-columns: 1.25rem 1fr;
    gap: 0.75rem;
    align-items: start;
    color: var(--text-main);
}
.hero-features .check {
    width: 1.125rem; height: 1.125rem;
    background: var(--primary); color: #fff;
    border-radius: 999px;
    display: inline-grid; place-items: center;
    margin-top: 0.25rem;
    font-size: 0.625rem; font-weight: 700;
    flex-shrink: 0;
}
.hero-features strong { display: block; font-weight: 600; color: var(--text-main); }
.hero-features span.desc { color: var(--text-muted); font-size: 0.9375rem; line-height: 1.45; }

/* Right card: tournament type selector. Sits on the light hero, so it needs
   a strong card surface to read as the primary action region. */
.hero-types-card {
    background: var(--card-bg);
    border-radius: var(--r-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-strong);
}
.hero-types-card h3 {
    color: var(--text-main);
    margin: 0 0 0.875rem;
    font-size: 1.0625rem;
    font-weight: 700;
}
.type-list {
    display: flex; flex-direction: column; gap: 0.5rem;
    list-style: none; padding: 0; margin: 0;
}
.type-row {
    display: grid;
    grid-template-columns: 2.25rem 1fr 1rem;
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem 0.875rem;
    background: #fff;
    border: 1px solid transparent;
    border-radius: var(--r);
    color: var(--text-main);
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.type-row:hover {
    color: var(--text-main); text-decoration: none;
    border-color: var(--primary);
    background: #fff;
}
.type-row:active { transform: translateY(1px); }
.type-row-icon {
    width: 2.5rem; height: 2.5rem;
    background: var(--primary-soft); color: var(--primary-hover);
    border-radius: var(--r-sm);
    display: inline-grid; place-items: center;
    flex-shrink: 0;
}
.type-row-icon svg { display: block; width: 1.625rem; height: 1.625rem; }
.type-row-body strong { display: block; font-weight: 600; font-size: 0.9375rem; color: var(--text-main); margin-bottom: 0.0625rem; }
.type-row-body span { color: var(--text-muted); font-size: 0.8125rem; line-height: 1.35; display: block; }
.type-row-chev { color: var(--text-faint); font-size: 1.1rem; line-height: 1; }

.hero-bottom {
    text-align: center;
    padding: 1.5rem 0 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}
.hero-bottom a { color: var(--text-muted); }
.hero-bottom .down-arrow {
    display: inline-grid; place-items: center;
    width: 1.875rem; height: 1.875rem;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    margin: 0.5rem auto 0;
    background: var(--card-bg);
}

/* ============================================================
   Format sections — alternating layout (text + mini preview)
   ============================================================ */
.format-section {
    padding: 4rem 0;
    border-bottom: 1px solid var(--border);
}
.format-section:last-child { border-bottom: none; }
.format-section:nth-child(even) { background: var(--surface-2); }
.format-inner {
    max-width: var(--container-w);
    margin: 0 auto;
    padding: 0 1.25rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: stretch;
}
.format-inner > .format-text { align-self: center; }
.format-section.flip .format-inner { direction: rtl; }
.format-section.flip .format-inner > * { direction: ltr; }

.format-text h2 { font-size: 2rem; margin-bottom: 1rem; line-height: 1.15; }
.format-text p { color: var(--text-muted); margin-bottom: 1.5rem; font-size: 1.0625rem; }
.format-text .btn { margin-top: 0.25rem; }

/* Mini-bracket preview card — fills full available height of section */
.mini-bracket-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 340px;
}

/* Bracket-tree layout (SE / DE / Swiss) — every column flex-grows equally */
.mini-bracket {
    display: flex;
    gap: 0.625rem;
    align-items: stretch;
    width: 100%;
    flex: 1;
    min-height: 0;
}
.mini-round {
    display: flex; flex-direction: column;
    flex: 1 1 0;
    min-width: 0;
}
.mini-round-label {
    font-size: 0.625rem; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.06em;
    font-weight: 700; margin-bottom: 0.5rem;
    text-align: center;
    flex: 0 0 auto;
}
/* The cell wrapper makes space-around distribute matches symmetrically
   so later rounds line up with the midpoint between paired matches. */
.mini-round-cells {
    display: flex; flex-direction: column;
    flex: 1;
    justify-content: space-around;
    gap: 0.375rem;
    min-height: 0;
}

.mini-match {
    background: var(--card-bg);
    border: 1px solid var(--border-strong);
    border-radius: 5px;
    overflow: hidden;
    flex: 0 0 auto;
}
.mini-match.blue  { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary-softer) inset; }
.mini-match.green { border-color: var(--success); }
.mini-slot {
    display: flex; align-items: center; gap: 0.375rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
    color: var(--text-main);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    line-height: 1.2;
}
.mini-slot:last-child { border-bottom: none; }
.mini-slot .nm {
    flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    font-weight: 500;
}
.mini-slot .sc {
    background: var(--primary-deep);
    color: #fff;
    min-width: 18px; padding: 0 4px; text-align: center;
    font-size: 0.6875rem; font-weight: 700;
    border-radius: 3px;
}

/* Round-robin / Swiss / Mixed mini layouts — grid that fills the card */
.mini-rr {
    display: grid; gap: 0.5rem;
    grid-template-columns: repeat(4, 1fr);
    flex: 1;
    align-content: stretch;
}
.mini-rr .mini-match { width: 100%; }
.mini-rr-col {
    display: flex; flex-direction: column;
    gap: 0.375rem;
    justify-content: space-around;
}
.mini-rr-col .mini-round-label { text-align: center; margin-bottom: 0.25rem; flex: 0 0 auto; }

/* Vertical stacks for DE / mixed (multiple sub-brackets in the same card).
   Each sub takes its natural height; card grows to fit (no shrink-overlap). */
.mini-stack {
    display: flex; flex-direction: column;
    gap: 1rem;
    flex: 1 1 auto;
    width: 100%;
}
.mini-stack > .mini-sub {
    display: flex; flex-direction: column;
    flex: 0 0 auto;
}
.mini-sub-label {
    font-size: 0.6875rem; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.06em;
    font-weight: 700; margin-bottom: 0.5rem;
}
/* In stacked layouts each sub-bracket has its own min row-height so matches
   don't collapse to nothing. */
.mini-sub .mini-bracket { min-height: 150px; }
.mini-sub .mini-rr { min-height: 140px; }

/* ============================================================
   Cards / Tables / Forms / Bracket tree (unchanged in spirit)
   ============================================================ */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}
.empty-state {
    padding: 3rem 1rem; text-align: center; color: var(--text-muted);
    background: var(--card-bg); border: 1px dashed var(--border-strong); border-radius: var(--r-lg);
}
.section-head {
    display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
    margin: 0 0 1rem;
}

/* ---------- Forms ---------- */
label {
    display: block; font-weight: 600; font-size: 0.875rem;
    color: var(--text-main); margin-bottom: 0.375rem;
}
input[type="text"], input[type="email"], input[type="number"], input[type="password"], select, textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    background: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-input);
    font: inherit; font-size: 0.9375rem;
    transition: border-color 0.15s, box-shadow 0.15s;
    min-height: 44px;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: var(--shadow-glow);
}
.form-row { display: flex; flex-direction: column; gap: 0.875rem; }
.form-row.inline { flex-direction: row; gap: 0.625rem; align-items: flex-end; flex-wrap: wrap; }

/* Scoring settings on create.php */
.scoring-grid { display: flex; flex-direction: column; gap: 1rem; }
.toggle-row {
    display: flex; align-items: flex-start; gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--border); border-radius: var(--r-input);
    background: var(--surface-2); cursor: pointer;
}
.toggle-row input[type="checkbox"] { width: 18px; min-height: 0; margin: 2px 0 0; flex: 0 0 auto; }
.toggle-row strong { display: block; font-size: 0.9375rem; }
.toggle-row .text-small { display: block; margin-top: 0.125rem; }
.points-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.points-row input[type="number"] { min-height: 0; padding: 0.5rem 0.625rem; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) { .points-row { gap: 0.5rem; } }
.form-help { color: var(--text-muted); font-size: 0.8125rem; margin-top: 0.375rem; }
input[type="range"] { width: 100%; padding: 0; min-height: auto; background: transparent; border: none; }

/* ---------- Player input list (editor) ---------- */
.players-list { display: flex; flex-direction: column; gap: 0.5rem; }
.players-list .player-row { display: flex; align-items: center; gap: 0.5rem; }
.players-list .player-row .seed {
    width: 28px; height: 28px; flex: 0 0 28px;
    background: var(--primary-soft); color: var(--primary-hover);
    border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.players-list input { flex: 1; }

/* ---------- Bracket tree (real game) ---------- */
.bracket-wrap { overflow-x: auto; padding: 0.5rem 0; -webkit-overflow-scrolling: touch; }
.bracket { display: flex; min-width: 100%; align-items: stretch; }
.bracket-round {
    display: flex; flex-direction: column;
    flex: 1 0 220px; min-width: 220px;
    padding: 0 0.25rem;
}
.bracket-round-label {
    text-align: center; font-size: 0.75rem; font-weight: 700;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
}
.bracket-cells { display: flex; flex-direction: column; flex: 1; }
.bracket-cell {
    flex: 1; display: flex; align-items: center;
    position: relative; padding: 0.4rem 1.25rem 0.4rem 0;
    min-height: 4.5rem;
}
.bracket-round:last-child .bracket-cell { padding-right: 0; }
.bracket-round:not(:last-child) .bracket-cells .bracket-cell::before {
    content: ''; position: absolute; right: 0; top: 50%; width: 1.25rem; height: 1px; background: var(--border-strong);
}
.bracket-round:not(:last-child) .bracket-cells .bracket-cell::after {
    content: ''; position: absolute; right: 0; width: 1px; background: var(--border-strong);
}
.bracket-round:not(:last-child) .bracket-cells .bracket-cell:nth-child(odd)::after  { top: 50%; bottom: 0; }
.bracket-round:not(:last-child) .bracket-cells .bracket-cell:nth-child(even)::after { top: 0; height: 50%; }

.bracket-match {
    flex: 1; background: var(--card-bg);
    border: 1px solid var(--border-strong); border-radius: 6px;
    overflow: hidden; box-shadow: var(--shadow-sm);
}
.bracket-match[data-finished="1"] { border-color: var(--border); }
.bracket-match[data-editable="1"] { border-color: oklch(0.54 0.22 264 / 0.45); }
.third-place-wrap { max-width: 280px; }
.bracket-match.is-editable:focus-within { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }

/* Inline score input shown on editable matches (replaces the score badge).
   `input.bracket-slot-score-input` bumps specificity above the global
   input[type="number"] rule so width/padding/min-height aren't overridden. */
input.bracket-slot-score-input {
    width: 2.75rem;
    min-height: 32px;
    padding: 0.3125rem 0.375rem;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    background: var(--bg);
    color: var(--text-main);
    font: inherit;
    font-size: 0.875rem; font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
    appearance: textfield;
    -moz-appearance: textfield;
    flex: 0 0 auto;
}
input.bracket-slot-score-input::-webkit-outer-spin-button,
input.bracket-slot-score-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input.bracket-slot-score-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-soft);
}

/* Save chip — hidden via [hidden], appears when both inputs are valid & dirty. */
.bracket-match-save {
    display: block; width: 100%;
    min-height: 36px;
    padding: 0.5rem 0.75rem;
    border: none; border-top: 1px solid var(--primary-hover);
    background: var(--primary); color: #fff;
    font: inherit; font-size: 0.8125rem; font-weight: 600;
    text-align: center; cursor: pointer;
    transition: background 0.15s var(--ease);
}
.bracket-match-save:hover { background: var(--primary-hover); }
.bracket-match-save:disabled { background: var(--border-strong); cursor: wait; }
.bracket-match-save[hidden] { display: none; }
.bracket-slot {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.4rem 0.625rem;
    font-size: 0.8125rem;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    color: var(--text-main);
}
.bracket-slot:last-child { border-bottom: none; }
.bracket-slot.is-winner { font-weight: 600; background: var(--primary-soft); }
.bracket-slot.is-empty { color: var(--text-muted); font-style: italic; }
.bracket-slot-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bracket-slot-score {
    background: var(--primary-deep);
    color: #fff;
    min-width: 20px; padding: 0 6px; text-align: center;
    font-size: 0.75rem; font-weight: 700;
    border-radius: 3px;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 1px 2px oklch(0.20 0.018 264 / 0.20);
}

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem; font-weight: 600;
    text-transform: capitalize;
}
.badge-draft     { background: var(--surface-3); color: var(--text-muted); }
.badge-active    { background: var(--success-soft); color: var(--success); }
.badge-finished  { background: var(--primary-soft); color: var(--primary-hover); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table {
    width: 100%; border-collapse: collapse; background: var(--card-bg);
    border: 1px solid var(--border); border-radius: var(--r); overflow: hidden;
}
th, td { padding: 0.625rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
th {
    background: var(--surface-3); color: var(--text-muted);
    font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700;
}
tr:last-child td { border-bottom: none; }

/* ---------- Modal / bottom-sheet ---------- */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(15, 23, 42, 0.55);
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.15s ease-out;
}
.modal-card {
    background: var(--card-bg);
    border-radius: var(--r-lg);
    width: 100%; max-width: 420px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: modalIn 0.2s ease-out;
}
.modal-header { padding: 1.25rem 1.5rem 0.5rem; }
.modal-header h3 { margin: 0; }
.modal-body { padding: 0.5rem 1.5rem 1.25rem; color: var(--text-muted); }
.modal-body p { color: var(--text-muted); margin-bottom: 1rem; }
.modal-body p:last-child { margin-bottom: 0; }
.modal-footer { padding: 0 1.5rem 1.25rem; display: flex; gap: 0.625rem; justify-content: flex-end; }

/* ---------- Share modal ---------- */
.bracket-header-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.share-modal { max-width: 460px; }
.share-url-row {
    display: flex; gap: 0.5rem; align-items: stretch;
    margin: 0 0 1rem;
}
.share-url-input {
    flex: 1; min-width: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.875rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    background: var(--surface-2);
    color: var(--text-main);
}
.share-url-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.share-copy-btn { flex-shrink: 0; }
.share-targets-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 0.5rem;
}
.share-target {
    display: flex; align-items: center; justify-content: center;
    padding: 0.7rem 0.75rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    background: var(--card-bg);
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: background 0.15s, border-color 0.15s, transform 0.05s;
    min-height: 44px;
}
.share-target:hover { background: var(--surface-3); border-color: var(--accent); color: var(--text-main); }
.share-target:active { transform: scale(0.98); }
@media (max-width: 640px) {
    .share-url-row { flex-direction: column; }
    .share-copy-btn { width: 100%; }
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes sheetIn { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ---------- Sticky CTA (mobile) ---------- */
.sticky-cta {
    position: sticky; bottom: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, var(--bg) 30%);
    padding: 1rem 0 0.5rem;
    z-index: 10;
}

/* ---------- Match score input ---------- */
.match-score-input {
    width: 3.25rem; min-height: 36px; text-align: center;
    padding: 0.25rem 0.375rem; font-variant-numeric: tabular-nums;
}

/* ---------- Standings ---------- */
.standings-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}
.standings-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--r); padding: 1rem; }
.standings-card h4 { margin: 0 0 0.625rem; }

/* ============================================================
   Footer — dark slate
   ============================================================ */
.footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    padding: 3rem 1.25rem 1.5rem;
    margin-top: auto;
}
.footer-inner {
    max-width: var(--container-w); margin: 0 auto;
    display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 2.5rem;
}
.footer-brand .nav-brand { color: var(--text-on-dark); }
.footer-brand .nav-brand:hover { color: var(--text-on-dark); }
.footer-brand p { color: var(--footer-muted); font-size: 0.875rem; margin-top: 0.75rem; max-width: 280px; }
.footer h4 {
    color: var(--text-on-dark);
    text-transform: uppercase; letter-spacing: 0.06em;
    font-size: 0.75rem; margin-bottom: 0.875rem;
}
.footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.875rem; }
.footer ul a { color: var(--footer-text); }
.footer ul a:hover { color: #fff; text-decoration: none; }
.footer-bottom {
    max-width: var(--container-w); margin: 2.5rem auto 0;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: var(--footer-muted);
    font-size: 0.8125rem;
    text-align: center;
}

/* ============================================================
   Section / heading / callout / utility component classes
   (replaces inline styles that were scattered through templates)
   ============================================================ */

/* Narrower container variant (auth, profile, simple settings pages). */
.container-narrow { max-width: 520px; }

/* Headings tuned for their context, so we don't fight default margins inline. */
.card-title         { margin: 0 0 1rem; font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; }
.section-title      { margin: 0 0 1rem; font-size: 1.5rem; font-weight: 700;  letter-spacing: -0.015em; }
.subsection-title   { margin: 1.5rem 0 0.75rem; font-size: 1.0625rem; font-weight: 600; }
.form-section-title { margin: 1.5rem 0 0.875rem; font-size: 1.0625rem; font-weight: 600; }

.standings-card-title    { margin: 0 0 0.625rem; font-size: 1rem; font-weight: 600; }
.standings-card-matches  { margin-top: 0.875rem; }

/* Auth pages (login, magic-link sent). */
.auth-title { margin: 0 0 0.375rem; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.015em; }
.auth-lede  { margin-bottom: 1.5rem; }
.auth-hint  { margin-top: 1.25rem; }

/* Page-level subtitle below an h1. */
.page-lede       { margin-bottom: 2rem; }
.page-lede-tight { margin-bottom: 1rem; }

/* Bracket detail page header (title + system + badge + count + CTA). */
.section-head.bracket-header { flex-wrap: wrap; }
.bracket-header-title { margin: 0 0 0.375rem; }
.bracket-header-meta {
    display: flex; align-items: center; flex-wrap: wrap;
    gap: 0.625rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Profile page form niceties. */
.profile-avatar-fields { flex: 1; min-width: 0; }
.form-help-tight       { margin: 0.375rem 0 0; }
.form-actions {
    display: flex; gap: 0.625rem; flex-wrap: wrap;
}

/* my.php — actions column at the right edge of each row. */
.row-actions {
    text-align: right;
    white-space: nowrap;
}

/* Zero-margin utility (single use-case helper for h1 inside .section-head). */
.m-0 { margin: 0 !important; }

/* ---------- Callouts ----------
   Replace inline-styled tinted cards used for inline success/error/info messages.
   No side-stripe borders — full border + tinted bg + accessible ink color. */
.callout {
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-lg);
    padding: 0.875rem 1rem;
    color: var(--text-main);
    font-size: 0.9375rem;
    line-height: 1.5;
}
.callout-info    { background: var(--info-soft);    border-color: var(--info);    color: var(--info-ink); }
.callout-success { background: var(--success-soft); border-color: var(--success); color: var(--success-ink); }
.callout-error   { background: var(--danger-soft);  border-color: var(--danger);  color: var(--danger-ink); }
.callout strong  { color: inherit; }
.callout-list    { margin: 0; padding-left: 1.25rem; }

/* ============================================================
   Focus, motion, and a11y utilities
   ============================================================ */

/* Keyboard focus ring — applies to anything not specifically overridden
   (inputs keep their own border + shadow-glow pattern). */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}
.btn:focus-visible,
.btn-secondary:focus-visible,
.btn-ghost:focus-visible,
.btn-google:focus-visible,
.btn-danger:focus-visible,
.btn-success:focus-visible { outline-offset: 3px; }

.type-row:focus-visible,
.create-chips a:focus-visible {
    outline-offset: 2px;
    border-color: var(--primary);
}

.bracket-match-save:focus-visible {
    outline-offset: -3px;
    outline-color: #fff;
}

/* Skip-to-content — fully clipped until focused via Tab. */
.skip-link {
    position: absolute;
    top: 0.75rem; left: 0.75rem;
    z-index: 200;
    background: var(--primary);
    color: #fff;
    padding: 0.625rem 1rem;
    border-radius: var(--r-sm);
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--shadow-lg);
    transform: translateY(-160%);
    transition: transform 0.15s var(--ease);
}
.skip-link:focus { transform: translateY(0); color: #fff; text-decoration: none; }

/* Visually hidden — for table headers etc. that need a label for screen
   readers but no visual presence. */
.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Subtle back-link (replaces a recurring inline-styled "← All formats" link). */
.back-link {
    display: inline-flex; align-items: center; gap: 0.375rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-decoration: none;
    padding: 0.375rem 0.5rem;
    margin: 0 -0.5rem 0.75rem;
    border-radius: var(--r-sm);
    transition: color 0.15s, background 0.15s;
}
.back-link:hover { color: var(--text-main); background: var(--surface-3); text-decoration: none; }
.back-link::before { content: '←'; font-size: 1rem; line-height: 1; }

/* Toast — non-blocking status / error messages dispatched from app.js. */
.toast-stack {
    position: fixed; right: 1rem; bottom: 1rem; z-index: 110;
    display: flex; flex-direction: column-reverse; gap: 0.5rem;
    pointer-events: none;
    max-width: calc(100% - 2rem);
}
.toast {
    background: var(--card-bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--r);
    padding: 0.75rem 1rem;
    box-shadow: var(--shadow-lg);
    min-width: 240px; max-width: 360px;
    font-size: 0.9375rem;
    color: var(--text-main);
    pointer-events: auto;
    animation: toastIn 0.18s ease-out;
}
.toast.is-leaving { animation: toastOut 0.16s ease-in forwards; }
.toast-error   { background: var(--danger-soft);  border-color: var(--danger);  color: var(--danger-ink); }
.toast-success { background: var(--success-soft); border-color: var(--success); color: var(--success-ink); }
.toast-info    { background: var(--info-soft);    border-color: var(--info);    color: var(--info-ink); }
@keyframes toastIn  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to   { opacity: 0; transform: translateY(8px); } }

/* Honor user's motion preference. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================
   MOBILE (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {
    /* Tighter side gutters across the board — phones don't have 1.25rem to spare. */
    .container          { padding: 1rem 0.75rem 2.25rem; }
    .nav-container      { padding: 0 0.75rem; }
    .card               { padding: 1rem; border-radius: var(--r); }
    .hero-types-card    { padding: 1rem; }

    .menu-toggle { display: inline-flex; }
    .nav-links {
        position: absolute; top: var(--nav-h); right: 0.75rem;
        flex-direction: column; align-items: stretch;
        gap: 0.125rem; padding: 0.5rem;
        background: #fff; border: 1px solid var(--border);
        border-radius: var(--r);
        box-shadow: var(--shadow-lg);
        min-width: 220px;
        display: none;
    }
    .nav-links.open { display: flex; }
    .nav-links a { padding: 0.625rem 0.875rem; }
    .nav-links a.nav-cta { margin-left: 0; box-shadow: none; }
    .nav-links a.nav-signout {
        margin-left: 0;
        border-color: transparent;
        background: transparent;
    }

    /* Create dropdown collapses inline inside the hamburger panel.
       The trigger disappears; the items show as a labeled group. */
    .nav-create-dropdown { width: 100%; display: flex; flex-direction: column; }
    .nav-dropdown-trigger { display: none; }
    .nav-dropdown-menu {
        position: static;
        display: block !important; /* override [hidden] */
        animation: none;
        padding: 0;
        background: transparent;
        border: none;
        box-shadow: none;
        min-width: 0;
    }
    .nav-links .nav-dropdown-menu a { padding: 0.625rem 0.875rem; }

    /* Visual gap between create group and account links inside the hamburger
       (extra margin reads as a section break without a hairline rule). */
    .nav-create-dropdown + a,
    .nav-create-dropdown + .nav-cta {
        margin-top: 0.75rem;
    }

    .hero { padding: 2rem 0 1.5rem; }
    .hero-inner {
        grid-template-columns: 1fr;
        grid-template-areas:
            "text"
            "types"
            "feats";
        gap: 1.25rem;
        padding: 0 0.75rem;
    }
    .hero-features { margin-top: 0; }
    .hero-text h1 { font-size: 1.75rem; margin-bottom: 0.5rem; }
    .hero-sub { font-size: 1rem; margin-bottom: 0; }
    .hero-features li { gap: 0.625rem; }

    .format-section { padding: 2.5rem 0; }
    .format-inner { grid-template-columns: 1fr; gap: 1.5rem; padding: 0 0.75rem; }
    .format-section.flip .format-inner { direction: ltr; }
    /* Allow grid children to shrink below their natural min-content so they
       don't push the section wider than the viewport. */
    .format-inner > * { min-width: 0; }
    .format-text h2 { font-size: 1.5rem; }
    .format-text p { font-size: 1rem; }
    .format-text .btn { width: 100%; }

    /* Mini-bracket card on mobile: stay within the viewport, scroll inside
       horizontally when the bracket tree is wider than the card. */
    .mini-bracket-card {
        min-height: 0;
        padding: 1rem;
        max-width: 100%;
        overflow: hidden;
    }
    .mini-bracket {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 0.5rem;
    }
    /* Fixed column width so the horizontal scroll feels natural. */
    .mini-round { flex: 0 0 auto; min-width: 96px; width: 96px; }
    .mini-rr { grid-template-columns: repeat(2, 1fr); }
    .mini-rr-col { min-width: 0; }
    .mini-sub .mini-bracket { min-height: 0; }
    .mini-sub .mini-rr { min-height: 0; }

    .container { padding: 1rem 1rem 3rem; }

    .footer { padding: 2rem 1rem 1rem; }
    .footer-inner { grid-template-columns: 1fr 1fr; gap: 1.5rem; }
    .footer-brand { grid-column: 1 / -1; }

    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }

    /* Bottom-sheet modal */
    .modal-backdrop { align-items: flex-end; padding: 0; }
    .modal-card {
        max-width: 100%;
        border-radius: var(--r-xl) var(--r-xl) 0 0;
        animation: sheetIn 0.25s ease-out;
    }
    .modal-footer { flex-direction: column-reverse; }
    .modal-footer .btn { width: 100%; }

    .form-row.inline { flex-direction: column; align-items: stretch; }

    /* Touch target bumps on small screens — compact button/input variants
       compress dangerously on phones, so we lift them toward 40–44px. */
    .btn-sm { min-height: 40px; padding: 0.5rem 1rem; }
    input.bracket-slot-score-input { min-height: 36px; width: 3rem; font-size: 0.9375rem; }
    .bracket-match-save { min-height: 40px; font-size: 0.875rem; }
}
