/* SportUnterricht Tools v2.0.0 — Sporthallen-tauglich, mobile-first */

:root {
    --primary: #2563EB;
    --primary-dark: #1D4ED8;
    --primary-light: rgba(37, 99, 235, 0.12);
    --success: #16A34A;
    --success-light: rgba(22, 163, 74, 0.12);
    --warning: #F97316;
    --warning-light: rgba(249, 115, 22, 0.12);
    --danger: #DC2626;
    --danger-light: rgba(220, 38, 38, 0.12);
    --info: #0EA5E9;
    --bg: #F1F5F9;
    --surface: #FFFFFF;
    --surface-2: #E2E8F0;
    --text: #0F172A;
    --text-secondary: #475569;
    --border: #CBD5E1;
    --radius: 20px;
    --radius-sm: 14px;
    --radius-xs: 10px;
    --shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 6px 18px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 14px 32px rgba(15, 23, 42, 0.16);
    --transition: all 0.15s ease;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --bottom-nav-height: 76px;
    --touch-min: 64px;
}

[data-theme="dark"] {
    --primary: #3B82F6;
    --primary-dark: #2563EB;
    --primary-light: rgba(59, 130, 246, 0.15);
    --success: #22C55E;
    --success-light: rgba(34, 197, 94, 0.12);
    --warning: #FB923C;
    --warning-light: rgba(251, 146, 60, 0.12);
    --danger: #F87171;
    --danger-light: rgba(248, 113, 113, 0.12);
    --info: #38BDF8;
    --bg: #0F172A;
    --surface: #1E293B;
    --surface-2: #334155;
    --text: #F8FAFC;
    --text-secondary: #94A3B8;
    --border: #334155;
    --shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 14px 32px rgba(0, 0, 0, 0.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { font-size: 18px; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

#app {
    max-width: 760px;
    margin: 0 auto;
    padding-bottom: calc(var(--bottom-nav-height) + 32px + var(--safe-bottom));
}

/* ---- Bottom Navigation ---- */
.bottom-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: calc(var(--bottom-nav-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: rgba(var(--surface-rgb, 255,255,255), 0.94);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    z-index: 1000;
    box-shadow: 0 -6px 24px rgba(0,0,0,0.08);
}

[data-theme="dark"] .bottom-nav {
    background: rgba(30, 41, 59, 0.94);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: var(--touch-min);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    min-width: 0;
}

.nav-item.active { color: var(--primary); }
.nav-icon { font-size: 1.55rem; line-height: 1; }
.nav-label { font-size: 0.7rem; font-weight: 800; }

/* ---- Typography ---- */
h1 { font-size: 1.9rem; font-weight: 900; letter-spacing: -0.02em; }
h2 { font-size: 1.4rem; font-weight: 800; }
h3 { font-size: 1.15rem; font-weight: 800; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 18px 28px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: white;
    background: var(--primary);
    touch-action: manipulation;
    user-select: none;
    min-height: var(--touch-min);
    box-shadow: var(--shadow);
}
.btn:active { transform: scale(0.96); }
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none !important; }

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 2px solid var(--border);
}
.btn-secondary:active { border-color: var(--primary); color: var(--primary); }

.btn-success { background: var(--success); }
.btn-danger { background: var(--danger); }
.btn-warning { background: var(--warning); color: #000; }

.btn-sm { padding: 14px 20px; font-size: 0.95rem; min-height: 48px; }
.btn-lg { padding: 22px 32px; font-size: 1.25rem; }
.btn-xl { padding: 26px 36px; font-size: 1.45rem; }
.btn-full { width: 100%; }

.btn-icon {
    width: var(--touch-min); height: var(--touch-min);
    padding: 0; border-radius: 50%;
    font-size: 1.45rem;
    flex-shrink: 0;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    box-shadow: none;
}
.btn-ghost:active { color: var(--text); background: rgba(0,0,0,0.04); }

/* ---- Cards ---- */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    margin: 14px 16px;
    border: 1px solid var(--border);
}

/* ---- Forms ---- */
.input-group { margin-bottom: 18px; }
.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

input[type="text"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 18px 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1.15rem;
    color: var(--text);
    background: var(--surface);
    transition: var(--transition);
    appearance: none;
    min-height: var(--touch-min);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 5px var(--primary-light);
}

.inline-input-group { display: flex; gap: 12px; }
.inline-input-group input { flex: 1; }
.inline-input-group .btn { flex-shrink: 0; }

.input-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* ---- Toggle Switch ---- */
.toggle {
    position: relative;
    display: inline-block;
    width: 56px;
    height: 32px;
    cursor: pointer;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle span {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 32px;
    transition: var(--transition);
}
.toggle span::before {
    content: '';
    position: absolute;
    height: 26px; width: 26px;
    left: 3px; top: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
}
.toggle input:checked + span { background: var(--success); }
.toggle input:checked + span::before { transform: translateX(24px); }

/* ---- Page Header ---- */
.page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px 10px;
    position: sticky;
    top: 0;
    background: rgba(var(--bg-rgb, 241,245,249), 0.94);
    backdrop-filter: blur(14px);
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .page-header {
    background: rgba(15, 23, 42, 0.94);
}

.page-header .back-btn {
    width: var(--touch-min); height: var(--touch-min);
    display: flex; align-items: center; justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 50%;
    font-size: 1.7rem;
    color: var(--text);
    cursor: pointer;
    box-shadow: var(--shadow);
    flex-shrink: 0;
}
.page-header h1, .page-header h2 { flex: 1; margin: 0; text-align: center; }
.page-header .header-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ---- Home ---- */
.home-hero {
    text-align: center;
    padding: 38px 20px 26px;
}
.hero-icon { font-size: 4.5rem; line-height: 1; margin-bottom: 14px; }
.home-hero h1 {
    font-size: 2.1rem;
    background: linear-gradient(135deg, var(--primary), #0EA5E9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.subtitle {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-top: 6px;
}

.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: 0 16px 10px;
}
.quick-action {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 14px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    min-height: 110px;
}
.quick-action:active { transform: scale(0.97); border-color: var(--primary); }
.quick-action .qa-icon { font-size: 2.4rem; margin-bottom: 12px; }
.quick-action .qa-title { font-weight: 900; font-size: 1.05rem; margin-bottom: 4px; }
.quick-action .qa-desc { font-size: 0.78rem; color: var(--text-secondary); }

.section-title {
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin: 26px 16px 12px;
}

.tournament-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px;
    margin: 10px 16px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border);
}
.tournament-item:active { transform: scale(0.99); border-color: var(--primary); }
.ti-icon { font-size: 2.2rem; flex-shrink: 0; }
.ti-info { flex: 1; min-width: 0; }
.ti-name { font-weight: 900; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ti-meta { font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; }
.ti-arrow { font-size: 1.7rem; color: var(--text-secondary); flex-shrink: 0; }

.progress-bar {
    height: 7px;
    background: var(--border);
    border-radius: 999px;
    margin-top: 10px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 999px;
    transition: width 0.3s ease;
}

.empty-state {
    text-align: center;
    padding: 52px 24px;
    color: var(--text-secondary);
}
.empty-state .icon { font-size: 4rem; margin-bottom: 18px; }
.empty-state .title { font-weight: 900; font-size: 1.25rem; color: var(--text); margin-bottom: 6px; }
.empty-state .desc { font-size: 1rem; margin-bottom: 16px; }

.activity-card { padding: 18px 22px; }
.activity-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}
.activity-item:last-child { border-bottom: none; }
.activity-item span:last-child { margin-left: auto; color: var(--text-secondary); font-size: 0.78rem; }
.activity-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}

/* ---- Tool Launcher ---- */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    padding: 8px 16px;
}
.tool-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 12px;
    min-height: 140px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}
.tool-card:active { transform: scale(0.97); border-color: var(--primary); background: var(--primary-light); }
.tool-card .icon { font-size: 2.6rem; }
.tool-card .title { font-weight: 900; font-size: 1rem; }
.tool-card .desc { font-size: 0.75rem; color: var(--text-secondary); }

/* ---- Scoreboard ---- */
.scoreboard-teams {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin: 16px;
}
.scoreboard-team {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    border: 2px solid var(--border);
    text-align: center;
    box-shadow: var(--shadow);
}
.scoreboard-team .team-name-input {
    font-size: 1.4rem;
    font-weight: 900;
    text-align: center;
    border: none;
    border-bottom: 2px solid var(--border);
    background: transparent;
    margin-bottom: 12px;
    padding: 8px;
    width: 100%;
}
.scoreboard-team .team-name-input:focus {
    outline: none;
    border-bottom-color: var(--primary);
    box-shadow: none;
}
.scoreboard-score {
    font-size: 5.5rem;
    font-weight: 900;
    line-height: 1;
    margin: 12px 0;
}
.scoreboard-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
}
.scoreboard-controls .score-btn {
    width: 72px; height: 72px;
    border-radius: 50%;
    border: none;
    font-size: 2.4rem;
    font-weight: 900;
    cursor: pointer;
    background: var(--surface-2);
    color: var(--text);
    box-shadow: var(--shadow-md);
}
.scoreboard-controls .score-btn:active { transform: scale(0.92); background: var(--primary-light); color: var(--primary); }
.scoreboard-controls .score-btn.plus { background: var(--primary); color: #fff; }
.scoreboard-controls .score-btn.plus:active { background: var(--primary-dark); }
.scoreboard-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin: 16px;
    padding: 16px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.scoreboard-timer .timer-display {
    font-family: 'SF Mono', ui-monospace, monospace;
    font-size: 2.4rem;
    font-weight: 900;
    min-width: 110px;
    text-align: center;
}

/* ---- Type Cards ---- */
.type-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.type-card {
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 20px 12px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid var(--border);
    min-height: 110px;
}
.type-card .icon { font-size: 2rem; margin-bottom: 8px; }
.type-card .title { font-weight: 900; font-size: 0.95rem; }
.type-card .desc { font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px; }
.type-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 4px var(--primary-light);
}
.type-card.selected .title { color: var(--primary-dark); }

/* ---- Teams ---- */
.team-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.team-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    border: 1px solid var(--border);
}
.team-color {
    width: 26px; height: 26px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.4);
}
.team-name { flex: 1; font-weight: 800; font-size: 1.05rem; }
.team-remove {
    width: 44px; height: 44px;
    border: none; background: var(--danger-light); color: var(--danger);
    border-radius: 50%;
    font-size: 1.4rem; font-weight: 800;
    cursor: pointer;
}

.chip-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.chip {
    padding: 12px 18px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
    min-height: 44px;
}
.chip:active { border-color: var(--primary); color: var(--primary); }

.participant-link { margin-top: 16px; }

/* ---- Participants ---- */
.participant-list { display: flex; flex-direction: column; gap: 8px; }
.participant-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    border: 1px solid var(--border);
    transition: var(--transition);
}
.participant-row.inactive { opacity: 0.5; }
.participant-drag { color: var(--text-secondary); font-size: 0.85rem; user-select: none; }
.participant-info { flex: 1; cursor: pointer; min-width: 0; }
.participant-name { font-weight: 900; font-size: 1.05rem; }
.participant-strength { color: var(--warning); font-size: 0.85rem; }
.participant-strength-small { color: var(--warning); font-size: 0.8rem; margin-top: 2px; }
.participant-class { color: var(--text-secondary); font-size: 0.78rem; }
.participant-actions { display: flex; gap: 6px; }

.participant-checklist {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 48vh;
    overflow-y: auto;
    margin-bottom: 14px;
}
.check-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: pointer;
}
.check-item input { width: 26px; height: 26px; accent-color: var(--primary); }
.mixer-summary { color: var(--text-secondary); font-size: 0.95rem; margin-bottom: 12px; }

/* ---- Tournament View ---- */
.tournament-header { padding: 8px 16px 0; }
.tournament-meta {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.tabs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 4px 16px 10px;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    flex-shrink: 0;
    padding: 14px 20px;
    border-radius: 999px;
    font-weight: 900;
    font-size: 0.95rem;
    background: var(--surface);
    border: 1px solid var(--border);
    cursor: pointer;
    color: var(--text-secondary);
    min-height: 48px;
}
.tab.active { background: var(--primary); color: white; border-color: var(--primary); }

.tab-content { padding: 8px 0 0; }

/* ---- Match Cards ---- */
.match-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    margin: 14px 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.match-card.completed { border-left: 6px solid var(--success); }
.match-card.pending { border-left: 6px solid var(--warning); }

.match-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.match-teams {
    display: flex;
    align-items: center;
    gap: 12px;
}
.match-team {
    flex: 1;
    text-align: center;
    padding: 18px 10px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    min-width: 0;
}
.match-team .name {
    font-weight: 900;
    font-size: 1.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.match-team .color-dot {
    width: 18px; height: 18px;
    border-radius: 50%;
    margin: 0 auto 8px;
}
.team-members { font-size: 0.78rem; color: var(--text-secondary); margin-top: 4px; }

.match-vs {
    font-weight: 900;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.score-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 16px;
}
.score-box {
    min-width: 80px;
    padding: 16px 22px;
    text-align: center;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    font-size: 2.2rem;
    font-weight: 900;
    border: 2px solid var(--border);
}
.score-box.win {
    background: var(--success-light);
    border-color: var(--success);
    color: var(--success);
}
.score-divider { font-size: 1.8rem; font-weight: 900; color: var(--text-secondary); }

.score-input-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
}
.score-input-row input {
    width: 80px;
    text-align: center;
    font-size: 1.8rem;
    font-weight: 900;
    padding: 14px 8px;
}
.score-step {
    width: 56px; height: 56px;
    border-radius: var(--radius-xs);
    border: 2px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 1.6rem;
    font-weight: 900;
    cursor: pointer;
}
.score-step:active { background: var(--primary-light); border-color: var(--primary); }

.match-actions { display: flex; gap: 10px; margin-top: 16px; }
.match-actions .btn { flex: 1; }

/* ---- Timer ---- */
.match-timer {
    margin-top: 16px;
    padding: 14px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.timer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.timer-display {
    font-family: 'SF Mono', ui-monospace, monospace;
    font-size: 2rem;
    font-weight: 900;
    color: var(--text);
    letter-spacing: 0.05em;
}
.timer-display.warning { color: var(--warning); }
.timer-display.danger { color: var(--danger); }
.timer-controls { display: flex; gap: 10px; }
.timer-progress {
    height: 6px;
    background: var(--border);
    border-radius: 999px;
    margin-bottom: 12px;
    overflow: hidden;
}
.timer-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success), var(--warning), var(--danger));
    width: 0%;
    transition: width 1s linear;
}

/* ---- Stopwatch ---- */
.stopwatch-display {
    font-family: 'SF Mono', ui-monospace, monospace;
    font-size: 4rem;
    font-weight: 900;
    text-align: center;
    margin: 24px 16px;
    padding: 24px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.stopwatch-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 16px;
}

/* ---- Standings ---- */
.standings-table {
    background: var(--surface);
    border-radius: var(--radius);
    margin: 12px 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.standings-row {
    display: grid;
    grid-template-columns: 42px 1fr 56px 44px 44px 44px;
    align-items: center;
    padding: 16px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 1rem;
}
.standings-row.header {
    background: var(--surface-2);
    font-weight: 900;
    font-size: 0.72rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    padding: 12px 14px;
}
.standings-row:last-child { border-bottom: none; }
.standings-rank {
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    font-weight: 900;
    font-size: 0.9rem;
    background: var(--surface-2);
}
.standings-rank.top { background: var(--warning); color: #000; }
.standings-name { font-weight: 900; padding-left: 6px; }
.standings-points { font-weight: 900; color: var(--primary-dark); }
.standings-cell { text-align: center; color: var(--text-secondary); font-weight: 800; }

/* ---- Groups ---- */
.group-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px;
    margin: 12px 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.group-title {
    font-weight: 900;
    font-size: 1.15rem;
    margin-bottom: 14px;
    color: var(--primary-dark);
}

/* ---- Stations ---- */
.station-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px;
    margin: 12px 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.station-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.station-name { font-weight: 900; font-size: 1.15rem; }
.station-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.station-row:last-child { border-bottom: none; }
.station-row .team-name { flex: 1; font-weight: 800; }
.station-stepper {
    display: flex;
    align-items: center;
    gap: 8px;
}
.station-stepper input {
    width: 80px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 900;
    padding: 12px;
}
.station-total-row {
    text-align: right;
    font-weight: 900;
    color: var(--text-secondary);
    margin-top: 10px;
    font-size: 0.95rem;
}

/* ---- Quick Match ---- */
.quick-team-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 22px;
    margin: 14px 16px;
    border: 1px solid var(--border);
    text-align: center;
    box-shadow: var(--shadow);
}
.quick-team-card label {
    display: block;
    font-weight: 900;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-size: 0.85rem;
    text-transform: uppercase;
}
.quick-team-card input {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 900;
    width: 100%;
    padding: 18px;
}

/* ---- Bracket ---- */
.bracket-container {
    display: flex;
    gap: 18px;
    overflow-x: auto;
    padding: 8px 16px 18px;
}
.bracket-round {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 180px;
    justify-content: center;
}
.bracket-round-title {
    font-weight: 900;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    text-align: center;
}
.bracket-match {
    background: var(--surface);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.bracket-match.done { border-color: var(--success); }
.bracket-team {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    font-size: 0.95rem;
    font-weight: 800;
    border-bottom: 1px solid var(--border);
}
.bracket-team:last-child { border-bottom: none; }
.bracket-team.winner { background: var(--success-light); color: var(--success); }
.bracket-score { margin-left: auto; font-weight: 900; }
.color-dot-sm {
    width: 12px; height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ---- Modals / Overlays ---- */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 0.15s ease;
}
.overlay-box {
    background: var(--surface);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 24px;
    width: 100%;
    max-width: 760px;
    max-height: 90dvh;
    overflow-y: auto;
    animation: slideUp 0.2s ease;
}
.modal-box { border-radius: var(--radius); max-height: 85dvh; margin: auto 16px 16px; }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}
.modal-close {
    width: 48px; height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--surface-2);
    color: var(--text);
    font-size: 1.7rem;
    cursor: pointer;
}
.modal-body { font-size: 1.05rem; color: var(--text); }
.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 22px;
}
.modal-actions .btn { flex: 1; }

.qr-box {
    text-align: center;
    padding: 16px;
}
.qr-box img {
    max-width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

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

/* ---- Toast ---- */
#toast-root {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + 14px + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 300;
    width: 92%;
    max-width: 760px;
    pointer-events: none;
}
.toast {
    background: var(--text);
    color: white;
    padding: 16px 24px;
    border-radius: 999px;
    font-weight: 900;
    font-size: 1rem;
    box-shadow: var(--shadow-lg);
    text-align: center;
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: auto;
}
.toast-success { background: var(--success); color: #000; }
.toast-warning { background: var(--warning); color: #000; }
.toast-error { background: var(--danger); color: #fff; }

/* ---- Confetti ---- */
#confetti-root {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 500;
    overflow: hidden;
}
.confetti {
    position: absolute;
    top: -10px;
    width: 10px;
    height: 16px;
    opacity: 0.9;
    animation: confetti-fall 2.5s ease-out forwards;
}
@keyframes confetti-fall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ---- Winner ---- */
.winner-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #FCD34D, #F97316);
    color: #000;
    padding: 14px 22px;
    border-radius: 999px;
    font-weight: 900;
    font-size: 1.15rem;
    margin: 14px 16px;
    box-shadow: var(--shadow);
}
.winner-flash {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--warning), #F97316);
    color: #000;
    padding: 18px 30px;
    border-radius: 999px;
    font-weight: 900;
    font-size: 1.35rem;
    box-shadow: var(--shadow-lg);
    z-index: 250;
    animation: popIn 0.4s ease;
}
@keyframes popIn {
    0% { transform: translateX(-50%) scale(0.5); opacity: 0; }
    60% { transform: translateX(-50%) scale(1.08); opacity: 1; }
    100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* ---- Settings ---- */
.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    font-weight: 900;
    font-size: 1.05rem;
}
.setting-row:last-child { border-bottom: none; }

/* ---- Utility ---- */
.fade-in { animation: fadeIn 0.25s ease; }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-2 { margin-bottom: 16px; }
.w-full { width: 100%; }
.flex { display: flex; }
.gap-2 { gap: 16px; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

@media (min-width: 600px) {
    .quick-actions { grid-template-columns: repeat(4, 1fr); }
    .type-grid { grid-template-columns: repeat(3, 1fr); }
    .tool-grid { grid-template-columns: repeat(3, 1fr); }
    .home-hero { padding-top: 52px; }
    .page-header h2 { text-align: left; }
}
