:root {
  --bg-dark: #0d3f63;
  --bg-deeper: #0a2f4d;
  --panel: #134b70;
  --line: #4eb2d8;
  --text: #eef8ff;
  --soft: #cfefff;
  --gold-a: #ffd978;
  --gold-b: #ffb84d;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background: #ffffff;
  color: var(--text);
}

.phone-shell {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 8px 14px;
  background: linear-gradient(180deg, #18537d 0%, #103f63 100%);
  overflow-x: clip;
}

@media (min-width: 768px) {
  .phone-shell {
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
  }
}

.main-card,
.rank-card {
  background: linear-gradient(180deg, #1a5f8c 0%, #124a71 100%);
  border-radius: 16px;
  border: 1px solid #3ca1cf;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.hero {
  position: relative;
  margin: -1px -8px 8px;
  height: 470px;
  padding: 62px 12px 10px;
  background: url("../images/top.png") center top / cover no-repeat;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  overflow: hidden;
}

.hero::after {
  display: none;
}

.rule-btn {
  position: absolute;
  top: 48px;
  right: 0;
  z-index: 2;
  border: none;
  background: linear-gradient(180deg, #ffd883, #ffaf3b);
  color: #2f2f2f;
  font-size: 12px;
  border-radius: 2px;
  height: 26px;
  padding: 0 8px;
}

.hero-title,
.hero-time {
  position: relative;
  z-index: 1;
  display: block;
  margin: 0 auto;
}

.hero-title {
  width: 82%;
  max-width: 332px;
}

.hero-time {
  width: 52%;
  max-width: 210px;
  margin-top: 6px;
}

.prize-strip {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 18px;
  position: absolute;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  background: linear-gradient(90deg, #7dd3fc 0%, #5eead4 100%);
  border-radius: 999px;
  padding: 8px 10px 8px 0;
  margin-bottom: 0;
  z-index: 2;
  overflow: visible;
}

.mascot {
  width: 72px;
  height: 88px;
  object-fit: contain;
  align-self: end;
  margin-top: -30px;
  margin-left: 2px;
}

.prize-texts {
  min-width: 0;
}

.prize-texts .prize-main-text {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 3px;
  color: #1f2d33;
  font-size: 19px;
  line-height: 1;
  font-weight: 900;
  white-space: nowrap;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
}

.prize-highlight {
  width: 106px;
  height: auto;
  display: inline-block;
  flex-shrink: 1;
  min-width: 0;
}

.prize-texts p {
  margin: 0;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}

.go-btn {
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, #1f2d33, #0f1a20);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  height: 40px;
  padding: 0 12px;
  white-space: nowrap;
}

.predict-title {
  margin: 0 0 8px;
  background: linear-gradient(180deg, #15547c, #103f63);
  color: #ffe8a3;
  text-align: center;
  font-size: 24px;
  border-radius: 10px 10px 0 0;
  padding: 8px 6px 6px;
  letter-spacing: 1px;
}

.main-card {
  padding: 12px;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.duel {
  display: grid;
  grid-template-columns: 1fr 64px 1fr;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.team-card {
  background: linear-gradient(180deg, #1c6594 0%, #145379 100%);
  border: 1px solid #69b7dc;
  border-radius: 10px;
  padding: 8px 6px 6px;
  text-align: center;
  position: relative;
}

.team-card.selectable {
  cursor: pointer;
}

.team-card.selectable.active {
  border-color: #c2ecff;
  box-shadow: 0 0 0 2px rgba(194, 236, 255, 0.35) inset;
}

.team-card h2 {
  margin: 6px 0 0;
  font-size: 17px;
  font-weight: 700;
}

.badge {
  position: absolute;
  top: -8px;
  right: 6px;
  font-size: 12px;
  color: #11324b;
  border-radius: 10px;
  padding: 1px 7px;
  font-weight: 700;
}

.badge-champion {
  background: linear-gradient(180deg, #fef3c7 0%, #fbbf24 100%);
}

.badge-runner {
  background: linear-gradient(180deg, #dbeafe 0%, #7dd3fc 100%);
}

.flag {
  width: 78px;
  height: 48px;
  margin: 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.5);
  overflow: hidden;
  background: transparent;
}

.flag img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.team-card:not(.waiting) .flag {
  background: #fff;
}

.team-card.waiting .flag img {
  object-fit: contain;
  padding: 8px;
}

.team-card.waiting h2 {
  color: #e6ffb7;
}

.vs {
  text-align: center;
}

.vs img {
  width: 62px;
  height: auto;
  display: inline-block;
}

.groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 8px;
}

.group {
  min-width: 0;
}

.group h3 {
  margin: 2px 0 4px;
  font-size: 14px;
  color: #d8f0ff;
}

.team-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  border: 1px solid #6bc0e7;
  border-radius: 2px;
  background: #ffffff;
  color: #333;
  margin-bottom: 4px;
  padding: 2px 4px;
  font-size: 12px;
}

.team-left {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.mini-flag {
  width: 20px;
  height: 13px;
  border: 1px solid #ddd;
  flex-shrink: 0;
  object-fit: cover;
  display: block;
  background: #fff;
}

.team-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-option input {
  accent-color: #ea3f8a;
  width: 14px;
  height: 14px;
  margin: 0;
  display: none;
}

.pick-mark {
  width: 15px;
  height: 15px;
  border: 1px solid #666;
  border-radius: 50%;
  background: #fff;
  position: relative;
  flex-shrink: 0;
}

.pick-mark::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: transparent;
}

.team-option.is-selected .pick-mark {
  border-color: #e4498d;
}

.team-option.is-selected .pick-mark::after {
  background: #e4498d;
}

.team-option.is-selected {
  border: 2px solid #e53935;
  padding: 1px 3px;
}

.team-option.selected-champion {
  box-shadow: inset 0 0 0 1px rgba(255, 214, 122, 0.65);
}

.team-option.selected-runner {
  box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.7);
}

.team-option.locked {
  opacity: 0.55;
}

.tip {
  text-align: center;
  color: #dff4ff;
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 700;
}

.rank-card {
  margin-top: 10px;
  overflow: hidden;
}

.rank-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.tab {
  border: none;
  font-size: 16px;
  font-style: italic;
  font-weight: 900;
  padding: 8px 0 7px;
  color: #7dd3fc;
  background: linear-gradient(180deg, #18557d, #124365);
}

.tab.active {
  color: #fff4cf;
  background: linear-gradient(180deg, #3d8fbf, #226d9b);
  border-radius: 16px 0 16px 0;
}

.rank-content {
  min-height: 128px;
  padding: 8px 10px 4px;
}

.rank-empty {
  min-height: 128px;
  display: grid;
  place-items: center;
  font-size: 22px;
  color: #dff4ff;
}

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

.rank-row {
  display: grid;
  grid-template-columns: 34px 42px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border-bottom: 1px solid rgba(117, 194, 228, 0.22);
}

.rank-row:last-child {
  border-bottom: none;
}

.rank-no {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
}

.rank-no.rank-1 {
  background: linear-gradient(180deg, #ffdc66, #e39c09);
  color: #523100;
}

.rank-no.rank-2 {
  background: linear-gradient(180deg, #d9e2ef, #8c9fb7);
}

.rank-no.rank-3 {
  background: linear-gradient(180deg, #f7bd95, #c6783f);
}

.rank-no.rank-4 {
  background: linear-gradient(180deg, #62d56c, #249f4d);
}

.rank-no.rank-5 {
  background: linear-gradient(180deg, #43c8f2, #1189cb);
}

.rank-no.rank-6 {
  background: linear-gradient(180deg, #8db3ff, #4f72e6);
}

.rank-no.rank-7 {
  background: linear-gradient(180deg, #b797ff, #7a57dd);
}

.rank-no.rank-8 {
  background: linear-gradient(180deg, #ff9fd6, #d565ab);
}

.rank-no.rank-9 {
  background: linear-gradient(180deg, #ff9f8f, #db5d4a);
}

.rank-no.rank-10 {
  background: linear-gradient(180deg, #8ad6c7, #3da48f);
}

.rank-flag {
  width: 36px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  object-fit: cover;
  background: #fff;
}

.rank-country {
  font-size: 15px;
  font-weight: 700;
  color: #e8f5ff;
}

.rank-votes {
  font-size: 14px;
  color: #ffe2a8;
  white-space: nowrap;
}

.rank-votes strong {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0.4px;
  font-weight: 500;
}

@media (max-width: 460px) {
  .rank-country {
    font-size: 14px;
  }

  .rank-votes {
    font-size: 13px;
  }
}

.rank-tip {
  margin: 0 0 12px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
  margin-top: 10px;
}

.btn {
  border: none;
  border-radius: 999px;
  height: 48px;
  font-size: 16px;
  font-weight: 800;
}

.btn-light {
  background: linear-gradient(180deg, #f5f9ff, #dceaf7);
  color: #213547;
}

.btn-gold {
  background: linear-gradient(180deg, var(--gold-a), var(--gold-b));
  color: #3d2b00;
}

.copyright {
  margin: 10px 0 0;
  text-align: center;
  color: #cde8fa;
  font-size: 11px;
}

.rule-modal {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: none;
}

.rule-modal.show {
  display: block;
}

.rule-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.rule-dialog {
  position: absolute;
  left: 50%;
  top: 52%;
  transform: translate(-50%, -50%);
  width: min(88vw, 410px);
  background: #ffffff;
  border-radius: 16px;
  padding: 16px 16px 18px;
  color: #111;
}

.rule-dialog h3 {
  margin: 0 0 10px;
  text-align: center;
  font-size: 18px;
}

.rule-dialog p {
  margin: 0 0 8px;
  font-size: 15px;
  line-height: 1.45;
}

.rule-close {
  position: absolute;
  right: 12px;
  top: 8px;
  border: none;
  background: transparent;
  font-size: 34px;
  line-height: 1;
  color: #111;
}

.vote-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
}

.vote-modal.show {
  display: block;
}

.vote-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.vote-dialog {
  position: absolute;
  left: 50%;
  top: 52%;
  transform: translate(-50%, -50%);
  width: min(88vw, 360px);
  background: #ffffff;
  border-radius: 14px;
  padding: 14px 16px 16px;
}

.vote-close {
  position: absolute;
  right: 10px;
  top: 6px;
  border: none;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  color: #222;
}

.vote-dialog h3 {
  margin: 0 0 10px;
  text-align: center;
  font-size: 18px;
  color: #1a1a1a;
}

.vote-input {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 8px;
  background: #f1f2f6;
  padding: 0 12px;
  font-size: 16px;
  color: #333;
}

.vote-input::placeholder {
  color: #b3b5bf;
  font-size: 16px;
}

.vote-submit {
  width: 100%;
  height: 48px;
  margin-top: 12px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffd647, #ffbb00);
  color: #332100;
  font-size: 16px;
  font-weight: 800;
}

.my-vote-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
}

.my-vote-modal.show {
  display: block;
}

.my-vote-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.my-vote-dialog {
  position: absolute;
  left: 50%;
  top: 52%;
  transform: translate(-50%, -50%);
  width: min(86vw, 360px);
  background: #ffffff;
  border-radius: 14px;
  padding: 12px 12px 14px;
}

.my-vote-dialog h3 {
  margin: 0 0 10px;
  text-align: center;
  color: #161616;
  font-size: 18px;
}

.my-vote-picks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.my-vote-team {
  background: linear-gradient(180deg, #1b6695, #13527a);
  border: 1px solid #69b7dc;
  border-radius: 8px;
  padding: 10px 8px 6px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.my-vote-flag-wrap {
  width: 100%;
  aspect-ratio: 1.5 / 1;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: #fff;
  overflow: hidden;
}

.my-vote-flag {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.my-vote-meta {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.my-vote-badge {
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 12px;
  font-weight: 700;
  color: #044123;
}

.my-vote-badge.champion {
  background: linear-gradient(180deg, #e8f489, #b9d54e);
}

.my-vote-badge.runner {
  background: linear-gradient(180deg, #9de5ff, #63bfd8);
}

.my-vote-name {
  color: #eaf6ff;
  font-size: 15px;
  font-weight: 700;
}

.my-vote-confirm {
  width: 100%;
  height: 44px;
  margin-top: 10px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffd647, #ffbb00);
  color: #332100;
  font-size: 15px;
  font-weight: 800;
}

.toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  max-width: min(88vw, 360px);
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(25, 25, 25, 0.88);
  color: #fff;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  z-index: 120;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

@media (max-width: 380px) {
  .team-card h2 {
    font-size: 17px;
  }

  .flag {
    width: 78px;
    height: 48px;
  }

  .group h3 {
    font-size: 14px;
  }

  .team-option {
    font-size: 11px;
  }

  .prize-strip {
    grid-template-columns: 56px minmax(0, 1fr) auto;
    gap: 5px;
    padding-right: 8px;
  }

  .mascot {
    width: 62px;
    height: 78px;
    margin-top: -24px;
  }

  .prize-texts .prize-main-text {
    font-size: 16px;
  }

  .prize-highlight {
    width: 92px;
  }

  .go-btn {
    font-size: 13px;
    height: 36px;
    padding: 0 10px;
  }

  .vote-dialog h3 {
    font-size: 17px;
  }

  .vote-input {
    font-size: 16px;
  }

  .vote-submit {
    font-size: 15px;
  }

  .my-vote-dialog h3 {
    font-size: 17px;
  }
}
