@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ── Design tokens ───────────────────────────────────── */
:root {
    --green-900: #0d3320;
    --green-800: #14532d;
    --green-700: #166534;
    --green-600: #16a34a;
    --green-500: #22c55e;
    --green-400: #4ade80;
    --green-100: #dcfce7;
    --gold:      #f59e0b;
    --silver:    #94a3b8;
    --bronze:    #b45309;
    --surface:   #ffffff;
    --bg:        #f0fdf4;
    --text:      #0f172a;
    --muted:     #64748b;
    --border:    #e2e8f0;
    --radius-sm: 10px;
    --radius:    16px;
    --radius-lg: 22px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow:    0 4px 16px rgba(0,0,0,.07), 0 1px 4px rgba(0,0,0,.04);
    --shadow-md: 0 8px 32px rgba(0,0,0,.10), 0 2px 8px rgba(0,0,0,.06);
    --shadow-lg: 0 20px 60px rgba(0,0,0,.14), 0 4px 16px rgba(0,0,0,.06);
}

/* ── Base ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* ── Navbar ──────────────────────────────────────────── */
.navbar {
    background: rgba(13,51,32,.96) !important;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255,255,255,.06);
    padding-top: .85rem;
    padding-bottom: .85rem;
    box-shadow: 0 2px 20px rgba(0,0,0,.18);
}
.navbar-brand {
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: -.02em;
    color: #fff !important;
}
.navbar-brand i { color: var(--green-400); }
.nav-link {
    font-weight: 500;
    font-size: .9rem;
    color: rgba(255,255,255,.75) !important;
    transition: color .15s;
    padding: .4rem .75rem !important;
    border-radius: 8px;
}
.nav-link:hover { color: #fff !important; background: rgba(255,255,255,.07); }
.nav-link.btn {
    background: var(--green-600) !important;
    color: #fff !important;
    font-weight: 600;
    padding: .4rem 1.1rem !important;
}
.nav-link.btn:hover { background: var(--green-500) !important; }

/* ── Hero ────────────────────────────────────────────── */
.hero {
    background:
        linear-gradient(150deg, var(--green-900) 0%, var(--green-800) 45%, #1a6b3a 100%);
    color: #fff;
    padding: 5rem 0 4.5rem;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 70% 40%, rgba(34,197,94,.15) 0%, transparent 60%),
        radial-gradient(ellipse 50% 40% at 20% 80%, rgba(74,222,128,.08) 0%, transparent 50%);
    pointer-events: none;
}
.hero::after {
    content: '⚽';
    position: absolute;
    right: -2rem;
    top: -2rem;
    font-size: 18rem;
    opacity: .04;
    line-height: 1;
    pointer-events: none;
    user-select: none;
}
.hero h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 900;
    letter-spacing: -.04em;
    line-height: 1.1;
    text-shadow: 0 2px 20px rgba(0,0,0,.3);
}
.hero p { font-size: 1.15rem; opacity: .8; font-weight: 400; }

/* ── Countdown ───────────────────────────────────────── */
.countdown-block {
    background: rgba(255,255,255,.1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,.15);
    border-radius: var(--radius-sm);
    padding: .75rem 1.25rem;
    text-align: center;
    min-width: 72px;
}
.countdown-block .num {
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: -.04em;
    line-height: 1;
}
.countdown-block .lbl {
    font-size: .65rem;
    opacity: .7;
    text-transform: uppercase;
    letter-spacing: .1em;
    font-weight: 600;
    margin-top: 2px;
}

/* ── Cards ───────────────────────────────────────────── */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow);
    background: var(--surface);
    overflow: hidden;
    transition: box-shadow .2s, transform .2s;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
    border-radius: 0 !important;
    font-weight: 700;
    font-size: .9rem;
    letter-spacing: .01em;
    padding: .9rem 1.25rem;
    border-bottom: 1px solid rgba(0,0,0,.06);
}
.card-header.bg-success {
    background: linear-gradient(100deg, var(--green-800), var(--green-600)) !important;
    border-bottom: none;
    color: #fff;
}

/* ── Match guesses (1X2) ───────────────────────────── */
.guess-card {
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.guess-crest {
    width: 48px;
    height: 48px;
    object-fit: contain;
}
.guess-btn {
    font-weight: 800;
    font-size: 1.15rem;
    min-height: 48px;
    border-radius: 10px;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .15s;
}
.guess-btn-inactive {
    background: #f8fafc !important;
    border: 2px solid #e2e8f0 !important;
    color: #94a3b8 !important;
}
.guess-btn-inactive:hover {
    background: #f0fdf4 !important;
    border-color: #86efac !important;
    color: #16a34a !important;
}
.guess-btn-active {
    background: #16a34a !important;
    border: 2px solid #15803d !important;
    color: #fff !important;
    font-size: 1.35rem;
    box-shadow: 0 4px 16px rgba(22, 163, 74, .45);
    transform: scale(1.06);
    z-index: 1;
    position: relative;
}
.guess-btn-active:hover,
.guess-btn-active:focus {
    background: #15803d !important;
    border-color: #166534 !important;
    color: #fff !important;
}

/* ── Leaderboard ─────────────────────────────────────── */
.table { margin-bottom: 0; }
.table thead th {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    background: #f8fafc;
    padding: .65rem 1rem;
    border-bottom: 1px solid var(--border);
}
.table tbody tr {
    transition: background .12s;
    border-bottom: 1px solid #f1f5f9;
}
.table tbody tr:last-child { border-bottom: none; }
.table tbody tr:hover { background: #f8fafc; }
.table tbody td { padding: .75rem 1rem; vertical-align: middle; }

.rank-1 td:first-child { font-size: 1.3rem; }
.rank-2 td:first-child { font-size: 1.2rem; }
.rank-3 td:first-child { font-size: 1.1rem; }
.rank-1 { background: linear-gradient(90deg, #fffbeb 0%, transparent 60%) !important; font-weight: 700; }
.rank-2 { background: linear-gradient(90deg, #f8fafc 0%, transparent 60%) !important; font-weight: 700; }
.rank-3 { background: linear-gradient(90deg, #fff7f0 0%, transparent 60%) !important; font-weight: 700; }

.my-row { background: #f0fdf4 !important; }
.my-row:hover { background: #dcfce7 !important; }

/* ── Points badge ────────────────────────────────────── */
.pts-badge {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, var(--green-700), var(--green-500));
    color: #fff;
    border-radius: 20px;
    padding: 3px 14px;
    font-weight: 700;
    font-size: .875rem;
    letter-spacing: -.01em;
    box-shadow: 0 2px 8px rgba(22,163,74,.3);
}

/* ── Team cards (pick-teams) ─────────────────────────── */
.team-card {
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all .18s cubic-bezier(.34,1.56,.64,1);
    padding: .85rem .6rem .7rem;
    background: var(--surface);
    position: relative;
    user-select: none;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.team-card:hover:not(.disabled):not(.selected) {
    border-color: var(--green-400);
    box-shadow: 0 4px 20px rgba(22,163,74,.15);
    transform: translateY(-3px);
}
.team-card.selected {
    border: 2px solid var(--green-500);
    background: linear-gradient(160deg, #d1fae5 0%, #a7f3d0 100%);
    color: var(--green-900);
    box-shadow: 0 6px 24px rgba(22,163,74,.25);
    transform: translateY(-3px);
}
.team-card.selected .team-name { color: var(--green-900); }
.team-card.selected .team-tla  { color: var(--green-700); }
.team-card.selected::before {
    content: '✓ VALGT';
    position: absolute;
    top: 0; left: 0; right: 0;
    background: var(--green-700);
    color: #fff;
    font-size: .58rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-align: center;
    padding: 3px 0;
    line-height: 1.4;
}
.team-card.disabled { opacity: .3; cursor: not-allowed; transform: none !important; }
.team-card.selected.disabled { opacity: .55; }
.team-crest  { width: 44px; height: 44px; object-fit: contain; }
.team-name   { font-size: .82rem; font-weight: 700; line-height: 1.2; }
.team-tla    { font-size: .68rem; color: var(--muted); font-weight: 500; }

/* ── Match tiles ─────────────────────────────────────── */
.match-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .9rem 1.1rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .15s, transform .15s;
}
.match-tile:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}
.match-tile-live {
    border: 2px solid #dc3545;
    background: linear-gradient(135deg, #fff5f5 0%, #fff 100%);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, .12), var(--shadow-sm);
}
.match-tile-live:hover {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, .18), var(--shadow);
}
.match-tile-live.match-tile-mine {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, .12), 0 0 0 5px rgba(22, 163, 74, .15), var(--shadow-sm);
}
.match-live-badge {
    animation: live-pulse 1.5s ease-in-out infinite;
}
@keyframes live-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: .65; }
}

/* ── Admin API log ───────────────────────────────────── */
.api-log-view {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: .8rem;
    line-height: 1.45;
    max-height: 70vh;
    overflow: auto;
    background: #0f172a;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Homepage live matches ───────────────────────────── */
.live-hero {
    background: linear-gradient(135deg, #7f1d1d 0%, #dc2626 45%, #991b1b 100%);
    color: #fff;
    border-bottom: 4px solid #fca5a5;
    box-shadow: 0 8px 40px rgba(220, 38, 38, .35);
}
.live-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    background: #fff;
    color: #dc2626;
    font-weight: 900;
    font-size: .85rem;
    letter-spacing: .12em;
    padding: .35rem 1rem;
    border-radius: 99px;
    margin-bottom: .75rem;
    animation: live-pulse 1.5s ease-in-out infinite;
}
.live-hero-dot {
    width: 10px;
    height: 10px;
    background: #dc2626;
    border-radius: 50%;
    animation: live-dot 1.2s ease-in-out infinite;
}
@keyframes live-dot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(1.35); opacity: .6; }
}
.live-hero-title {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 900;
    letter-spacing: -.02em;
    text-shadow: 0 2px 12px rgba(0,0,0,.2);
}
.live-match-card {
    background: rgba(255,255,255,.12);
    border: 2px solid rgba(255,255,255,.25);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.25rem 1.75rem;
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.live-match-card-mine {
    border-color: #fbbf24;
    box-shadow: 0 0 0 3px rgba(251,191,36,.35), 0 8px 32px rgba(0,0,0,.2);
}
.live-match-stage {
    text-align: center;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    opacity: .85;
    margin-bottom: .35rem;
}
.live-match-kickoff {
    text-align: center;
    font-size: .85rem;
    font-weight: 600;
    opacity: .9;
    margin-bottom: 1.25rem;
}
.live-match-body {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(1rem, 4vw, 2.5rem);
}
.live-match-team {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: .5rem;
    min-width: 0;
}
.live-match-crest {
    width: clamp(64px, 14vw, 96px);
    height: clamp(64px, 14vw, 96px);
    object-fit: contain;
    filter: drop-shadow(0 4px 16px rgba(0,0,0,.25));
}
.live-match-crest-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    background: rgba(255,255,255,.15);
    border-radius: 50%;
}
.live-match-name {
    font-weight: 800;
    font-size: clamp(.9rem, 2.5vw, 1.15rem);
    line-height: 1.2;
    max-width: 140px;
}
.live-match-mine-badge {
    font-size: .65rem !important;
    font-weight: 700;
}
.live-match-score {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .25rem;
}
.live-match-goals-row {
    display: flex;
    align-items: center;
    gap: .35rem;
}
.live-match-goals {
    font-size: clamp(2.5rem, 8vw, 4rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -.03em;
    min-width: 1.1em;
    text-align: center;
}
.live-match-sep {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: 300;
    opacity: .7;
    margin: 0 .1rem;
}
.live-match-vs {
    font-size: clamp(1.4rem, 4vw, 2rem);
    font-weight: 900;
    opacity: .8;
}
.live-match-scoreline {
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    font-weight: 900;
    letter-spacing: .05em;
}
.live-match-status-label {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    opacity: .85;
    margin-top: .35rem;
}
.match-score { font-size: 1.4rem; font-weight: 900; min-width: 80px; text-align: center; letter-spacing: -.02em; }
.match-team  { font-weight: 600; font-size: .92rem; }
.match-meta  { font-size: .75rem; color: var(--muted); font-weight: 500; }

/* ── Stage header ────────────────────────────────────── */
.stage-header {
    background: linear-gradient(100deg, var(--green-800), var(--green-600));
    color: #fff;
    border-radius: var(--radius-sm);
    padding: .5rem 1.1rem;
    font-weight: 700;
    font-size: .85rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    margin: 1.5rem 0 .75rem;
    box-shadow: 0 2px 10px rgba(22,163,74,.2);
}

/* ── Progress bar ────────────────────────────────────── */
.progress {
    height: 8px;
    border-radius: 99px;
    background: #e2e8f0;
}
.progress-bar {
    background: linear-gradient(90deg, var(--green-700), var(--green-500));
    border-radius: 99px;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn-success {
    background: linear-gradient(135deg, var(--green-700), var(--green-600)) !important;
    border: none !important;
    font-weight: 600;
    letter-spacing: -.01em;
    box-shadow: 0 2px 10px rgba(22,163,74,.25);
    transition: all .18s;
}
.btn-success:hover {
    background: linear-gradient(135deg, var(--green-600), var(--green-500)) !important;
    box-shadow: 0 4px 18px rgba(22,163,74,.35);
    transform: translateY(-1px);
}
.btn-outline-success {
    border-color: var(--green-600) !important;
    color: var(--green-700) !important;
    font-weight: 600;
}
.btn-outline-success:hover {
    background: var(--green-600) !important;
    color: #fff !important;
}
.btn { border-radius: 10px !important; }
.btn-lg { border-radius: 12px !important; padding: .75rem 2rem !important; font-size: 1rem !important; }

/* ── Alerts ──────────────────────────────────────────── */
.alert {
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: .9rem;
}
.alert-danger  { background: #fef2f2; color: #991b1b; border-left: 4px solid #ef4444; }
.alert-success { background: #f0fdf4; color: #166534; border-left: 4px solid var(--green-500); }
.alert-warning { background: #fffbeb; color: #92400e; border-left: 4px solid var(--gold); }
.alert-info    { background: #eff6ff; color: #1e40af; border-left: 4px solid #3b82f6; }

/* ── Pick flag ───────────────────────────────────────── */
.pick-flag { width: 34px; height: 34px; object-fit: contain; border-radius: 50%; border: 2px solid var(--border); }

/* ── Footer ──────────────────────────────────────────── */
footer {
    margin-top: auto;
    background: var(--green-900) !important;
    color: rgba(255,255,255,.4) !important;
    padding: 1.25rem 0;
    font-size: .82rem;
}
footer a { color: rgba(255,255,255,.5) !important; }
footer a:hover { color: rgba(255,255,255,.8) !important; }

/* ── Form controls ───────────────────────────────────── */
.form-control, .form-select {
    border-radius: 10px !important;
    border: 1.5px solid var(--border);
    font-size: .92rem;
    padding: .6rem .9rem;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgba(34,197,94,.15);
}
.form-label { font-weight: 600; font-size: .85rem; color: #374151; margin-bottom: .4rem; }

/* ── Badge overrides ─────────────────────────────────── */
.badge.bg-success { background: var(--green-600) !important; font-weight: 600; border-radius: 6px; }

/* ── Warning banners (top of page) ──────────────────── */
.bg-danger  { background: linear-gradient(100deg, #991b1b, #dc2626) !important; }
.bg-warning { background: #fef3c7 !important; color: #78350f !important; }
.bg-warning.text-dark, .card-header.bg-warning { color: #78350f !important; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 576px) {
    .hero { padding: 3.5rem 0 3rem; }
    .hero h1 { font-size: 1.9rem; }
    .match-score { font-size: 1.1rem; min-width: 60px; }
    .countdown-block { padding: .6rem .9rem; min-width: 60px; }
    .countdown-block .num { font-size: 1.75rem; }
}
