/* ============================================================
   CHICKEN COOP CLASSIC – Design System & Styles
   ============================================================ */

/* Fonts are loaded via <link> in base.html (non-blocking, with preconnect) */

/* --- CSS Custom Properties --- */
:root {
    /* Colors */
    --white: #FFFFFF;
    --off-white: #F8F9FA;
    --bg-subtle: #F1F3F5;
    --green-900: #0D3B0D;
    --green-800: #145214;
    --green-700: #1B5E20;
    --green-600: #2E7D32;
    --green-500: #388E3C;
    --green-400: #4CAF50;
    --green-100: #C8E6C9;
    --green-50: #E8F5E9;
    --gold-600: #F57F17;
    --gold-500: #F9A825;
    --gold-400: #FBC02D;
    --gold-300: #FDD835;
    --gold-100: #FFF9C4;
    --red-600: #C62828;
    --red-500: #E53935;
    --red-100: #FFCDD2;
    --text-primary: #1A1A2E;
    --text-secondary: #4A4A68;
    --text-muted: #8A8AA3;
    --border: #DEE2E6;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --shadow-xl: 0 20px 60px rgba(0,0,0,0.15);

    /* Typography */
    --font-display: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Borders */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* The hidden attribute must win even over author display rules
   (e.g. .smack-form's display: flex) */
[hidden] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

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

img { max-width: 100%; height: auto; }

/* --- Layout --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.container-sm {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.section {
    padding: var(--space-3xl) 0;
}

.section--alt {
    background-color: var(--off-white);
}

/* --- Navbar --- */
.navbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: var(--space-md) 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.navbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.navbar__brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--green-800);
    text-decoration: none;
    transition: transform var(--transition-fast);
}
.navbar__brand:hover {
    transform: scale(1.02);
    color: var(--green-800);
}

.navbar__logo {
    height: 44px;
    width: auto;
    border-radius: var(--radius-sm);
}

.navbar__links {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    list-style: none;
}

.navbar__link {
    font-weight: 500;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
    position: relative;
}
.navbar__link:hover {
    color: var(--green-700);
}
.navbar__link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--green-600);
    transition: width var(--transition-base);
    border-radius: var(--radius-full);
}
.navbar__link:hover::after {
    width: 100%;
}

.navbar__actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.navbar__toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-sm);
}

.navbar__toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    margin: 5px 0;
    transition: var(--transition-base);
    border-radius: var(--radius-full);
}

/* --- Hero Section --- */
.hero {
    text-align: center;
    padding: var(--space-3xl) 0 var(--space-2xl);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center top, var(--green-50) 0%, transparent 70%);
    z-index: -1;
}

.hero__logo {
    width: 220px;
    height: auto;
    margin: 0 auto var(--space-xl);
    display: block;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.1));
    animation: fadeInUp 0.8s ease-out;
}

.hero__title {
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--green-900);
    margin-bottom: var(--space-md);
    letter-spacing: -0.02em;
    animation: fadeInUp 0.8s ease-out 0.1s both;
}

.hero__subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: var(--space-xl);
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.hero__actions {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    flex-wrap: wrap;
    animation: fadeInUp 0.8s ease-out 0.3s both;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.75rem 1.75rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    line-height: 1.4;
}

.btn--primary {
    background: linear-gradient(135deg, var(--green-700) 0%, var(--green-600) 100%);
    color: var(--white);
    box-shadow: 0 4px 14px rgba(27, 94, 32, 0.3);
}
.btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(27, 94, 32, 0.4);
    color: var(--white);
    background: linear-gradient(135deg, var(--green-600) 0%, var(--green-500) 100%);
}

.btn--secondary {
    background: var(--white);
    color: var(--green-700);
    border: 2px solid var(--green-700);
}
.btn--secondary:hover {
    background: var(--green-50);
    transform: translateY(-2px);
    color: var(--green-700);
}

.btn--gold {
    background: linear-gradient(135deg, var(--gold-500) 0%, var(--gold-400) 100%);
    color: var(--green-900);
    box-shadow: 0 4px 14px rgba(249, 168, 37, 0.3);
}
.btn--gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(249, 168, 37, 0.4);
    color: var(--green-900);
}

.btn--danger {
    background: var(--red-500);
    color: var(--white);
}
.btn--danger:hover {
    background: var(--red-600);
    transform: translateY(-2px);
}

.btn--sm {
    padding: 0.4rem 1rem;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
}

.btn--ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
}
.btn--ghost:hover {
    background: var(--off-white);
    color: var(--green-700);
}

/* --- Cards --- */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: var(--space-xl);
    transition: all var(--transition-base);
    border: 1px solid transparent;
}
.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card--flat {
    box-shadow: none;
    border: 1px solid var(--border);
}
.card--flat:hover {
    border-color: var(--green-400);
    box-shadow: var(--shadow-sm);
}

.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border);
}

.card__title {
    font-size: 1.25rem;
    font-weight: 700;
}

/* --- Flash Messages --- */
.flash-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-md) var(--space-lg) 0;
}

.flash {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    animation: slideDown 0.3s ease-out;
    position: relative;
}

.flash--success {
    background: var(--green-50);
    color: var(--green-800);
    border: 1px solid var(--green-100);
}

.flash--danger {
    background: var(--red-100);
    color: var(--red-600);
    border: 1px solid #ef9a9a;
}

.flash--warning {
    background: var(--gold-100);
    color: var(--gold-600);
    border: 1px solid #ffe082;
}

.flash--info {
    background: #E3F2FD;
    color: #1565C0;
    border: 1px solid #90CAF9;
}

.flash__close {
    position: absolute;
    right: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}
.flash__close:hover { opacity: 1; }

/* --- Forms --- */
.form-page {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl) var(--space-lg);
}

.form-card {
    width: 100%;
    max-width: 480px;
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: var(--space-2xl);
    animation: fadeInUp 0.5s ease-out;
}

.form-card__title {
    text-align: center;
    font-size: 1.75rem;
    margin-bottom: var(--space-xs);
}

.form-card__subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: var(--space-xl);
}

.form-group {
    margin-bottom: var(--space-lg);
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: var(--font-body);
    font-size: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    background: var(--white);
    color: var(--text-primary);
}

.form-control:focus {
    outline: none;
    border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234A4A68' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--green-600);
    cursor: pointer;
}

.form-actions {
    margin-top: var(--space-xl);
}

.form-footer {
    text-align: center;
    margin-top: var(--space-lg);
    color: var(--text-muted);
}

/* --- Leaderboard Table --- */
.leaderboard {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.leaderboard thead {
    position: sticky;
    top: 70px;
    z-index: 10;
}

.leaderboard th {
    background: var(--green-800);
    color: var(--white);
    font-family: var(--font-display);
    font-weight: 600;
    padding: var(--space-md) var(--space-lg);
    text-align: left;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.leaderboard th:first-child {
    border-radius: var(--radius-md) 0 0 0;
}
.leaderboard th:last-child {
    border-radius: 0 var(--radius-md) 0 0;
}

.leaderboard td {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border);
    font-variant-numeric: tabular-nums;
    transition: background var(--transition-fast);
}

.leaderboard tbody tr {
    transition: all var(--transition-fast);
}

.leaderboard tbody tr:hover {
    background: var(--green-50);
}

.leaderboard tbody tr:last-child td:first-child {
    border-radius: 0 0 0 var(--radius-md);
}
.leaderboard tbody tr:last-child td:last-child {
    border-radius: 0 0 var(--radius-md) 0;
}

/* Position badges */
.position {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 0.875rem;
}

.position--1 {
    background: linear-gradient(135deg, #FFD700, #FFA000);
    color: #5D4037;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

.position--2 {
    background: linear-gradient(135deg, #E0E0E0, #BDBDBD);
    color: #424242;
    box-shadow: 0 2px 8px rgba(189, 189, 189, 0.4);
}

.position--3 {
    background: linear-gradient(135deg, #D7A86E, #CD7F32);
    color: #3E2723;
    box-shadow: 0 2px 8px rgba(205, 127, 50, 0.4);
}

.position--other {
    background: var(--off-white);
    color: var(--text-secondary);
}

.position--tied {
    font-size: 0.75rem;
    letter-spacing: -0.02em;
}

/* Position movement arrows (live refresh) */
.pos-move {
    margin-left: var(--space-xs);
    font-size: 0.7rem;
    vertical-align: middle;
    animation: posMovePulse 1.2s ease-in-out 3;
}
.pos-move--up { color: var(--green-600); }
.pos-move--down { color: var(--red-500); }

@keyframes posMovePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.25; }
}

.lb-row--moved td {
    background: var(--green-50);
    transition: background 1.5s ease 2s;
}

/* Score colors */
.score--under {
    color: var(--green-600);
    font-weight: 700;
}

.score--even {
    color: var(--text-primary);
    font-weight: 600;
}

.score--over {
    color: var(--red-500);
    font-weight: 600;
}

.vs-par {
    font-size: 0.85rem;
    font-weight: 600;
}

/* Player name in leaderboard */
.player-name {
    font-weight: 600;
    font-family: var(--font-display);
}

.player-name--link {
    color: var(--green-800);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
    padding-bottom: 1px;
}
.player-name--link:hover {
    color: var(--green-600);
    border-bottom-color: var(--green-500);
}

.player-name__type {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: var(--space-sm);
    background: var(--off-white);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

/* --- Scorecard (Submit Score) --- */
.scorecard {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: var(--space-md) 0;
    table-layout: fixed;
}

.scorecard th, .scorecard td {
    padding: var(--space-xs) var(--space-sm);
    text-align: center;
    border: 1px solid var(--border);
    overflow: hidden;
}

.scorecard th {
    background: var(--green-700);
    color: var(--white);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.85rem;
}

.scorecard .scorecard__hole-num {
    background: var(--green-800);
    color: var(--gold-300);
    font-weight: 800;
    font-size: 1rem;
}

.scorecard .scorecard__par {
    background: var(--off-white);
    font-weight: 600;
    color: var(--text-secondary);
}

.scorecard input[type="number"] {
    width: 100%;
    max-width: 52px;
    height: 38px;
    text-align: center;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    transition: all var(--transition-fast);
    color: var(--text-primary);
    box-sizing: border-box;
}

.scorecard input[type="number"]:focus {
    outline: none;
    border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.15);
}

.scorecard__total {
    background: var(--green-900);
    color: var(--gold-300);
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.2rem;
}

.scorecard__total-value {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--green-700);
    font-family: var(--font-display);
}

/* --- Dashboard --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: var(--space-xl);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.stat-card {
    text-align: center;
    padding: var(--space-lg);
    background: var(--off-white);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}
.stat-card:hover {
    background: var(--green-50);
    transform: translateY(-2px);
}

.stat-card__value {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 2rem;
    color: var(--green-700);
    line-height: 1;
}

.stat-card__label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: var(--space-xs);
}

/* --- Score History Table --- */
.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th {
    background: var(--off-white);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: var(--space-sm) var(--space-md);
    text-align: left;
}

.history-table td {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--border);
}

/* --- Admin Panel --- */
.admin-section {
    margin-bottom: var(--space-2xl);
}

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

.admin-table th {
    background: var(--off-white);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: var(--space-md);
    text-align: left;
}

.admin-table td {
    padding: var(--space-md);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.admin-table tbody tr:hover {
    background: var(--off-white);
}

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge--active {
    background: var(--green-100);
    color: var(--green-800);
}

.badge--inactive {
    background: var(--bg-subtle);
    color: var(--text-muted);
}

.badge--admin {
    background: var(--gold-100);
    color: var(--gold-600);
}

.badge--team {
    background: #E3F2FD;
    color: #1565C0;
}

.badge--xs {
    font-size: 0.65rem;
    padding: 1px 6px;
}

.badge--stroke {
    background: var(--green-50);
    color: var(--green-700);
}

.badge--scramble {
    background: var(--gold-100);
    color: var(--gold-600);
}

.badge--shamble {
    background: #F3E5F5;
    color: #7B1FA2;
}

.actions-cell {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    flex-wrap: wrap;
}

/* --- Footer --- */
.footer {
    background: var(--green-900);
    color: rgba(255,255,255,0.7);
    padding: var(--space-2xl) 0;
    text-align: center;
    margin-top: var(--space-3xl);
}

.footer__brand {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--gold-400);
    margin-bottom: var(--space-sm);
}

.footer__text {
    font-size: 0.875rem;
}

.footer__emoji {
    font-size: 1.5rem;
    margin-bottom: var(--space-sm);
}

/* --- Page Header --- */
.page-header {
    padding: var(--space-2xl) 0 var(--space-xl);
    text-align: center;
}

.page-header__title {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--green-900);
    margin-bottom: var(--space-sm);
}

.page-header__subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* --- Utility --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }

.inline-form {
    display: inline;
}

.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;
}

/* King of the Coop marker on the leaderboard leader */
.leader-mark {
    font-size: 1rem;
    margin-left: var(--space-xs);
    display: inline-block;
    animation: struttingChicken 2.5s ease-in-out infinite;
}

@keyframes struttingChicken {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-8deg); }
    75% { transform: rotate(8deg); }
}

.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-lg);
    color: var(--text-muted);
}

.empty-state__icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
}

.empty-state__text {
    font-size: 1.1rem;
    margin-bottom: var(--space-lg);
}

/* --- Round Info Card --- */
.round-info {
    display: flex;
    gap: var(--space-md);
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: var(--space-lg);
    padding: var(--space-md) var(--space-lg);
    background: var(--off-white);
    border-radius: var(--radius-md);
}

.round-info__item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.round-info__item strong {
    color: var(--text-primary);
}

/* --- Admin Tabs --- */
.admin-tabs {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
    padding: var(--space-sm);
    background: var(--off-white);
    border-radius: var(--radius-lg);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-tab {
    flex: 1;
    min-width: max-content;
    padding: var(--space-sm) var(--space-lg);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-base);
    white-space: nowrap;
}

.admin-tab:hover {
    background: var(--white);
    color: var(--green-700);
    box-shadow: var(--shadow-sm);
}

.admin-tab--active {
    background: var(--white);
    color: var(--green-800);
    box-shadow: var(--shadow-md);
}

.admin-tab-panel {
    display: none;
}

.admin-tab-panel--active {
    display: block;
    animation: fadeInUp 0.3s ease-out;
}

/* --- Scores Accordion --- */
.scores-accordion {
    margin-bottom: var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.scores-accordion__header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
    padding: var(--space-md) var(--space-lg);
    cursor: pointer;
    background: var(--off-white);
    border-bottom: 2px solid var(--green-100);
    user-select: none;
    list-style: none;
    transition: background var(--transition-fast);
}

.scores-accordion__header::-webkit-details-marker { display: none; }

.scores-accordion__header:hover {
    background: var(--green-50);
}

.scores-accordion__title {
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--green-800);
    font-size: 1rem;
}

.scores-accordion__meta {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.scores-accordion__arrow {
    margin-left: auto;
    font-size: 1.1rem;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.scores-accordion[open] .scores-accordion__arrow {
    transform: rotate(90deg);
}

.scores-accordion[open] .scores-accordion__header {
    background: var(--green-50);
}

.scores-accordion__body {
    padding: var(--space-sm) var(--space-md);
}

/* --- Desktop / Mobile Layout Toggles --- */
.scorecard-desktop { display: block !important; overflow: hidden; }
.scorecard-mobile { display: none !important; }
.leaderboard-desktop { display: block !important; }
.leaderboard-mobile { display: none !important; }

/* --- Mobile Scorecard (Vertical Layout) --- */
.scorecard-mobile__section {
    margin-bottom: var(--space-lg);
}

.scorecard-mobile__section-title {
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--space-sm);
    padding: var(--space-sm) 0;
    border-bottom: 2px solid var(--green-700);
}

.scorecard-mobile__hole {
    display: flex;
    align-items: center;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border);
    gap: var(--space-md);
}

.scorecard-mobile__hole-num {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--green-800);
    width: 32px;
    text-align: center;
    flex-shrink: 0;
}

.scorecard-mobile__par {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    width: 44px;
}

.scorecard-mobile__par-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
}

.scorecard-mobile__par-value {
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 1rem;
}

.scorecard-mobile__input-wrap {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

.scorecard-mobile__input {
    width: 64px !important;
    height: 44px !important;
    text-align: center;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.2rem;
    transition: all var(--transition-fast);
    color: var(--text-primary);
    -webkit-appearance: none;
    -moz-appearance: textfield;
}

.scorecard-mobile__input:focus {
    outline: none;
    border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.15);
}

.scorecard-mobile__subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-bottom: 2px solid var(--border);
    margin-bottom: var(--space-sm);
}

.scorecard-mobile__subtotal span:last-child {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--green-700);
}

.scorecard-mobile__total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) 0;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--green-900);
    border-top: 3px solid var(--green-700);
    margin-top: var(--space-md);
}

.scorecard-mobile__total span:last-child {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 1.5rem;
    color: var(--green-700);
}

/* --- Mobile Leaderboard Cards --- */
.leaderboard-mobile {
    flex-direction: column;
    gap: var(--space-sm);
}

.leaderboard-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    transition: all var(--transition-fast);
    background: var(--white);
}

.leaderboard-card:hover {
    border-color: var(--green-400);
    box-shadow: var(--shadow-sm);
}

.leaderboard-card:first-child {
    border-color: rgba(255, 215, 0, 0.4);
    background: linear-gradient(135deg, rgba(255, 249, 196, 0.3), var(--white));
}

.leaderboard-card__link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.leaderboard-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xs);
}

.leaderboard-card__pos-name {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-width: 0;
}

.leaderboard-card__pos-name .player-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-card__score {
    flex-shrink: 0;
    margin-left: var(--space-sm);
}

.leaderboard-card__bottom {
    display: flex;
    justify-content: space-between;
    padding-top: var(--space-xs);
    border-top: 1px solid var(--border);
    margin-top: var(--space-xs);
}

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

/* --- Smack Board Drawer (slide-out) --- */
.smack-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(13, 59, 13, 0.45);
    z-index: 1250;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}
.smack-backdrop--open {
    opacity: 1;
    pointer-events: auto;
}

.smack-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(420px, 92vw);
    background: var(--white);
    z-index: 1300;
    transform: translateX(100%);
    transition: transform var(--transition-base);
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    padding: var(--space-lg);
    padding-bottom: calc(var(--space-lg) + env(safe-area-inset-bottom, 0px));
}
.smack-drawer--open {
    transform: translateX(0);
}

.smack-drawer__header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.smack-drawer__title {
    flex: 1;
    font-size: 1.2rem;
}

.smack-drawer__close {
    background: none;
    border: none;
    font-size: 1.6rem;
    color: var(--text-muted);
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
    line-height: 1;
}
.smack-drawer__close:hover { color: var(--text-primary); }

.smack-drawer .smack-form,
.smack-drawer .ob-report {
    flex-shrink: 0;
}

.smack-tabs {
    display: flex;
    gap: var(--space-xs);
    padding: var(--space-xs);
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    flex-shrink: 0;
}

.smack-tab {
    flex: 1;
    padding: var(--space-sm);
    min-height: 40px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.smack-tab:hover {
    color: var(--green-700);
}

.smack-tab--active {
    background: var(--white);
    color: var(--green-800);
    box-shadow: var(--shadow-sm);
}

.smack-drawer .feed-list {
    flex: 1;
    max-height: none;
    min-height: 0;
}

/* --- Smack Board / Live Feed --- */
.smack-form {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.smack-form .form-control {
    flex: 1;
    min-width: 0;
}

.ob-report {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    flex-wrap: wrap;
    padding: var(--space-sm) var(--space-md);
    background: var(--gold-100);
    border: 1px solid #ffe082;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
}

.ob-report__label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gold-600);
    white-space: nowrap;
}

.ob-report .form-control {
    flex: 1;
    min-width: 130px;
    max-width: 220px;
    min-height: 40px;
}

.feed-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-height: 480px;
    overflow-y: auto;
}

.feed-item {
    display: flex;
    align-items: baseline;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    background: var(--off-white);
    border-left: 3px solid var(--border);
    font-size: 0.95rem;
    animation: fadeInUp 0.3s ease-out;
}

.feed-item__body { flex: 1; min-width: 0; overflow-wrap: break-word; }

.feed-item__author {
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--green-800);
}

.feed-item__author::after { content: ':'; }

.feed-item__time {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.feed-item__delete {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 var(--space-xs);
    line-height: 1;
}
.feed-item__delete:hover { color: var(--red-600); }

.feed-item--ob {
    background: var(--gold-100);
    border-left-color: var(--gold-500);
    font-weight: 600;
}

.feed-item--birdie {
    background: var(--green-50);
    border-left-color: var(--green-500);
}

.feed-item--chicken {
    background: var(--red-100);
    border-left-color: var(--red-500);
}

/* --- OB button on scorecard --- */
.btn-ob {
    min-width: 44px;
    min-height: 38px;
    padding: 0 var(--space-sm);
    border: 2px solid var(--gold-500);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--gold-600);
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.btn-ob:hover, .btn-ob:active {
    background: var(--gold-100);
}

.scorecard-mobile__hole .btn-ob {
    min-height: 44px;
    margin-left: var(--space-sm);
}

/* --- Active Round Cards (homepage) --- */
.round-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-lg);
    max-width: 900px;
    margin: 0 auto;
}

.round-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}
.round-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--green-400);
}

.round-card__name {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--green-900);
}

.round-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.round-card__cta {
    margin-top: var(--space-sm);
}

/* --- Hole Tiles (mobile read-only scorecards) ---
   Holes wrap into rows instead of scrolling sideways — the whole card
   is visible at a glance on a phone. */
.holecard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: var(--space-xs);
}

.holecard {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: var(--space-xs) 2px;
    background: var(--off-white);
    border-radius: var(--radius-sm);
}

.holecard__num {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
}

.holecard__score {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1;
}

.holecard__score .hole-score {
    min-width: 28px;
    height: 28px;
}

.holecard__par {
    font-size: 0.6rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.holecard-subtotal {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    align-items: baseline;
    padding: var(--space-sm) var(--space-xs) 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.holecard-subtotal strong {
    font-family: var(--font-display);
    font-size: 1.15rem;
    color: var(--green-700);
}

[data-theme="dark"] .holecard-subtotal strong { color: #81C784; }

/* --- Golf Scorecard Notation ---
   Circle = birdie, double circle = eagle or better,
   square = bogey, double square = double bogey or worse.
   Shapes + color, so it still reads for color-blind players. */
.hole-score {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    line-height: 1;
}

.hole-score--birdie {
    color: var(--green-600);
    border: 2px solid var(--green-600);
    border-radius: var(--radius-full);
}

.hole-score--eagle {
    color: var(--green-600);
    border: 2px solid var(--green-600);
    border-radius: var(--radius-full);
    box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--green-600);
}

.hole-score--bogey {
    color: var(--red-500);
    border: 2px solid var(--red-500);
    border-radius: 3px;
}

.hole-score--double {
    color: var(--red-500);
    border: 2px solid var(--red-500);
    border-radius: 3px;
    box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--red-500);
}

/* Same notation on live scorecard inputs (pill = under par, square = over) */
.hole-input--birdie,
.hole-input--eagle {
    color: var(--green-600) !important;
    border-color: var(--green-600) !important;
    border-radius: var(--radius-full) !important;
}

.hole-input--eagle {
    box-shadow: 0 0 0 1.5px var(--white), 0 0 0 3.5px var(--green-600) !important;
}

.hole-input--bogey,
.hole-input--double {
    color: var(--red-500) !important;
    border-color: var(--red-500) !important;
    border-radius: 3px !important;
}

.hole-input--double {
    box-shadow: 0 0 0 1.5px var(--white), 0 0 0 3.5px var(--red-500) !important;
}

/* --- Team Generator: draggable player chips --- */
.gen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-md);
}

.gen-team {
    background: var(--off-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-sm);
}

.gen-team--bench {
    background: var(--gold-100);
    border-color: var(--gold-500);
}

/* The "Not placed yet" parking zone: always a valid drop target */
.gen-team--unplaced {
    background: var(--gold-100);
    border: 2px dashed var(--gold-500);
    min-height: 88px;
}

/* Zone highlighted while a dragged chip can be dropped into it */
.gen-team--over {
    border-color: var(--green-600);
    border-style: dashed;
    background: var(--green-50);
}

.gen-team__label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
    padding-left: var(--space-xs);
}

.gen-chip {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-height: 44px;
    padding: var(--space-xs) var(--space-sm);
    margin-bottom: var(--space-xs);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: grab;
    user-select: none;
    transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}
.gen-chip:last-child { margin-bottom: 0; }
.gen-chip:hover { border-color: var(--green-400); box-shadow: var(--shadow-sm); }
.gen-chip:active { cursor: grabbing; }

.gen-chip__grip {
    color: var(--text-muted);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.gen-chip--dragging { opacity: 0.4; }

.gen-chip--over {
    border-color: var(--green-600);
    border-style: dashed;
    background: var(--green-50);
}

.gen-chip--selected {
    border-color: var(--green-600);
    box-shadow: 0 0 0 2px var(--green-100);
    background: var(--green-50);
}

.gen-chip--swapped {
    animation: chipSwapped 0.6s ease-out;
}

@keyframes chipSwapped {
    0% { background: var(--green-100); }
    100% { background: var(--white); }
}

/* --- Stats Page: hole difficulty chart --- */
.difficulty-chart {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.difficulty-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
}

.difficulty-row--hardest { background: var(--red-100); }
.difficulty-row--easiest { background: var(--green-50); }

.difficulty-row__hole {
    width: 26px;
    text-align: center;
    font-family: var(--font-display);
    font-weight: 800;
    color: var(--green-800);
    flex-shrink: 0;
}

.difficulty-row__par {
    width: 44px;
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.difficulty-row__track {
    flex: 1;
    position: relative;
    height: 18px;
    background: var(--bg-subtle);
    border-radius: var(--radius-full);
    overflow: hidden;
    min-width: 80px;
}

.difficulty-row__center {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    margin-left: -1px;
    background: var(--border);
}

.difficulty-row__bar {
    position: absolute;
    top: 3px;
    bottom: 3px;
    border-radius: var(--radius-full);
    min-width: 3px;
    transition: width var(--transition-slow);
}

.difficulty-row__bar--over { background: var(--red-500); }
.difficulty-row__bar--under { background: var(--green-500); }

.difficulty-row__avg {
    width: 105px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.difficulty-row__detail { font-size: 0.75rem; margin-left: 4px; }

.difficulty-row__badges {
    width: 150px;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.stats-table th, .stats-table td {
    text-align: center;
    white-space: nowrap;
}
.stats-table th:first-child, .stats-table td:first-child {
    text-align: left;
}

@media (max-width: 768px) {
    .difficulty-row__detail { display: none; }
    .difficulty-row__badges { width: auto; min-width: 60px; }
    .difficulty-row__avg { width: 56px; }
    .difficulty-row__par { width: 36px; }
}

/* --- PWA: install banner + offline queue badge --- */
.install-banner {
    position: fixed;
    left: var(--space-sm);
    right: var(--space-sm);
    bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 1200;
    animation: fadeInUp 0.4s ease-out;
    max-width: 480px;
    margin: 0 auto;
}

.install-banner__icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.install-banner__text {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.4;
}

.install-banner__close {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-xs);
    min-width: 44px;
    min-height: 44px;
    flex-shrink: 0;
}

.badge--warning-queue {
    background: var(--gold-100);
    color: var(--gold-600);
}

/* --- Tap-Pad Score Entry (mobile layout only) --- */
.scorecard-mobile .hole-input {
    cursor: pointer;
    caret-color: transparent;
}

.tap-pad {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: var(--white);
    border-top: 3px solid var(--green-700);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.18);
    padding: var(--space-sm) var(--space-md);
    padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom, 0px));
    z-index: 1100;
    animation: slideUpPad 0.2s ease-out;
}

@keyframes slideUpPad {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* Keep the last holes reachable above the open pad */
body.tap-pad-open {
    padding-bottom: 300px;
}

.tap-pad__header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    max-width: 480px;
    margin: 0 auto var(--space-sm);
}

.tap-pad__title {
    flex: 1;
    text-align: center;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--green-900);
}

.tap-pad__nav {
    min-width: 44px;
    min-height: 44px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--off-white);
    color: var(--text-secondary);
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition-fast);
}
.tap-pad__nav:hover { background: var(--green-50); }
.tap-pad__nav--close { font-size: 1rem; }

.tap-pad__grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--space-xs);
    max-width: 480px;
    margin: 0 auto;
}

.tap-pad__chip {
    min-height: 50px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--white);
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.tap-pad__chip:active { transform: scale(0.95); }

.tap-pad__chip--under { color: var(--green-600); }
.tap-pad__chip--over { color: var(--red-500); }
.tap-pad__chip--par {
    border-color: var(--green-600);
    background: var(--green-50);
}
.tap-pad__chip--selected {
    background: var(--green-700);
    border-color: var(--green-700);
    color: var(--white);
}
.tap-pad__chip--clear {
    grid-column: span 5;
    min-height: 44px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.animate-in {
    animation: fadeInUp 0.5s ease-out;
}

.stagger-1 { animation-delay: 0.1s; animation-fill-mode: both; }
.stagger-2 { animation-delay: 0.2s; animation-fill-mode: both; }
.stagger-3 { animation-delay: 0.3s; animation-fill-mode: both; }
.stagger-4 { animation-delay: 0.4s; animation-fill-mode: both; }

/* --- Responsive: Tablet (max-width: 768px) --- */
@media (max-width: 768px) {
    .hero__title { font-size: 2.25rem; }
    .hero__logo { width: 160px; }
    .hero { padding: var(--space-2xl) 0 var(--space-xl); }

    .navbar__toggle { display: block; }

    .navbar__links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--white);
        flex-direction: column;
        padding: var(--space-lg);
        gap: var(--space-sm);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-md);
    }

    .navbar__links--open {
        display: flex;
    }

    .navbar__links li {
        width: 100%;
    }

    .navbar__links .navbar__link {
        display: block;
        padding: var(--space-sm) var(--space-md);
        border-radius: var(--radius-sm);
    }
    .navbar__links .navbar__link:hover {
        background: var(--green-50);
    }
    .navbar__links .navbar__link::after {
        display: none;
    }

    .navbar__links .btn {
        width: 100%;
        justify-content: center;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .page-header__title { font-size: 1.75rem; }
    .page-header { padding: var(--space-xl) 0 var(--space-lg); }

    .section { padding: var(--space-2xl) 0; }

    /* Toggle desktop/mobile layouts */
    .scorecard-desktop { display: none !important; }
    .scorecard-mobile { display: block !important; }
    .leaderboard-desktop { display: none !important; }
    .leaderboard-mobile { display: flex !important; }

    /* Read-only scorecard tables (player pages): fixed layout squeezes a
       13-hole card into phone width — let cells keep their size and the
       overflow-x wrapper scroll instead */
    .scorecard {
        table-layout: auto;
    }
    .scorecard th,
    .scorecard td {
        min-width: 42px;
        padding: var(--space-xs) 4px;
    }

    .form-card {
        padding: var(--space-xl);
        border-radius: var(--radius-lg);
        margin: 0 var(--space-sm);
    }

    .form-page {
        padding: var(--space-xl) var(--space-sm);
        min-height: auto;
    }

    .container-sm {
        padding: 0 var(--space-md);
    }

    .card {
        padding: var(--space-lg);
        border-radius: var(--radius-md);
    }

    .card__header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-sm);
    }

    /* Admin tabs: wrap into grid */
    .admin-tabs {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--space-xs);
        padding: var(--space-xs);
    }

    .admin-tab {
        flex: none;
        padding: var(--space-sm) var(--space-md);
        font-size: 0.8rem;
        text-align: center;
    }

    /* Admin tables → stacked card rows */
    .admin-table {
        border: none;
    }

    .admin-table thead {
        display: none;
    }

    .admin-table tbody {
        display: flex;
        flex-direction: column;
        gap: var(--space-sm);
    }

    .admin-table tbody tr {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-xs) var(--space-md);
        align-items: center;
        padding: var(--space-md);
        background: var(--white);
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-sm);
    }

    .admin-table tbody tr:hover {
        background: var(--green-50);
    }

    .admin-table td {
        display: inline-flex;
        align-items: center;
        padding: 0;
        border: none;
        font-size: 0.85rem;
        white-space: normal;
    }

    /* First cell (usually name) takes full width */
    .admin-table td:first-child {
        flex: 1 0 100%;
        font-size: 0.95rem;
    }

    /* Last cell (actions) takes full width */
    .admin-table td:last-child {
        flex: 1 0 100%;
        margin-top: var(--space-xs);
    }

    .actions-cell {
        flex-wrap: wrap;
        gap: var(--space-xs);
        width: 100%;
    }

    .actions-cell .btn {
        flex: 1;
        justify-content: center;
        min-width: 0;
    }

    /* Round info */
    .round-info {
        flex-direction: column;
        gap: var(--space-sm);
    }

    /* Form pages full width */
    .form-card {
        max-width: 100% !important;
        margin: 0 var(--space-sm);
    }

    /* Quick action buttons */
    .flex-center {
        flex-wrap: wrap;
    }

    .flex-center .btn {
        flex: 1 1 auto;
        min-width: 120px;
        justify-content: center;
        font-size: 0.9rem;
        padding: 0.65rem 1rem;
    }

    /* Footer */
    .footer {
        padding: var(--space-xl) 0;
        margin-top: var(--space-2xl);
    }

    /* Player scorecards page */
    .player-name--link {
        font-size: 0.9rem;
    }
}

/* --- Responsive: Mobile (max-width: 480px) --- */
@media (max-width: 480px) {
    .hero__title { font-size: 1.6rem; }
    .hero__subtitle { font-size: 0.95rem; }
    .hero__logo { width: 130px; margin-bottom: var(--space-lg); }
    .hero { padding: var(--space-xl) 0; }

    .hero__actions {
        flex-direction: column;
        align-items: stretch;
    }
    .hero__actions .btn {
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-sm);
    }

    .stat-card {
        padding: var(--space-md);
    }

    .stat-card__value {
        font-size: 1.5rem;
    }

    .stat-card__label {
        font-size: 0.7rem;
    }

    .container {
        padding: 0 var(--space-md);
    }

    .page-header__title { font-size: 1.4rem; }
    .page-header__subtitle { font-size: 0.9rem; }

    .section { padding: var(--space-xl) 0; }

    .card {
        padding: var(--space-md);
    }

    .form-card {
        padding: var(--space-lg);
    }

    .form-card__title { font-size: 1.4rem; }
    .form-card__subtitle { font-size: 0.85rem; }

    .btn {
        padding: 0.65rem 1.25rem;
        font-size: 0.9rem;
    }

    .btn--sm {
        padding: 0.35rem 0.75rem;
        font-size: 0.8rem;
    }

    /* Badge compact */
    .badge {
        font-size: 0.65rem;
        padding: 1px 6px;
    }

    /* Navbar brand compact */
    .navbar__brand span {
        font-size: 1rem;
    }

    .navbar__logo {
        height: 36px;
    }

    /* Flash messages */
    .flash {
        font-size: 0.9rem;
        padding: var(--space-sm) var(--space-md);
        padding-right: var(--space-2xl);
    }

    /* History table compact */
    .history-table th,
    .history-table td {
        padding: var(--space-xs) var(--space-sm);
        font-size: 0.8rem;
    }

    /* Footer compact */
    .footer__brand { font-size: 1rem; }
    .footer__text { font-size: 0.8rem; }
    .footer__emoji { font-size: 1.25rem; }
}

/* --- Touch-friendly: increase hit targets --- */
@media (hover: none) and (pointer: coarse) {
    .navbar__link {
        padding: var(--space-sm) 0;
    }

    .leaderboard tbody tr {
        cursor: pointer;
    }

    .scorecard input[type="number"] {
        min-height: 44px;
        font-size: 1.1rem;
    }

    .form-control {
        min-height: 48px;
        font-size: 16px; /* Prevents iOS zoom */
    }

    select.form-control {
        min-height: 48px;
        font-size: 16px;
    }

    .btn {
        min-height: 44px;
    }

    .flash__close {
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* --- Dark Mode ---
   Activated by data-theme="dark" on <html>. A tiny inline script in
   base.html sets it before first paint: system preference by default,
   localStorage override once the user taps the navbar toggle.
   Every component color comes from these custom properties, so remapping
   them is (nearly) the whole job. A few hardcoded light-mode colors are
   overridden below the variable block. */
:root[data-theme="dark"] {
    --white: #151b15;         /* base surface */
    --off-white: #1c231c;
    --bg-subtle: #232b23;
    --green-900: #A5D6A7;     /* headings flip to light green */
    --green-800: #9CCC9E;
    --green-100: #2E4A31;
    --green-50: #1E2C1F;
    --gold-100: #3A331A;
    --red-100: #402222;
    --red-600: #EF9A9A;
    --text-primary: #E8ECE8;
    --text-secondary: #B4BDB4;
    --text-muted: #7E887E;
    --border: #2E372E;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.55);
    --shadow-xl: 0 20px 60px rgba(0,0,0,0.6);
}

[data-theme="dark"] .navbar {
    background: rgba(21, 27, 21, 0.95);
}

[data-theme="dark"] .btn--secondary {
    background: transparent;
    color: var(--green-400);
    border-color: var(--green-500);
}
[data-theme="dark"] .btn--secondary:hover {
    background: var(--green-50);
    color: var(--green-400);
}

[data-theme="dark"] .flash--info {
    background: #1A2733;
    color: #90CAF9;
    border-color: #2A3F52;
}

[data-theme="dark"] .badge--team {
    background: #1A2733;
    color: #90CAF9;
}

[data-theme="dark"] .badge--shamble {
    background: #32243A;
    color: #CE93D8;
}

[data-theme="dark"] .flash--danger {
    background: var(--red-100);
    color: var(--red-600);
    border-color: #5A3030;
}

[data-theme="dark"] .flash--warning {
    border-color: #55491F;
}

[data-theme="dark"] select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23B4BDB4' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

[data-theme="dark"] .hero__logo,
[data-theme="dark"] .navbar__logo {
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
}

/* Components that use green vars as text need lighter greens,
   and ones that use them as backgrounds need to stay dark */
[data-theme="dark"] a { color: #81C784; }
[data-theme="dark"] a:hover { color: #A5D6A7; }

[data-theme="dark"] .badge--stroke { color: #81C784; }
[data-theme="dark"] .badge--admin { background: #3A331A; }
[data-theme="dark"] .badge--scramble { background: #3A331A; }

[data-theme="dark"] .stat-card__value,
[data-theme="dark"] .scorecard__total-value,
[data-theme="dark"] .scorecard-mobile__subtotal span:last-child,
[data-theme="dark"] .scorecard-mobile__total span:last-child { color: #81C784; }

[data-theme="dark"] .leaderboard th { background: #163A19; color: #E8ECE8; }
[data-theme="dark"] .scorecard .scorecard__hole-num { background: #163A19; }
[data-theme="dark"] .scorecard__total { background: #0F2A10; }
[data-theme="dark"] .footer { background: #0F1F0F; }
[data-theme="dark"] .btn--gold { color: #143014; }
[data-theme="dark"] .btn--gold:hover { color: #143014; }

[data-theme="dark"] .leaderboard-card:first-child {
    border-color: rgba(255, 213, 79, 0.3);
    background: linear-gradient(135deg, rgba(58, 51, 26, 0.5), var(--white));
}

[data-theme="dark"] .hole-score--eagle {
    box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--green-600);
}

/* Navbar theme toggle button */
.theme-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
    border-radius: var(--radius-full);
    transition: background var(--transition-fast);
    line-height: 1;
}
.theme-toggle:hover {
    background: var(--off-white);
}
