:root {
  --bg: #7ec8ff;
  --ink: #021a3a;
  --muted: #006eff;
  --ok: #6eff00;
  --bad: #ef4444;
  --ice: #3d8fff;
  --lime: #6eff00;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --stage-max: 480px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Fredoka", "Nunito", system-ui, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: stretch;
  background: linear-gradient(180deg, #7ec8ff 0%, #d6ecff 42%, #eaffc8 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: -18%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 22%, #c8f08a 0 16%, transparent 17%),
    radial-gradient(circle at 86% 16%, #7ec8ff 0 14%, transparent 15%),
    radial-gradient(circle at 78% 78%, #6eff00 0 18%, transparent 19%),
    radial-gradient(circle at 16% 82%, #3d8fff 0 14%, transparent 15%),
    radial-gradient(circle at 50% 48%, #fde047 0 10%, transparent 11%);
  animation: sky-drift 14s ease-in-out infinite;
}

.fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.fx span {
  position: absolute;
  border-radius: 50%;
  will-change: transform, opacity;
}

.fx .blob {
  opacity: 0.42;
  filter: blur(2px);
}

.fx .blob-a {
  width: 280px;
  height: 280px;
  left: -8%;
  top: 8%;
  background: #3d8fff;
  animation: blob-a 11s ease-in-out infinite;
}

.fx .blob-b {
  width: 240px;
  height: 240px;
  right: -6%;
  top: 28%;
  background: #6eff00;
  animation: blob-b 13s ease-in-out infinite;
}

.fx .blob-c {
  width: 260px;
  height: 260px;
  left: 18%;
  bottom: -12%;
  background: #7ec8ff;
  animation: blob-c 10s ease-in-out infinite;
}

.fx .blob-d {
  width: 200px;
  height: 200px;
  right: 12%;
  bottom: 6%;
  background: #facc15;
  animation: blob-d 12s ease-in-out infinite;
}

.fx .b1,
.fx .b2,
.fx .b3,
.fx .b4,
.fx .b5,
.fx .b6 {
  box-shadow: inset -10px -12px 0 rgba(0, 0, 0, 0.08), 0 8px 0 rgba(0, 0, 0, 0.08);
  opacity: 0.85;
}

.fx .b1 {
  width: 92px;
  height: 92px;
  left: 2%;
  top: 38%;
  background: #3d8fff;
  animation: ball-a 7s ease-in-out infinite;
}

.fx .b2 {
  width: 74px;
  height: 74px;
  right: 4%;
  top: 52%;
  background: #6eff00;
  animation: ball-b 8.5s ease-in-out infinite;
}

.fx .b3 {
  width: 58px;
  height: 58px;
  left: 42%;
  top: 6%;
  background: #4ade80;
  animation: ball-c 6.5s ease-in-out infinite;
}

.fx .b4 {
  width: 80px;
  height: 80px;
  right: 8%;
  top: 10%;
  background: #38bdf8;
  animation: ball-a 9s ease-in-out infinite reverse;
}

.fx .b5 {
  width: 64px;
  height: 64px;
  left: 8%;
  bottom: 12%;
  background: #006eff;
  animation: ball-b 7.8s ease-in-out infinite reverse;
}

.fx .b6 {
  width: 48px;
  height: 48px;
  right: 22%;
  bottom: 18%;
  background: #facc15;
  animation: ball-c 5.8s ease-in-out infinite reverse;
}

.fx .s1,
.fx .s2,
.fx .s3,
.fx .s4,
.fx .s5,
.fx .s6,
.fx .s7,
.fx .s8 {
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 110, 255, 0.28);
  animation: sparkle 2.4s ease-in-out infinite;
}

.fx .s1 { left: 8%; top: 22%; font-size: 1.5rem; animation-delay: 0s; }
.fx .s2 { right: 10%; top: 30%; font-size: 1.2rem; animation-delay: 0.4s; }
.fx .s3 { left: 14%; bottom: 18%; font-size: 1.7rem; animation-delay: 0.8s; }
.fx .s4 { right: 16%; bottom: 22%; font-size: 1.25rem; animation-delay: 1.2s; }
.fx .s5 { left: 48%; top: 12%; font-size: 1.1rem; animation-delay: 0.2s; }
.fx .s6 { right: 28%; top: 62%; font-size: 1.35rem; animation-delay: 1s; }
.fx .s7 { left: 28%; top: 70%; font-size: 1rem; animation-delay: 1.6s; }
.fx .s8 { right: 40%; bottom: 8%; font-size: 1.45rem; animation-delay: 0.6s; }

@keyframes sky-drift {
  0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); }
  50% { transform: translate(-5%, 4%) scale(1.12) rotate(4deg); }
}

@keyframes blob-a {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(18vw, 10vh) scale(1.18); }
}

@keyframes blob-b {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-16vw, 12vh) scale(1.22); }
}

@keyframes blob-c {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(14vw, -12vh) scale(1.16); }
}

@keyframes blob-d {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-12vw, -10vh) scale(1.2); }
}

@keyframes ball-a {
  0%, 100% { transform: translate(0, 0) rotate(0deg) scale(1); }
  25% { transform: translate(22vw, -16vh) rotate(50deg) scale(1.18); }
  50% { transform: translate(8vw, 18vh) rotate(-20deg) scale(0.9); }
  75% { transform: translate(-10vw, 8vh) rotate(35deg) scale(1.12); }
}

@keyframes ball-b {
  0%, 100% { transform: translate(0, 0) rotate(0deg) scale(1); }
  30% { transform: translate(-20vw, -14vh) rotate(-45deg) scale(1.2); }
  60% { transform: translate(-6vw, 16vh) rotate(30deg) scale(0.88); }
}

@keyframes ball-c {
  0%, 100% { transform: translate(0, 0) rotate(0deg) scale(1); }
  40% { transform: translate(16vw, 14vh) rotate(60deg) scale(1.25); }
  70% { transform: translate(-14vw, -10vh) rotate(-30deg) scale(0.92); }
}

@keyframes sparkle {
  0%, 100% { transform: translateY(0) rotate(0deg) scale(0.85); opacity: 0.35; }
  50% { transform: translateY(-28px) rotate(18deg) scale(1.35); opacity: 1; }
}

@keyframes toy-press {
  0% { transform: translateY(0); }
  100% { transform: translateY(5px); }
}

@keyframes toy-pop {
  0% { transform: scale(0.86); }
  60% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes play-pulse {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.03); }
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-6deg); }
  75% { transform: rotate(6deg); }
}

@keyframes title-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

button,
input {
  font-family: inherit;
}

input {
  user-select: text;
}

.hidden {
  display: none !important;
}

html.spw-consented #consentModal {
  display: none !important;
}

html.spw-consented #toolContent.hidden,
html.spw-consented #toolContent[hidden] {
  display: block !important;
}

#adSplash {
  display: none;
}

html.spw-consented:not(.spw-ad-done) #adSplash {
  display: flex !important;
}

#toolContent {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--stage-max);
  height: 100dvh;
  height: 100svh;
  margin: 0 auto;
  overflow: hidden;
  background: linear-gradient(180deg, #d6ecff 0%, #f3ffe6 100%);
}

#toolContent::before {
  content: "";
  position: absolute;
  inset: -35%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 22% 18%, rgba(110, 255, 0, 0.42), transparent 36%),
    radial-gradient(circle at 84% 16%, rgba(61, 143, 255, 0.5), transparent 34%),
    radial-gradient(circle at 78% 78%, rgba(110, 255, 0, 0.38), transparent 38%),
    radial-gradient(circle at 16% 82%, rgba(0, 110, 255, 0.28), transparent 34%);
  animation: sky-drift 12s ease-in-out infinite reverse;
}

.screen {
  position: relative;
  z-index: 1;
  display: none;
  height: 100%;
  padding: calc(58px + var(--safe-t)) 16px calc(16px + var(--safe-b));
  overflow: hidden;
}

#screenVestibule {
  padding-top: calc(14px + var(--safe-t));
}

.screen.is-on {
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.screen.is-on::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.brand {
  text-align: center;
  margin-bottom: 4px;
}

.brand-lockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.brand-host {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  background: #fff;
  border-radius: 14px;
  padding: 6px 10px;
  border-bottom: 4px solid #c8e4ff;
  box-shadow: 0 4px 0 rgba(2, 26, 58, 0.08);
}

.brand-host img {
  height: clamp(28px, 7.5vw, 40px);
  width: auto;
  display: block;
}

.brand-game {
  display: block;
  height: clamp(44px, 13vw, 72px);
  width: auto;
  margin: 2px 0 0;
  animation: title-bounce 1.6s ease-in-out infinite;
}

.brand p {
  margin: 6px 0 0;
  color: #021a3a;
  font-size: 1.05rem;
  font-weight: 700;
}

.best-score {
  appearance: none;
  display: block;
  margin: 8px auto 10px;
  width: fit-content;
  padding: 8px 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, #b8ff5a, #6eff00);
  color: #021a3a;
  font-family: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  border: 0;
  border-bottom: 5px solid #4fd100;
  box-shadow: 0 6px 0 rgba(2, 26, 58, 0.12);
  cursor: pointer;
}

.best-score:active {
  transform: translateY(4px);
  border-bottom-width: 2px;
}

.music-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 8px 0 10px;
  padding: 6px 4px;
}

.music-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: #021a3a;
  letter-spacing: 0.02em;
}

.scores-modal {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 26, 58, 0.55);
  padding: 16px;
}

.scores-sheet {
  width: min(100%, 400px);
  max-height: min(88dvh, 640px);
  overflow-x: hidden;
  overflow-y: auto;
  background: #fff;
  border-radius: 28px;
  padding: 18px 16px 16px;
  text-align: center;
  border-bottom: 8px solid #c8e4ff;
  box-shadow: 0 16px 0 rgba(0, 110, 255, 0.12);
}

.scores-sheet h2 {
  margin: 0 0 12px;
  color: #021a3a;
  font-size: 1.45rem;
}

.scores-sheet .rank-list {
  width: 100%;
  margin: 0 0 12px;
}

.scores-close {
  appearance: none;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-bottom: 5px solid rgba(0, 0, 0, 0.14);
  border-radius: 14px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  background: #e2e8f0;
  color: #021a3a;
}

.scores-close:active {
  transform: translateY(3px);
  border-bottom-width: 2px;
}

.rank-list li.is-me {
  box-shadow: 0 0 0 3px #6eff00;
}

.section-label {
  margin: 8px 0 10px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: none;
  color: #021a3a;
}

.level-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
  align-items: stretch;
}

.level-btn {
  appearance: none;
  border: 0;
  border-bottom: 8px solid rgba(0, 0, 0, 0.2);
  color: #fff;
  border-radius: 20px;
  min-height: 92px;
  height: 100%;
  min-width: 0;
  width: 100%;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 4px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
  transition: border-bottom-width 0.08s ease, filter 0.12s ease, opacity 0.12s ease;
}

.level-btn[data-level="facil"] {
  background: linear-gradient(180deg, #b8ff5a, #4fd100);
  color: #021a3a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}

.level-btn[data-level="dificil"] {
  background: linear-gradient(180deg, #5aa8ff, #006eff);
}

.level-btn[data-level="rayo"] {
  background: linear-gradient(180deg, #facc15, #ea580c);
}

.level-name {
  font-size: clamp(0.92rem, 3.5vw, 1.2rem);
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
}

.level-hint {
  font-size: clamp(0.62rem, 2.3vw, 0.74rem);
  font-weight: 650;
  opacity: 0.95;
  line-height: 1.2;
  text-align: center;
}

.level-btn:not(.is-on) {
  filter: saturate(0.55) brightness(1.12);
  opacity: 0.72;
}

.level-btn.is-on {
  box-shadow: 0 0 0 4px #fff;
  animation: toy-pop 0.32s ease;
}

.level-btn:active {
  transform: translateY(5px);
  border-bottom-width: 3px;
}

.mode-row,
.count-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}

.mode-btn,
.count-btn {
  appearance: none;
  border: 0;
  border-bottom: 6px solid rgba(0, 0, 0, 0.2);
  color: #fff;
  border-radius: 16px;
  min-height: 52px;
  font-size: 1.08rem;
  font-weight: 700;
  cursor: pointer;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
  transition: transform 0.08s ease, border-bottom-width 0.08s ease, filter 0.12s ease;
}

.mode-btn {
  background: linear-gradient(180deg, #5aa8ff, #006eff);
}

.mode-btn[data-mode="torneo"] {
  background: linear-gradient(180deg, #b8ff5a, #4fd100);
  color: #021a3a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}

.count-btn {
  background: linear-gradient(180deg, #5aa8ff, #006eff);
}

.rounds-btn {
  background: linear-gradient(180deg, #7ee8d8, #0d9488);
}

.mode-btn:not(.is-on),
.count-btn:not(.is-on) {
  filter: saturate(0.55) brightness(1.15);
  opacity: 0.7;
  transform: scale(0.96);
}

.mode-btn.is-on,
.count-btn.is-on {
  box-shadow: 0 0 0 3px #fff;
  animation: toy-pop 0.28s ease;
}

.mode-btn:active,
.count-btn:active {
  transform: translateY(4px);
  border-bottom-width: 2px;
}

.count-row {
  grid-template-columns: repeat(3, 1fr);
}

#roundsRow {
  grid-template-columns: repeat(4, 1fr);
}

.play-btn {
  appearance: none;
  position: relative;
  z-index: 2;
  margin-top: auto;
  width: 100%;
  min-height: 72px;
  border: 0;
  border-bottom: 8px solid #0054c4;
  border-radius: 22px;
  background: linear-gradient(180deg, #5aa8ff, #006eff);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 700;
  cursor: pointer;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
  box-shadow: 0 0 0 4px #6eff00, 0 10px 0 rgba(2, 26, 58, 0.12);
}

.play-btn:not(:disabled) {
  animation: play-pulse 1.15s ease-in-out infinite;
}

.play-btn:not(:disabled):active {
  animation: none;
  transform: translateY(6px);
  border-bottom-width: 3px;
}

.play-btn:disabled {
  opacity: 0.4;
  box-shadow: none;
  cursor: default;
  animation: none;
}

.credit {
  margin-top: 10px;
  text-align: center;
  color: #021a3a;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.45;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.25em 0.35em;
}

.credit a {
  color: #006eff;
  text-decoration: none;
  font-weight: 700;
}

.credit-miniapps {
  display: inline-flex;
  align-items: center;
  background: #fff;
  border: 1px solid #d6e4f8;
  border-radius: 8px;
  padding: 4px 8px;
}

.credit-miniapps img {
  height: 26px;
  width: auto;
  display: block;
}

.app-ver {
  margin: 4px 0 0;
  text-align: center;
  color: #64748b;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  opacity: 0.55;
  line-height: 1.2;
}

.ring-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.ring-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.score-chip {
  font-weight: 800;
  font-size: 1.12rem;
  color: #021a3a;
  background: linear-gradient(180deg, #b8ff5a, #6eff00);
  padding: 6px 14px;
  border-radius: 999px;
  border-bottom: 4px solid rgba(0, 0, 0, 0.14);
  min-width: 6.5rem;
  text-align: center;
}

.streak-chip,
.progress-chip,
.player-chip {
  font-weight: 700;
  font-size: 0.95rem;
}

.streak-chip {
  color: #c2410c;
  background: #ffedd5;
  padding: 4px 10px;
  border-radius: 999px;
}

.progress-chip {
  color: #006eff;
  background: #dbeafe;
  padding: 4px 10px;
  border-radius: 999px;
}

.player-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #1e3a8a;
  background: #dbeafe;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
}

.player-chip img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.ring-wrap {
  position: relative;
  width: min(72%, 280px);
  margin: 4px auto 8px;
  aspect-ratio: 1;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 10px 0 rgba(0, 110, 255, 0.18), 0 0 0 8px #fff;
}

.ring-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-track {
  fill: none;
  stroke: #c8e4ff;
  stroke-width: 10;
}

.ring-value {
  fill: none;
  stroke: #4fd100;
  stroke-width: 10;
  stroke-linecap: round;
}

.op {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(2.4rem, 11vw, 4.2rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #006eff;
}

.review-flag {
  text-align: center;
  color: #0e7490;
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  min-height: 1.1em;
}

.tiles {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
  flex: 1;
  min-height: 0;
}

.tile {
  appearance: none;
  flex: 1;
  width: 100%;
  min-height: 68px;
  border: 0;
  border-bottom: 8px solid rgba(0, 0, 0, 0.18);
  border-radius: 20px;
  color: #fff;
  font-size: clamp(1.8rem, 8vw, 2.6rem);
  font-weight: 700;
  cursor: pointer;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
  transition: transform 0.08s ease, border-bottom-width 0.08s ease;
}

#tile0 {
  background: linear-gradient(180deg, #5aa8ff, #006eff);
}

#tile1 {
  background: linear-gradient(180deg, #b8ff5a, #4fd100);
  color: #021a3a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

#tile2 {
  background: linear-gradient(180deg, #facc15, #ca8a04);
  color: #713f12;
  text-shadow: none;
}

.tile:active {
  transform: translateY(6px);
  border-bottom-width: 3px;
}

.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: calc(12px + var(--safe-b));
  z-index: 10000;
  pointer-events: none !important;
  width: 44px;
  height: 44px;
  margin: 0;
  border-radius: 50%;
  background: rgba(0, 110, 255, 0.95);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 0 3px #fff,
    0 8px 18px rgba(2, 26, 58, 0.35);
  transform: translateX(-50%);
  animation: hint-bounce 1.35s ease-in-out infinite;
}

.scroll-hint:not(.hidden):not([hidden]) {
  display: flex !important;
}

@keyframes hint-bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(7px); }
}

.flash {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  pointer-events: none;
  border-radius: inherit;
}

.flash.is-on {
  display: flex;
}

.flash.is-ok {
  background: rgba(74, 222, 128, 0.55);
}

.flash.is-bad {
  background: rgba(251, 113, 133, 0.55);
}

.flash-mark {
  font-size: 5.5rem;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  text-shadow: 0 8px 0 rgba(0, 0, 0, 0.15);
}

.flash-pts {
  margin-top: 4px;
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.18);
  animation: pts-pop 0.28s ease;
}

.flash-pts.is-up {
  color: #f7ffe8;
}

.flash-pts.is-down {
  color: #fff1f2;
}

@keyframes pts-pop {
  0% { transform: scale(0.4); opacity: 0; }
  70% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); }
}

.flash-answer {
  margin-top: 8px;
  font-size: 2.2rem;
  font-weight: 700;
  color: #fff;
}

.turn-panel {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 26, 58, 0.55);
  padding: 16px;
}

.turn-card {
  width: min(100%, 340px);
  background: #fff;
  border-radius: 28px;
  padding: 22px 18px 18px;
  text-align: center;
  border-bottom: 8px solid #c8e4ff;
  box-shadow: 0 16px 0 rgba(0, 110, 255, 0.12);
}

.turn-kicker {
  margin: 0 0 2px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #3d8fff;
}

.turn-round {
  margin: 0 0 10px;
  font-weight: 700;
  font-size: 1.35rem;
  color: #006eff;
}

.turn-card img {
  width: 96px;
  height: 96px;
  display: block;
  margin: 0 auto 8px;
  border-radius: 50%;
  object-fit: cover;
}

.turn-card h2 {
  margin: 0 0 4px;
  color: #021a3a;
  font-size: 1.6rem;
}

.turn-card p {
  margin: 0 0 8px;
  color: #006eff;
  font-weight: 650;
}

.turn-seat {
  margin: 0 0 6px !important;
  font-size: 0.92rem;
  color: #64748b !important;
  font-weight: 600 !important;
}

.turn-next {
  margin: 0 0 10px !important;
  font-size: 0.95rem;
  color: #0f766e !important;
  font-weight: 700 !important;
  min-height: 1.2em;
}

.turn-count {
  font-size: 4.4rem;
  font-weight: 700;
  line-height: 1;
  color: #e11d48;
}

.turn-count.is-pop {
  animation: toy-pop 0.28s ease;
}

.back-btn {
  position: absolute;
  top: calc(10px + var(--safe-t));
  left: 12px;
  z-index: 60;
  width: 48px;
  height: 48px;
  appearance: none;
  border: 0;
  border-bottom: 5px solid rgba(0, 0, 0, 0.18);
  border-radius: 16px;
  background: linear-gradient(180deg, #5aa8ff, #006eff);
  color: #fff;
  font-family: inherit;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 0 0 3px #fff;
}

.back-btn:active {
  transform: translateY(4px);
  border-bottom-width: 2px;
}

.mute-btn {
  position: relative;
  flex: 0 0 auto;
  width: 48px;
  height: 42px;
  appearance: none;
  border: 0;
  border-bottom: 5px solid rgba(0, 0, 0, 0.18);
  border-radius: 14px;
  background: linear-gradient(180deg, #b8ff5a, #4fd100);
  color: #021a3a;
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 0 0 3px #fff;
}

.mute-btn.is-muted {
  background: linear-gradient(180deg, #fda4af, #e11d48);
  color: #fff;
}

.mute-btn:active {
  transform: translateY(4px);
  border-bottom-width: 2px;
}

.quit-modal {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 26, 58, 0.55);
  padding: 16px;
}

.quit-card {
  width: min(100%, 340px);
  background: #fff;
  border-radius: 28px;
  padding: 22px 18px 18px;
  text-align: center;
  border-bottom: 8px solid #c8e4ff;
  box-shadow: 0 16px 0 rgba(0, 110, 255, 0.12);
}

.quit-card h2 {
  margin: 0 0 8px;
  color: #021a3a;
  font-size: 1.7rem;
}

.quit-card p {
  margin: 0 0 16px;
  color: #006eff;
  font-weight: 650;
}

.quit-stay,
.quit-leave {
  appearance: none;
  display: block;
  width: 100%;
  min-height: 52px;
  border: 0;
  border-bottom: 6px solid rgba(0, 0, 0, 0.16);
  border-radius: 16px;
  font-family: inherit;
  font-size: 1.08rem;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
}

.quit-stay {
  background: linear-gradient(180deg, #b8ff5a, #4fd100);
  color: #021a3a;
  margin-bottom: 10px;
}

.quit-leave {
  background: linear-gradient(180deg, #fda4af, #f43f5e);
}

.quit-stay:active,
.quit-leave:active {
  transform: translateY(4px);
  border-bottom-width: 2px;
}

.share-modal {
  position: absolute;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(2, 26, 58, 0.55);
  padding: 16px;
}

.share-sheet {
  width: min(100%, 400px);
  max-height: min(88dvh, 720px);
  overflow-x: hidden;
  overflow-y: auto;
  background: #fff;
  border-radius: 28px;
  padding: 18px 16px 16px;
  text-align: center;
  border-bottom: 8px solid #c8e4ff;
  box-shadow: 0 16px 0 rgba(0, 110, 255, 0.12);
}

.share-sheet h2 {
  margin: 0 0 6px;
  color: #021a3a;
  font-size: 1.45rem;
}

.share-lead {
  margin: 0 0 12px;
  color: #006eff;
  font-weight: 650;
  font-size: 0.92rem;
}

.share-preview {
  width: 100%;
  max-height: 42vh;
  object-fit: contain;
  border-radius: 16px;
  background: #021a3a;
  margin: 0 0 12px;
  display: block;
  pointer-events: auto;
  touch-action: auto;
  -webkit-touch-callout: default;
  -webkit-user-select: auto;
  user-select: auto;
}

.share-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 0 0 10px;
}

.share-app,
.share-close {
  appearance: none;
  min-height: 48px;
  border: 0;
  border-bottom: 5px solid rgba(0, 0, 0, 0.14);
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

.share-app {
  background: linear-gradient(180deg, #5aa8ff, #006eff);
  color: #fff;
}

.share-close {
  width: 100%;
  background: #e2e8f0;
  color: #021a3a;
}

.share-app:active,
.share-close:active {
  transform: translateY(3px);
  border-bottom-width: 2px;
}

.setup,
.podium {
  align-items: center;
  text-align: center;
}

.setup {
  min-height: 0;
}

.setup h2,
.podium h2 {
  margin: 12px 0 8px;
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  color: #006eff;
}

.setup h2 {
  margin: 4px 0 2px;
  flex-shrink: 0;
}

.setup p {
  color: #006eff;
  margin: 0 0 8px;
  font-weight: 650;
  flex-shrink: 0;
}

.name-input {
  width: min(100%, 360px);
  border: 4px solid #3d8fff;
  background: #fff;
  color: var(--ink);
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
  outline: none;
  flex-shrink: 0;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: auto;
  gap: 8px;
  width: 100%;
  max-width: 440px;
  margin: 10px 0;
  flex: 0 0 auto;
}

.avatar-btn {
  appearance: none;
  border: 0;
  border-bottom: 5px solid rgba(0, 0, 0, 0.12);
  background: #fff;
  border-radius: 18px;
  padding: 0;
  cursor: pointer;
  color: #006eff;
  min-width: 0;
  aspect-ratio: 1 / 1;
  position: relative;
  overflow: hidden;
  transition: transform 0.08s ease;
}

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

.avatar-btn span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 10px 2px 4px;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.92) 55%);
}

.avatar-btn.is-on {
  box-shadow: 0 0 0 4px #facc15;
  animation: toy-pop 0.3s ease, wiggle 0.45s ease;
}

.avatar-btn.is-used {
  opacity: 0.28;
  cursor: default;
}

.avatar-btn:not(.is-used):active {
  transform: translateY(4px);
}

.ready-btn,
.again-btn,
.home-btn,
.share-btn {
  appearance: none;
  width: min(100%, 360px);
  min-height: 56px;
  border: 0;
  border-bottom: 6px solid rgba(0, 0, 0, 0.18);
  border-radius: 16px;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
}

.ready-btn,
.again-btn {
  background: linear-gradient(180deg, #b8ff5a, #4fd100);
  color: #021a3a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

.setup .ready-btn {
  flex-shrink: 0;
  margin-top: auto;
}

.ready-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.ready-btn:not(:disabled):active,
.again-btn:active,
.home-btn:active,
.share-btn:not(:disabled):active {
  transform: translateY(5px);
  border-bottom-width: 2px;
}

.share-btn {
  margin-top: 4px;
  margin-bottom: 10px;
  background: linear-gradient(180deg, #fde047, #f59e0b);
  color: #78350f;
}

.share-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.share-hint {
  width: min(100%, 360px);
  margin: -4px 0 10px;
  color: #006eff;
  font-weight: 650;
  font-size: 0.88rem;
  line-height: 1.3;
}

.home-btn {
  margin-top: 10px;
  background: linear-gradient(180deg, #5aa8ff, #006eff);
  color: #fff;
}

.stats {
  width: min(100%, 420px);
  margin: 12px 0 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.podium-hero {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #fff;
  border-bottom: 5px solid #c8e4ff;
  border-radius: 16px;
  padding: 10px 12px;
}

.podium-hero img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
}

.podium-hero b {
  font-size: 1.35rem;
  color: #006eff;
}

.stat {
  background: #fff;
  border: 0;
  border-bottom: 5px solid #c8e4ff;
  border-radius: 16px;
  padding: 12px 8px;
  color: var(--ink);
}

.stat b {
  display: block;
  font-size: 1.45rem;
  color: #006eff;
}

.stat-score {
  grid-column: 1 / -1;
  background: linear-gradient(180deg, #b8ff5a, #6eff00);
  border-bottom-color: #4fd100;
}

.stat-score b {
  font-size: 2.35rem;
  color: #021a3a;
}

.stat-score span {
  color: #021a3a;
}

.stat span {
  color: #006eff;
  font-size: 0.78rem;
  font-weight: 700;
}

.attention {
  grid-column: 1 / -1;
  background: #fff;
  border-bottom: 5px solid #facc15;
  border-radius: 16px;
  padding: 12px 10px 14px;
}

.attention p {
  margin: 0 0 8px;
  color: #021a3a;
  font-size: 0.82rem;
  font-weight: 700;
}

.attention-ok {
  border-bottom-color: #6eff00;
  color: #006eff;
  font-weight: 700;
  font-size: 0.95rem;
}

.table-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.table-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 6px 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe566, #facc15);
  color: #021a3a;
  font-weight: 800;
  font-size: 1.05rem;
  border-bottom: 3px solid rgba(0, 0, 0, 0.12);
}

.attention-compact {
  margin-top: 6px;
  padding: 6px 0 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  text-align: left;
}

.attention-compact p {
  margin: 0 0 4px;
  font-size: 0.68rem;
  color: #c2410c;
}

.attention-compact .table-chips {
  justify-content: flex-start;
  gap: 4px;
}

.attention-compact .table-chip {
  min-width: 36px;
  padding: 3px 7px;
  font-size: 0.82rem;
}

.attention-compact.attention-ok {
  color: #16a34a;
  font-size: 0.72rem;
  padding-top: 4px;
}

.rank-list {
  width: min(100%, 420px);
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.rank-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: #fff;
  border-radius: 14px;
  padding: 8px 10px;
  margin-bottom: 8px;
  border-bottom: 4px solid #c8e4ff;
}

.rank-list img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}

.rank-list .place {
  width: 1.4rem;
  font-weight: 700;
  color: #d97706;
}

.rank-body {
  min-width: 0;
  flex: 1;
}

.medal {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 700;
  color: #db2777;
  text-align: right;
  max-width: 46%;
}

.new-record {
  color: #b45309;
  background: #fde047;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
  margin-bottom: 8px;
}

#consentModal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background:
    radial-gradient(ellipse at 50% 8%, rgba(61, 143, 255, 0.38), transparent 52%),
    #021a3a;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  user-select: text;
}

.consent-panel {
  width: min(100%, 500px);
  max-height: min(92dvh, 860px);
  overflow-y: auto;
  background: #fff;
  border-radius: 24px;
  padding: 0;
  border: 2px solid #006eff;
  text-align: center;
  box-shadow:
    0 0 0 4px rgba(110, 255, 0, 0.22),
    0 22px 56px rgba(2, 26, 58, 0.55);
}

.ad-hero {
  display: block;
  position: relative;
  line-height: 0;
  background: #021a3a;
  overflow: hidden;
}

.ad-hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 46%;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(2, 26, 58, 0) 0%, rgba(2, 26, 58, 0.72) 42%, #021a3a 100%);
}

.consent-panel > .ad-hero {
  border-radius: 22px 22px 0 0;
}

.ad-hero-art {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  vertical-align: bottom;
}

.consent-body {
  padding: 1.05rem 1.35rem 1.45rem;
}

.consent-panel h2 {
  color: #021a3a;
  margin: 0 0 0.85rem;
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.consent-panel p {
  color: #334155;
  font-size: 0.92rem;
  line-height: 1.6;
  margin: 0 0 1rem;
}

.consent-panel .hint {
  font-size: 0.85rem;
  color: #64748b;
}

.consent-panel a {
  color: #006eff;
  font-weight: 700;
}

.consent-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.consent-accept {
  background: linear-gradient(135deg, #3d8fff, #006eff);
  color: #fff;
  padding: 0.85rem 1.6rem;
  border: none;
  border-radius: 14px;
  font-family: inherit;
  font-weight: 800;
  cursor: pointer;
  font-size: 1rem;
  box-shadow: 0 4px 0 #0054c4;
}

.consent-accept:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #0054c4;
}

.consent-reject {
  background: #fff;
  color: #021a3a;
  padding: 0.85rem 1.6rem;
  border: 2px solid #d0d7e2;
  border-radius: 14px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
}

#adSplash {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background:
    radial-gradient(ellipse at 50% 8%, rgba(61, 143, 255, 0.38), transparent 52%),
    #021a3a;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
}

.ad-panel {
  position: relative;
  isolation: isolate;
  width: min(100%, 500px);
  max-height: min(92dvh, 860px);
  overflow: hidden;
  background: #fff;
  border-radius: 24px;
  padding: 0;
  border: 2px solid #006eff;
  text-align: center;
  box-shadow:
    0 0 0 4px rgba(110, 255, 0, 0.22),
    0 22px 56px rgba(2, 26, 58, 0.55);
}

.ad-panel .ad-hero {
  position: relative;
  z-index: 1;
  display: block;
}

.ad-count {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 20;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 26, 58, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.ad-thanks {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  margin: 0;
  padding: 16px 16px 14px;
  background: none;
  color: #fff;
  font-size: 1.02rem;
  line-height: 1.35;
  font-weight: 700;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}

.consent-panel .ad-thanks,
.ad-panel .ad-thanks {
  color: #fff;
}

.ad-thanks strong {
  color: #fff;
  font-weight: 800;
}

.ad-url {
  display: block;
  margin-top: 6px;
  color: #6eff00;
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.consent-panel .ad-url,
.ad-panel .ad-url {
  color: #6eff00;
}

@media (min-width: 520px) {
  body {
    padding: 16px;
    align-items: center;
  }

  #toolContent {
    height: min(calc(100dvh - 32px), 860px);
    max-height: calc(100dvh - 32px);
    border-radius: 32px;
    box-shadow:
      0 0 0 6px rgba(255, 255, 255, 0.65),
      0 22px 48px rgba(91, 33, 182, 0.22);
  }
}

@media (max-height: 700px) {
  .level-btn {
    min-height: 72px;
  }

  .level-name {
    font-size: 1.15rem;
  }

  .play-btn {
    min-height: 60px;
  }

  .tile {
    min-height: 56px;
  }
}
