/* ============ Smart Home League — mobile-first, dark & light ============ */
:root {
  color-scheme: dark;
  --bg: #070b14;
  --bg-soft: #0d1322;
  --panel: rgba(19, 27, 46, 0.72);
  --panel-solid: #131b2e;
  --panel-2: #182238;
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.3);
  --text: #eaeffa;
  --muted: #8b98ad;
  --accent: #22d3ee;
  --accent-contrast: #06222b;
  --gold: #fbbf24;
  --ok: #34d399;
  --err: #f87171;
  --fs: #22d3ee;
  --u14: #a78bfa;
  --u19: #fbbf24;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 44px rgba(2, 6, 16, 0.55);
  --thead-bg: rgba(255, 255, 255, 0.025);
  --row-border: rgba(148, 163, 184, 0.07);
  --row-alt: rgba(255, 255, 255, 0.014);
  --row-hover: rgba(255, 255, 255, 0.03);
  --sticky-bg: #131b2e;
  --sticky-head-bg: #161f33;
  --sticky-hover: #1a2439;
  --sticky-shadow: 6px 0 12px -6px rgba(2, 6, 16, 0.6);
  --chip-bg: rgba(148, 163, 184, 0.12);
  --faint: rgba(139, 152, 173, 0.5);
  --accent-soft: rgba(34, 211, 238, 0.07);
  --logo-glow: 0 0 24px rgba(34, 211, 238, 0.18);
  --hero-gradient: linear-gradient(92deg, #7dd3fc 5%, #c4b5fd 50%, #fcd34d 95%);
  --body-bg:
    radial-gradient(140vw 60vh at 85% -10%, rgba(34, 211, 238, 0.11), transparent 60%),
    radial-gradient(120vw 55vh at -10% 0%, rgba(167, 139, 250, 0.1), transparent 55%),
    radial-gradient(100vw 40vh at 50% 110%, rgba(251, 191, 36, 0.05), transparent 60%),
    #070b14;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef1f8;
  --bg-soft: #f7f9fd;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-solid: #ffffff;
  --panel-2: #ffffff;
  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.24);
  --text: #0f172a;
  --muted: #5a6b84;
  --accent: #0891b2;
  --accent-contrast: #ffffff;
  --gold: #b45309;
  --ok: #059669;
  --err: #dc2626;
  --fs: #0891b2;
  --u14: #7c3aed;
  --u19: #b45309;
  --shadow: 0 18px 44px rgba(15, 23, 42, 0.14);
  --thead-bg: rgba(15, 23, 42, 0.035);
  --row-border: rgba(15, 23, 42, 0.06);
  --row-alt: rgba(15, 23, 42, 0.022);
  --row-hover: rgba(8, 145, 178, 0.06);
  --sticky-bg: #ffffff;
  --sticky-head-bg: #f1f5fb;
  --sticky-hover: #edf6f9;
  --sticky-shadow: 6px 0 12px -6px rgba(15, 23, 42, 0.18);
  --chip-bg: rgba(15, 23, 42, 0.07);
  --faint: rgba(90, 107, 132, 0.55);
  --accent-soft: rgba(8, 145, 178, 0.08);
  --logo-glow: 0 0 24px rgba(8, 145, 178, 0.2);
  --hero-gradient: linear-gradient(92deg, #0284c7 5%, #7c3aed 50%, #d97706 95%);
  --body-bg:
    radial-gradient(140vw 60vh at 85% -10%, rgba(8, 145, 178, 0.09), transparent 60%),
    radial-gradient(120vw 55vh at -10% 0%, rgba(124, 58, 237, 0.07), transparent 55%),
    radial-gradient(100vw 40vh at 50% 110%, rgba(217, 119, 6, 0.05), transparent 60%),
    #eef1f8;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

/* inline SVG icons */
.ic { display: inline-block; width: 1.05em; height: 1.05em; vertical-align: -0.15em; flex: none; }
.theme-btn .ic { width: 18px; height: 18px; vertical-align: 0; }
.dock-icon { display: grid; place-items: center; height: 24px; }
.dock-icon .ic { width: 21px; height: 21px; vertical-align: 0; }
.brand-logo .ic { width: 50%; height: 50%; vertical-align: 0; }
.award-icon .ic { width: 32px; height: 32px; }
.qr-emoji .ic { width: clamp(44px, 9vw, 68px); height: clamp(44px, 9vw, 68px); }
.draw-dice .ic { width: clamp(30px, 7vw, 46px); height: clamp(30px, 7vw, 46px); }
.no-map .ic { width: 42px; height: 42px; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--body-bg);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.55;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  transition: background 0.3s ease, color 0.3s ease;
}

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 clamp(12px, 4vw, 24px) clamp(56px, 10vw, 96px); }
a { color: inherit; text-decoration: none; }
button { font: inherit; }

::selection { background: rgba(34, 211, 238, 0.3); }

/* ---------- header ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
  padding: clamp(14px, 3.5vw, 26px) 0 6px;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-logo {
  width: clamp(38px, 10vw, 46px); height: clamp(38px, 10vw, 46px);
  border-radius: 13px; flex: none;
  display: grid; place-items: center; font-size: clamp(18px, 5vw, 23px);
  background: linear-gradient(135deg, rgba(34,211,238,0.28), rgba(167,139,250,0.28));
  border: 1px solid var(--border-strong);
  box-shadow: var(--logo-glow);
}
.brand-name { font-size: clamp(0.98rem, 3.4vw, 1.18rem); font-weight: 800; letter-spacing: 0.02em; line-height: 1.2; }
.brand-sub { font-size: clamp(0.58rem, 2vw, 0.7rem); color: var(--muted); text-transform: uppercase; letter-spacing: 0.2em; }

.header-actions { display: inline-flex; align-items: center; gap: 10px; }

.theme-btn {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 1.05rem; line-height: 1;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); cursor: pointer;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}
.theme-btn:hover { border-color: var(--accent); transform: rotate(15deg) scale(1.06); box-shadow: 0 4px 16px rgba(2,6,16,0.2); }
.theme-btn:active { transform: scale(0.94); }

.live-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.14em;
  color: var(--ok);
  border: 1px solid rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.08);
  padding: 6px 13px; border-radius: 999px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.3s ease;
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: pulse 1.7s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

/* ---------- hero ---------- */
.hero { text-align: center; padding: clamp(22px, 6vw, 44px) 0 4px; }
.hero h1 {
  font-size: clamp(1.75rem, 7.5vw, 3.1rem);
  font-weight: 900; letter-spacing: -0.01em; line-height: 1.12;
  background: var(--hero-gradient);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--muted); margin-top: 10px; font-size: clamp(0.86rem, 2.8vw, 1rem); max-width: 46ch; margin-inline: auto; }

/* ---------- league cards ---------- */
.league-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(12px, 3vw, 18px);
  margin: clamp(20px, 5vw, 32px) 0 4px;
}
@media (min-width: 700px) { .league-cards { grid-template-columns: repeat(3, 1fr); } }

.league-card {
  position: relative; display: block;
  background: var(--panel);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(18px, 4.5vw, 26px);
  overflow: hidden;
  transition: transform 0.22s cubic-bezier(0.2, 0.7, 0.3, 1.2), border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  animation: rise 0.5s ease-out both;
  box-shadow: 0 6px 20px rgba(2, 6, 16, 0.12);
}
.league-card:nth-child(2) { animation-delay: 0.07s; }
.league-card:nth-child(3) { animation-delay: 0.14s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.league-card:hover, .league-card:active { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.league-card::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--card-accent, var(--accent)), transparent);
}
.league-card::after {
  content: ''; position: absolute; width: 170px; height: 170px; right: -50px; top: -50px;
  background: radial-gradient(circle, color-mix(in srgb, var(--card-accent, var(--accent)) 16%, transparent), transparent 70%);
  pointer-events: none;
}
.league-card .lc-tag {
  font-size: 0.66rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.2em;
  color: var(--card-accent, var(--accent));
}
.league-card h2 { font-size: clamp(1.4rem, 5vw, 1.7rem); font-weight: 800; margin: 7px 0 2px; }
.league-card .lc-meta { color: var(--muted); font-size: 0.84rem; }
.league-card .lc-leader {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px dashed var(--border);
  font-size: 0.86rem; color: var(--muted);
  padding-right: 34px;
}
.league-card .lc-leader strong { color: var(--text); }
.league-card .lc-go {
  position: absolute; right: 16px; bottom: 14px;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 1rem; color: var(--card-accent, var(--accent));
  border: 1px solid color-mix(in srgb, var(--card-accent, var(--accent)) 40%, transparent);
  transition: transform 0.2s ease;
}
.league-card:hover .lc-go { transform: translateX(4px); }
.card-fs { --card-accent: var(--fs); }
.card-u14 { --card-accent: var(--u14); }
.card-u19 { --card-accent: var(--u19); }

/* ---------- sections ---------- */
.section { margin-top: clamp(28px, 7vw, 46px); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head h3 {
  display: flex; align-items: center; gap: 10px;
  font-size: clamp(1.05rem, 3.6vw, 1.3rem); font-weight: 800; letter-spacing: 0.01em;
}
.section-head h3::before {
  content: ''; width: 5px; height: 1.05em; border-radius: 3px; flex: none;
  background: linear-gradient(180deg, currentColor, transparent);
  opacity: 0.75;
}
.section-head .hint { color: var(--muted); font-size: 0.8rem; }
.section-head a.hint:hover { color: var(--accent); }

/* ---------- tables (mobile-first: sticky team column + smooth h-scroll) ---------- */
.table-wrap {
  background: var(--panel);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  box-shadow: 0 8px 28px rgba(2, 6, 16, 0.14);
}
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { padding: clamp(9px, 2.6vw, 13px) clamp(8px, 2.4vw, 14px); text-align: center; white-space: nowrap; }
th {
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--muted); font-weight: 800;
  border-bottom: 1px solid var(--border);
  background: var(--thead-bg);
  position: sticky; top: 0;
}
td { border-bottom: 1px solid var(--row-border); font-variant-numeric: tabular-nums; font-size: clamp(0.86rem, 2.8vw, 0.95rem); }
tbody tr:nth-child(even) td { background: var(--row-alt); }
tr:last-child td { border-bottom: none; }
td.team-cell, th.team-cell {
  text-align: left; font-weight: 700;
  position: sticky; left: 0; z-index: 2;
  background: var(--sticky-bg);
  max-width: 46vw; overflow: hidden; text-overflow: ellipsis;
  box-shadow: var(--sticky-shadow);
}
tbody tr:nth-child(even) td.team-cell { background: var(--sticky-bg); }
th.team-cell { z-index: 3; background: var(--sticky-head-bg); }
@media (min-width: 700px) {
  td.team-cell, th.team-cell { max-width: none; box-shadow: none; }
}
tbody tr { transition: background 0.15s ease; }
@media (hover: hover) {
  tbody tr:hover td { background: var(--row-hover); }
  tbody tr:hover td.team-cell { background: var(--sticky-hover); }
}

.total-col { font-weight: 900; font-size: clamp(0.95rem, 3vw, 1.08rem); color: var(--accent); background: var(--accent-soft); }
th.total-col { color: var(--accent); font-size: 0.66rem; }
tbody tr:nth-child(even) td.total-col { background: var(--accent-soft); }

.rank-chip {
  display: inline-grid; place-items: center;
  width: clamp(26px, 7vw, 30px); height: clamp(26px, 7vw, 30px); border-radius: 50%;
  font-weight: 800; font-size: 0.8rem;
  background: var(--chip-bg); color: var(--muted);
}
.rank-1 { background: linear-gradient(135deg, #fde68a, #d97706); color: #1a1206; box-shadow: 0 0 14px rgba(251,191,36,0.35); }
.rank-2 { background: linear-gradient(135deg, #f1f5f9, #94a3b8); color: #10141c; }
.rank-3 { background: linear-gradient(135deg, #f59e0b, #92400e); color: #fff7e6; }

.empty-score { color: var(--faint); }

.time-badge {
  display: inline-block; padding: 3px 10px; border-radius: 8px;
  background: var(--chip-bg); border: 1px solid var(--border);
  font-size: 0.82rem; font-variant-numeric: tabular-nums;
}

/* schedule cell: play time + points earned in that round together */
.ts-cell { display: flex; flex-direction: column; gap: 3px; align-items: center; }
.cell-pts { font-size: 0.78rem; font-weight: 800; color: var(--ok); font-variant-numeric: tabular-nums; }
.cell-pts.empty { color: var(--faint); font-weight: 600; }

@keyframes flash { 0% { background: rgba(52,211,153,0.4); } 100% { background: transparent; } }
td.flash { animation: flash 1.8s ease-out; }
td.team-cell.flash { animation: none; }

.scroll-hint { display: block; text-align: center; color: var(--faint); font-size: 0.7rem; margin-top: 6px; }
@media (min-width: 700px) { .scroll-hint { display: none; } }

/* ---------- league page ---------- */
.back-link {
  display: inline-flex; align-items: center; gap: 9px;
  margin: 18px 0 10px;
  padding: 11px 22px; border-radius: 999px;
  font-size: clamp(0.94rem, 3vw, 1.02rem); font-weight: 800;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: transform 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}
.back-link .bl-arrow { font-size: 1.1em; transition: transform 0.18s ease; }
.back-link:hover { border-color: var(--accent); color: var(--accent); box-shadow: 0 6px 20px rgba(2,6,16,0.18); }
.back-link:hover .bl-arrow { transform: translateX(-4px); }
.back-link:active { transform: scale(0.97); }

.league-title { display: flex; align-items: center; gap: 12px; margin: 10px 0 2px; flex-wrap: wrap; }
.league-title h1 { font-size: clamp(1.5rem, 6.5vw, 2.3rem); font-weight: 900; letter-spacing: -0.01em; }
.league-badge {
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase;
  padding: 5px 12px; border-radius: 999px;
  color: var(--lg-accent, var(--accent));
  border: 1px solid currentColor;
}
.updated-at { color: var(--muted); font-size: 0.74rem; }

/* ---------- footer ---------- */
.site-footer { margin-top: clamp(40px, 9vw, 64px); text-align: center; color: var(--muted); font-size: 0.76rem; }
.site-footer a { color: var(--accent); }

/* ---------- forms / admin ---------- */
.login-box {
  max-width: 390px; margin: clamp(3vh, 6vw, 8vh) auto 0;
  background: var(--panel);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: clamp(22px, 6vw, 30px);
  box-shadow: var(--shadow);
}
.login-box h1 { font-size: 1.3rem; font-weight: 800; margin-bottom: 4px; }
.login-box p { color: var(--muted); font-size: 0.85rem; margin-bottom: 20px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin-bottom: 6px; font-weight: 700; }
input, select {
  width: 100%; padding: 12px 13px;
  background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: inherit; font-size: 16px; /* prevents iOS zoom-on-focus */
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px;
  padding: 10px 20px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font: inherit; font-weight: 800; cursor: pointer;
  background: linear-gradient(135deg, #22d3ee, #38bdf8); color: #06222b;
  transition: filter 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; transform: none; }
.btn.full { width: 100%; }
.btn.ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn.ghost:hover { color: var(--text); border-color: var(--border-strong); }
.btn.danger { background: transparent; color: var(--err); border-color: rgba(248,113,113,0.4); }
.btn.small { min-height: 36px; padding: 6px 13px; font-size: 0.82rem; }

.msg { font-size: 0.85rem; margin-top: 10px; min-height: 1.2em; }
.msg.err { color: var(--err); }
.msg.ok { color: var(--ok); }

/* admin layout */
.admin-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.admin-user { color: var(--muted); font-size: 0.85rem; }
.admin-user strong { color: var(--text); }

.tabs {
  display: flex; gap: 8px; margin: 6px 0 20px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; padding-bottom: 4px;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none;
  min-height: 40px; padding: 8px 18px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  font-size: 0.88rem; font-weight: 700;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }

.subtabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.subtab {
  min-height: 38px; padding: 6px 14px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--panel-solid); color: var(--muted);
  font-size: 0.84rem; font-weight: 700;
  -webkit-tap-highlight-color: transparent;
}
.subtab.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.panel {
  background: var(--panel);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: clamp(16px, 4vw, 22px); margin-bottom: 18px;
}
.panel h3 { font-size: 1rem; font-weight: 800; margin-bottom: 3px; }
.panel .sub { color: var(--muted); font-size: 0.8rem; margin-bottom: 14px; }

/* editable grids */
.edit-table input {
  width: clamp(58px, 14vw, 86px); text-align: center; padding: 9px 4px;
  font-variant-numeric: tabular-nums;
}
.edit-table input.wide { width: clamp(84px, 20vw, 112px); }
.edit-table input.team-input { width: 100%; min-width: 140px; text-align: left; }
.edit-table td { padding: 7px 6px; }
.edit-table input.saved { border-color: var(--ok); box-shadow: 0 0 0 3px rgba(52,211,153,0.16); }
.edit-table input.save-err { border-color: var(--err); box-shadow: 0 0 0 3px rgba(248,113,113,0.16); }

/* audit log */
.audit-table td { text-align: left; white-space: normal; }
.audit-table .a-time { color: var(--muted); font-size: 0.76rem; white-space: nowrap; }
.audit-table .a-admin { font-weight: 800; white-space: nowrap; }
.action-chip {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.05em;
  border: 1px solid var(--border); color: var(--muted); white-space: nowrap;
}
.action-score { color: var(--ok); border-color: rgba(52,211,153,0.4); }
.action-schedule { color: var(--fs); border-color: rgba(34,211,238,0.4); }
.action-team-rename { color: var(--u14); border-color: rgba(167,139,250,0.4); }
.action-admin-create, .action-admin-delete, .action-settings, .action-password-change { color: var(--gold); border-color: rgba(251,191,36,0.4); }
.old-new { font-variant-numeric: tabular-nums; }
.old-new .old { color: var(--err); text-decoration: line-through; opacity: 0.85; }
.old-new .arrow { color: var(--muted); margin: 0 6px; }
.old-new .new { color: var(--ok); font-weight: 800; }

.inline-form { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: end; }
@media (min-width: 700px) { .inline-form { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); } }

.toast {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%) translateY(90px);
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 22px; font-size: 0.9rem; font-weight: 700;
  box-shadow: var(--shadow);
  transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.3, 1.2); z-index: 50;
  max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.ok { border-color: rgba(52,211,153,0.5); color: var(--ok); }
.toast.err { border-color: rgba(248,113,113,0.5); color: var(--err); }

/* ---------- quarantine page ---------- */
.qr-hero { text-align: center; padding: clamp(26px, 7vh, 70px) 0; }
.qr-emoji { font-size: clamp(2.2rem, 8vw, 3.6rem); animation: swing 2.4s ease-in-out infinite; display: inline-block; }
@keyframes swing { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }
.qr-title {
  font-size: clamp(1.9rem, 9vw, 4.2rem);
  font-weight: 900; letter-spacing: -0.01em; line-height: 1.1;
  background: var(--hero-gradient);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-top: 8px;
}
.qr-sub { color: var(--muted); margin-top: 10px; font-size: clamp(0.9rem, 3vw, 1.12rem); max-width: 44ch; margin-inline: auto; }
.countdown {
  display: flex; justify-content: center; flex-wrap: wrap;
  gap: clamp(8px, 2.5vw, 18px);
  margin-top: clamp(24px, 6vw, 44px);
}
.cd-cell {
  background: var(--panel);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: clamp(12px, 3.5vw, 26px) clamp(10px, 3vw, 30px);
  min-width: clamp(78px, 24vw, 160px);
  box-shadow: var(--shadow);
}
.cd-num {
  font-size: clamp(2.2rem, 12vw, 5.6rem);
  font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.05;
}
.cd-label {
  font-size: clamp(0.56rem, 2vw, 0.72rem);
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.18em; font-weight: 800;
  margin-top: 4px;
}
.countdown.urgent .cd-num { color: var(--err); }
.countdown.urgent .cd-cell { border-color: rgba(248, 113, 113, 0.5); animation: urgentpulse 1s infinite; }
@keyframes urgentpulse { 50% { box-shadow: 0 0 34px rgba(248, 113, 113, 0.3); } }
.qr-deadline { margin-top: 20px; color: var(--muted); font-size: clamp(0.85rem, 2.8vw, 1rem); font-variant-numeric: tabular-nums; }
.qr-none { margin-top: 34px; color: var(--muted); font-size: 1.05rem; }
.qr-closed { margin-top: 28px; font-size: clamp(1.5rem, 7vw, 3rem); font-weight: 900; color: var(--err); }
.qr-closed span { display: block; font-size: clamp(0.88rem, 3vw, 1.1rem); color: var(--muted); font-weight: 600; margin-top: 10px; }

/* home quarantine banner */
.qr-banner {
  display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
  margin: clamp(18px, 4.5vw, 28px) 0 0;
  padding: 14px 18px; border-radius: var(--radius);
  border: 1px solid rgba(251, 191, 36, 0.45);
  background: color-mix(in srgb, var(--gold) 10%, transparent);
  font-weight: 700; font-size: clamp(0.88rem, 2.8vw, 1rem);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}
.qr-banner:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.qr-banner strong { color: var(--gold); font-variant-numeric: tabular-nums; }

.action-round-draw { color: var(--u14); border-color: rgba(167, 139, 250, 0.4); }

/* ---------- live draw reveal ---------- */
.draw-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: 16px;
  background: rgba(4, 8, 18, 0.86);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: fadein 0.3s ease;
}
.draw-overlay.closing { opacity: 0; transition: opacity 0.3s ease; }
@keyframes fadein { from { opacity: 0; } }
.draw-box {
  width: min(560px, 94vw);
  max-height: 90dvh; overflow-y: auto;
  background: var(--panel-solid);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  padding: clamp(20px, 5vw, 34px);
  text-align: center;
  box-shadow: var(--shadow);
}
.draw-dice { font-size: clamp(2rem, 7vw, 3rem); animation: diceroll 0.9s ease; display: inline-block; }
@keyframes diceroll { from { transform: rotate(-360deg) scale(0.3); opacity: 0; } }
.draw-title {
  font-size: clamp(1.35rem, 5.5vw, 2rem); font-weight: 900;
  background: var(--hero-gradient);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-top: 4px;
}
.draw-league { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.draw-slots { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.draw-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 16px;
  animation: rise 0.3s ease;
}
.draw-time { font-weight: 900; color: var(--accent); font-variant-numeric: tabular-nums; min-width: 62px; text-align: left; flex: none; }
.draw-name { font-weight: 800; font-size: clamp(0.95rem, 3vw, 1.05rem); text-align: left; }
.draw-name.spinning { opacity: 0.5; filter: blur(1px); }
.draw-name.locked { animation: lockin 0.4s cubic-bezier(0.2, 0.7, 0.3, 1.4); }
@keyframes lockin { from { transform: scale(1.3); color: var(--gold); } }
.draw-meta { margin-top: 16px; color: var(--muted); font-size: 0.76rem; }
.draw-close { margin-top: 14px; }
.draw-note { color: var(--muted); font-size: 0.8rem; margin-top: 8px; }

/* combined multi-league draw reveal */
.draw-box.wide { width: min(720px, 96vw); }
.mdraw-grid { display: grid; gap: 8px; margin-top: 18px; align-items: stretch; }
.mdraw-col-head {
  font-weight: 900; font-size: clamp(0.78rem, 2.6vw, 0.95rem);
  letter-spacing: 0.14em; text-transform: uppercase;
  padding-bottom: 2px;
}
.mdraw-cell {
  background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 7px 8px; min-height: 48px; text-align: left;
  animation: rise 0.3s ease;
}
.mdraw-time { display: block; color: var(--accent); font-weight: 800; font-size: 0.72rem; font-variant-numeric: tabular-nums; }
.mdraw-name {
  display: block; font-weight: 700;
  font-size: clamp(0.72rem, 2.4vw, 0.86rem);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mdraw-name.spinning { opacity: 0.5; filter: blur(1px); }
.mdraw-name.locked { animation: lockin 0.4s cubic-bezier(0.2, 0.7, 0.3, 1.4); }
@media (max-width: 480px) { .mdraw-cell { min-height: 44px; padding: 6px; } }

/* ---------- bottom navigation dock (mobile-first) ---------- */
body.has-dock { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
.dock {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 40;
  display: flex; justify-content: space-around; gap: 2px;
  width: min(560px, calc(100vw - 14px));
  padding: 6px;
  background: color-mix(in srgb, var(--panel-solid) 84%, transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.dock-item {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 3px; border-radius: 15px;
  color: var(--muted);
  font-size: 0.54rem; font-weight: 800; letter-spacing: 0.03em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}
.dock-icon { font-size: 1.3rem; line-height: 1; }
.dock-item.active { background: var(--accent-soft); color: var(--accent); }
.dock-item:active { transform: scale(0.92); }
@media (hover: hover) { .dock-item:hover { color: var(--text); } .dock-item.active:hover { color: var(--accent); } }

/* ---------- awards ---------- */
.awards-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 700px) { .awards-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); } }
.award-card {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 16px;
  background: var(--panel);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: var(--radius);
  padding: 18px 20px;
  animation: rise 0.4s ease-out both;
}
.award-card::after {
  content: ''; position: absolute; width: 140px; height: 140px; right: -46px; top: -46px;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.16), transparent 70%);
  pointer-events: none;
}
.award-icon { font-size: 2rem; flex: none; }
.award-title { font-size: 0.7rem; color: var(--gold); text-transform: uppercase; letter-spacing: 0.16em; font-weight: 800; }
.award-recipient { font-weight: 900; font-size: 1.18rem; margin-top: 2px; }
.award-note { color: var(--muted); font-size: 0.8rem; margin-top: 2px; }
.awards-empty { text-align: center; color: var(--muted); padding: 48px 0; font-size: 1.02rem; }

/* ---------- super teams ---------- */
.st-groups { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 700px) { .st-groups { grid-template-columns: repeat(3, 1fr); } }
.st-card {
  background: var(--panel);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px;
}
.st-name { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent); }
.st-teams { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 6px; }
.st-chip {
  background: var(--chip-bg); border: 1px solid var(--border);
  padding: 4px 13px; border-radius: 999px;
  font-weight: 700; font-size: 0.88rem;
}
.action-award, .action-telegram { color: var(--gold); border-color: rgba(251, 191, 36, 0.4); }
.action-superteam-draw, .action-superteam-pick { color: var(--u14); border-color: rgba(167, 139, 250, 0.4); }
.action-map-upload { color: var(--fs); border-color: rgba(34, 211, 238, 0.4); }
.action-technical { color: var(--ok); border-color: rgba(52, 211, 153, 0.4); }

/* technical: pass-check + completion time */
.tech-done { color: var(--ok); font-weight: 800; display: inline-flex; align-items: center; gap: 5px; }
.tech-done .ic { width: 1.15em; height: 1.15em; }

/* inline admin editing on public pages */
.admin-inline [data-edit] { cursor: pointer; }
.admin-inline [data-edit]:hover { box-shadow: inset 0 0 0 1.5px var(--accent); border-radius: 8px; }
input.inline-edit {
  width: 68px; text-align: center; padding: 6px 4px;
  font: inherit; font-size: 16px; font-variant-numeric: tabular-nums;
  background: var(--bg-soft); color: var(--text);
  border: 1.5px solid var(--accent); border-radius: 8px; outline: none;
}
.inline-hint {
  position: fixed; left: 12px; bottom: calc(100px + env(safe-area-inset-bottom));
  z-index: 45;
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--panel-2); color: var(--accent);
  border: 1px solid rgba(34, 211, 238, 0.4); border-radius: 999px;
  padding: 8px 14px; font-size: 0.78rem; font-weight: 700;
  box-shadow: var(--shadow);
  transition: opacity 0.6s ease;
}
.inline-hint.fade { opacity: 0; pointer-events: none; }

/* home page sub-blocks: one league inside a bigger section */
.home-sub { margin-top: 16px; }
.home-sub:first-child { margin-top: 0; }
.league-sub {
  font-size: 0.98rem; font-weight: 800;
  margin-bottom: 9px;
  display: flex; align-items: center; gap: 8px;
}
.league-sub::before {
  content: ''; width: 4px; height: 1em; border-radius: 3px; flex: none;
  background: currentColor; opacity: 0.75;
}

/* narrow tables (e.g. Technical page): no sticky column — every cell shares the same background */
table.flat { min-width: 0; }
table.flat td.team-cell, table.flat th.team-cell {
  position: static; box-shadow: none; max-width: none; background: transparent;
}
table.flat th.team-cell { background: var(--thead-bg); }
table.flat tbody tr:nth-child(even) td.team-cell { background: var(--row-alt); }
@media (hover: hover) {
  table.flat tbody tr:hover td.team-cell { background: var(--row-hover); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
