:root {
  color-scheme: dark;
  --bg: #08111f;
  --panel: #0f1c2d;
  --line: rgba(255, 255, 255, 0.12);
  --text: #f8fafc;
  --muted: #9fb0c8;
  --accent: #2dd4bf;
  --danger: #fb7185;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 50% 0%, #132942 0, var(--bg) 42rem);
  color: var(--text);
  font-family: Arial, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

button {
  font: inherit;
}

.shell {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 92px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(34px, 9vw, 68px);
  line-height: 0.95;
  letter-spacing: 0;
}

.subtitle {
  margin-bottom: 6px;
  color: #dbeafe;
  font-size: 18px;
  font-weight: 700;
}

.privacy-note {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.check-button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 20px;
  background: var(--accent);
  color: #031016;
  cursor: pointer;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 16px 40px rgba(45, 212, 191, 0.25);
}

.check-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.boost-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 0.6fr);
  gap: 12px;
  border: 1px solid rgba(45, 212, 191, 0.26);
  border-radius: 8px;
  margin-bottom: 14px;
  padding: 14px;
  background:
    linear-gradient(135deg, rgba(45, 212, 191, 0.12), rgba(59, 130, 246, 0.07)),
    rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 0 32px rgba(45, 212, 191, 0.06);
}

.boost-kicker {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.boost-copy strong {
  display: block;
  margin-bottom: 6px;
  font-size: 20px;
}

.boost-copy span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

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

.boost-stats span {
  display: grid;
  align-content: center;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(8, 17, 31, 0.42);
}

.boost-stats b {
  display: block;
  overflow: hidden;
  color: #fff;
  font-size: 19px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.boost-stats small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.boost-panel.boost-success {
  border-color: rgba(34, 197, 94, 0.45);
}

.boost-panel.boost-waiting {
  border-color: rgba(245, 158, 11, 0.45);
}

.league-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.league-kicker {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.league-bar strong {
  display: block;
  font-size: 18px;
}

.league-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.league-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}

.league-button.active {
  border-color: color-mix(in srgb, var(--color) 70%, #fff);
  background: color-mix(in srgb, var(--color) 38%, rgba(255, 255, 255, 0.08));
}

.map-section {
  position: relative;
}

.map {
  position: relative;
  min-height: 56vw;
  max-height: 660px;
  height: 620px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #0b1f35 0%, #0a1728 100%);
}

.map-grid {
  position: absolute;
  inset: 0;
  opacity: 0.26;
  background-image:
    linear-gradient(rgba(255,255,255,0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.12) 1px, transparent 1px);
  background-size: 10% 20%;
}

.continents span {
  position: absolute;
  display: block;
  background: rgba(105, 126, 153, 0.28);
  filter: blur(0.2px);
}

.territories {
  position: absolute;
  inset: 0;
  overflow: hidden;
  filter: saturate(1.08);
}

.territory-paint {
  position: absolute;
  width: var(--spread);
  height: var(--spread);
  border-radius: 47% 53% 46% 54%;
  background:
    radial-gradient(circle at 38% 34%,
      color-mix(in srgb, var(--color) 92%, #fff) 0%,
      color-mix(in srgb, var(--color) 74%, transparent) 32%,
      color-mix(in srgb, var(--color) 42%, transparent) 55%,
      transparent 76%);
  filter: blur(18px);
  mix-blend-mode: screen;
  opacity: var(--alpha);
  transform: translate(-50%, -50%) rotate(-8deg) scaleX(1.28);
  pointer-events: none;
}

.territory-cell {
  position: absolute;
  display: block;
  background:
    radial-gradient(circle at 45% 40%, color-mix(in srgb, var(--color) 52%, transparent), transparent 67%),
    color-mix(in srgb, var(--color) 34%, transparent);
  border-radius: 18px;
  filter: blur(5px);
  transform: scale(1.35);
  pointer-events: none;
}

.north-america {
  left: 8%;
  top: 22%;
  width: 26%;
  height: 24%;
  border-radius: 52% 45% 50% 40%;
  transform: rotate(-12deg);
}

.south-america {
  left: 28%;
  top: 52%;
  width: 11%;
  height: 31%;
  border-radius: 45% 55% 48% 60%;
  transform: rotate(18deg);
}

.europe {
  left: 47%;
  top: 27%;
  width: 12%;
  height: 13%;
  border-radius: 50%;
}

.africa {
  left: 48%;
  top: 42%;
  width: 15%;
  height: 28%;
  border-radius: 48% 52% 55% 45%;
  transform: rotate(-8deg);
}

.asia {
  left: 57%;
  top: 24%;
  width: 31%;
  height: 28%;
  border-radius: 48% 55% 45% 50%;
  transform: rotate(5deg);
}

.australia {
  left: 76%;
  top: 67%;
  width: 13%;
  height: 10%;
  border-radius: 50%;
  transform: rotate(8deg);
}

.bubbles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.bubble {
  position: absolute;
  width: var(--size);
  height: var(--size);
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 999px;
  background: color-mix(in srgb, var(--color) 52%, rgba(8, 17, 31, 0.32));
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: clamp(10px, calc(var(--size) / 4.5), 13px);
  font-weight: 800;
  text-align: center;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 18px color-mix(in srgb, var(--color) 45%, transparent);
  animation: none;
  pointer-events: auto;
}

.bubble.pop {
  animation: pop 520ms ease-out, pulse 2.8s ease-in-out 520ms infinite;
}

.bubble-card {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  min-width: 150px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(6, 14, 26, 0.94);
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(4px);
  transition: 150ms ease;
  font-size: 12px;
  text-align: left;
}

.bubble:hover .bubble-card,
.bubble:focus .bubble-card {
  opacity: 1;
  transform: translateX(-50%);
}

.bubble-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.empty-state {
  position: absolute;
  inset: auto 20px 20px;
  color: var(--muted);
  text-align: center;
}

.empty-state.hidden {
  display: none;
}

.viral-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(240px, 0.75fr);
  gap: 12px;
  margin-top: 14px;
}

.share-card,
.challenge-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  padding: 14px;
}

.share-kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.share-card h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.share-description,
.challenge-card span {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.share-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.secondary-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}

.secondary-button:hover {
  background: rgba(255, 255, 255, 0.14);
}

.challenge-card strong {
  display: block;
  margin-bottom: 7px;
  font-size: 18px;
}

.bubble.highlight {
  outline: 3px solid #fff;
  box-shadow:
    0 0 0 8px rgba(255, 255, 255, 0.12),
    0 0 32px color-mix(in srgb, var(--color) 70%, transparent);
  animation: pop 620ms ease-out;
}

.ranking-list li.rank-highlight {
  border-color: rgba(255, 255, 255, 0.38);
  background: rgba(45, 212, 191, 0.1);
}

.ranking-section {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.ranking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.ranking-header h2 {
  margin: 0;
  font-size: 20px;
}

.ranking-header span {
  color: var(--accent);
  font-weight: 800;
}

.ranking-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style-position: inside;
}

.ranking-list li {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.rank-city {
  font-weight: 800;
}

.rank-score {
  float: right;
  color: var(--accent);
  font-weight: 800;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 72px;
  z-index: 10;
  max-width: calc(100% - 32px);
  border-radius: 8px;
  padding: 12px 16px;
  background: #f8fafc;
  color: #08111f;
  font-weight: 800;
  opacity: 0;
  transform: translate(-50%, 16px);
  transition: 180ms ease;
  pointer-events: none;
}

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

.side-ad {
  position: fixed;
  top: 120px;
  width: 96px;
  height: 420px;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.45);
  display: grid;
  place-items: center;
  font-weight: 800;
}

.side-ad-left {
  left: max(16px, calc((100vw - 1380px) / 2));
}

.side-ad-right {
  right: max(16px, calc((100vw - 1380px) / 2));
}

.mobile-ad {
  display: none;
}

@keyframes pulse {
  0%, 100% { scale: 1; }
  50% { scale: 1.07; }
}

@keyframes pop {
  0% { scale: 0.65; }
  70% { scale: 1.22; }
  100% { scale: 1; }
}

@media (max-width: 1320px) {
  .side-ad {
    display: none;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 20px, 1100px);
    display: flex;
    flex-direction: column;
    padding-top: 8px;
    padding-bottom: 96px;
  }

  .hero {
    display: block;
    padding: 10px 0 10px;
  }

  .subtitle,
  .privacy-note {
    font-size: 13px;
  }

  .boost-panel {
    order: 3;
    grid-template-columns: 1fr;
    margin-top: 12px;
  }

  .league-bar {
    order: 1;
    align-items: stretch;
    flex-direction: column;
    margin-bottom: 8px;
  }

  .map-section {
    order: 2;
  }

  .viral-panel {
    order: 4;
  }

  .ranking-section {
    order: 5;
  }

  .boost-copy strong {
    font-size: 16px;
  }

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

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

  h1 {
    font-size: 34px;
  }

  .check-button {
    width: 100%;
    margin-top: 18px;
  }

  .map {
    height: 54vh;
    min-height: 360px;
  }

  .ranking-list {
    grid-template-columns: 1fr;
  }

  .share-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .mobile-ad {
    display: grid;
    place-items: center;
    height: 46px;
    border: 1px dashed rgba(255, 255, 255, 0.22);
    color: rgba(255, 255, 255, 0.45);
    font-weight: 800;
  }

  .mobile-ad-bottom {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9;
    background: rgba(8, 17, 31, 0.96);
  }
}
