/* KaiKai Foil Ladder — Dark-mode design system */
:root {
    --bg: #111318;
    --surface: #1a1d24;
    --surface-2: #22262e;
    --surface-3: #2a2f38;
    --border: rgba(255,255,255,.08);
    --border-hi: rgba(255,255,255,.14);
    --text: #eaf0f6;
    --text-dim: #8b96a8;
    --text-muted: #555d6e;
    --green: #22c55e;
    --green-dim: #16a34a;
    --green-glow: rgba(34,197,94,.25);
    --red: #ef4444;
    --amber: #f59e0b;
    --gold: #f5b731;
    --cyan: #00d4ff;
    --purple: #a78bfa;
    --danger: #ef4444;
    --palm: #22c55e;
    --sunset: #f59e0b;

    --radius: 12px;
    --radius-lg: 18px;
    --shadow: 0 2px 12px rgba(0,0,0,.3);
    --shadow-lg: 0 8px 32px rgba(0,0,0,.4);
    --transition: .2s cubic-bezier(.4,0,.2,1);

    --font: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: 'Nunito', sans-serif;
}

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

html { font-size: 16px; scroll-behavior: smooth; overflow-x: hidden; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

a { color: var(--green); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--green-dim); }

/* ── Navigation ──────────────────────────────── */
.nav {
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
    padding-top: env(safe-area-inset-top, 0);
}

.nav-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-logo {
    display: flex;
    align-items: baseline;
    gap: 2px;
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    text-decoration: none;
}

.logo-k { color: var(--green); }
.logo-k2 { color: #fff; }

.logo-sub {
    font-family: var(--font);
    font-size: .6rem;
    font-weight: 700;
    letter-spacing: .25em;
    text-transform: uppercase;
    color: rgba(255,255,255,.4);
    margin-left: 10px;
}

.nav-ladder-label {
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    margin-left: 12px;
    padding-left: 10px;
    border-left: 2px solid var(--green);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    line-height: 1.2;
    letter-spacing: .01em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-links a:not(.btn) {
    color: rgba(255,255,255,.7);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: .875rem;
    font-weight: 500;
    transition: all var(--transition);
}

.nav-links a:not(.btn):hover,
.nav-links a:not(.btn).active {
    color: #fff;
    background: rgba(255,255,255,.08);
}

.nav-challenge-link {
    position: relative;
}

.nav-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--green);
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
    font-size: .55rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 0 8px var(--green-glow);
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { box-shadow: 0 0 6px rgba(34,197,94,.4); }
    50%      { box-shadow: 0 0 14px rgba(34,197,94,.7); }
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
    padding-left: 14px;
    border-left: 1px solid rgba(255,255,255,.15);
}

.nav-rider-name { color: var(--green); font-weight: 600; font-size: .875rem; }
.nav-position {
    background: var(--green);
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.nav-toggle span {
    width: 24px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: var(--transition);
}

/* ── Buttons ─────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: .875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

.btn-sm { padding: 6px 14px; font-size: .8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }

.btn-primary {
    background: var(--green);
    color: #fff;
    box-shadow: 0 2px 8px var(--green-glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px var(--green-glow); background: var(--green-dim); color: #fff; }

.btn-coral {
    background: var(--green);
    color: #fff;
    box-shadow: 0 2px 8px var(--green-glow);
}
.btn-coral:hover { transform: translateY(-1px); box-shadow: 0 4px 16px var(--green-glow); background: var(--green-dim); color: #fff; }

.btn-outline {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border-hi);
}
.btn-outline:hover { background: rgba(255,255,255,.06); color: var(--text); }

.btn-outline-dark {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border-hi);
}
.btn-outline-dark:hover { background: rgba(255,255,255,.06); color: var(--text); }

.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { filter: brightness(1.1); color: #fff; }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); color: #fff; }

.btn-gold {
    background: linear-gradient(135deg, var(--gold), var(--amber));
    color: #111;
    font-weight: 700;
}

.btn:active { transform: scale(.97); }

/* ── Flash messages ──────────────────────────── */
.flash {
    padding: 12px 0;
    font-size: .9rem;
    font-weight: 500;
}
.flash-success { background: rgba(34,197,94,.12); color: #4ade80; border: 1px solid rgba(34,197,94,.2); }
.flash-error { background: rgba(239,68,68,.12); color: #f87171; border: 1px solid rgba(239,68,68,.2); }
.flash-info { background: rgba(0,212,255,.1); color: #67e8f9; border: 1px solid rgba(0,212,255,.2); }

/* ── Main content ────────────────────────────── */
.main { flex: 1; }

/* ── Hero ─────────────────────────────────────── */
.hero {
    background: linear-gradient(165deg, #0e1118 0%, var(--surface) 40%, var(--surface-2) 100%);
    color: #fff;
    padding: 80px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -10%;
    width: 120%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 50%, rgba(34,197,94,.06) 0%, transparent 60%),
                radial-gradient(ellipse at 70% 80%, rgba(34,197,94,.03) 0%, transparent 50%);
    pointer-events: none;
}

.hero-content { position: relative; z-index: 1; max-width: 680px; margin: 0 auto; }

.hero h1 {
    font-family: var(--font-display);
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 16px;
}

.hero h1 .accent { color: var(--green); }
.hero h1 .coral { color: #fff; }

.hero p {
    font-size: 1.15rem;
    color: rgba(255,255,255,.7);
    margin-bottom: 32px;
    line-height: 1.7;
}

.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.hero-stats {
    display: flex;
    gap: 40px;
    justify-content: center;
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid rgba(255,255,255,.1);
}

.hero-stat { text-align: center; }
.hero-stat-num {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    color: var(--green);
}
.hero-stat-label {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: rgba(255,255,255,.4);
    margin-top: 2px;
}

/* ── Section ─────────────────────────────────── */
.section {
    padding: 60px 20px;
}

.section-header {
    text-align: center;
    margin-bottom: 40px;
}

.section-header h2 {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
}

.section-header p {
    color: var(--text-dim);
    margin-top: 8px;
    font-size: 1.05rem;
}

.section-dark {
    background: var(--surface);
    color: #fff;
}

.section-dark .section-header h2 { color: var(--green); }
.section-dark .section-header p { color: var(--text-dim); }

/* ── Cards ───────────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: all var(--transition);
}

.card:hover { box-shadow: var(--shadow-lg); border-color: var(--border-hi); }

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.card-body { padding: 24px; }

/* ── Ladder table ────────────────────────────── */
.ladder-table {
    width: 100%;
    border-collapse: collapse;
}

.ladder-table th {
    text-align: left;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-muted);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.ladder-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: .9rem;
}

.ladder-table tr:hover td { background: rgba(34,197,94,.04); }

.ladder-pos {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    width: 48px;
    text-align: center;
}

.ladder-pos-1 { color: var(--gold); }
.ladder-pos-2 { color: #adb5bd; }
.ladder-pos-3 { color: #cd7f32; }

.rider-name {
    font-weight: 600;
    color: var(--text);
}

.rider-name a { color: var(--text); }
.rider-name a:hover { color: var(--green); }

.record {
    display: flex;
    gap: 4px;
    align-items: center;
}

.record-w { color: var(--palm); font-weight: 700; }
.record-l { color: var(--danger); font-weight: 700; }
.record-sep { color: var(--text-muted); }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.badge-active { background: rgba(34,197,94,.12); color: var(--green); }
.badge-inactive { background: rgba(239,68,68,.1); color: var(--red); }
.badge-pending { background: rgba(245,158,11,.12); color: var(--amber); }
.badge-accepted { background: rgba(34,197,94,.1); color: var(--green); }
.badge-completed { background: rgba(34,197,94,.12); color: var(--green); }

.challenge-btn {
    padding: 4px 12px;
    font-size: .75rem;
    border-radius: 6px;
    background: var(--green);
    color: #fff;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all var(--transition);
}

.challenge-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.challenge-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

/* ── Forms ────────────────────────────────────── */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: .95rem;
    color: var(--text);
    background: var(--surface-2);
    transition: border-color var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px var(--green-glow);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238b96a8' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

textarea.form-control { resize: vertical; min-height: 80px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.form-error {
    background: rgba(239,68,68,.1);
    border: 1px solid rgba(239,68,68,.2);
    color: #f87171;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: .9rem;
    margin-bottom: 20px;
}

/* ── Dashboard ───────────────────────────────── */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.stat-card-num {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    color: var(--green);
}

.stat-card-label {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Challenge card ──────────────────────────── */
.challenge-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.challenge-item:last-child { border-bottom: none; }

.challenge-riders {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.challenge-vs {
    font-size: .7rem;
    font-weight: 800;
    color: var(--green);
    text-transform: uppercase;
}

/* ── Location cards ──────────────────────────── */
.location-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.location-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--green);
    border: 1px solid var(--border);
    border-left: 4px solid var(--green);
    transition: all var(--transition);
}

.location-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.location-name { font-weight: 700; font-size: 1.1rem; color: var(--text); margin-bottom: 4px; }
.location-region {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--green);
    margin-bottom: 8px;
}
.location-desc { font-size: .9rem; color: var(--text-dim); }

/* ── Rules ────────────────────────────────────── */
.rules-list {
    max-width: 760px;
    margin: 0 auto;
}

.rule-item {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    position: relative;
    padding-left: 72px;
}

.rule-num {
    position: absolute;
    left: 20px;
    top: 24px;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--green), var(--green-dim));
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: .8rem;
}

.rule-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
    margin-bottom: 8px;
}

.rule-text {
    font-size: .9rem;
    color: var(--text-dim);
    line-height: 1.7;
}

.rule-text ul {
    margin: 8px 0;
    padding-left: 20px;
}

.rule-text li { margin-bottom: 4px; }

/* ── Profile ─────────────────────────────────── */
.profile-header {
    background: linear-gradient(165deg, var(--bg), var(--surface));
    color: #fff;
    padding: 48px 20px;
}

.profile-info { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; gap: 24px; }

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--green), var(--green-dim));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 2rem;
    color: #fff;
    flex-shrink: 0;
}

.profile-name { font-family: var(--font-display); font-size: 1.8rem; }
.profile-meta {
    display: flex;
    gap: 20px;
    margin-top: 8px;
    font-size: .85rem;
    color: rgba(255,255,255,.6);
}

.profile-meta strong { color: var(--green); }

/* ── Auth pages ──────────────────────────────── */
.auth-page {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: linear-gradient(165deg, var(--bg) 0%, var(--surface) 100%);
}

.auth-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.auth-card h2 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 8px;
}

.auth-card .subtitle {
    color: var(--text-dim);
    font-size: .9rem;
    margin-bottom: 28px;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: .85rem;
    color: var(--text-dim);
}

/* ── Admin ────────────────────────────────────── */
.admin-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.admin-nav a {
    padding: 8px 16px;
    background: var(--surface);
    border-radius: var(--radius);
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-dim);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.admin-nav a:hover, .admin-nav a.active {
    background: var(--green);
    color: #fff;
    border-color: var(--green);
}

/* ── Match log ───────────────────────────────── */
.match-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: .9rem;
}

.match-item:last-child { border-bottom: none; }

.match-winner { font-weight: 700; color: var(--green); }
.match-loser { color: var(--text-dim); }
.match-date { font-size: .8rem; color: var(--text-muted); }
.match-type {
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(34,197,94,.1);
    color: var(--green);
}

/* ── Empty state ─────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-dim);
}

.empty-state-icon { font-size: 3rem; margin-bottom: 12px; opacity: .3; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: 4px; color: var(--text); }
.empty-state p { font-size: .9rem; }

/* ── Footer ──────────────────────────────────── */
.footer {
    background: var(--surface);
    color: rgba(255,255,255,.4);
    padding: 40px 0 calc(40px + env(safe-area-inset-bottom, 0));
    margin-top: 60px;
    border-top: 2px solid var(--green);
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-brand { display: flex; align-items: baseline; gap: 2px; font-family: var(--font-display); font-size: 1.2rem; }
.footer-brand p { margin-left: 12px; font-family: var(--font); font-size: .75rem; }

.footer-links { display: flex; gap: 20px; }
.footer-links a { color: rgba(255,255,255,.4); font-size: .85rem; }
.footer-links a:hover { color: var(--green); }

.footer-copy { font-size: .75rem; }

/* ── Dashboard Notifications & Timers ────────── */
.dash-notify {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, rgba(34,197,94,.06), rgba(34,197,94,.03));
    border: 1px solid rgba(34,197,94,.15);
    border-left: 3px solid var(--green);
    border-radius: var(--radius);
    animation: notifySlide .4s ease both;
}

@keyframes notifySlide {
    from { opacity: 0; transform: translateX(-12px); }
    to   { opacity: 1; transform: translateX(0); }
}

.dash-notify-icon {
    font-size: 1.2rem;
    position: relative;
    flex-shrink: 0;
}

.dash-notify-ping {
    position: absolute;
    top: -3px; right: -3px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--green);
    animation: badgePulse 2s infinite;
}

.dash-notify-text {
    flex: 1;
    font-size: .85rem;
    color: var(--text);
}

.dash-notify-text strong {
    color: var(--green);
}

.dash-notify-btn {
    padding: 6px 14px;
    background: var(--green);
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
    border-radius: 6px;
    text-decoration: none;
    white-space: nowrap;
    transition: background .2s;
}

.dash-notify-btn:hover {
    background: var(--green-dim);
    color: #fff;
}

/* ── Notification permission prompt ── */
.dash-notif-prompt {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    margin-bottom: 20px;
    border-radius: var(--radius);
    background: rgba(99,102,241,.08);
    border: 1px solid rgba(99,102,241,.2);
    flex-wrap: wrap;
}
.dash-notif-prompt-icon {
    flex-shrink: 0;
    color: #818cf8;
}
.dash-notif-prompt-text {
    flex: 1;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.dash-notif-prompt-text strong {
    font-size: .88rem;
    font-weight: 700;
    color: var(--text);
}
.dash-notif-prompt-text span {
    font-size: .78rem;
    color: var(--text-dim);
    line-height: 1.4;
}
.dash-notif-prompt-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.dash-notif-prompt-btn {
    padding: 7px 16px;
    border-radius: 8px;
    border: none;
    font-size: .8rem;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    transition: background .15s ease, opacity .15s ease;
    white-space: nowrap;
}
.dash-notif-prompt-btn:disabled {
    opacity: .5;
    cursor: default;
}
.dash-notif-prompt-btn--enable {
    background: #6366f1;
    color: #fff;
}
.dash-notif-prompt-btn--enable:hover:not(:disabled) {
    background: #4f46e5;
}
.dash-notif-prompt-btn--dismiss {
    background: transparent;
    color: var(--text-dim);
}
.dash-notif-prompt-btn--dismiss:hover {
    color: var(--text);
    background: rgba(139,150,168,.08);
}

.dash-timer {
    font-family: 'JetBrains Mono', monospace;
    font-size: .75rem;
    font-weight: 600;
    color: var(--sunset);
    letter-spacing: .04em;
}

/* ── Windytron Wind Report Module ────────────── */
.wind-module {
    width: 100%;
    max-width: 480px;
    margin: 20px auto;
    padding: 0 16px;
    box-sizing: border-box;
}

.wind-module-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    text-align: center;
}

/* Header — centered title */
.wind-module-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.wind-module-dot {
    width: 8px;
    height: 8px;
    background: var(--palm);
    border-radius: 50%;
    animation: windPulse 2s ease-in-out infinite;
    box-shadow: 0 0 6px rgba(46, 204, 113, .4);
    flex-shrink: 0;
}

@keyframes windPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .3; }
}

.wind-module-title {
    font-family: 'Barlow Condensed', var(--font);
    font-weight: 800;
    font-size: 1.3rem;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: rgba(255, 255, 255, .7);
    text-decoration: none;
    transition: color var(--transition);
}

.wind-module-title:hover {
    color: #fff;
}

/* Divider under header */
.wind-module-rule {
    height: 1px;
    background: rgba(255, 255, 255, .08);
    margin: 14px 0 16px;
}

/* Station section */
.wind-tile {
    display: block;
    text-decoration: none;
    text-align: center;
    padding: 12px 0;
    transition: opacity var(--transition);
}

.wind-tile:hover {
    opacity: .85;
}

/* Station name */
.wind-tile-name {
    display: block;
    font-family: var(--font);
    font-weight: 700;
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: rgba(255, 255, 255, .5);
    margin-bottom: 6px;
}

/* Speed — dominant element */
.wind-tile-speed {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 5px;
    margin-bottom: 6px;
}

.ws-speed {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 900;
    font-size: 2.8rem;
    color: #fff;
    letter-spacing: -.03em;
    line-height: 1;
}

.wind-tile-unit {
    font-size: .78rem;
    font-weight: 600;
    color: rgba(255, 255, 255, .22);
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* Direction + gust — secondary */
.wind-tile-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.ws-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .95rem;
    color: rgba(255, 255, 255, .4);
    transition: transform .5s ease, opacity .3s;
    line-height: 1;
    width: 16px;
}

.ws-dir {
    font-weight: 600;
    font-size: .9rem;
    color: rgba(255, 255, 255, .5);
}

.ws-gust {
    font-size: .85rem;
    font-weight: 700;
    color: rgba(255, 255, 255, .35);
    opacity: 0;
    transition: opacity .3s;
    margin-left: 2px;
}

.ws-gust.visible { opacity: 1; }

/* Divider between stations */
.wind-tile-divider {
    height: 1px;
    background: rgba(255, 255, 255, .06);
    margin: 4px 24px;
}

/* Footer — last updated */
.wind-module-footer {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, .06);
}

.wind-module-time {
    font-size: .72rem;
    font-weight: 500;
    color: rgba(255, 255, 255, .25);
    letter-spacing: .03em;
}

/* Wind speed color tiers */
.ws-speed-calm { color: var(--text-dim); }
.ws-speed-moderate { color: var(--green); }
.ws-speed-fresh { color: var(--gold); }
.ws-speed-strong { color: var(--red); }

/* Loading skeleton */
.wind-module.loading .ws-speed,
.wind-module.loading .ws-dir {
    background: rgba(255, 255, 255, .06);
    color: transparent;
    border-radius: 4px;
    animation: windSkeleton 1.5s ease-in-out infinite;
}

.wind-module.loading .ws-speed {
    width: 64px;
    height: 2.5rem;
    display: inline-block;
    margin: 0 auto;
}

.wind-module.loading .ws-arrow { opacity: .1; }

@keyframes windSkeleton {
    0%, 100% { opacity: .3; }
    50% { opacity: .6; }
}

/* Error state */
.wind-module.error .wind-module-dot {
    background: var(--danger);
    box-shadow: 0 0 6px rgba(231, 76, 60, .5);
    animation: none;
}

.wind-module.error .wind-module-title { color: rgba(255, 255, 255, .2); }

/* Desktop — cap width, keep stacked */
@media (min-width: 768px) {
    .wind-module {
        max-width: 420px;
    }
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 768px) {
    .nav-toggle { display: flex; }

    .nav-ladder-label {
        font-size: .85rem;
        max-width: 120px;
        margin-left: 8px;
        padding-left: 8px;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--surface);
        flex-direction: column;
        padding: 16px 20px;
        border-top: 1px solid var(--border);
        gap: 4px;
    }

    .nav-links.open { display: flex; }
    .nav-links a:not(.btn) { padding: 10px 12px; }

    .nav-user {
        border-left: none;
        border-top: 1px solid var(--border);
        padding: 12px 0 0;
        margin: 8px 0 0;
    }

    .hero { padding: 48px 20px; }
    .hero h1 { font-size: 2.2rem; }
    .hero-stats { gap: 20px; }

    .form-row { grid-template-columns: 1fr; }
    .qp-riders { grid-template-columns: repeat(2, 1fr); }
    .dash-grid { grid-template-columns: 1fr; }

    .ladder-table { font-size: .8rem; }
    .ladder-table th, .ladder-table td { padding: 10px 8px; }

    .footer-inner { flex-direction: column; text-align: center; }
    .footer-links { justify-content: center; }

    .profile-info { flex-direction: column; text-align: center; }
    .profile-meta { justify-content: center; }
}

@media (max-width: 480px) {
    .hero h1 { font-size: 1.8rem; }
    .hero-actions { flex-direction: column; }
    .hero-actions .btn { width: 100%; }
    .stat-cards { grid-template-columns: 1fr 1fr; }
}

/* ── Challenge Banner ────────────────────────── */
.cb-banner {
    background: var(--surface);
    border-left: 4px solid var(--green);
    z-index: 50;
    animation: cbSlideIn .4s ease both;
}

.cb-banner.cb-urgent {
    border-left-color: #ff4757;
}

.cb-banner.cb-expired {
    border-left-color: #666;
    opacity: .7;
}

.cb-banner.cb-slideout {
    animation: cbSlideOut .4s ease forwards;
}

@keyframes cbSlideIn {
    from { transform: translateY(-100%); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

@keyframes cbSlideOut {
    from { transform: translateY(0); opacity: 1; }
    to   { transform: translateY(-100%); opacity: 0; }
}

.cb-banner-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.cb-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.cb-challenger {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cb-name {
    font-family: 'Barlow Condensed', var(--font);
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    white-space: nowrap;
}

.cb-rank {
    background: var(--green);
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 20px;
    white-space: nowrap;
}

.cb-text {
    color: rgba(255,255,255,.6);
    font-size: .85rem;
    white-space: nowrap;
}

.cb-gap {
    font-size: .7rem;
    font-weight: 600;
    color: var(--sunset);
    background: rgba(255,159,67,.12);
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.cb-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.cb-timer-icon {
    color: var(--sunset);
    flex-shrink: 0;
}

.cb-timer-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: .9rem;
    font-weight: 600;
    color: var(--sunset);
    letter-spacing: .04em;
}

.cb-urgent .cb-timer-val,
.cb-urgent .cb-timer-icon {
    color: #ff4757;
    animation: cbBlink 1s ease-in-out infinite;
}

@keyframes cbBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: .4; }
}

.cb-expired .cb-timer-val {
    color: #666;
    animation: none;
}

.cb-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.cb-btn {
    padding: 7px 18px;
    border: none;
    border-radius: 8px;
    font-family: var(--font);
    font-size: .8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    min-height: 36px;
}

.cb-btn:disabled {
    opacity: .4;
    cursor: not-allowed;
    transform: none;
}

.cb-btn-accept {
    background: linear-gradient(135deg, var(--green), var(--green-dim));
    color: #fff;
    box-shadow: 0 2px 8px var(--green-glow);
}

.cb-btn-accept:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px var(--green-glow);
}

.cb-btn-decline {
    background: rgba(255,255,255,.08);
    color: rgba(255,255,255,.6);
    border: 1px solid rgba(255,255,255,.12);
}

.cb-btn-decline:hover:not(:disabled) {
    background: rgba(255,255,255,.14);
    color: #fff;
}

.cb-error {
    width: 100%;
    font-size: .8rem;
    color: #ff4757;
    padding: 4px 0;
}

/* ── Challenge Banner — Mobile ───────────────── */
@media (max-width: 768px) {
    .cb-banner-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 14px 16px;
    }

    .cb-info {
        flex-wrap: wrap;
        gap: 6px;
    }

    .cb-timer {
        justify-content: center;
    }

    .cb-actions {
        justify-content: stretch;
    }

    .cb-btn {
        flex: 1;
        min-height: 44px;
        font-size: .85rem;
    }
}

/* ── Dashboard Match Actions (Confirm/Dispute) ── */
.match-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.match-btn-confirm,
.match-btn-dispute {
    padding: 4px 12px;
    border: none;
    border-radius: 6px;
    font-family: var(--font);
    font-size: .72rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    line-height: 1.4;
}

.match-btn-confirm {
    background: var(--palm);
    color: #fff;
}

.match-btn-confirm:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.match-btn-dispute {
    background: transparent;
    color: var(--sunset);
    border: 1px solid var(--sunset);
}

.match-btn-dispute:hover:not(:disabled) {
    background: rgba(255, 159, 67, .1);
}

.match-btn-confirm:disabled,
.match-btn-dispute:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
}

/* ── Dashboard Dispute Modal ─────────────────── */
.dash-dispute-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, .6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s, visibility .25s;
}

.dash-dispute-modal.active {
    opacity: 1;
    visibility: visible;
}

.dash-dispute-modal-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 420px;
    transform: translateY(12px);
    transition: transform .25s;
}

.dash-dispute-modal.active .dash-dispute-modal-card {
    transform: translateY(0);
}

.dash-dispute-modal-header {
    padding: 18px 24px;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.dash-dispute-modal-body {
    padding: 20px 24px;
}

.dash-dispute-modal-actions {
    padding: 14px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

@media (max-width: 768px) {
    .match-item--actionable {
        flex-wrap: wrap;
        gap: 8px;
    }

    .match-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .match-btn-confirm,
    .match-btn-dispute {
        padding: 6px 14px;
        font-size: .78rem;
        min-height: 32px;
    }
}

/* ── Riders ─────────────────────────────────── */
.riders-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 640px) {
    .riders-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
    .riders-grid { grid-template-columns: repeat(3, 1fr); }
}

.rider-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all var(--transition);
}

.rider-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--border-hi);
    transform: translateY(-2px);
}

.rider-card-identity {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 20px 16px;
}

.rider-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}

.rider-avatar--champion { background: linear-gradient(135deg, var(--gold), var(--amber)); }
.rider-avatar--diamond  { background: linear-gradient(135deg, var(--cyan), #0099cc); }
.rider-avatar--platinum { background: linear-gradient(135deg, var(--purple), #7c5cbf); }
.rider-avatar--standard { background: linear-gradient(135deg, var(--surface-3), var(--surface-2)); border: 1px solid var(--border-hi); }
.rider-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.rider-card-name-block {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.rider-card-name {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rider-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.rider-card-division {
    font-size: .75rem;
    font-weight: 600;
    color: var(--green);
}

.rider-card-rank {
    font-size: .75rem;
    font-weight: 700;
    color: var(--text-muted);
    background: rgba(255,255,255,.06);
    padding: 1px 7px;
    border-radius: 10px;
}

.rider-card-ladders {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 4px;
}

.rider-card-ladder-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .7rem;
    font-weight: 600;
    color: var(--green);
    background: rgba(255,255,255,.05);
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.rider-card-ladder-pos {
    font-weight: 700;
    color: var(--text-muted);
}

.rider-stats {
    display: flex;
    align-items: stretch;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.rider-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 8px;
}

.rider-stat + .rider-stat {
    border-left: 1px solid var(--border);
}

.rider-stat-val {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text);
}

.rider-stat-val--accent {
    color: var(--green);
}

.rider-stat-label {
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    margin-top: 2px;
}

.rider-gear {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rider-gear-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: .82rem;
}

.rider-gear-label {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: .68rem;
    letter-spacing: .06em;
}

.rider-gear-val {
    color: var(--text-dim);
    font-weight: 500;
}

.rider-cta {
    padding: 16px 20px;
    margin-top: auto;
}

.rider-cta-btn {
    display: block;
    text-align: center;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: .85rem;
    font-weight: 700;
    color: #fff;
    background: var(--green);
    box-shadow: 0 2px 8px var(--green-glow);
    transition: all var(--transition);
    text-decoration: none;
}

.rider-cta-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--green-glow);
    background: var(--green-dim);
    color: #fff;
}

/* ── Rider Skeleton & Error ──────────────────── */
.rider-card--skel { pointer-events: none; }

.skel-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--surface-2);
    flex-shrink: 0;
}

.skel-line {
    border-radius: 6px;
    background: var(--surface-2);
}

.skel-line--name { width: 60%; height: 16px; }
.skel-line--meta { width: 40%; height: 12px; margin-top: 6px; }
.skel-line--stat { width: 36px; height: 20px; margin: 0 auto; }
.skel-line--btn  { height: 40px; border-radius: var(--radius); }

.riders-skel .rider-card--skel .rider-stats {
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.riders-skel .rider-card--skel .rider-cta {
    padding: 16px 20px;
}

.rider-card--skel .skel-circle,
.rider-card--skel .skel-line {
    animation: skelShimmer 1.6s ease-in-out infinite;
}

@keyframes skelShimmer {
    0%, 100% { opacity: .35; }
    50%      { opacity: .7; }
}

.riders-error {
    text-align: center;
    padding: 60px 20px;
}

.riders-error-icon {
    color: var(--text-muted);
    margin-bottom: 16px;
    opacity: .5;
}

.riders-error h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.riders-error p {
    font-size: .9rem;
    color: var(--text-dim);
    max-width: 360px;
    margin: 0 auto;
}

/* ── Rider Filters ──────────────────────────── */
.rf-bar {
    margin-bottom: 24px;
}

.rf-toggle {
    display: none;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-dim);
    font-family: var(--font);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.rf-toggle:hover { color: var(--text); border-color: var(--border-hi); }

.rf-toggle-icon { flex-shrink: 0; opacity: .6; }

.rf-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.rf-search-wrap {
    position: relative;
    flex: 1;
    min-width: 180px;
    max-width: 320px;
}

.rf-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.rf-search {
    width: 100%;
    padding: 9px 12px 9px 36px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: .85rem;
    color: var(--text);
    transition: border-color var(--transition);
}

.rf-search::placeholder { color: var(--text-muted); }
.rf-search:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-glow); }

.rf-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rf-group-label {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    white-space: nowrap;
}

.rf-pills {
    display: flex;
    gap: 4px;
}

.rf-pill {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-dim);
    font-family: var(--font);
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.rf-pill:hover { border-color: var(--border-hi); color: var(--text); }

.rf-pill--active {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
    box-shadow: 0 2px 8px var(--green-glow);
}

.rf-pill--active:hover {
    background: var(--green-dim);
    border-color: var(--green-dim);
    color: #fff;
}

.rf-count {
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-left: auto;
    white-space: nowrap;
}

.rf-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-dim);
}

.rf-empty .empty-state-icon { font-size: 3rem; margin-bottom: 12px; opacity: .3; }
.rf-empty h3 { font-size: 1.1rem; margin-bottom: 4px; color: var(--text); }
.rf-empty p { font-size: .9rem; }

@media (max-width: 768px) {
    .rf-toggle { display: flex; }

    .rf-controls {
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 14px 0 0;
    }

    .rf-controls--open { display: flex; }

    .rf-search-wrap { max-width: none; }

    .rf-group { justify-content: space-between; }

    .rf-count {
        margin-left: 0;
        margin-top: 4px;
        text-align: center;
    }
}
