/* ============================================================
   KM Tippkupa VB2026
   "A irany - Stadion klasszikus" design system
   ============================================================ */

/* -- Twemoji flags ----------------------------------------- */
img.emoji {
  height: 1.2em;
  width: 1.2em;
  margin: 0 .05em 0 .1em;
  vertical-align: -0.2em;
  display: inline;
}

/* -- Winner secret (eye toggle) ----------------------------- */
.winner-eye-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1em;
  padding: 2px 6px;
  border-radius: 6px;
  vertical-align: middle;
  opacity: 0.6;
  transition: opacity .15s;
}
.winner-eye-btn:hover { opacity: 1; }
.winner-secret.winner-hidden {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin: 0;
  pointer-events: none;
}
.winner-secret {
  transition: max-height .25s ease, opacity .2s ease;
  max-height: 300px;
  opacity: 1;
}

/* -- Collapsible sync card ---------------------------------- */
details.card { padding: 0; }
details.card > .sync-summary {
  padding: 16px 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
details.card > .sync-summary::before {
  content: '\u25B6';
  font-size: .7em;
  transition: transform .2s;
  color: var(--faint);
}
details.card[open] > .sync-summary::before {
  transform: rotate(90deg);
}
details.card > .sync-summary::-webkit-details-marker { display: none; }
details.card > .sync-body {
  padding: 0 20px 16px;
}

/* -- Toggle switch ------------------------------------------ */
.toggle-label {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  cursor: pointer;
}
.toggle-label input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--line);
  border-radius: 26px;
  transition: background .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  left: 3px; top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.toggle-label input:checked + .toggle-slider {
  background: var(--brand-primary);
}
.toggle-label input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

/* -- Odds row on match cards -------------------------------- */
.odds-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
  padding: 6px 10px;
  background: var(--panel-2);
  border-radius: 8px;
  font-size: .82rem;
  color: var(--muted);
}
.odds-label {
  font-weight: 600;
  color: var(--faint);
}
.odds-val {
  font-variant-numeric: tabular-nums;
}
.odds-val strong {
  color: var(--text);
  margin-right: 2px;
}
.odds-pred {
  margin-left: auto;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

/* -- Tip counter ------------------------------------------- */
.tip-counter {
  font-size: .7em;
  font-weight: 500;
  color: var(--muted);
  vertical-align: middle;
}
.tip-counter.all-done {
  color: var(--accent);
}

/* -- Design tokens ------------------------------------------ */

/* Brand szinsenak: KM (zold) */
html, html[data-brand="km"] {
  --brand-dark: #323D37;
  --brand-primary: #7BBA40;
  --brand-primary-deep: #4c7d33;
  --brand-light: #d9f29b;
  --brand-btn: #7BBA40;
  --brand-btn-saved: #4c7d33;
  --bg: #f2f5ef;
  --panel-2: #f4f7f1;
  --line: #dde4d8;
  --text: #323D37;
  --accent: #7BBA40;
  --accent-2: #323D37;
  --shadow-hero: 0 10px 24px rgba(60,100,40,0.28);
  --shadow-login: 0 12px 32px rgba(40,55,45,0.16);
  --shadow-btn: 0 6px 14px rgba(123,186,64,0.35);
  --grad-hero: linear-gradient(165deg, #2c3832 0%, #323D37 55%, #3a4a3f 100%);
  --grad-countdown: linear-gradient(150deg, #3a6428 0%, #4c7d33 45%, #5f9440 100%);
}

/* Brand szinsenak: BVMK (piros + szurkes gombok) */
html[data-brand="bvmk"] {
  --brand-dark: #32373c;
  --brand-primary: #dd0031;
  --brand-primary-deep: #a50025;
  --brand-light: #ffd6e0;
  --brand-btn: #32373c;
  --brand-btn-saved: #4a5259;
  --bg: #f2f3f5;
  --panel-2: #f4f5f7;
  --line: #dcdee2;
  --text: #32373c;
  --accent: #dd0031;
  --accent-2: #32373c;
  --shadow-hero: 0 10px 24px rgba(50,55,60,0.28);
  --shadow-login: 0 12px 32px rgba(55,40,45,0.16);
  --shadow-btn: 0 4px 10px rgba(50,55,60,0.25);
  --grad-hero: linear-gradient(165deg, #2d1520 0%, #32373c 55%, #3a2530 100%);
  --grad-countdown: linear-gradient(150deg, #2c3032 0%, #3a4148 45%, #435058 100%);
}

:root {
  --panel: #ffffff;
  --muted: #6b776e;
  --faint: #93a094;
  --killer: #d9622b;
  --killer-border: #e8a36c;
  --killer-text: #b35427;
  --danger: #dc3545;
  --warn: #c58a1e;
  --radius: 16px;

  /* Shadows */
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06);

  /* Gradients */
  --grad-killer: linear-gradient(135deg, #d9622b 0%, #c2451d 100%);

  /* Podium metals */
  --gold: #e9c46a;
  --gold-border: #f4dfa6;
  --gold-text: #5c4715;
  --silver: #b8c6bd;
  --silver-border: #dfe7e2;
  --bronze: #c89e7a;
  --bronze-border: #e3c8ae;
  --bronze-text: #4d3520;

  font-size: 14.5px;
}

/* -- Reset & base ------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Barlow', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }
a   { color: var(--brand-primary-deep); }

/* -- Typography --------------------------------------------- */
h1, h2, .section-title {
  font-family: 'Barlow Condensed', sans-serif;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
}

h1 {
  font-size: 22px;
  margin: 0 0 4px;
  color: var(--text);
}

h2 {
  font-size: 19px;
  margin: 24px 0 12px;
  color: var(--text);
}

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.faint { color: var(--faint); }

.section-title {
  font-size: 19px;
  color: var(--brand-dark);
  margin: 24px 0 12px;
}

/* -- Layout ------------------------------------------------- */
main {
  max-width: 920px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

.center { text-align: center; }

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.spacer { flex: 1; }

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

@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* ============================================================
   HEADER (sticky)
   ============================================================ */
header.app {
  display: flex;
  flex-direction: column;
  background: var(--brand-dark);
  color: #ffffff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
}

/* Logo white circle (header, 34px) */
.logo-circle-sm {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.logo-circle-sm img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

/* Brand */
header.app .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 21px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #ffffff;
  text-decoration: none;
}
header.app .brand span { color: var(--brand-primary); }
html[data-brand="bvmk"] header.app .brand #nav-brand-prefix { color: #ffffff; }

/* Right-side header controls */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Monogram avatar (32px green circle) */
.monogram-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: #ffffff;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-transform: uppercase;
}

/* Logout link */
.logout-link {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  padding: 0;
}
.logout-link:hover { color: #ffffff; }

/* Tab bar */
nav.app {
  display: flex;
  gap: 0;
  padding: 0 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

nav.app a {
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  padding: 10px 16px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 3px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

nav.app a:hover { color: #ffffff; }

nav.app a.active {
  color: #ffffff;
  font-weight: 700;
  border-bottom-color: var(--brand-primary);
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-card);
}

/* ============================================================
   HERO SECTIONS
   ============================================================ */
.hero,
.login-hero {
  background: var(--grad-hero);
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* -- Login hero --------------------------------------------- */
.login-hero {
  padding: 84px 28px 110px;
}

.login-hero .deco-circle-1 {
  position: absolute;
  width: 560px;
  height: 560px;
  border-radius: 50%;
  border: 2px solid rgba(123,186,64,0.18);
  top: -220px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.login-hero .deco-circle-2 {
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.12);
  bottom: -150px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.login-hero .deco-line {
  position: absolute;
  width: 2px;
  height: 60px;
  background: rgba(255,255,255,0.12);
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

/* Logo on white disc (login hero, 104px) */
.logo-circle {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: #ffffff;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo-circle .logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
}

/* Hero typography */
.hero-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 42px;
  font-weight: 700;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin: 0 0 8px;
}

.hero-sub {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--brand-primary);
  letter-spacing: 4px;
  text-transform: uppercase;
  margin: 0;
}

/* -- Login card (floats over hero) -------------------------- */
.login-card {
  background: var(--panel);
  border-radius: 20px;
  padding: 28px 24px;
  margin: -64px 20px 0;
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
  box-shadow: var(--shadow-login);
  position: relative;
  z-index: 2;
}

.login-card h2 {
  font-family: 'Barlow Condensed', sans-serif;
  margin: 0 0 16px;
  font-size: 22px;
  letter-spacing: 1px;
}

.login-card .btn-full {
  width: 100%;
  padding: 15px;
  border-radius: 12px;
  font-size: 16px;
  margin-top: 14px;
}

/* Register link row */
.register-link {
  text-align: center;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1.5px solid var(--line);
  font-size: 14px;
  color: var(--muted);
}
.register-link a,
.register-link button {
  color: var(--brand-primary-deep);
  font-weight: 700;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  box-shadow: none;
  padding: 0;
  font-size: 14px;
  font-family: inherit;
}
.register-link a:hover,
.register-link button:hover { text-decoration: underline; }

/* Login page footer */
.login-footer {
  text-align: center;
  font-size: 12.5px;
  color: var(--faint);
  padding: 20px 16px 0;
  max-width: 440px;
  margin: 0 auto;
}

/* ============================================================
   COUNTDOWN HERO
   ============================================================ */
.countdown-hero {
  background: var(--grad-countdown);
  border-radius: 18px;
  padding: 20px 22px 22px;
  margin-bottom: 16px;
  color: #ffffff;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-hero);
}

.countdown-hero .deco-circle {
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.12);
  top: -60px;
  right: -40px;
  pointer-events: none;
}

.countdown-hero .deco-vline {
  position: absolute;
  width: 2px;
  height: 80px;
  background: rgba(255,255,255,0.12);
  top: 0;
  right: 60px;
  pointer-events: none;
}

/* Pulsing dot */
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-light);
  animation: pulse-dot 1.6s ease-in-out infinite;
  flex-shrink: 0;
}

.countdown-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.countdown-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.85);
}

.countdown-match-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 27px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.countdown-meta {
  font-size: 13px;
  color: rgba(255,255,255,0.75);
  margin-bottom: 14px;
}

.countdown-digits {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.countdown-unit {
  min-width: 42px;
  text-align: center;
}

.countdown-unit .num {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 34px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #ffffff;
  line-height: 1.1;
}

.countdown-unit .num.sec {
  color: var(--brand-light);
}

.countdown-unit .lbl {
  font-size: 12.5px;
  color: rgba(255,255,255,0.7);
  text-transform: uppercase;
}

/* Legacy .countdown class (JS uses it) */
.countdown { font-variant-numeric: tabular-nums; }

/* ============================================================
   FORMS & INPUTS
   ============================================================ */
label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin: 12px 0 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input, select, button {
  font: inherit;
  color: var(--text);
}

input[type=text],
input[type=email],
input[type=password],
input[type=number],
select {
  width: 100%;
  padding: 13px 14px;
  background: var(--panel-2);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  outline: none;
  font-size: 15px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(123,186,64,0.18);
}

input:disabled,
select:disabled,
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

input::placeholder {
  color: var(--faint);
}

/* ============================================================
   BUTTONS
   ============================================================ */
button {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 12px 22px;
  background: var(--brand-btn);
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  transition: filter 0.15s, background 0.2s;
  box-shadow: var(--shadow-btn);
}

button:hover:not(:disabled) {
  filter: brightness(1.07);
}

button.secondary {
  background: var(--panel-2);
  color: var(--text);
  border: 1.5px solid var(--line);
  box-shadow: none;
}
button.secondary:hover:not(:disabled) {
  background: #eef1ea;
}

button.link {
  background: none;
  color: var(--brand-primary-deep);
  padding: 0;
  font-weight: 700;
  box-shadow: none;
}
button.link:hover:not(:disabled) {
  text-decoration: underline;
  filter: none;
}

button.saved {
  background: var(--brand-btn-saved);
}

/* ============================================================
   MESSAGES
   ============================================================ */
.msg {
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  min-width: 220px;
  max-width: calc(100vw - 32px);
  text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.msg.show { opacity: 1; pointer-events: auto; }
.msg.error { background: #fdf0f0; border: 1.5px solid var(--danger); color: #a71d2a; }
.msg.ok    { background: #edf7e6; border: 1.5px solid var(--brand-primary); color: #3d6b1a; }

/* ============================================================
   BADGES & CHIPS
   ============================================================ */
.badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  vertical-align: middle;
}

.badge.lock   { color: var(--warn); border-color: var(--warn); }
.badge.killer {
  background: var(--grad-killer);
  color: #ffffff;
  border: none;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 4px 12px;
}
.badge.result      { color: var(--brand-dark); border-color: var(--brand-dark); }
.badge.info        { color: #0d6efd; border-color: #0d6efd; }
.badge.points-badge {
  background: var(--brand-primary);
  color: #ffffff;
  border: none;
}

/* Chips */
.chip {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  background: #eef6e3;
  color: var(--brand-primary-deep);
}
.chip.orange {
  background: #fdf0e6;
  color: var(--killer-text);
}
.chip.countdown-chip {
  background: #eef6e3;
  color: var(--brand-primary-deep);
  font-size: 12px;
}

/* ============================================================
   WINNER CARD
   ============================================================ */
.winner-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
}

.winner-icon-tile {
  width: 44px;
  height: 44px;
  background: #f0f6e6;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.winner-info { flex: 1; min-width: 0; }
.winner-info .title { font-weight: 700; font-size: 15px; margin: 0; }
.winner-info .status { font-size: 13.5px; color: var(--muted); margin: 2px 0 0; }

.winner-points {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--brand-primary-deep);
  white-space: nowrap;
}

/* ============================================================
   MATCH CARDS
   ============================================================ */
.match {
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  background: var(--panel);
  box-shadow: var(--shadow-card);
  transition: opacity 0.2s;
}

.match .top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.match .round {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-primary-deep);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.match .teams {
  font-weight: 700;
  font-size: 15px;
  margin: 4px 0;
  color: var(--text);
}

.match .kickoff {
  color: var(--muted);
  font-size: 13px;
}

/* Team grid (1fr auto 1fr) */
.match-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  margin: 12px 0;
}

.match-team {
  display: flex;
  align-items: center;
  gap: 8px;
}
.match-team.away {
  justify-content: flex-end;
  text-align: right;
}

.match-team .flag {
  font-size: 34px;
  line-height: 1;
}

.match-team .team-name {
  font-weight: 700;
  font-size: 15px;
}

/* Score center (inputs between team names) */
.score-center {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}

.score-center input {
  width: 52px !important;
  height: 52px;
  text-align: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 26px;
  font-weight: 700;
  background: var(--panel-2);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 0;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.score-center input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(123,186,64,0.18);
}

.score-center input:not(:placeholder-shown) {
  border-color: var(--brand-primary);
}

.score-center .dash {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--muted);
}

/* Legacy score-inputs (JS-generated) */
.match .score-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}
.match .score-inputs input {
  width: 64px;
  text-align: center;
}
.match .score-inputs .dash { color: var(--muted); }

.match .meta { font-size: 12.5px; color: var(--muted); }

/* Match footer */
.match-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.match-footer .advancer-row {
  font-size: 12.5px;
  color: var(--muted);
}
.match-footer .advancer-row strong { color: var(--text); }

.match-footer .js-save {
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
}

/* Autosave status indicator */
.autosave-status {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  white-space: nowrap;
}
.autosave-status.unsaved {
  color: #b45309;
  background: #fef3c7;
  animation: pulse-unsaved 1.5s ease-in-out infinite;
}
.autosave-status.saving { color: #6b776e; background: #eef1ea; }
.autosave-status.saved { color: #4c7d33; background: #e8f5e0; }
.autosave-status.error { color: #d62828; background: #fde8e8; }

@keyframes pulse-unsaved {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Locked / played */
.match.locked {
  background: #eef1ea;
  opacity: 0.92;
}

.match .result-score {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 30px;
  font-weight: 700;
  text-align: center;
  margin: 8px 0;
  letter-spacing: 2px;
}
.match .result-score .pen-score {
  font-size: 16px;
  font-weight: 400;
  opacity: 0.7;
  letter-spacing: 0;
}

.match .points-breakdown {
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
}

/* Unknown matches (TBD teams) */
.match.unknown {
  background: #f7faf4;
  border-style: dashed;
  border-color: #c5d1bd;
}

/* Killer match */
.match.killer-match {
  border: 1.5px solid var(--killer-border);
  background: linear-gradient(135deg, #ffffff 70%, #fdf3ec 100%);
}

.killer-explain {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--killer-text);
  margin-top: 8px;
}

/* ============================================================
   TABLE (standings)
   ============================================================ */
table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #edf1ea;
}

th {
  font-family: 'Barlow Condensed', sans-serif;
  color: var(--faint);
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td.num, th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

td.num strong {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px;
  font-weight: 700;
}

/* Own row highlight */
tr.me {
  background: #eef6e3;
  border-left: 4px solid var(--brand-primary);
}
tr.me td:first-child { padding-left: 6px; }
tr.me td.name-col { font-weight: 700; }
tr.me td.num strong { color: var(--brand-primary-deep); }

/* Claude AI row */
tr.claude-row {
  opacity: 0.55;
  font-style: italic;
}
tr.claude-row td.name-col { color: var(--faint); }

/* Ranking grid (alternative to table) */
.ranking-row {
  display: grid;
  grid-template-columns: 36px 1fr 64px 56px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid #edf1ea;
  font-size: 14.5px;
}

.ranking-row .rank {
  font-weight: 700;
  color: var(--faint);
}

.ranking-row .points {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px;
  font-weight: 700;
  text-align: right;
}

.ranking-row.me {
  background: #eef6e3;
  border-left: 4px solid var(--brand-primary);
}
.ranking-row.me .points { color: var(--brand-primary-deep); }

/* ============================================================
   PODIUM
   ============================================================ */
.podium-hero {
  background: var(--grad-hero);
  border-radius: 18px;
  padding: 24px 16px 0;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-hero);
}

.podium-hero .deco-circle {
  position: absolute;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  border: 2px solid rgba(123,186,64,0.18);
  top: -100px;
  right: -60px;
  pointer-events: none;
}

.podium-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: rgba(255,255,255,0.8);
  text-align: center;
  margin-bottom: 20px;
  position: relative;
}

.podium-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  align-items: end;
  text-align: center;
}

.podium-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.podium-crown {
  font-size: 20px;
  margin-bottom: 4px;
}

/* Monogram circles (podium) */
.podium-monogram {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 6px;
}

.podium-monogram.gold {
  width: 60px;
  height: 60px;
  font-size: 24px;
  background: var(--gold);
  border: 3px solid var(--gold-border);
  color: var(--gold-text);
}

.podium-monogram.silver {
  width: 52px;
  height: 52px;
  font-size: 20px;
  background: var(--silver);
  border: 3px solid var(--silver-border);
}

.podium-monogram.bronze {
  width: 52px;
  height: 52px;
  font-size: 20px;
  background: var(--bronze);
  border: 3px solid var(--bronze-border);
  color: var(--bronze-text);
}

.podium-name {
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 600;
  margin-bottom: 2px;
}
.podium-name.first { font-size: 14.5px; }

.podium-score {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  margin-bottom: 8px;
}
.podium-score.gold   { font-size: 26px; color: var(--gold); }
.podium-score.silver { font-size: 22px; color: var(--silver); }
.podium-score.bronze { font-size: 22px; color: var(--bronze); }

/* Bars */
.podium-bar {
  width: 100%;
  border-radius: 10px 10px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.podium-bar .rank {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
}

.podium-bar.first {
  height: 84px;
  background: rgba(233,196,106,0.3);
  border: 1px solid rgba(233,196,106,0.4);
  border-bottom: none;
}
.podium-bar.first .rank {
  font-size: 30px;
  color: var(--gold);
}

.podium-bar.second {
  height: 56px;
  background: rgba(255,255,255,0.10);
}
.podium-bar.second .rank { font-size: 22px; }

.podium-bar.third {
  height: 40px;
  background: rgba(255,255,255,0.14);
}
.podium-bar.third .rank { font-size: 22px; }

/* ============================================================
   SCORING CHIPS
   ============================================================ */
.scoring-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

/* ============================================================
   BRACKET VIEW (ágrajz) — SVG connector bracket
   ============================================================ */
.bracket-header { text-align: center; margin-bottom: 8px; }

.bracket-scroll {
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 16px;
}

main.bracket-page { max-width: 1060px; }

/* Viewport (relatively positioned, holds all absolute cells) */
.bk-viewport { position: relative; }

/* Round column headers */
.bk-rtitle {
  position: absolute;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--brand-primary-deep);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bk-rtitle--final { color: var(--killer-text); }

/* Absolutely positioned cell wrapper */
.bk-wrap { position: absolute; }

/* ---- Match cell ---- */
.bk-cell {
  width: 100%; height: 100%;
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: transform 0.15s, box-shadow 0.15s;
}
.bk-cell:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.bk-cell--tbd {
  background: var(--panel-2);
  border-style: dashed;
  border-color: #c5d1bd;
  opacity: 0.6;
}
.bk-cell--tbd:hover { opacity: 0.8; }

.bk-cell--played { border-color: var(--brand-primary); }

.bk-cell--final {
  background: var(--grad-hero);
  border: 2px solid rgba(123,186,64,0.3);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
}
.bk-cell--final:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.22); transform: translateY(-1px); }
html[data-brand="bvmk"] .bk-cell--final { border-color: rgba(221,0,49,0.25); }

.bk-cell--third { border-color: var(--bronze); }

.bk-cell--empty {
  display: flex; align-items: center; justify-content: center;
  background: var(--panel-2);
  border: 1.5px dashed var(--line);
  border-radius: 10px;
  color: var(--faint); font-size: 11px;
  width: 100%; height: 100%;
}

/* ---- Header bar inside cell ---- */
.bk-hdr {
  display: flex; justify-content: space-between; align-items: center;
  padding: 2px 8px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}
.bk-cell--final .bk-hdr {
  background: rgba(255,255,255,0.08);
  border-bottom-color: rgba(255,255,255,0.12);
}
.bk-cell--played .bk-hdr { background: #eef6e3; }
html[data-brand="bvmk"] .bk-cell--played .bk-hdr { background: #f5eef0; }

.bk-id {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--faint);
  text-transform: uppercase;
}
.bk-cell--final .bk-id { color: rgba(255,255,255,0.7); }

.bk-ko { font-size: 9px; color: var(--faint); }
.bk-cell--final .bk-ko { color: rgba(255,255,255,0.5); }

/* ---- Team rows ---- */
.bk-team {
  display: flex; align-items: center;
  padding: 1px 8px;
  gap: 4px;
  flex: 1; min-height: 0;
}
.bk-team--win { font-weight: 700; }
.bk-team--win .bk-score { color: var(--brand-primary-deep); }
.bk-cell--final .bk-team--win .bk-score { color: var(--brand-light); }
.bk-team--lose { opacity: 0.45; }

.bk-flag { font-size: 13px; line-height: 1; width: 16px; text-align: center; flex-shrink: 0; }

.bk-name {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 11.5px; line-height: 1.3;
}
.bk-cell--final .bk-name { color: #fff; }

.bk-score {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700; font-size: 13px;
  min-width: 12px; text-align: right;
}
.bk-cell--final .bk-score { color: rgba(255,255,255,0.9); }

.bk-pen {
  font-size: 8.5px; color: var(--muted);
  text-align: center; padding-bottom: 1px;
}
.bk-cell--final .bk-pen { color: rgba(255,255,255,0.5); }

/* ---- SVG connector lines ---- */
.bk-svg {
  position: absolute; top: 0; left: 0;
  pointer-events: none;
}
.bk-svg path {
  fill: none;
  stroke: var(--line);
  stroke-width: 1.5;
}

/* ---- Winner card (bracket page) ---- */
.bk-winner {
  display: flex; align-items: center;
  gap: 10px; font-size: 14px;
}
.bk-winner-icon { font-size: 22px; }

/* ============================================================
   FIELD DECORATIONS (generic pitch-line helper)
   ============================================================ */
.field-decor {
  position: relative;
  overflow: hidden;
}

.field-decor::before {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: 50%;
  pointer-events: none;
}

.field-decor::after {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  border: 2px solid rgba(123,186,64,0.22);
  border-radius: 50%;
  pointer-events: none;
}

/* ============================================================
   RULES LIST
   ============================================================ */
.rules-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}
.rules-list li {
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
}
.rules-list li:last-child { border-bottom: none; }
.rules-list .pts {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--brand-dark);
  white-space: nowrap;
}

/* ============================================================
   SERVER INFO
   ============================================================ */
.server-info {
  font-size: 12.5px;
  color: var(--faint);
  margin-bottom: 8px;
}

/* ============================================================
   SYNC INFO INDICATOR
   ============================================================ */
.sync-info {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sync-dot.fresh  { background: var(--brand-primary); }
.sync-dot.recent { background: var(--warn); }
.sync-dot.stale  { background: var(--danger); }

/* ============================================================
   ADMIN PANEL
   ============================================================ */
#sync-card {
  border-left: 3px solid var(--brand-primary);
}

#sync-log {
  background: var(--panel-2);
  padding: 10px 12px;
  border-radius: 8px;
  max-height: 200px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.5;
  font-family: 'Courier New', monospace;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.35s ease-out;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--faint); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  .header-top { padding: 10px 14px; }
  nav.app { padding: 0 10px; }
  nav.app a { padding: 8px 10px; font-size: 13.5px; }
  main { padding: 16px 12px 60px; }

  /* Login */
  .login-hero { padding: 60px 20px 90px; }
  .hero-title { font-size: 34px; }
  .hero-sub { font-size: 17px; letter-spacing: 3px; }
  .logo-circle { width: 80px; height: 80px; margin-bottom: 18px; }
  .logo-circle .logo { width: 60px; height: 60px; }
  .login-card { margin: -50px 12px 0; padding: 22px 18px; }

  /* Match grid */
  .match-grid { grid-template-columns: 1fr; gap: 12px; }
  .score-center { margin: 4px 0; }

  /* Countdown */
  .countdown-match-name { font-size: 22px; }

  /* Podium */
  .podium-monogram.gold { width: 52px; height: 52px; font-size: 20px; }
  .podium-monogram.silver,
  .podium-monogram.bronze { width: 44px; height: 44px; font-size: 16px; }
  .podium-score.gold { font-size: 22px; }
  .podium-score.silver,
  .podium-score.bronze { font-size: 18px; }
  .podium-bar.first  { height: 68px; }
  .podium-bar.second { height: 46px; }
  .podium-bar.third  { height: 32px; }
  .podium-grid { gap: 4px; }

  /* Bracket (mobile) */
  .bracket-scroll { margin: 0 -12px; padding-left: 12px; padding-right: 12px; }
}

@media (min-width: 641px) {
  .score-center input {
    width: 56px !important;
    height: 56px;
    font-size: 28px;
  }
}

/* ============================================================
   POINT DETAILS TABLE (pontreszletezo)
   ============================================================ */
.pd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  white-space: nowrap;
}

.pd-table th,
.pd-table td {
  padding: 4px 6px;
  border-bottom: 1px solid #edf1ea;
}

.pd-match-hdr {
  text-align: left;
  min-width: 180px;
  position: sticky;
  left: 0;
  background: var(--panel);
  z-index: 2;
}

.pd-res-hdr {
  text-align: center;
  min-width: 44px;
}

.pd-player-hdr {
  text-align: center;
  min-width: 64px;
  font-size: 11px;
  vertical-align: bottom;
  padding-bottom: 6px;
}
.pd-player-hdr.me {
  background: #eef6e3;
  color: var(--brand-primary-deep);
}

.pd-round-row td {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--brand-primary-deep);
  background: var(--panel-2);
  padding: 6px 8px;
  border-bottom: 1.5px solid var(--line);
}

.pd-match-row:hover {
  background: #f8faf5;
}

.pd-match-cell {
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  position: sticky;
  left: 0;
  background: var(--panel);
  z-index: 1;
}
.pd-match-row:hover .pd-match-cell {
  background: #f8faf5;
}

.pd-match-row.pd-killer .pd-match-cell {
  color: var(--killer-text);
}
.pd-match-row.pd-killer {
  background: #fdf8f4;
}
.pd-match-row.pd-killer:hover {
  background: #fdf3ec;
}
.pd-match-row.pd-killer .pd-match-cell {
  background: #fdf8f4;
}
.pd-match-row.pd-killer:hover .pd-match-cell {
  background: #fdf3ec;
}

.pd-res-cell {
  text-align: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 14px;
  font-weight: 700;
}

.pd-tip-cell {
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.pd-tip-cell.me {
  background: #f3fae9;
}

.pd-tip {
  color: var(--muted);
  font-size: 11.5px;
}

.pd-pts-ok {
  font-weight: 700;
  color: var(--brand-primary-deep);
  font-size: 12px;
}

.pd-pts-high {
  font-weight: 800;
  color: var(--brand-primary);
  font-size: 13px;
}

.pd-pts-zero {
  color: var(--faint);
  font-size: 11px;
}

.pd-no-tip {
  color: var(--line);
}

.pd-total-row td {
  border-top: 2px solid var(--brand-primary);
  border-bottom: none;
  padding: 8px 6px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 15px;
}
.pd-total-row .pd-total {
  font-weight: 700;
  font-size: 16px;
  color: var(--brand-dark);
}
.pd-total-row .pd-total.me {
  color: var(--brand-primary-deep);
  background: #eef6e3;
}

/* Danger button */
button.danger {
  background: var(--danger);
  color: #ffffff;
  box-shadow: 0 6px 14px rgba(220,53,69,0.3);
}
button.danger:hover:not(:disabled) {
  filter: brightness(1.07);
}

/* Admin small buttons */
.btn-sm {
  padding: 4px 10px;
  font-size: .8rem;
  border-radius: 6px;
  border: 1px solid var(--brand-primary);
  background: var(--panel);
  color: var(--brand-primary-deep);
  cursor: pointer;
  font-weight: 500;
  transition: background .15s;
}
.btn-sm:hover:not(:disabled) { background: var(--panel-2); }
.danger-sm {
  color: var(--danger);
  border-color: var(--danger);
}
.danger-sm:hover:not(:disabled) { background: #fdf0f1; }

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  header.app { position: static; }
  nav.app { display: none; }
  body { background: #ffffff; }
  .card, .match { box-shadow: none; border: 1px solid #ccc; }
  button { display: none; }
}
