/* ==========================================================================
   ENTER Timing Challenge - Cute Bubbly Design System & Stylesheet
   ========================================================================== */

/* --- CSS Variables & Cute Color Pastels --- */
:root {
  --primary-pink: #facc15;
  --primary-pink-hover: #eab308;
  --primary-pink-glow: rgba(250, 204, 21, 0.4);
  
  --pastel-mint: #fef08a;
  --pastel-cyan: #fffbeb;
  --pastel-yellow: #fef3c7;
  --pastel-purple: #fffbeb;
  --pastel-orange: #fbbf24;
  
  --bg-peach: #fffbeb;
  --bg-cream: #fffbeb;
  --card-bg: rgba(255, 255, 255, 0.94);
  --card-border: rgba(234, 179, 8, 0.25);
  
  --text-dark: #451a03;
  --text-soft: #78350f;
  --text-muted: #b45309;
  
  --font-title: 'Fredoka', sans-serif;
  --font-body: 'Nunito', sans-serif;
  
  --slow-mo-multiplier: 1s;
}

/* --- Base Styles & Reset --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-peach);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* --- Cute Pastel Ambient Background overlays --- */
.cute-gradient-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at 10% 20%, #fffbeb 0%, #fef9c3 44%, #fef3c7 93%);
  z-index: -3;
}

/* Floating Bubble Layer */
.bubble-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: -2;
  overflow: hidden;
}

.floating-bubble {
  position: absolute;
  bottom: -100px;
  left: var(--left);
  width: var(--size);
  height: var(--size);
  background: rgba(255, 255, 255, 0.45);
  border: 2px solid rgba(255, 182, 193, 0.35);
  border-radius: 50%;
  animation: floatUp var(--duration) linear infinite;
  animation-delay: var(--delay);
}

.floating-bubble::before {
  content: '';
  position: absolute;
  top: 15%;
  left: 15%;
  width: 30%;
  height: 30%;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
}

@keyframes floatUp {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.8;
  }
  90% {
    opacity: 0.8;
  }
  100% {
    transform: translateY(-110vh) translateX(50px) rotate(360deg);
    opacity: 0;
  }
}

/* Clouds drifting in background */
.clouds-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: -2;
  overflow: hidden;
}

.cloud {
  position: absolute;
  background: #ffffff;
  border-radius: 100px;
  opacity: 0.7;
}

.cloud::before, .cloud::after {
  content: '';
  position: absolute;
  background: #ffffff;
  border-radius: 50%;
}

.cloud-1 {
  width: 120px;
  height: 40px;
  top: 15%;
  left: -150px;
  animation: driftRight 45s linear infinite;
}
.cloud-1::before { width: 50px; height: 50px; top: -20px; left: 15px; }
.cloud-1::after { width: 70px; height: 70px; top: -35px; left: 45px; }

.cloud-2 {
  width: 150px;
  height: 50px;
  top: 60%;
  left: -200px;
  animation: driftRight 60s linear infinite;
  animation-delay: -15s;
}
.cloud-2::before { width: 60px; height: 60px; top: -25px; left: 20px; }
.cloud-2::after { width: 80px; height: 80px; top: -40px; left: 55px; }

@keyframes driftRight {
  0% { transform: translateX(0); }
  100% { transform: translateX(calc(100vw + 350px)); }
}

canvas#fx-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10;
  pointer-events: none;
}

/* Cute wobble screen shake */
.shake-anim {
  animation: cuteWobble 0.5s ease-in-out;
}

@keyframes cuteWobble {
  0%, 100% { transform: rotate(0deg) scale(1); }
  15% { transform: rotate(-3deg) scale(1.02); }
  30% { transform: rotate(2.5deg) scale(1.02); }
  45% { transform: rotate(-2deg) scale(1.01); }
  60% { transform: rotate(1.5deg) scale(1.01); }
  75% { transform: rotate(-0.5deg) scale(1); }
}

/* --- Ambient Border (For Perfect state) --- */
.ambient-border {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: 0px solid transparent;
  pointer-events: none;
  z-index: 9;
  transition: border-width 0.3s ease;
}

.ambient-border.active-perfect {
  border-width: 12px;
  animation: borderCuteRun 3s linear infinite;
}

@keyframes borderCuteRun {
  0%, 100% {
    border-color: #facc15;
    box-shadow: inset 0 0 15px rgba(250, 204, 21, 0.6), 0 0 15px rgba(250, 204, 21, 0.6);
  }
  33% {
    border-color: #fbbf24;
    box-shadow: inset 0 0 15px rgba(251, 191, 36, 0.6), 0 0 15px rgba(251, 191, 36, 0.6);
  }
  66% {
    border-color: #ffd166;
    box-shadow: inset 0 0 15px rgba(255, 209, 102, 0.6), 0 0 15px rgba(255, 209, 102, 0.6);
  }
}

/* --- Container Layout --- */
.game-container {
  width: 100%;
  max-width: 1550px; /* Massive arcade cabinet sizing */
  margin: 20px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  z-index: 5;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.4s ease;
}

/* Slow Motion squishy scaling */
body.slow-mo .game-container {
  transform: scale(0.95);
  filter: saturate(1.2);
}

/* --- Cute Sweet Cards --- */
.cute-card {
  background: var(--card-bg);
  border: 3px solid var(--card-border);
  box-shadow: 
    0 12px 24px rgba(255, 143, 163, 0.12),
    0 2px 4px rgba(255, 143, 163, 0.05),
    inset 0 4px 0 rgba(255, 255, 255, 0.8);
  border-radius: 28px;
  position: relative;
  overflow: hidden;
}

/* Add a scalloped style colored band on top of cute cards */
.cute-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, #fde047, #facc15, #fbbf24, #f59e0b);
}

/* --- Header Section --- */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px;
  margin-bottom: 8px;
}

.header-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.brand {
  display: flex;
  flex-direction: column;
}

.brand-sub {
  font-family: var(--font-title);
  font-size: 0.75rem;
  letter-spacing: 1px;
  color: var(--text-soft);
  font-weight: 600;
}

.brand-title {
  font-family: var(--font-title);
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.1;
}

.glow-peach {
  color: #ea580c;
  text-shadow: 0 2px 0 #ffedd5;
}

.glow-mint {
  color: #ca8a04;
  text-shadow: 0 2px 0 #fef9c3;
}

/* Cute Pill sound button */
.cute-icon-btn {
  background: #ffffff;
  border: 2px solid var(--card-border);
  color: var(--text-dark);
  padding: 10px 18px;
  border-radius: 50px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.85rem;
  box-shadow: 0 4px 0 rgba(250, 204, 21, 0.2);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cute-icon-btn:hover {
  background: #fffbeb;
  border-color: #facc15;
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 0 rgba(250, 204, 21, 0.28);
}

.cute-icon-btn:active {
  transform: translateY(2px) scale(0.98);
  box-shadow: 0 2px 0 rgba(250, 204, 21, 0.15);
}

.sound-emoji {
  font-size: 1.1rem;
}

/* --- Setup Panel Section --- */
.setup-panel {
  display: flex;
  padding: 24px;
  gap: 24px;
}

.panel-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-divider {
  width: 3px;
  background: radial-gradient(circle, var(--card-border) 20%, transparent 60%);
  background-size: 3px 15px;
}

.section-title {
  font-family: var(--font-title);
  font-size: 0.85rem;
  color: var(--text-soft);
  font-weight: 600;
}

/* Preset Buttons */
.presets-container {
  justify-content: center;
}

.preset-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.preset-btn {
  background: #ffffff;
  border: 2px solid rgba(0, 0, 0, 0.06);
  border-radius: 18px;
  padding: 10px;
  color: var(--text-dark);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.04);
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.preset-emoji {
  font-size: 1.3rem;
  margin-bottom: 2px;
  transition: transform 0.2s;
}

.preset-label {
  font-family: var(--font-title);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
}

.preset-val {
  font-size: 0.85rem;
  font-weight: 800;
}

.preset-btn:hover {
  border-color: var(--btn-color, var(--primary-pink));
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.06);
}

.preset-btn:hover .preset-emoji {
  transform: scale(1.15) rotate(5deg);
}

.preset-btn.active {
  background: #fff;
  border-color: var(--btn-color, var(--primary-pink));
  border-width: 3px;
  box-shadow: 
    0 6px 0 var(--btn-color, var(--primary-pink-glow)),
    inset 0 -2px 0 rgba(0, 0, 0, 0.05);
  transform: translateY(-3px);
}

.preset-btn.active .preset-label {
  color: var(--btn-color, var(--primary-pink));
}

.preset-btn.active .preset-emoji {
  transform: scale(1.2) rotate(-5deg);
}

/* Custom Inputs Bubbly Style */
.time-inputs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: #fbf6f0;
  padding: 16px 32px;
  border-radius: 20px;
  border: 2px dashed rgba(255, 143, 163, 0.2);
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

.input-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.input-group label {
  font-family: var(--font-title);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-soft);
}

.stepper {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 2px solid rgba(255, 143, 163, 0.2);
  border-radius: 12px;
  overflow: hidden;
  width: 100%;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.step-btn {
  background: transparent;
  border: none;
  font-size: 0.75rem;
  width: 26px;
  height: 32px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background 0.2s, transform 0.1s;
}

.step-btn:hover {
  background: #fff2f4;
  transform: scale(1.1);
}

.step-btn:active {
  transform: scale(0.9);
}

.stepper input {
  background: transparent;
  border: none;
  color: #ff5c7a;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 800;
  width: 100%;
  text-align: center;
  padding: 2px 0;
  outline: none;
  -moz-appearance: textfield;
}

.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.colon-divider {
  font-family: var(--font-title);
  color: var(--text-muted);
  font-size: 1.3rem;
  margin-top: 20px;
  animation: cuteBlink 1.5s infinite;
}

@keyframes cuteBlink {
  0%, 100% { opacity: 0.3; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* --- Screen Panel Section --- */
.screen-panel {
  padding: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

/* Target banner */
.target-banner-cute {
  background: #fff9e6;
  border: 2px solid #ffd166;
  padding: 10px 28px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 0 rgba(255, 209, 102, 0.25);
  animation: floatSmall 4s ease-in-out infinite;
}

@keyframes floatSmall {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.target-tag-cute {
  font-family: var(--font-title);
  font-size: 0.75rem;
  font-weight: 700;
  color: #e29578;
}

.target-time-cute {
  font-family: var(--font-body);
  font-size: 1.25rem;
  font-weight: 900;
  color: #ff5c7a;
}

/* Bubbly stopwatch frame */
.stopwatch-bubble-container {
  width: 100%;
  position: relative;
  border-radius: 64px;
  background: #ffffff;
  border: 6px solid #fef08a;
  box-shadow: 
    0 25px 50px rgba(250, 204, 21, 0.2),
    0 2px 4px rgba(0, 0, 0, 0.02),
    inset 0 -12px 0 rgba(254, 240, 138, 0.35);
  padding: 12px;
  overflow: hidden;
}

.stopwatch-bubble-container::before {
  content: '';
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  height: 35%;
  background: linear-gradient(
    rgba(255, 255, 255, 0.6) 0%,
    rgba(255, 255, 255, 0.05) 100%
  );
  border-radius: 52px 52px 0 0;
  pointer-events: none;
  z-index: 2;
}

.stopwatch-screen {
  background: radial-gradient(circle, #fffdf0 0%, #fffbeb 100%);
  padding: 85px 20px;
  border-radius: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  border: 2.5px solid rgba(234, 179, 8, 0.18);
}

.time-digits {
  font-family: var(--font-body);
  font-size: clamp(5.5rem, 21vw, 16.5rem); /* Extremely massive jumbo digits clock */
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  letter-spacing: -2px;
  color: #8c7a7a;
  transition: color 0.3s, transform 0.3s;
}

#timer-mm {
  color: #3b82f6; /* Bright sky blue */
  text-shadow: 0 5px 0 #dbeafe;
  transition: all 0.3s ease;
}

#timer-ss {
  color: #ec4899; /* Bright sweet pink */
  text-shadow: 0 5px 0 #fce7f3;
  transition: all 0.3s ease;
}

#timer-ms {
  color: #eab308; /* Bright yellow */
  text-shadow: 0 5px 0 #fef9c3;
  transition: all 0.3s ease;
}

/* Run visual changes: text becomes bright/colorful and pulses */
.stopwatch-bubble-container.running .time-digits {
  animation: clockHeartbeat 1.2s infinite;
}

.stopwatch-bubble-container.running #timer-mm {
  color: #06b6d4; /* Vibrant cyan */
  text-shadow: 0 0 15px rgba(6, 182, 212, 0.7), 0 0 35px rgba(6, 182, 212, 0.4);
}

.stopwatch-bubble-container.running #timer-ss {
  color: #ff0055; /* Vibrant pink */
  text-shadow: 0 0 15px rgba(255, 0, 85, 0.7), 0 0 35px rgba(255, 0, 85, 0.4);
}

.stopwatch-bubble-container.running #timer-ms {
  color: #f59e0b; /* Vibrant gold */
  text-shadow: 0 0 15px rgba(245, 158, 11, 0.7), 0 0 35px rgba(245, 158, 11, 0.4);
}

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

.digit-group {
  letter-spacing: 1px;
  display: inline-block;
  min-width: 2ch;
  text-align: center;
}

.time-sep {
  color: #dcd0c9;
  font-size: 0.92em; /* Scales relatively to prevent overflow */
  margin-top: -0.06em;
}

.stopwatch-bubble-container.running .time-sep {
  color: #fef08a;
  text-shadow: 0 0 10px rgba(254, 240, 138, 0.5);
}

.highlight-ms {
  /* Inherits scale automatically */
}

.time-labels {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  width: 100%;
  max-width: 1080px; /* Extended to match the wider giant clock */
  text-align: center;
  font-family: var(--font-title);
  font-size: clamp(0.8rem, 2.2vw, 1.35rem); /* Increased size to match giant digits */
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1.5px;
}

.stopwatch-bubble-container.running .time-labels {
  color: #fbbf24;
}

.time-labels-cute {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  max-width: 580px;
  text-align: center;
  font-family: var(--font-title);
  font-size: clamp(0.6rem, 1.8vw, 0.95rem);
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1.5px;
}

.stopwatch-bubble-container.running .time-labels-cute {
  color: #fbbf24;
}

/* Tip styling */
.keyboard-tip {
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  color: var(--text-soft);
  height: 24px;
}

.pulse-cute-glow {
  display: inline-block;
  animation: pulseCute 2s infinite ease-in-out;
}

@keyframes pulseCute {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.04); opacity: 1; color: #ff5c7a; }
}

/* Cute Buttons */
.action-buttons {
  display: flex;
  gap: 15px;
  width: 100%;
}

.cute-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-inner {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 52px;
  border-radius: 50px;
  color: #fff;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1rem;
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.35);
  transition: all 0.2s;
}

/* Yellow btn (START) */
.btn-primary-cute .btn-inner {
  background: linear-gradient(135deg, #fef08a 0%, #eab308 100%);
  border: 2px solid #d97706;
  color: #451a03;
}
.btn-primary-cute {
  box-shadow: 0 6px 0 #fbbf24, 0 10px 20px rgba(217, 119, 6, 0.2);
}
.btn-primary-cute:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #fbbf24, 0 12px 22px rgba(217, 119, 6, 0.25);
}

/* Tangerine btn (STOP) */
.btn-danger-cute .btn-inner {
  background: linear-gradient(135deg, #fed7aa 0%, #ea580c 100%);
  border: 2px solid #c2410c;
  color: #ffffff;
}
.btn-danger-cute {
  box-shadow: 0 6px 0 #f97316, 0 10px 20px rgba(234, 88, 12, 0.2);
}
.btn-danger-cute:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #f97316, 0 12px 22px rgba(234, 88, 12, 0.25);
}

/* Cream btn (RESET) */
.btn-secondary-cute .btn-inner {
  background: #ffffff;
  border: 2px solid #fef08a;
  color: var(--text-dark);
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.8);
}
.btn-secondary-cute {
  box-shadow: 0 6px 0 #fef3c7, 0 10px 15px rgba(0, 0, 0, 0.05);
}
.btn-secondary-cute:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 0 #fef3c7, 0 12px 18px rgba(0, 0, 0, 0.08);
}

/* Active clicks */
.cute-btn:active:not(:disabled) {
  transform: translateY(4px) !important;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1) !important;
}

/* Disabled buttons */
.cute-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}
.cute-btn:disabled .btn-inner {
  background: #eee !important;
  border-color: #ddd !important;
  color: #bbb !important;
  box-shadow: none !important;
}

/* Bouncy Modal Buttons */
.pulse-cute-btn {
  animation: pulseCuteBtn 2s infinite ease-in-out;
}

@keyframes pulseCuteBtn {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); box-shadow: 0 8px 0 #ff8fa3, 0 12px 24px rgba(255, 77, 109, 0.3); }
}

/* --- Footer Guidelines --- */
.game-footer {
  display: flex;
  flex-direction: column;
  gap: 15px;
  align-items: center;
  text-align: center;
}

.guide-text {
  font-size: 0.85rem;
  color: var(--text-soft);
  line-height: 1.6;
}

.guide-text code {
  background: #ffffff;
  border: 1.5px solid rgba(255, 143, 163, 0.2);
  padding: 3px 8px;
  border-radius: 8px;
  color: #ff5c7a;
  font-family: var(--font-title);
  font-size: 0.75rem;
}

.accuracy-criteria {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.badge {
  font-family: var(--font-title);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 50px;
}

.badge.perfect {
  background: #fff9e6;
  color: #d4a373;
  border: 2px solid #ffe8a3;
}

.badge.amazing {
  background: #fff0f3;
  color: #ff4d6d;
  border: 2px solid #ffccd5;
}

.badge.great {
  background: #e6f9f7;
  color: #1a938a;
  border: 2px solid #bbf2e6;
}

.badge.try-again {
  background: #fdfaf7;
  color: var(--text-muted);
  border: 2px dashed #e8e2db;
}

/* --- Result Modal (Cute Sweet Pop-up) --- */
.result-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(92, 79, 79, 0.45);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  transition: opacity 0.3s ease;
}

.result-card-cute {
  width: 100%;
  max-width: 720px; /* Increased from 440px to look grand and full screen on desktops */
  padding: 44px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
  border-width: 4px;
  border-radius: 36px !important;
  box-shadow: 
    0 24px 48px rgba(92, 79, 79, 0.25),
    inset 0 4px 0 #fff;
}

/* Huge Stopped Time Display in Popup */
.result-time-huge-container {
  background: #ffffff;
  border: 3px solid rgba(255, 143, 163, 0.15);
  border-radius: 24px;
  padding: 14px 20px;
  width: 100%;
  box-shadow: 0 8px 16px rgba(255, 143, 163, 0.04);
}

.result-time-huge-label {
  font-family: var(--font-title);
  font-size: 0.8rem;
  color: var(--text-soft);
  display: block;
  margin-bottom: 4px;
  letter-spacing: 0.5px;
}

.result-time-huge {
  font-family: var(--font-body);
  font-size: clamp(3.6rem, 15vw, 9.2rem); /* Substantially scaled up */
  font-weight: 900;
  letter-spacing: 2px;
  display: inline-block;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.08));
  margin: 10px 0;
}

.card-perfect .result-time-huge {
  background: linear-gradient(135deg, #ca8a04 0%, #fde047 30%, #eab308 60%, #ea580c 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: #ca8a04; /* Fallback */
}
.card-amazing .result-time-huge {
  background: linear-gradient(135deg, #ea580c 0%, #facc15 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: #ea580c; /* Fallback */
}
.card-great .result-time-huge {
  background: linear-gradient(135deg, #d97706 0%, #fef08a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: #d97706; /* Fallback */
}
.card-try-again .result-time-huge {
  background: linear-gradient(135deg, #854d0e 0%, #fbbf24 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: #854d0e; /* Fallback */
}

/* Pop-up float decoration */
.card-floating-decor {
  font-size: 1.5rem;
  line-height: 1;
  animation: cuteFloat 3s ease-in-out infinite;
}

@keyframes cuteFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-5px) rotate(3deg); }
}

/* Result modal colors based on categories */
.result-card-cute.card-perfect {
  background: #fffdf5;
  border-color: #facc15;
}
.result-card-cute.card-amazing {
  background: #fffdf5;
  border-color: #fbbf24;
}
.result-card-cute.card-great {
  background: #fffdf5;
  border-color: #fef08a;
}
.result-card-cute.card-try-again {
  background: #fffdfb;
  border-color: #eab308;
}

.result-badge {
  font-family: var(--font-title);
  font-size: 2.2rem;
  font-weight: 700;
}

/* Badge animations based on category */
.result-card-cute.card-perfect .result-badge {
  color: #cca43b;
  animation: bounceCute 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) infinite alternate;
}
.result-card-cute.card-amazing .result-badge {
  color: #ff4d6d;
  animation: bounceCute 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) infinite alternate;
}
.result-card-cute.card-great .result-badge {
  color: #1a938a;
}
.result-card-cute.card-try-again .result-badge {
  color: var(--text-soft);
}

@keyframes bounceCute {
  0% { transform: scale(0.95); }
  100% { transform: scale(1.08) translateY(-3px); }
}

/* Result Comparison Area */
.result-comparison {
  background: #ffffff;
  border: 2px dashed rgba(255, 143, 163, 0.15);
  border-radius: 20px;
  width: 100%;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.01);
}

.comp-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.comp-label {
  font-family: var(--font-title);
  font-size: 0.78rem;
  color: var(--text-soft);
}

.comp-val {
  font-size: 1.05rem;
  font-weight: 900;
}

.val-target {
  color: #ff8fa3;
}

.val-stopped {
  color: var(--text-dark);
}

.comp-divider {
  height: 2px;
  background: radial-gradient(circle, rgba(0,0,0,0.05) 10%, transparent 60%);
  background-size: 6px 2px;
}

.diff-row {
  padding-top: 4px;
}

.diff-row .comp-val {
  font-size: 1.25rem;
}

/* Diff values color coding */
.result-card-cute.card-perfect .diff-row .comp-val { color: #d4a373; }
.result-card-cute.card-amazing .diff-row .comp-val { color: #ff4d6d; }
.result-card-cute.card-great .diff-row .comp-val { color: #1a938a; }
.result-card-cute.card-try-again .diff-row .comp-val { color: var(--text-muted); }

.result-message {
  font-size: 0.88rem;
  color: var(--text-soft);
  line-height: 1.6;
  max-width: 320px;
  margin: 0 auto;
}

.modal-buttons {
  display: flex;
  gap: 12px;
  width: 100%;
  margin-top: 10px;
}

.modal-buttons .cute-btn {
  flex: 1;
}

.animate-pop {
  animation: popCute 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes popCute {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* --- Responsive Adaptations --- */
@media (max-width: 768px) {
  .brand-title {
    font-size: 1.8rem;
  }
  
  .setup-panel {
    flex-direction: column;
    gap: 16px;
  }
  
  .panel-divider {
    height: 3px;
    width: 100%;
    background: radial-gradient(circle, var(--card-border) 20%, transparent 60%);
    background-size: 15px 3px;
  }
  
  .time-digits {
    font-size: 3.8rem;
  }
  
  .time-sep {
    font-size: 3.2rem;
  }
  
  .highlight-ms {
    font-size: 3.2rem;
  }
}

@media (max-width: 480px) {
  .time-digits {
    font-size: 2.8rem;
  }
  
  .time-sep {
    font-size: 2.4rem;
  }
  
  .highlight-ms {
    font-size: 2.4rem;
  }
  
  .action-buttons {
    flex-direction: column;
    gap: 10px;
  }
  
  .action-buttons .cute-btn {
    width: 100%;
  }
  
  .modal-buttons {
    flex-direction: column;
  }
}

@media (max-width: 580px) {
  .game-header {
    flex-direction: column;
    gap: 12px;
    align-items: center;
    text-align: center;
  }
}

/* --- Global Utility Classes --- */
.hidden {
  display: none !important;
}
