:root {
  --primary-green: #00a86b;
  --dark-green: #1b5e20;
  --gold: #ffd700;
  --dark-gold: #b8860b;
  --white: #ffffff;
  --light-bg: #f5f7f5;
  --card-bg: #ffffff;
  --text-primary: #1a1a2e;
  --text-secondary: #666666;
  --border: #e0e0e0;
  --accent-red: #e74c3c;
  --accent-blue: #3498db;
  --shadow: 0 10px 24px rgba(26, 26, 46, 0.08);
  --radius: 8px;
  --topbar-height: 78px;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--light-bg);
  color: var(--text-primary);
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  background:
    linear-gradient(180deg, rgba(0, 168, 107, 0.08), rgba(245, 247, 245, 0) 22rem),
    var(--light-bg);
}

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

button {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--topbar-height);
  padding: 0.75rem 1rem;
  color: var(--white);
  background: linear-gradient(135deg, var(--dark-green), var(--primary-green));
  box-shadow: 0 6px 18px rgba(0, 79, 50, 0.22);
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  font-size: 1.4rem;
}

.brand h1 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.brand p {
  margin: 0.15rem 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.875rem;
}

.topbar-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.score-badge,
.golden-entry {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  padding: 0 0.75rem;
  color: var(--dark-green);
  background: var(--gold);
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.14);
}

.golden-entry {
  display: none;
  color: var(--white);
  background: rgba(255, 255, 255, 0.14);
}

.desktop-tabs {
  display: none;
  align-items: center;
  gap: 0.35rem;
  margin-left: 0.75rem;
}

.tab-button {
  border-radius: 999px;
  color: var(--text-secondary);
  background: transparent;
  font-weight: 700;
  transition: color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.desktop-tabs .tab-button {
  color: rgba(255, 255, 255, 0.78);
  padding: 0 1rem;
}

.tab-button:hover {
  transform: translateY(-1px);
}

.desktop-tabs .tab-button.is-active {
  color: var(--dark-green);
  background: var(--white);
}

.bottom-tabs {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 35;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.15rem;
  padding: 0.35rem 0.35rem calc(0.35rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -8px 24px rgba(26, 26, 46, 0.1);
}

.bottom-tabs .tab-button {
  display: flex;
  min-width: 0;
  height: 52px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  border-radius: 8px;
  font-size: 0.75rem;
}

.bottom-tabs .tab-button span {
  line-height: 1;
}

.bottom-tabs .tab-button.is-active {
  color: var(--white);
  background: var(--primary-green);
}

.app-shell {
  width: min(100%, 1280px);
  margin: 0 auto;
  padding: 1rem 1rem 5.5rem;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-head h2 {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.2;
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--primary-green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.toolbar {
  display: flex;
  max-width: 100%;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.1rem;
}

.filter-chip,
.action-button {
  min-height: 44px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 0.85rem;
  color: var(--text-primary);
  background: var(--card-bg);
  font-weight: 700;
}

.filter-chip.is-active,
.action-button.primary {
  border-color: var(--primary-green);
  color: var(--white);
  background: var(--primary-green);
}

.content-grid,
.standings-grid {
  display: grid;
  gap: 0.85rem;
}

.card,
.group-card,
.share-card,
.admin-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  box-shadow: var(--shadow);
}

.card {
  padding: 1rem;
}

.card h3,
.bracket-round h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  line-height: 1.25;
}

.match-card.finished {
  border-color: var(--gold);
  box-shadow: 0 10px 26px rgba(184, 134, 11, 0.18);
}

.match-meta,
.muted {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.match-teams {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.65rem;
  margin: 0.85rem 0;
}

.team-side {
  min-width: 0;
  font-weight: 800;
}

.team-side:last-child {
  text-align: right;
}

.flag {
  margin-right: 0.35rem;
}

.score {
  display: inline-grid;
  min-width: 72px;
  min-height: 44px;
  place-items: center;
  border-radius: 8px;
  color: var(--dark-green);
  background: rgba(255, 215, 0, 0.28);
  font-size: 1.2rem;
  font-weight: 900;
}

.prob-row {
  display: grid;
  gap: 0.45rem;
}

.prob-track {
  display: grid;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe7e2;
}

.prob-home {
  background: var(--primary-green);
}

.prob-draw {
  background: var(--accent-blue);
}

.prob-away {
  background: var(--accent-red);
}

.prob-labels {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
}

.guess-slot {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.85rem;
  border: 1px solid rgba(0, 168, 107, 0.22);
  border-radius: 8px;
  padding: 0.75rem;
  background: rgba(0, 168, 107, 0.06);
}

.guess-outcomes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.guess-outcome-btn {
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  background: var(--white);
  font-weight: 800;
}

.guess-outcome-btn.is-active {
  border-color: var(--primary-green);
  color: var(--white);
  background: var(--primary-green);
}

.guess-score-row {
  display: grid;
  grid-template-columns: auto 52px auto 52px minmax(112px, 1fr);
  align-items: center;
  gap: 0.45rem;
}

.guess-score-input {
  min-height: 44px;
  width: 52px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem;
  text-align: center;
}

.guess-submitted,
.guess-result {
  color: var(--dark-green);
  font-weight: 800;
}

.guess-missed {
  color: var(--accent-red);
  font-weight: 800;
}

.group-guess {
  display: grid;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
  padding: 0.75rem;
  border-radius: 8px;
  background: rgba(255, 215, 0, 0.14);
}

.group-guess span {
  color: var(--dark-green);
  font-weight: 900;
}

.group-guess select,
.bracket-pick {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  background: var(--white);
}

.table-scroll,
.bracket-scroll {
  max-width: 100%;
  overflow-x: auto;
}

.standings-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.standings-table th,
.standings-table td {
  padding: 0.65rem 0.55rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.standings-table th:first-child,
.standings-table td:first-child {
  text-align: left;
}

.rank-auto {
  border-left: 4px solid var(--primary-green);
}

.rank-wildcard {
  border-left: 4px solid var(--dark-gold);
}

.bracket-board {
  display: grid;
  min-width: 980px;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  align-items: start;
  padding-bottom: 0.5rem;
}

.bracket-round {
  display: grid;
  gap: 0.75rem;
}

.bracket-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.bracket-match {
  min-height: 96px;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
}

.share-layout {
  display: grid;
  gap: 1rem;
}

#poster-canvas {
  width: min(100%, 375px);
  height: auto;
  border-radius: 8px;
  background: var(--dark-green);
  box-shadow: var(--shadow);
}

.form-grid {
  display: grid;
  gap: 0.75rem;
}

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

.field {
  display: grid;
  gap: 0.35rem;
}

.field label {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  color: var(--text-primary);
  background: var(--white);
}

.field textarea {
  min-height: 132px;
  resize: vertical;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.action-button.danger {
  border-color: var(--accent-red);
  color: var(--accent-red);
}

.floating-actions {
  position: fixed;
  right: 1rem;
  bottom: calc(5.8rem + env(safe-area-inset-bottom));
  z-index: 34;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  align-items: flex-end;
}

.floating-champion,
.floating-golden {
  border-radius: 999px;
  padding: 0 1rem;
  color: var(--dark-green);
  background: var(--gold);
  font-weight: 900;
  box-shadow: var(--shadow);
}

.floating-golden {
  color: var(--white);
  background: var(--primary-green);
}

.daily-challenge-card {
  position: fixed;
  right: 1rem;
  bottom: calc(9.2rem + env(safe-area-inset-bottom));
  left: 1rem;
  z-index: 33;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  max-width: 460px;
  margin-left: auto;
  border: 1px solid rgba(255, 215, 0, 0.45);
  border-radius: 8px;
  padding: 0.85rem;
  background: var(--white);
  box-shadow: var(--shadow);
}

.daily-challenge-card div {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.daily-challenge-card span {
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 0.84rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(26, 26, 46, 0.46);
}

.modal-card {
  width: min(100%, 760px);
  max-height: min(86vh, 820px);
  overflow: auto;
  border-radius: 8px;
  padding: 1rem;
  background: var(--white);
  box-shadow: 0 18px 50px rgba(26, 26, 46, 0.28);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.modal-head h3 {
  margin: 0;
  font-size: 1.15rem;
}

.icon-button {
  border-radius: 50%;
  color: var(--text-primary);
  background: var(--light-bg);
  font-size: 1.35rem;
  line-height: 1;
}

.score-total {
  margin: 0.5rem 0 0.9rem;
  color: var(--dark-green);
  font-size: 2rem;
  font-weight: 900;
}

.score-breakdown {
  display: grid;
  gap: 0.55rem;
  padding: 0.8rem 0;
  border-block: 1px solid var(--border);
}

.score-breakdown div,
.score-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
}

.score-stats {
  display: grid;
  margin: 0.9rem 0;
  color: var(--text-secondary);
  font-weight: 700;
}

.selected-prediction {
  margin-bottom: 0.75rem;
  color: var(--dark-green);
  font-weight: 900;
}

.champion-grid,
.player-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.team-pick,
.player-pick {
  display: grid;
  min-height: 72px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem;
  color: var(--text-primary);
  background: var(--white);
  text-align: left;
}

.team-pick.is-selected,
.player-pick.is-selected {
  border-color: var(--dark-gold);
  box-shadow: inset 0 0 0 2px rgba(255, 215, 0, 0.55);
}

.team-pick strong,
.player-pick strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-pick small,
.player-pick small {
  color: var(--text-secondary);
}

.daily-question {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.daily-question span {
  color: var(--primary-green);
  font-weight: 800;
}

.daily-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.streak-fire {
  animation: streak-pulse 900ms ease-in-out infinite alternate;
}

.hidden {
  display: none !important;
}

@keyframes streak-pulse {
  from {
    transform: scale(1);
  }

  to {
    transform: scale(1.08);
  }
}

.empty-state {
  padding: 2rem 1rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  text-align: center;
}

@media (min-width: 768px) {
  .topbar {
    padding-inline: 1.5rem;
  }

  .desktop-tabs {
    display: flex;
  }

  .golden-entry {
    display: inline-flex;
  }

  .bottom-tabs {
    display: none;
  }

  .app-shell {
    padding: 1.5rem;
  }

  .section-head h2 {
    font-size: 1.8rem;
  }

  .group-guess {
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) auto;
    align-items: center;
  }

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

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

  .floating-actions {
    bottom: 1.25rem;
  }

  .floating-golden {
    display: none;
  }

  .daily-challenge-card {
    bottom: 5rem;
  }

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

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

  .share-layout {
    grid-template-columns: minmax(0, 1fr) 375px;
    align-items: start;
  }

  .form-grid.two-cols {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1180px) {
  .content-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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