:root {
  --bg: #06111f;
  --bg-soft: #0d1b31;
  --bg-panel: rgba(9, 19, 37, 0.72);
  --card: rgba(255, 255, 255, 0.94);
  --card-strong: #ffffff;
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #64748b;
  --border: rgba(255, 255, 255, 0.18);

  --red: #d92d43;
  --blue: #2563eb;
  --green: #1fa463;
  --gold: #d4a017;
  --silver: #c7d2e3;
  --bronze: #b87444;

  --primary: linear-gradient(135deg, #d92d43 0%, #2563eb 55%, #1fa463 100%);
  --primary-dark: linear-gradient(135deg, #b61f34 0%, #1d4ed8 55%, #188451 100%);
  --ghost: rgba(255, 255, 255, 0.08);

  --success-bg: #dcfce7;
  --success-text: #166534;
  --error-bg: #fee2e2;
  --error-text: #991b1b;

  --shadow: 0 18px 40px rgba(2, 8, 23, 0.28);
  --shadow-soft: 0 10px 25px rgba(15, 23, 42, 0.16);
  --radius: 20px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(217, 45, 67, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.18), transparent 30%),
    radial-gradient(circle at bottom center, rgba(31, 164, 99, 0.15), transparent 24%),
    linear-gradient(180deg, #07111f 0%, #0c1730 30%, #15274a 54%, #edf2f7 55%, #f4f7fb 100%);
}

body {
  min-height: 100vh;
}

.app {
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(60px);
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
}

.bg-orb-red {
  width: 240px;
  height: 240px;
  background: var(--red);
  top: 40px;
  left: -40px;
}

.bg-orb-green {
  width: 220px;
  height: 220px;
  background: var(--green);
  top: 220px;
  right: -50px;
}

.bg-orb-blue {
  width: 280px;
  height: 280px;
  background: var(--blue);
  bottom: 140px;
  left: 10%;
}

.topbar,
.container {
  position: relative;
  z-index: 1;
}

.topbar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 16px 12px;
  color: #fff;
}

.topbar-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  padding: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
}

.brand {
  margin: 0;
}

.brand-kicker {
  display: inline-block;
  margin-bottom: 4px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand-title {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.95rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero {
  margin-top: 16px;
}

.hero-card {
  position: relative;
  overflow: hidden;
  padding: 22px 18px 18px;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    linear-gradient(135deg, rgba(217, 45, 67, 0.12), rgba(37, 99, 235, 0.14) 55%, rgba(31, 164, 99, 0.12));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(8px);
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 255, 255, 0.16), transparent 28%),
    radial-gradient(circle at 82% 24%, rgba(255, 255, 255, 0.08), transparent 20%);
  pointer-events: none;
}

.hero-card::after {
  content: "";
  position: absolute;
  right: -60px;
  bottom: -60px;
  width: 180px;
  height: 180px;
  border-radius: 999px;
  border: 18px solid rgba(255, 255, 255, 0.05);
}

.hero-badge {
  display: inline-block;
  margin-bottom: 12px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(212, 160, 23, 0.18);
  color: #ffe7a7;
  border: 1px solid rgba(255, 231, 167, 0.25);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: 1.55rem;
  line-height: 1.15;
  max-width: 760px;
}

.hero p {
  margin: 0;
  max-width: 760px;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.55;
}

.hero-stripes {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.stripe {
  display: inline-block;
  height: 6px;
  border-radius: 999px;
}

.stripe-red {
  width: 90px;
  background: linear-gradient(90deg, rgba(217, 45, 67, 0.4), rgba(217, 45, 67, 1));
}

.stripe-blue {
  width: 110px;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.4), rgba(37, 99, 235, 1));
}

.stripe-green {
  width: 80px;
  background: linear-gradient(90deg, rgba(31, 164, 99, 0.4), rgba(31, 164, 99, 1));
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 16px 28px;
}

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

.page {
  display: block;
}

.card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96));
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(255, 255, 255, 0.88);
  padding: 18px;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--red), var(--blue), var(--green));
}

.card-accent-red::before {
  background: linear-gradient(90deg, var(--red), #ff7b8c);
}

.card-accent-blue::before {
  background: linear-gradient(90deg, var(--blue), #7ab3ff);
}

.card-accent-green::before {
  background: linear-gradient(90deg, var(--green), #64d39c);
}

.card-accent-gold::before {
  background: linear-gradient(90deg, var(--gold), #f5d67a);
}

.card h2 {
  margin: 0 0 10px;
  font-size: 1.22rem;
  line-height: 1.2;
}

.card h3 {
  line-height: 1.25;
}

.muted {
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.msg {
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 0.95rem;
  border: 1px solid transparent;
  box-shadow: var(--shadow-soft);
}

.msg.ok {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: #86efac;
}

.msg.err {
  background: var(--error-bg);
  color: var(--error-text);
  border-color: #fca5a5;
}

label {
  display: block;
  margin: 12px 0 6px;
  font-size: 0.94rem;
  font-weight: 700;
  color: #1e293b;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid #d7e0ea;
  background: #ffffff;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, transform 0.08s ease;
}

input::placeholder,
textarea::placeholder {
  color: #94a3b8;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.5);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: #f8fafc;
  color: #94a3b8;
  cursor: not-allowed;
}

textarea {
  min-height: 220px;
  resize: vertical;
  line-height: 1.45;
}

textarea[readonly] {
  background: #07111f;
  color: #dbeafe;
  border-color: #1e293b;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.22);
}

button {
  width: 100%;
  margin-top: 12px;
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.22);
  transition: transform 0.06s ease, opacity 0.15s ease, filter 0.15s ease, box-shadow 0.2s ease;
}

button:hover {
  filter: brightness(1.05);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.26);
}

button:active {
  transform: translateY(1px);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.24);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.14);
  filter: none;
  box-shadow: none;
}

.row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 0;
  border-bottom: 1px solid #e8edf4;
}

.row:last-child {
  border-bottom: 0;
}

.row strong {
  display: inline-block;
  line-height: 1.4;
}

.row.row-highlight {
  position: relative;
  padding: 18px;
  border: 1px solid rgba(207, 219, 232, 0.8);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.92));
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  margin-bottom: 12px;
  transition: transform 0.12s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.row.row-highlight:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12);
  border-color: rgba(180, 198, 220, 0.9);
}

.row.row-highlight:last-child {
  border-bottom: 1px solid rgba(207, 219, 232, 0.8);
}

.match-topline,
.ranking-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.stage-badge,
.kickoff-badge,
.locked-badge,
.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 0.82rem;
  font-weight: 700;
}

.stage-badge {
  background: rgba(37, 99, 235, 0.1);
  color: var(--blue);
}

.kickoff-badge {
  background: rgba(15, 23, 42, 0.06);
  color: #334155;
}

.locked-badge {
  background: rgba(217, 45, 67, 0.12);
  color: #a61b2f;
}

.result-badge {
  background: rgba(31, 164, 99, 0.12);
  color: #176845;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.92rem;
  font-weight: 700;
}

.pill.pill-role-admin {
  background: rgba(212, 160, 23, 0.14);
  color: #8a6800;
  border-color: rgba(212, 160, 23, 0.28);
}

.pill.pill-role-player {
  background: rgba(31, 164, 99, 0.12);
  color: #176845;
  border-color: rgba(31, 164, 99, 0.25);
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-weight: 700;
}

.checkbox-line input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
}

.team-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  vertical-align: middle;
}

.flag-img {
  width: 24px;
  height: 18px;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
  flex-shrink: 0;
  background: #f8fafc;
}

.flag-emoji {
  display: inline-block;
  width: 1.4em;
  text-align: center;
  font-size: 1.1em;
  line-height: 1;
}

.score-inputs {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.team-vs {
  color: #64748b;
  font-weight: 700;
}

.match-actions {
  min-width: 280px;
}

.match-card-strong {
  font-size: 1.03rem;
}

.match-subline {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.ranking-row {
  align-items: center;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f8d66d, #d4a017);
  color: #3f3100;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(212, 160, 23, 0.24);
}

.rank-badge.rank-plain {
  background: linear-gradient(135deg, #dbe4f0, #c0cedd);
  color: #334155;
  box-shadow: none;
}

.ranking-name {
  font-weight: 700;
  color: #0f172a;
}

.ranking-points {
  font-size: 1.15rem;
}

.meta-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
  font-size: 0.83rem;
  font-weight: 700;
}

.dashboard-card {
  position: relative;
  padding: 16px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.9));
  border: 1px solid rgba(207, 219, 232, 0.85);
}

.dashboard-card.dashboard-highlight {
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.08), transparent 28%),
    radial-gradient(circle at bottom left, rgba(217, 45, 67, 0.08), transparent 26%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.92));
}

.dashboard-card.dashboard-highlight::after {
  content: "";
  position: absolute;
  right: -28px;
  top: -28px;
  width: 92px;
  height: 92px;
  border-radius: 999px;
  border: 12px solid rgba(31, 164, 99, 0.08);
}

.dashboard-title {
  margin-bottom: 8px;
}

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

.section-intro {
  margin-bottom: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.podium {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.podium-card {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  padding: 18px 16px;
  color: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.1);
}

.podium-card::after {
  content: "";
  position: absolute;
  right: -16px;
  bottom: -16px;
  width: 78px;
  height: 78px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
}

.podium-first {
  background: linear-gradient(135deg, #f7e2a1, #f3c95f);
}

.podium-second {
  background: linear-gradient(135deg, #edf3fb, #d7e1f0);
}

.podium-third {
  background: linear-gradient(135deg, #ecc3a0, #cf8e61);
}

.podium-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.podium-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  border-radius: 999px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.56);
}

.podium-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.72;
  font-weight: 800;
}

.podium-name {
  margin-top: 10px;
  font-size: 1.08rem;
  font-weight: 800;
}

.podium-points {
  margin-top: 6px;
  font-size: 1.2rem;
}

.podium-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.podium-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  font-size: 0.82rem;
  font-weight: 700;
}

#predList input[type="number"] {
  width: 74px;
  text-align: center;
}

#predList select {
  min-width: 150px;
}

#syncStatus,
#adminResultStatus {
  margin-top: 10px;
  white-space: pre-line;
}

#debugOutput {
  font-family: Consolas, Monaco, 'Courier New', monospace;
  font-size: 0.9rem;
}

.result-row {
  align-items: flex-start;
}

.result-score-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(31, 164, 99, 0.12);
  color: #176845;
  font-weight: 800;
  border: 1px solid rgba(31, 164, 99, 0.18);
}

#resultsList .row.row-highlight {
  border-left: 4px solid rgba(31, 164, 99, 0.45);
}

#resultsList .match-subline strong {
  color: #0f172a;
}

.prediction-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.10);
  color: #1d4ed8;
  border: 1px solid rgba(37, 99, 235, 0.18);
  font-size: 0.84rem;
  font-weight: 700;
}

.btn-link {
  background: none;
  border: none;
  padding: 0;
  color: #1d4ed8;
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  box-shadow: none;
  width: auto;
  min-width: 0;
  margin-top: 0;
}

.btn-link:hover {
  opacity: 0.8;
  filter: none;
  box-shadow: none;
}

@media (min-width: 700px) {
  .topbar {
    padding: 24px 20px 14px;
  }

  .topbar-inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
  }

  .container {
    padding: 12px 20px 30px;
  }

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

  .row {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
  }

  button {
    width: auto;
    min-width: 170px;
  }

  .nav button {
    width: auto;
    min-width: 0;
    margin-top: 0;
  }

  .hero-card {
    padding: 28px 24px 22px;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .brand-logo {
    width: 60px;
    height: 60px;
  }

  .podium {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
  }
}

@media (min-width: 980px) {
  .brand-title {
    font-size: 2.2rem;
  }

  .card {
    padding: 22px;
  }

  .hero h1 {
    font-size: 2.2rem;
  }
}

@media (max-width: 699px) {
  .brand-wrap {
    align-items: flex-start;
  }

  .brand-title {
    font-size: 1.55rem;
  }

  .brand-subtitle {
    font-size: 0.88rem;
  }

  .hero-card {
    padding: 20px 16px 16px;
  }

  .hero h1 {
    font-size: 1.4rem;
  }

  .match-actions {
    min-width: 0;
    width: 100%;
  }

  .score-inputs {
    width: 100%;
  }

  .score-inputs input,
  .score-inputs select,
  .score-inputs button {
    width: 100%;
  }

  #predList input[type="number"] {
    width: calc(50% - 20px);
    min-width: 0;
  }

  #predList select {
    width: 100%;
    min-width: 0;
  }

  .team-label {
    gap: 8px;
  }

  .match-card-strong {
    font-size: 0.98rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto;
    animation: none !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }

  .row.row-highlight:hover,
  button:active {
    transform: none;
  }
}
@media (max-width: 699px) {
  .topbar {
    padding: 14px 14px 8px;
  }

  .brand-wrap {
    gap: 10px;
  }

  .brand-logo {
    width: 46px;
    height: 46px;
  }

  .brand-kicker {
    margin-bottom: 3px;
    padding: 4px 9px;
    font-size: 0.68rem;
  }

  .brand-title {
    font-size: 1.28rem;
    line-height: 1.05;
  }

  .brand-subtitle {
    margin-top: 3px;
    font-size: 0.82rem;
    line-height: 1.25;
  }

  .nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .nav > button {
    width: 100%;
    min-width: 0;
    margin-top: 0;
    padding: 10px 10px;
    min-height: 46px;
    font-size: 0.98rem;
    border-radius: 12px;
  }

  .hero {
    margin-top: 10px;
  }

  .hero-card {
    padding: 16px 14px 14px;
    border-radius: 18px;
  }

  .hero-badge {
    margin-bottom: 9px;
    padding: 6px 10px;
    font-size: 0.72rem;
  }

  .hero h1 {
    font-size: 1.2rem;
    line-height: 1.15;
    margin-bottom: 8px;
  }

  .hero p {
    font-size: 0.95rem;
    line-height: 1.4;
  }

  .hero-stripes {
    margin-top: 14px;
  }

  .container {
    padding: 8px 14px 22px;
  }
}