:root {
  --bg: #061225;
  --bg-deep: #030816;
  --panel: rgba(11, 34, 67, 0.86);
  --panel-strong: rgba(13, 43, 82, 0.94);
  --line: rgba(166, 197, 255, 0.22);
  --text: #f6f9ff;
  --muted: #aebbd0;
  --green: #68e94e;
  --green-2: #12a84d;
  --blue: #1f78ff;
  --red: #ff4b45;
  --gold: #ffd849;
  --card: #f7fbff;
  --ink: #172033;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg-deep);
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background:
    radial-gradient(circle at 20% 0%, rgba(35, 121, 255, 0.22), transparent 28rem),
    linear-gradient(180deg, #020715 0%, #082044 54%, #061225 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 280px 1fr 260px;
  align-items: center;
  min-height: 76px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(2, 8, 24, 0.92);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 900;
  font-size: 25px;
}

.brand-cup {
  font-size: 30px;
}

.desktop-nav {
  display: flex;
  align-items: stretch;
  justify-content: center;
  height: 76px;
}

.nav-link {
  position: relative;
  min-width: 116px;
  border: 0;
  color: #dce5f5;
  background: transparent;
  font-weight: 800;
  font-size: 16px;
}

.nav-link.is-active {
  color: white;
  background: linear-gradient(180deg, rgba(46, 224, 89, 0.08), rgba(46, 224, 89, 0.18));
}

.nav-link.is-active::after {
  content: "";
  position: absolute;
  left: 34%;
  right: 34%;
  bottom: 0;
  height: 5px;
  border-radius: 999px 999px 0 0;
  background: var(--green);
}

.user-chip {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
}

.icon-button,
.profile-button,
.ghost-button,
.text-link {
  border: 0;
  color: inherit;
  background: transparent;
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
}

.icon-bell {
  width: 20px;
  height: 22px;
  border: 2px solid currentColor;
  border-radius: 12px 12px 7px 7px;
  position: relative;
}

.icon-bell::before {
  content: "";
  position: absolute;
  left: 7px;
  top: -7px;
  width: 4px;
  height: 7px;
  border-radius: 5px;
  background: currentColor;
}

.icon-bell::after {
  content: "";
  position: absolute;
  left: 6px;
  bottom: -7px;
  width: 7px;
  height: 4px;
  border-radius: 0 0 8px 8px;
  background: currentColor;
}

.profile-button {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.avatar {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 50%;
  color: #072044;
  background: linear-gradient(145deg, #f9fbff, #b7d6ff);
  font-weight: 900;
}

main {
  width: min(1520px, calc(100vw - 44px));
  margin: 24px auto 42px;
}

.view {
  display: none;
}

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

.hero-panel {
  position: relative;
  min-height: 300px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-panel.slim {
  min-height: 210px;
  margin-bottom: 22px;
}

.hero-panel img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.88;
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(2, 8, 24, 0.2), rgba(2, 8, 24, 0.1) 42%, rgba(2, 8, 24, 0.64));
}

.hero-copy {
  position: relative;
  z-index: 1;
  width: min(720px, 72%);
  padding: 54px 52px;
  text-align: center;
  margin: 0 auto;
}

.hero-copy h1 {
  margin: 6px 0 14px;
  font-size: clamp(36px, 4vw, 64px);
  line-height: 1.08;
  letter-spacing: 0;
  font-weight: 950;
}

.koi-title {
  position: relative;
  display: inline-block;
  text-shadow: 0 8px 28px rgba(0, 0, 0, 0.38);
}

.koi-title::after {
  content: "";
  position: absolute;
  inset: 0 -16%;
  transform: translateX(-120%) skewX(-18deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.34), transparent);
  animation: titleShine 4.8s ease-in-out infinite;
  pointer-events: none;
}

.koi-title span {
  display: inline-block;
  margin: 0 0.08em;
  color: transparent;
  background: linear-gradient(135deg, #ffe98a 0%, #ff9f29 38%, #ff4b45 68%, #fff0b8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 16px rgba(255, 188, 48, 0.35));
  transform: skewX(-6deg);
}

.prize-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 14px;
  border: 1px solid rgba(255, 216, 73, 0.34);
  border-radius: 999px;
  color: #fff3b5;
  background: rgba(73, 43, 6, 0.32);
  box-shadow: 0 0 20px rgba(255, 190, 65, 0.14);
}

.eyebrow,
.section-kicker,
.fine-print {
  margin: 0;
  color: #d5e4fa;
}

.eyebrow {
  font-size: 20px;
}

.fine-print {
  margin-top: 10px;
  font-size: 14px;
}

.primary-cta {
  border: 0;
  border-radius: 12px;
  color: white;
  background: linear-gradient(180deg, #79f05b, #0aa64d);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34), 0 12px 28px rgba(24, 202, 87, 0.28);
  font-weight: 900;
  min-height: 50px;
  padding: 0 28px;
}

.hero-copy .primary-cta {
  min-width: 260px;
  min-height: 64px;
  font-size: 26px;
}

.hero-stats {
  position: absolute;
  z-index: 2;
  right: 34px;
  top: 42px;
  display: grid;
  grid-template-columns: repeat(4, minmax(94px, 1fr));
  gap: 0;
  width: min(560px, 42%);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(8, 30, 64, 0.86);
  backdrop-filter: blur(12px);
}

@media (min-width: 1181px) {
  #view-home .hero-copy {
    width: min(680px, 56%);
    margin: 0;
    padding: 52px 40px 96px clamp(330px, 28vw, 430px);
    text-align: left;
  }

  #view-home .hero-copy h1 {
    max-width: 680px;
    font-size: clamp(42px, 3.2vw, 58px);
  }

  #view-home .hero-copy .primary-cta {
    min-width: 230px;
  }

  #view-home .hero-stats {
    top: auto;
    right: 34px;
    bottom: 38px;
    width: min(520px, 38%);
  }

  #view-home .hero-stats .stat {
    padding: 20px 14px;
  }

  #view-leaderboard .hero-copy {
    width: min(620px, 50%);
    margin: 0;
    padding: 46px 40px 42px clamp(230px, 21vw, 360px);
    text-align: left;
  }

  #view-leaderboard .hero-copy h1 {
    max-width: 560px;
    font-size: clamp(40px, 3.1vw, 56px);
    white-space: nowrap;
  }

  #view-leaderboard .hero-stats {
    top: 44px;
    right: 34px;
    width: min(520px, 39%);
  }

  #view-leaderboard .hero-stats .stat {
    padding: 20px 14px;
  }
}

@media (min-width: 1181px) and (max-width: 1380px) {
  #view-leaderboard .hero-copy {
    width: 52%;
    padding-left: 230px;
  }

  #view-leaderboard .hero-copy h1 {
    font-size: clamp(34px, 2.8vw, 44px);
  }

  #view-leaderboard .hero-stats {
    width: 42%;
    right: 24px;
  }

  #view-leaderboard .hero-stats .stat strong {
    font-size: 24px;
  }
}

.stat {
  padding: 26px 18px;
  text-align: center;
}

.stat + .stat {
  border-left: 1px solid var(--line);
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.stat strong {
  display: block;
  margin-top: 8px;
  color: var(--green);
  font-size: 28px;
}

.stat .gold {
  color: var(--gold);
}

.home-grid,
.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 20px;
  margin-top: 20px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 22px;
}

.panel.wide,
.below-panel {
  background: rgba(248, 251, 255, 0.96);
  color: var(--ink);
}

.panel-heading,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-heading.compact {
  margin-bottom: 14px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 22px;
}

.section-kicker {
  color: var(--green-2);
  font-weight: 900;
}

.text-link {
  color: inherit;
  opacity: 0.78;
}

.match-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(230px, 1fr));
  gap: 16px;
}

.match-card {
  border: 1px solid rgba(12, 33, 66, 0.14);
  border-radius: 12px;
  background: white;
  color: var(--ink);
  padding: 16px;
  box-shadow: 0 10px 24px rgba(8, 24, 56, 0.08);
}

.match-card.dark {
  border-color: var(--line);
  background: rgba(6, 24, 52, 0.9);
  color: var(--text);
}

.match-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #68758a;
  font-size: 14px;
  font-weight: 800;
}

.dark .match-meta {
  color: #b8c6dd;
}

.teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  text-align: center;
}

.team-flag {
  display: grid;
  width: 74px;
  height: 48px;
  place-items: center;
  margin: 0 auto 8px;
  border: 1px solid rgba(10, 29, 61, 0.16);
  border-radius: 3px;
  background: #f5f7fb;
  font-size: 28px;
}

.team-name {
  font-weight: 900;
}

.vs {
  font-weight: 950;
  font-size: 28px;
}

.progress-stack {
  display: grid;
  gap: 8px;
}

.share-row {
  display: grid;
  grid-template-columns: 82px 1fr 48px;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.bar {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(132, 150, 178, 0.28);
}

.bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.blue {
  color: var(--blue);
}

.red {
  color: var(--red);
}

.green {
  color: var(--green);
}

.rule-list {
  padding: 0;
  margin: 0;
  list-style: none;
}

.rule-list li {
  position: relative;
  padding: 8px 0 8px 28px;
  color: #e4ecfa;
}

.rule-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: inset 0 0 0 4px rgba(4, 34, 20, 0.28);
}

.compact-list li {
  font-size: 15px;
}

.leader-mini {
  display: grid;
  gap: 12px;
}

.leader-mini-row,
.record-row {
  display: grid;
  align-items: center;
  gap: 12px;
}

.leader-mini-row {
  grid-template-columns: 32px 38px 1fr auto;
}

.rank-badge {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  color: #072044;
  background: #e9eef7;
  font-weight: 900;
}

.rank-badge.top1 {
  background: var(--gold);
}

.rank-badge.top2 {
  background: #dbe6ff;
}

.rank-badge.top3 {
  background: #ffb66b;
}

.focus-match {
  min-height: 520px;
  padding: 0;
  overflow: hidden;
}

.focus-head {
  position: relative;
  padding: 30px 36px 22px;
  background-image: linear-gradient(rgba(3, 12, 30, 0.42), rgba(3, 12, 30, 0.84)), url("./assets/hero-stadium.png");
  background-size: cover;
  background-position: center;
}

.focus-head-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #dbe7fb;
}

.badge {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border-radius: 999px;
  padding: 0 14px;
  color: var(--green);
  background: rgba(54, 232, 80, 0.13);
  border: 1px solid rgba(104, 233, 78, 0.28);
  font-weight: 900;
}

.countdown {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 900;
}

.countdown strong {
  min-width: 38px;
  padding: 5px 6px;
  border-radius: 7px;
  color: var(--green);
  background: rgba(0, 0, 0, 0.34);
  text-align: center;
}

.focus-teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  margin: 24px auto 0;
  max-width: 680px;
  text-align: center;
}

.focus-teams .team-flag {
  width: 102px;
  height: 66px;
  font-size: 38px;
}

.focus-teams .team-name {
  font-size: 28px;
}

.focus-body {
  padding: 24px 36px 32px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 22px;
}

.choice-button {
  min-height: 102px;
  border: 2px solid rgba(172, 194, 230, 0.34);
  border-radius: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  font-weight: 900;
}

.choice-button.is-selected {
  border-color: var(--blue);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(242, 247, 255, 0.96));
  color: #0c2d70;
}

.choice-button span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 700;
}

.choice-button.is-selected span {
  color: #5d6b80;
}

.bet-panel {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 20px;
  align-items: end;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
}

.input-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.input-row input,
.search-box input,
.modal input,
.select-control {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(171, 193, 226, 0.35);
  border-radius: 8px;
  color: inherit;
  background: rgba(255, 255, 255, 0.08);
  padding: 0 14px;
}

.quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.quick-row button,
.segmented button {
  min-height: 38px;
  border: 1px solid rgba(171, 193, 226, 0.28);
  border-radius: 999px;
  color: inherit;
  background: rgba(255, 255, 255, 0.08);
  padding: 0 16px;
  font-weight: 800;
}

.quick-row button:hover,
.segmented button.is-active {
  color: white;
  background: linear-gradient(180deg, #43dd64, #0a9a47);
  border-color: transparent;
}

.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.estimate {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.estimate-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.06);
}

.estimate-card span {
  color: var(--muted);
  font-size: 14px;
}

.estimate-card strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.side-stack {
  display: grid;
  gap: 20px;
  align-content: start;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.info-grid .stat {
  border: 0;
}

.info-grid .stat:nth-child(2n) {
  border-left: 1px solid var(--line);
}

.info-grid .stat:nth-child(n + 3) {
  border-top: 1px solid var(--line);
}

.match-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 14px;
}

.mini-match {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  border: 1px solid rgba(12, 33, 66, 0.12);
  border-radius: 12px;
  background: white;
  padding: 14px 16px;
}

.mini-match button {
  min-width: 92px;
  min-height: 42px;
  border: 1px solid rgba(255, 75, 69, 0.42);
  border-radius: 999px;
  color: var(--red);
  background: white;
  font-weight: 900;
}

.leader-table {
  overflow: hidden;
  border: 1px solid rgba(12, 33, 66, 0.1);
  border-radius: 12px;
}

.leader-row {
  display: grid;
  grid-template-columns: 74px 1.6fr 1fr 1fr 1fr;
  align-items: center;
  min-height: 58px;
  padding: 0 18px;
  color: var(--ink);
  background: white;
}

.leader-row.header {
  min-height: 48px;
  color: #6f7a8e;
  background: #f1f5fb;
  font-weight: 800;
}

.leader-row + .leader-row {
  border-top: 1px solid rgba(12, 33, 66, 0.09);
}

.leader-row.mine {
  background: linear-gradient(90deg, rgba(104, 233, 78, 0.18), rgba(255, 255, 255, 0.96));
  outline: 1px solid rgba(104, 233, 78, 0.28);
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
}

.user-cell .avatar {
  width: 34px;
  height: 34px;
  font-size: 14px;
}

.toolbar {
  flex-wrap: wrap;
}

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

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #6b778a;
}

.search-box input,
.select-control {
  color: var(--ink);
  background: white;
}

.number-list {
  margin: 0;
  padding-left: 24px;
}

.number-list li {
  margin: 12px 0;
}

.rank-progress {
  height: 12px;
  margin: 18px 0 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.rank-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #66e950, #0aa64d);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background-image: linear-gradient(90deg, rgba(8, 30, 64, 0.92), rgba(8, 30, 64, 0.7)), url("./assets/hero-stadium.png");
  background-size: cover;
  box-shadow: var(--shadow);
}

.records-list {
  display: grid;
  gap: 10px;
}

.record-row {
  grid-template-columns: 1.5fr 1fr 1fr 0.8fr 1fr auto;
  min-height: 76px;
  border: 1px solid rgba(12, 33, 66, 0.1);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  padding: 12px 16px;
}

.status-pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  padding: 0 10px;
  color: #087938;
  background: rgba(22, 185, 83, 0.14);
  font-weight: 900;
}

.status-pill.locked {
  color: #176ed9;
  background: rgba(31, 120, 255, 0.14);
}

.status-pill.pending {
  color: #657184;
  background: rgba(101, 113, 132, 0.14);
}

.detail-link {
  border: 0;
  color: inherit;
  background: transparent;
  font-size: 24px;
}

.chart-card {
  min-height: 190px;
}

.chart-card svg {
  width: 100%;
  height: auto;
}

.gain {
  color: var(--green);
  font-weight: 900;
}

.rules-panel {
  color: var(--ink);
  background: rgba(248, 251, 255, 0.96);
}

.rules-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 28px;
  align-items: center;
  margin-bottom: 24px;
  padding: 28px;
  overflow: hidden;
  border-radius: 14px;
  color: var(--text);
  background:
    radial-gradient(circle at 88% 20%, rgba(255, 216, 73, 0.2), transparent 16rem),
    linear-gradient(135deg, rgba(8, 30, 64, 0.98), rgba(6, 19, 42, 0.94)),
    url("./assets/hero-stadium.png");
  background-size: cover;
  background-position: center;
}

.rules-title-block .section-kicker {
  color: var(--green);
  margin-bottom: 10px;
}

.rules-title-block h2 {
  margin: 0;
  font-size: clamp(28px, 3vw, 44px);
  line-height: 1.14;
}

.rules-title-block p {
  max-width: 680px;
  margin: 12px 0 0;
  color: #dbe7fb;
  line-height: 1.75;
}

.prize-badge {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 148px;
  border: 1px solid rgba(255, 216, 73, 0.42);
  border-radius: 18px;
  color: #492a00;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), transparent 42%),
    linear-gradient(145deg, #ffe98a, #ffb43a 54%, #f46d2b);
  box-shadow: 0 18px 40px rgba(255, 151, 34, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.66);
  text-align: center;
  animation: prizeFloat 3.4s ease-in-out infinite;
}

.prize-badge::before,
.prize-badge::after {
  content: "";
  position: absolute;
  bottom: -18px;
  width: 44px;
  height: 44px;
  background: #ef3d36;
  clip-path: polygon(0 0, 100% 0, 78% 100%, 50% 70%, 22% 100%);
}

.prize-badge::before {
  left: 38px;
}

.prize-badge::after {
  right: 38px;
}

.prize-badge span {
  font-size: 30px;
  font-weight: 950;
}

.prize-badge strong {
  display: block;
  margin-top: -18px;
  color: #7b220b;
  font-size: 15px;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.rules-grid article {
  min-height: 178px;
  border: 1px solid rgba(12, 33, 66, 0.1);
  border-radius: 12px;
  background: white;
  padding: 20px;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.rules-grid article:hover {
  transform: translateY(-3px);
  border-color: rgba(18, 168, 77, 0.24);
  box-shadow: 0 16px 34px rgba(8, 24, 56, 0.1);
}

.rules-grid h3 {
  margin: 0 0 10px;
}

.rules-grid p {
  margin: 0;
  color: #526076;
  line-height: 1.75;
}

.mobile-tabs {
  display: none;
}

.modal {
  width: min(520px, calc(100vw - 36px));
  border: 0;
  border-radius: 18px;
  padding: 0;
  color: var(--text);
  background: transparent;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(8px);
}

.modal-card {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(13, 43, 82, 0.98), rgba(6, 19, 42, 0.98));
  padding: 26px;
}

.modal-card h2 {
  margin: 0;
}

.modal-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.modal-card label {
  display: grid;
  gap: 8px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.ghost-button {
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 22px;
}

.detail-grid {
  display: grid;
  gap: 10px;
}

.detail-grid div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.disabled {
  opacity: 0.55;
  pointer-events: none;
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .desktop-nav {
    display: none;
  }

  .hero-copy {
    width: 100%;
    padding-right: 42%;
    text-align: left;
  }

  .home-grid,
  .page-grid {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 760px) {
  body {
    background: linear-gradient(180deg, #020816 0%, #061a38 54%, #07152a 100%);
  }

  .app-shell {
    padding-bottom: 92px;
  }

  .topbar {
    min-height: 74px;
    padding: 0 16px;
  }

  .brand {
    gap: 8px;
    font-size: 22px;
  }

  .brand-cup {
    font-size: 24px;
  }

  .icon-button {
    display: none;
  }

  .profile-button span:not(.avatar) {
    max-width: 86px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  main {
    width: calc(100vw - 24px);
    margin: 12px auto 18px;
  }

  .hero-panel {
    min-height: 260px;
    border-radius: 14px;
  }

  .hero-panel.slim {
    min-height: 240px;
  }

  .hero-copy {
    width: 100%;
    padding: 26px 20px 120px;
    text-align: center;
  }

  .hero-copy h1 {
    font-size: 32px;
  }

  .koi-title {
    max-width: 100%;
  }

  .eyebrow {
    font-size: 15px;
  }

  .hero-copy .primary-cta {
    min-width: 180px;
    min-height: 52px;
    font-size: 20px;
  }

  .hero-stats {
    left: 14px;
    right: 14px;
    top: auto;
    bottom: 14px;
    width: auto;
    grid-template-columns: repeat(4, 1fr);
  }

  .stat {
    padding: 14px 6px;
  }

  .stat span {
    font-size: 12px;
  }

  .stat strong {
    font-size: 22px;
  }

  .home-grid,
  .page-grid {
    margin-top: 12px;
    gap: 12px;
  }

  .panel {
    border-radius: 13px;
    padding: 16px;
  }

  .panel-heading,
  .toolbar {
    align-items: flex-start;
  }

  .panel-heading h2 {
    font-size: 19px;
  }

  .match-grid,
  .match-list,
  .side-stack,
  .rules-grid {
    grid-template-columns: 1fr;
  }

  .focus-head {
    padding: 18px 16px;
  }

  .focus-head-top {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 8px;
    font-size: 15px;
  }

  .focus-head-top > span:first-child {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .focus-head-top .badge {
    flex: 0 0 auto;
    min-height: 28px;
    padding: 0 12px;
    font-size: 15px;
  }

  .countdown {
    justify-content: flex-start;
    gap: 4px;
    white-space: nowrap;
    font-size: 14px;
  }

  .countdown strong {
    min-width: 30px;
    padding: 4px 5px;
    font-size: 16px;
  }

  .focus-teams {
    gap: 10px;
  }

  .focus-teams .team-flag {
    width: 84px;
    height: 54px;
    font-size: 32px;
  }

  .focus-teams .team-name {
    font-size: 22px;
  }

  .focus-body {
    padding: 16px;
  }

  .choice-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .choice-button {
    min-height: 72px;
    text-align: left;
    padding: 0 18px;
  }

  .bet-panel {
    grid-template-columns: 1fr;
    position: sticky;
    bottom: 92px;
    z-index: 10;
    background: rgba(7, 25, 54, 0.96);
    backdrop-filter: blur(12px);
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .estimate {
    grid-template-columns: 1fr;
  }

  .mini-match {
    grid-template-columns: 1fr;
  }

  .leader-row {
    grid-template-columns: 48px 1.4fr 0.9fr 0.9fr;
    padding: 0 10px;
    font-size: 13px;
  }

  .leader-row span:nth-child(5) {
    display: none;
  }

  .summary-strip {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 14px;
  }

  .record-row {
    grid-template-columns: 1fr 0.8fr;
    gap: 8px;
    align-items: start;
  }

  .record-row > span:nth-child(3),
  .record-row > span:nth-child(4) {
    color: #6b778a;
  }

  .rules-grid article {
    min-height: auto;
  }

  .rules-hero {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 22px;
  }

  .prize-badge {
    min-height: 118px;
  }

  .prize-badge span {
    font-size: 26px;
  }

  .mobile-tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    min-height: 78px;
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: rgba(4, 15, 34, 0.94);
    backdrop-filter: blur(18px);
  }

  .mobile-tabs button {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 5px;
    border: 0;
    color: #b7c1d0;
    background: transparent;
    font-size: 12px;
  }

  .mobile-tabs button span {
    font-size: 24px;
  }

  .mobile-tabs button.is-active {
    color: var(--green);
    background: linear-gradient(180deg, rgba(104, 233, 78, 0.08), rgba(104, 233, 78, 0.16));
  }
}

@media (max-width: 420px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .brand {
    font-size: 18px;
  }

  .avatar {
    width: 34px;
    height: 34px;
  }

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

  .hero-panel {
    min-height: 360px;
  }

  .hero-copy {
    padding-bottom: 170px;
  }
}

/* Motion layer */
.view.is-active {
  animation: viewIn 320ms ease both;
}

.hero-panel img {
  animation: stadiumDrift 18s ease-in-out infinite alternate;
}

.hero-panel::after {
  z-index: 0;
}

.hero-panel::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: -40% auto -40% -34%;
  width: 38%;
  transform: rotate(18deg);
  background: linear-gradient(90deg, transparent, rgba(126, 255, 91, 0.18), transparent);
  animation: fieldSweep 6.8s ease-in-out infinite;
  pointer-events: none;
}

.hero-copy,
.hero-stats {
  z-index: 2;
}

.primary-cta,
.choice-button,
.quick-row button,
.segmented button,
.mobile-tabs button {
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease, background 180ms ease, border-color 180ms ease;
}

.primary-cta:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34), 0 16px 34px rgba(24, 202, 87, 0.34);
}

.hero-copy .primary-cta {
  animation: ctaBreath 2.6s ease-in-out infinite;
}

.match-card,
.mini-match {
  animation: cardIn 420ms ease both;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.match-card:hover,
.mini-match:hover,
.leader-row:hover,
.record-row:hover {
  transform: translateY(-2px);
}

.bar > span,
.rank-progress span {
  transform-origin: left center;
  animation: barGrow 720ms ease both;
}

.stat strong {
  animation: numberPop 460ms ease both;
}

.countdown strong {
  animation: flipTick 1s ease-in-out infinite;
}

.choice-button.is-selected {
  transform: translateY(-3px);
  box-shadow: 0 0 0 4px rgba(31, 120, 255, 0.12), 0 14px 30px rgba(31, 120, 255, 0.2);
  animation: selectedPulse 420ms ease both;
}

.quick-row button:active,
.segmented button:active,
.mobile-tabs button:active {
  transform: scale(0.96);
}

.estimate-card {
  animation: estimatePulse 360ms ease both;
}

.leader-row,
.record-row {
  animation: rowIn 360ms ease both;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.leader-row.mine {
  position: relative;
  overflow: hidden;
}

.leader-row.mine::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 -40%;
  width: 30%;
  background: linear-gradient(90deg, transparent, rgba(104, 233, 78, 0.25), transparent);
  animation: mineSweep 2.8s ease-out 1;
}

.status-pill {
  animation: labelGlow 1.8s ease-in-out infinite;
}

.modal-card {
  animation: modalIn 220ms ease both;
}

.mobile-tabs button.is-active span {
  animation: tabPop 360ms ease both;
}

.input-error {
  border-color: var(--red) !important;
  animation: shake 260ms ease;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 102px;
  z-index: 60;
  min-width: 220px;
  max-width: min(420px, calc(100vw - 32px));
  transform: translate(-50%, 24px);
  border: 1px solid rgba(104, 233, 78, 0.3);
  border-radius: 14px;
  color: var(--text);
  background: rgba(8, 30, 64, 0.94);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  padding: 14px 18px;
  text-align: center;
  font-weight: 900;
  backdrop-filter: blur(14px);
  transition: transform 220ms ease, opacity 220ms ease;
}

.toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes stadiumDrift {
  from {
    transform: scale(1.02) translate3d(-0.8%, 0, 0);
  }
  to {
    transform: scale(1.08) translate3d(0.8%, -0.6%, 0);
  }
}

@keyframes fieldSweep {
  0%,
  24% {
    transform: translateX(0) rotate(18deg);
    opacity: 0;
  }
  44% {
    opacity: 1;
  }
  70%,
  100% {
    transform: translateX(420%) rotate(18deg);
    opacity: 0;
  }
}

@keyframes ctaBreath {
  0%,
  100% {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34), 0 12px 28px rgba(24, 202, 87, 0.28);
  }
  50% {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34), 0 18px 44px rgba(104, 233, 78, 0.42);
  }
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes rowIn {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes barGrow {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes selectedPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(31, 120, 255, 0.28);
  }
  100% {
    box-shadow: 0 0 0 4px rgba(31, 120, 255, 0.12), 0 14px 30px rgba(31, 120, 255, 0.2);
  }
}

@keyframes estimatePulse {
  from {
    transform: scale(0.985);
    border-color: rgba(104, 233, 78, 0.42);
  }
  to {
    transform: scale(1);
  }
}

@keyframes numberPop {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes flipTick {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-1px);
  }
}

@keyframes mineSweep {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(520%);
  }
}

@keyframes labelGlow {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.16);
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes tabPop {
  0% {
    transform: scale(0.92);
  }
  60% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

@keyframes titleShine {
  0%,
  38% {
    transform: translateX(-120%) skewX(-18deg);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  68%,
  100% {
    transform: translateX(120%) skewX(-18deg);
    opacity: 0;
  }
}

@keyframes prizeFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
