:root {
  --river-0: #03101d;
  --river-1: #0a2a49;
  --river-2: #0f497a;
  --foam: #90efff;
  --panel: rgba(4, 18, 33, 0.94);
  --panel-border: rgba(152, 229, 255, 0.18);
  --text-main: #f1f9ff;
  --text-sub: #c5deef;
}

body {
  background:
    radial-gradient(circle at 18% 8%, rgba(88, 221, 255, 0.25), transparent 25%),
    radial-gradient(circle at 84% 10%, rgba(100, 153, 255, 0.2), transparent 28%),
    linear-gradient(180deg, #051423 0%, #030b14 100%);
}

.main-card,
.ranking-card {
  background: linear-gradient(180deg, rgba(8, 19, 36, 0.98), rgba(4, 11, 22, 0.98));
  border-color: var(--panel-border);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.38);
}

header h1,
header p,
.hub-link {
  color: var(--text-main);
}

header p {
  color: var(--text-sub);
}

/* Dark theme package (Yokai Run style) */
.ranking-card h3,
.ranking-card h4 {
  color: var(--text-main);
}

.ranking-card h4 {
  background: rgba(255, 238, 190, 0.98);
  color: #6a4300;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ranking-item {
  border-bottom-color: rgba(228, 241, 255, 0.26);
  color: #dbe9ff;
}

.rank-num {
  color: #ff5e9b;
}

.rank-name {
  color: #dbe9ff;
}

.rank-score {
  color: #9fd8ff;
}

.ranking-item.small {
  opacity: 0.8;
  border-bottom-color: rgba(228, 241, 255, 0.14);
}

.more-games h3 {
  color: var(--text-main);
}

.more-games .liquid-card {
  background: linear-gradient(180deg, rgba(14, 33, 58, 0.96), rgba(8, 20, 38, 0.98));
  border-color: rgba(132, 214, 255, 0.26);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.34);
  color: #dbe9ff;
}

.more-games .liquid-card::after {
  opacity: 0.45;
  color: #9fd8ff;
}

.more-games .card-label {
  color: #f1f9ff;
}

.more-games .card-desc {
  color: #b5c8df;
  opacity: 1;
}

.hub-link {
  color: rgba(241, 249, 255, 0.84);
  text-decoration: none;
}

.dance-shell {
  margin-top: 18px;
  border-radius: 26px;
  border: 0;
  background: transparent;
  padding: 0;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat-box {
  padding: 10px 8px;
  border-radius: 14px;
  border: 1px solid rgba(148, 220, 255, 0.18);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #aed5ef;
}

.stat-value {
  display: block;
  margin-top: 5px;
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  line-height: 1;
}

.stat-best {
  font-size: 20px;
}

.stage-frame {
  margin-top: 0;
  border-radius: 20px;
  overflow: hidden;
  border: 0;
  background: transparent;
  box-shadow: none;
  position: relative;
}

.stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(2, 10, 20, 0.65);
}

.intro-panel {
  display: grid;
  gap: 12px;
  padding: 0;
  background: transparent;
}

.intro-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 20px;
  border: 0;
  box-shadow: none;
}

.intro-start-btn {
  width: 100%;
  border: 0;
  border-radius: 20px;
  padding: 14px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.02em;
  cursor: pointer;
  color: #ffffff;
  background: linear-gradient(180deg, #ff6ca7, #ff8f4a);
}

.intro-guide {
  margin: 0;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  color: #cde7ff;
  line-height: 1.45;
}

#btnToList {
  display: block;
  text-decoration: none;
  text-align: center;
  margin-top: 12px;
}

.phase-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(26, 62, 96, 0.9);
  border: 1px solid rgba(134, 217, 255, 0.32);
  font-size: 12px;
  font-weight: 900;
  color: #ffdf84;
}

.mini-cta {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: linear-gradient(180deg, #d8faff, #8fe8ff);
  color: #042138;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  background: linear-gradient(180deg, #08223d, #041427);
  image-rendering: pixelated;
  touch-action: none;
}

canvas.is-hidden {
  display: none;
}

.countdown-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, rgba(9, 18, 36, 0.32) 0%, rgba(5, 11, 22, 0.46) 100%);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
  z-index: 25;
}

.countdown-overlay.is-visible {
  opacity: 1;
}

.countdown-value {
  font-family: 'Outfit', sans-serif;
  font-size: 104px;
  line-height: 1;
  font-weight: 900;
  color: #f7fbff;
  letter-spacing: 0.01em;
  text-shadow: 0 0 24px rgba(95, 246, 255, 0.44), 0 0 40px rgba(255, 94, 155, 0.28);
}

.bottom-guide {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.guide-pill {
  border-radius: 14px;
  text-align: center;
  font-weight: 800;
  font-size: 12px;
  padding: 12px 10px;
  border: 1px solid rgba(145, 223, 255, 0.2);
  background: rgba(17, 50, 80, 0.92);
  color: #dff3ff;
}

.guide-pill.alt {
  background: linear-gradient(180deg, #56d9ff, #3db4f5);
  color: #042139;
}

.result-emoji {
  margin-bottom: 6px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.result-icon {
  width: 140px;
  height: 140px;
  object-fit: contain;
  image-rendering: pixelated;
}

.result-score {
  font-family: 'Outfit', sans-serif;
  font-size: 56px;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 4px;
  color: #ffd25e;
}

.result-sub {
  font-size: 15px;
  font-weight: 900;
  color: #ecf6ff;
  margin-bottom: 8px;
}

.result-rank {
  min-height: 20px;
  font-size: 14px;
  font-weight: 900;
  color: #9beaff;
  margin-bottom: 10px;
}

.modal-overlay {
  background: rgba(4, 11, 21, 0.84);
  backdrop-filter: blur(4px);
}

@media (max-width: 520px) {
  .stat-row {
    grid-template-columns: 1fr 1fr;
  }

  .stat-box:last-child {
    grid-column: 1 / -1;
  }

  .bottom-guide {
    grid-template-columns: 1fr;
  }
}
