:root {
  --bg: #fff4f7;
  --ink: #241824;
  --muted: #7f6673;
  --pink: #ff7fb1;
  --pink-deep: #e74386;
  --blue: #1672d8;
  --blue-soft: #d9ecff;
  --cream: #fffaf0;
  --card: rgba(255, 255, 255, 0.82);
  --stroke: rgba(231, 67, 134, 0.2);
  --shadow: 0 24px 80px rgba(106, 28, 70, 0.16);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at 15% 10%, rgba(255, 190, 214, 0.8), transparent 32rem),
    radial-gradient(circle at 85% 0%, rgba(86, 169, 255, 0.24), transparent 28rem),
    linear-gradient(135deg, #fff8fb 0%, var(--bg) 44%, #edf6ff 100%);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  overflow: hidden;
}

.page {
  width: min(1220px, calc(100% - 24px));
  min-height: 100dvh;
  margin: 0 auto;
  padding: 12px 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  gap: 10px;
}

.topbar,
.top-nav,
.hero,
.stats-grid,
.section-head {
  display: flex;
}

.topbar {
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 0;
}

.brand {
  color: var(--pink-deep);
  font-family: "Baloo 2", system-ui, sans-serif;
  font-size: clamp(1.75rem, 4vw, 2.9rem);
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  text-shadow: 0 8px 24px rgba(231, 67, 134, 0.18);
}

.top-nav {
  gap: 10px;
  flex-wrap: wrap;
}

.top-nav a {
  padding: 8px 12px;
  border: 1px solid var(--stroke);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.hero {
  align-items: center;
  justify-content: space-between;
  gap: clamp(18px, 4vw, 52px);
  margin-bottom: 0;
  min-height: 0;
}

.hero-copy {
  flex: 1 1 440px;
}

.eyebrow {
  display: inline-flex;
  margin: 0 0 8px;
  padding: 6px 10px;
  border: 1px solid rgba(22, 114, 216, 0.18);
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 690px;
  font-family: "Baloo 2", system-ui, sans-serif;
  font-size: clamp(2.45rem, 6.9vw, 5.8rem);
  font-weight: 800;
  line-height: 0.86;
  letter-spacing: -0.05em;
}

.subhead {
  max-width: 620px;
  margin: 12px 0;
  color: var(--muted);
  font-size: clamp(0.92rem, 1.7vw, 1.05rem);
  font-weight: 600;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.ca-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: 100%;
  padding: 10px 14px;
  border: 1px dashed rgba(231, 67, 134, 0.55);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  backdrop-filter: blur(10px);
  font: 700 0.78rem ui-monospace, "Cascadia Code", Consolas, monospace;
}

.ca-label {
  color: var(--pink-deep);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
}

.ca-pill-addr {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-toast {
  display: block;
  min-height: 1.2rem;
  margin-top: 6px;
  color: var(--pink-deep);
  font-weight: 800;
}

.machine {
  position: relative;
  flex: 0 1 370px;
  min-height: min(340px, 46vh);
  display: grid;
  place-items: center;
}

.pig-wrap {
  position: relative;
  z-index: 2;
  width: min(360px, 46vh, 86vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow);
}

.pig {
  width: 138%;
  height: 138%;
  display: block;
  object-fit: contain;
  transform: translateY(-10%);
  filter: drop-shadow(0 18px 22px rgba(72, 24, 56, 0.18));
}

.draw-orbit {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.draw-orbit span {
  position: absolute;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 50%, white 0 18%, transparent 19%),
    radial-gradient(circle at 50% 50%, transparent 0 44%, white 45% 55%, transparent 56%),
    linear-gradient(145deg, #1f8af2, #0759b8);
  box-shadow: 0 12px 24px rgba(22, 114, 216, 0.24);
}

.draw-orbit span:nth-child(1) { top: 10%; left: 8%; }
.draw-orbit span:nth-child(2) { top: 8%; right: 12%; }
.draw-orbit span:nth-child(3) { right: -2%; top: 48%; }
.draw-orbit span:nth-child(4) { bottom: 8%; right: 22%; }
.draw-orbit span:nth-child(5) { bottom: 12%; left: 10%; }

.is-drawing .draw-orbit {
  opacity: 1;
}

.is-drawing .draw-orbit span {
  animation: coin-rush 0.7s linear infinite;
}

.is-drawing .pig {
  animation: pig-wiggle 0.45s ease-in-out infinite;
}

.cycle-card {
  position: absolute;
  z-index: 3;
  right: 0;
  bottom: 10px;
  min-width: 164px;
  padding: 12px 14px;
  border: 1px solid var(--stroke);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.cycle-label,
.cycle-value {
  display: block;
}

.cycle-label {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cycle-value {
  color: var(--pink-deep);
  font-family: "Baloo 2", system-ui, sans-serif;
  font-size: 1.8rem;
  line-height: 1;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.stat-card,
.fame-card {
  border: 1px solid var(--stroke);
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.stat-card {
  min-height: 118px;
  padding: 14px 16px;
}

.stat-card h2,
.section-head h2 {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stat-big {
  margin: 6px 0 2px;
  color: var(--pink-deep);
  font-family: "Baloo 2", system-ui, sans-serif;
  font-size: clamp(1.65rem, 3.2vw, 2.55rem);
  font-weight: 800;
  line-height: 1;
}

.stat-small,
.section-head p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.82rem;
}

.winner-list {
  margin: 8px 0 0;
  padding-left: 1.35rem;
  font-size: 0.84rem;
  font-weight: 800;
}

.winner-list li + li {
  margin-top: 4px;
}

.winner-list a,
.fame-table a {
  color: var(--blue);
  text-decoration: none;
}

.muted {
  color: var(--muted);
  font-weight: 700;
}

.fame-card {
  overflow: hidden;
}

.section-head {
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px 6px;
}

.table-wrap {
  overflow-x: auto;
  max-height: 166px;
  overflow-y: auto;
}

.fame-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 540px;
}

.fame-table th,
.fame-table td {
  padding: 8px 16px;
  border-top: 1px solid rgba(231, 67, 134, 0.12);
  text-align: left;
}

.fame-table th {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.fame-table td {
  font-size: 0.84rem;
  font-weight: 800;
}

.empty td {
  color: var(--muted);
  text-align: center;
}

footer {
  max-width: 840px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
}

@keyframes pig-wiggle {
  0%, 100% { transform: translateY(-10%) rotate(-1deg); }
  50% { transform: translateY(calc(-10% - 4px)) rotate(1deg); }
}

@keyframes coin-rush {
  0% { transform: scale(0.82) rotate(0deg); }
  50% { transform: scale(1.12) rotate(180deg); }
  100% { transform: scale(0.82) rotate(360deg); }
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .page {
    min-height: auto;
  }

  .hero {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .machine {
    min-height: 280px;
  }

  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .page {
    width: min(100% - 20px, 1180px);
    padding-top: 14px;
  }

  .topbar {
    margin-bottom: 20px;
  }

  .machine {
    min-height: 260px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .cycle-card {
    left: 12px;
    right: 12px;
    bottom: 0;
  }
}
