:root {
  --bg-cream: #F9FDF7;
  --surface: #FFFFFF;
  --ink: #1E293B;
  --ink-soft: #57657A;
  --green: #16A34A;
  --green-dark: #15803D;
  --coral: #FF6B4A;
  --coral-dark: #E04B2B;
  --teal: #1FB6A6;
  --teal-dark: #138F82;
  --sunny: #FFB830;
  --sunny-dark: #E09612;
  --berry: #8B5CF6;
  --card-accent: #DCFCE7;
  --card-accent-strong: #15803D;
  --shadow-card: 0 18px 40px -16px rgba(21, 128, 61, 0.14), 0 4px 12px rgba(30, 41, 59, 0.05);
  --radius-card: 32px;
  --radius-pill: 24px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: var(--bg-cream);
  color: var(--ink);
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

/* Soft storybook background shapes */
.bg-decor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.58;
}

.blob-1 {
  width: 340px;
  height: 340px;
  background: #DCFCE7;
  top: -120px;
  left: -100px;
}

.blob-2 {
  width: 310px;
  height: 310px;
  background: #FEF3C7;
  bottom: -110px;
  right: -80px;
}

.blob-3 {
  width: 210px;
  height: 210px;
  background: #E0F2FE;
  top: 42%;
  right: -70px;
}

.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

/* Main App Container */
.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  max-width: 540px;
  margin: 0 auto;
  padding: 16px 18px 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}

/* Header */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-badge {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(145deg, #22C55E, #16A34A);
  color: #FFFFFF;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 5px 0 var(--green-dark), 0 8px 16px rgba(22, 163, 74, 0.26);
}

.brand-badge svg {
  width: 22px;
  height: 22px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-title {
  font-family: "Baloo 2", "Nunito", sans-serif;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.brand-sub {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--green-dark);
}

.top-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.place-pill {
  height: 44px;
  padding: 0 14px;
  border-radius: 15px;
  border: 2px solid rgba(22, 163, 74, 0.2);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(30, 41, 59, 0.08);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.15s ease;
}

.place-pill[data-place="ev"] {
  border-color: #FDBA74;
  background: #FFF7ED;
  color: #C2410C;
  box-shadow: 0 4px 0 #FED7AA;
}

.place-pill[data-place="okul"] {
  border-color: #86EFAC;
  background: #F0FDF4;
  color: #15803D;
  box-shadow: 0 4px 0 #BBF7D0;
}

.place-pill:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(30, 41, 59, 0.08);
}

.place-pill-icon {
  display: inline-flex;
  align-items: center;
}

.place-pill-icon svg {
  width: 17px;
  height: 17px;
}

.place-pill-chevron {
  width: 14px;
  height: 14px;
  opacity: 0.65;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  border: 2px solid rgba(30, 41, 59, 0.08);
  background: var(--surface);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 0 rgba(30, 41, 59, 0.08);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.15s ease;
}

.icon-btn:hover {
  background: #F0FDF4;
}

.icon-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(30, 41, 59, 0.08);
}

.icon-btn svg {
  width: 21px;
  height: 21px;
}

/* Stage & Move Card */
.stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.move-card {
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 20px 20px 22px;
  box-shadow: var(--shadow-card);
  border: 3px solid rgba(22, 163, 74, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 13px;
  position: relative;
  overflow: hidden;
}

.move-card.card-pop {
  animation: cardPop 0.34s cubic-bezier(0.22, 1.28, 0.36, 1);
}

.move-card.is-rolling {
  border-color: rgba(255, 184, 48, 0.72);
  box-shadow: 0 18px 40px -14px rgba(255, 184, 48, 0.32), 0 0 0 4px rgba(255, 184, 48, 0.16);
}

.move-card.is-rolling .type-badge {
  background: #FEF3C7;
  color: #B45309;
}

.move-card.is-rolling .illustration-frame {
  border-color: #FCD34D;
  box-shadow: 0 0 0 4px rgba(252, 211, 77, 0.25);
}

.move-card.is-rolling .move-prompt {
  color: var(--ink-soft);
}

.roll-tick {
  animation: slotTick 0.12s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes slotTick {
  0% {
    opacity: 0.55;
    transform: translateY(14px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.move-card.card-land {
  animation: cardLand 0.44s cubic-bezier(0.2, 1.45, 0.35, 1);
}

@keyframes cardLand {
  0% {
    transform: scale(0.93);
  }
  55% {
    transform: scale(1.035);
  }
  100% {
    transform: scale(1);
  }
}

.illustration-frame.land-flash {
  animation: frameBurst 0.5s ease-out;
}

@keyframes frameBurst {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55);
  }
  100% {
    box-shadow: 0 0 0 18px rgba(34, 197, 94, 0);
  }
}

@keyframes cardPop {
  0% {
    opacity: 0.35;
    transform: scale(0.94) translateY(10px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Place Selection Card */
.place-card {
  padding: 32px 22px 30px;
  gap: 14px;
}

.league-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 15px;
  border-radius: 999px;
  background: #DCFCE7;
  color: #15803D;
  font-size: 0.84rem;
  font-weight: 800;
}

.welcome-title {
  margin: 4px 0 0;
  font-family: "Baloo 2", "Nunito", sans-serif;
  font-size: clamp(1.85rem, 6.5vw, 2.3rem);
  line-height: 1.12;
  color: var(--ink);
}

.welcome-subtitle {
  margin: 0 0 8px;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink-soft);
  max-width: 340px;
  line-height: 1.42;
}

.place-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.place-choice {
  border-radius: 26px;
  padding: 24px 14px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.15s ease;
}

.place-choice:hover {
  transform: translateY(-2px);
  filter: brightness(1.01);
}

.place-choice:active {
  transform: translateY(4px);
}

.place-ev {
  background: linear-gradient(180deg, #FFF8F1 0%, #FFEDD5 100%);
  border: 3px solid #FDBA74;
  box-shadow: 0 6px 0 #FB923C;
  color: #9A3412;
}

.place-ev:active {
  box-shadow: 0 2px 0 #FB923C;
}

.place-okul {
  background: linear-gradient(180deg, #F0FDF4 0%, #DCFCE7 100%);
  border: 3px solid #86EFAC;
  box-shadow: 0 6px 0 #22C55E;
  color: #166534;
}

.place-okul:active {
  box-shadow: 0 2px 0 #22C55E;
}

.place-choice-icon {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.88);
  display: grid;
  place-items: center;
  box-shadow: 0 6px 14px rgba(30, 41, 59, 0.08);
}

.place-choice-icon svg {
  width: 48px;
  height: 48px;
}

.place-choice-title {
  font-family: "Baloo 2", "Nunito", sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
  margin-top: 2px;
}

.place-choice-meta {
  font-size: 0.82rem;
  font-weight: 800;
  opacity: 0.85;
  line-height: 1.25;
}

/* Card Meta Badges */
.card-meta {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.type-badge,
.song-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.type-badge {
  background: var(--card-accent);
  color: var(--card-accent-strong);
}

.song-badge {
  background: #F3E8FF;
  color: #7C3AED;
  border: 2px solid #E4D0FF;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.song-badge:hover {
  background: #EBD9FF;
  border-color: #D2B2FF;
}

.song-badge:active {
  transform: scale(0.96);
}

.song-badge.is-playing {
  background: #EDE0FF;
  border-color: #A855F7;
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.14);
}

.song-badge svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.song-badge .song-swap-icon {
  width: 13px;
  height: 13px;
  opacity: 0.72;
  margin-left: 2px;
}

/* Illustration & Dance Video */
.illustration-frame {
  position: relative;
  width: min(336px, 82vw);
  aspect-ratio: 1 / 1;
  border-radius: 26px;
  background: #FFFFFF;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 3px solid var(--card-accent);
  box-shadow: 0 8px 20px -12px rgba(30, 41, 59, 0.2);
  transition: width 0.2s ease, background-color 0.2s ease;
}

.illustration-frame.is-video {
  width: 100%;
  max-width: 440px;
  aspect-ratio: auto;
  min-height: 220px;
  max-height: 310px;
  background: #141827;
  border-color: #D8B4FE;
  box-shadow: 0 10px 24px -10px rgba(124, 58, 237, 0.35);
  cursor: pointer;
}

.illustration-frame.is-poster {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  height: fit-content;
  max-width: 100%;
  aspect-ratio: auto;
  background: #FFFFFF;
  box-shadow: 0 10px 26px -12px rgba(21, 128, 61, 0.28);
}

.illustration-frame.is-poster .move-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(440px, 54dvh);
  object-fit: contain;
}

.move-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.move-video {
  width: 100%;
  height: 100%;
  max-height: 304px;
  object-fit: contain;
  display: block;
  background: #141827;
}

.video-play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 24, 39, 0.32);
  display: grid;
  place-items: center;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.video-play-circle {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: #9333EA;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 24px rgba(20, 24, 39, 0.35);
}

.video-play-circle svg {
  width: 30px;
  height: 30px;
  margin-left: 3px;
}

/* Move Text */
.move-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.move-prompt {
  margin: 0;
  font-family: "Baloo 2", "Nunito", sans-serif;
  font-size: clamp(1.75rem, 6.4vw, 2.35rem);
  font-weight: 800;
  line-height: 1.14;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.move-tip {
  margin: 2px 0 0;
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--ink-soft);
}

/* Tappable Timer Pill */
.timer-section {
  width: 100%;
  margin-top: 2px;
}

.timer-pill {
  position: relative;
  width: 100%;
  border: 3px solid #BCEEE5;
  border-radius: var(--radius-pill);
  background: #F0FCF9;
  padding: 13px 18px;
  cursor: pointer;
  overflow: hidden;
  text-align: left;
  box-shadow: 0 5px 0 #BCEEE5;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.timer-pill:hover {
  background: #E5FAF5;
}

.timer-pill:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #BCEEE5;
}

.timer-progress-track {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.timer-progress-fill {
  height: 100%;
  width: 100%;
  background: rgba(31, 182, 166, 0.16);
  transform-origin: left center;
  transition: background-color 0.25s ease;
}

.timer-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.timer-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: var(--teal);
  color: #FFFFFF;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 4px 0 var(--teal-dark);
  transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.timer-icon-wrap svg {
  width: 24px;
  height: 24px;
}

.timer-readout {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 165px;
}

.timer-digits {
  font-family: "Baloo 2", "Nunito", sans-serif;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #0F6E64;
}

.timer-status {
  font-size: 0.88rem;
  font-weight: 800;
  color: #1D7E74;
  margin-top: 2px;
}

/* Timer Running State */
.timer-pill[data-state="running"] {
  border-color: #FFD166;
  background: #FFFBEF;
  box-shadow: 0 5px 0 #F4C04A;
}

.timer-pill[data-state="running"] .timer-progress-fill {
  background: rgba(255, 184, 48, 0.24);
}

.timer-pill[data-state="running"] .timer-icon-wrap {
  background: var(--sunny);
  box-shadow: 0 4px 0 var(--sunny-dark);
  animation: pulseSoft 1.2s ease-in-out infinite;
}

.timer-pill[data-state="running"] .timer-digits {
  color: #9A5B00;
}

.timer-pill[data-state="running"] .timer-status {
  color: #A96B08;
}

/* Timer Last 3 Seconds Urgency */
.timer-pill[data-state="running"].timer-urgent {
  border-color: #FF8E72;
  box-shadow: 0 5px 0 #F26B4E;
}

.timer-pill[data-state="running"].timer-urgent .timer-digits {
  color: #C93518;
}

/* Timer Paused State */
.timer-pill[data-state="paused"] {
  border-color: #D7CEFF;
  background: #F8F5FF;
  box-shadow: 0 5px 0 #C4B5FD;
}

.timer-pill[data-state="paused"] .timer-progress-fill {
  background: rgba(139, 92, 246, 0.14);
}

.timer-pill[data-state="paused"] .timer-icon-wrap {
  background: var(--berry);
  box-shadow: 0 4px 0 #6D28D9;
}

.timer-pill[data-state="paused"] .timer-digits,
.timer-pill[data-state="paused"] .timer-status {
  color: #5B21B6;
}

/* Timer Done State */
.timer-pill[data-state="done"] {
  border-color: #6EE7B7;
  background: #ECFDF5;
  box-shadow: 0 5px 0 #34D399;
}

.timer-pill[data-state="done"] .timer-progress-fill {
  background: rgba(16, 185, 129, 0.2);
}

.timer-pill[data-state="done"] .timer-icon-wrap {
  background: #10B981;
  box-shadow: 0 4px 0 #059669;
}

.timer-pill[data-state="done"] .timer-digits,
.timer-pill[data-state="done"] .timer-status {
  color: #065F46;
}

@keyframes pulseSoft {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

/* Dance Play / Pause Pill (replaces timer on dance moves) */
.dance-play-pill {
  position: relative;
  width: 100%;
  border: 3px solid #D8B4FE;
  border-radius: var(--radius-pill);
  background: #FAF5FF;
  padding: 13px 18px;
  cursor: pointer;
  overflow: hidden;
  text-align: left;
  box-shadow: 0 5px 0 #C084FC;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.dance-play-pill:hover {
  background: #F3E8FF;
}

.dance-play-pill:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #C084FC;
}

.dance-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: #9333EA;
  color: #FFFFFF;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 4px 0 #7E22CE;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.dance-icon-wrap svg {
  width: 24px;
  height: 24px;
}

.dance-play-title {
  font-family: "Baloo 2", "Nunito", sans-serif;
  font-size: 1.48rem;
  font-weight: 800;
  line-height: 1.1;
  color: #581C87;
}

.dance-play-status {
  font-size: 0.86rem;
  font-weight: 800;
  color: #7E22CE;
  margin-top: 2px;
}

.dance-play-pill[data-state="playing"] {
  border-color: #F472B6;
  background: #FDF2F8;
  box-shadow: 0 5px 0 #EC4899;
}

.dance-play-pill[data-state="playing"] .dance-icon-wrap {
  background: #EC4899;
  box-shadow: 0 4px 0 #BE185D;
  animation: pulseSoft 1.15s ease-in-out infinite;
}

.dance-play-pill[data-state="playing"] .dance-play-title {
  color: #831843;
}

.dance-play-pill[data-state="playing"] .dance-play-status {
  color: #BE185D;
}

.dance-play-pill:focus-visible {
  outline: 4px solid #3B82F6;
  outline-offset: 3px;
}

/* Primary Action Button */
.controls {
  padding-top: 2px;
}

.primary-btn {
  width: 100%;
  border: none;
  border-radius: 26px;
  padding: 19px 26px;
  background: linear-gradient(180deg, #22C55E 0%, #16A34A 100%);
  color: #FFFFFF;
  font-family: "Baloo 2", "Nunito", sans-serif;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 7px 0 var(--green-dark), 0 14px 26px rgba(22, 163, 74, 0.3);
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.15s ease;
  user-select: none;
}

.primary-btn:hover {
  filter: brightness(1.04);
}

.primary-btn:active {
  transform: translateY(5px);
  box-shadow: 0 2px 0 var(--green-dark), 0 6px 14px rgba(22, 163, 74, 0.24);
}

.primary-btn:focus-visible,
.timer-pill:focus-visible,
.icon-btn:focus-visible,
.place-choice:focus-visible,
.place-pill:focus-visible,
.song-badge:focus-visible {
  outline: 4px solid #3B82F6;
  outline-offset: 3px;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon svg {
  width: 26px;
  height: 26px;
}

.hidden {
  display: none !important;
}

/* Compact screen tweaks */
@media (max-height: 740px) {
  .app-shell {
    padding: 12px 16px 16px;
    gap: 10px;
  }

  .move-card {
    padding: 14px 16px 16px;
    gap: 10px;
  }

  .illustration-frame {
    width: min(260px, 64vw);
  }

  .primary-btn {
    padding: 15px 22px;
    font-size: 1.4rem;
  }
}

@media (max-width: 390px) {
  .place-grid {
    grid-template-columns: 1fr;
  }
}
