:root {
  --pink: #ff8fc7;
  --pink-soft: #ffd6ec;
  --turquoise: #4fd6c4;
  --turquoise-soft: #c9f7ef;
  --yellow: #ffd54f;
  --purple: #a78bfa;
  --purple-dark: #6d4fb5;
  --coral: #ff6f6f;
  --blue: #4f9dfb;
  --text-dark: #4a3a66;
  --white: #fffdf9;
  --radius-lg: 28px;
  --radius-md: 18px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

body {
  font-family: 'Nunito', 'Comic Sans MS', system-ui, sans-serif;
  background: linear-gradient(160deg, var(--pink-soft) 0%, var(--turquoise-soft) 50%, #fff8e1 100%);
  color: var(--text-dark);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  overflow-x: hidden;
}

.app {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: clamp(10px, 3vw, 24px);
  gap: clamp(10px, 2vw, 18px);
}

/* ---------- Header ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 12px 20px;
  box-shadow: 0 8px 0 rgba(167, 139, 250, 0.25);
}

.logo {
  font-size: clamp(1.3rem, 4vw, 1.9rem);
  font-weight: 900;
  color: var(--purple-dark);
  margin: 0;
}

.stars-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--yellow);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 800;
  font-size: clamp(1.1rem, 3.5vw, 1.5rem);
  color: #7a5a00;
  box-shadow: 0 4px 0 rgba(122, 90, 0, 0.2);
}

.star-icon {
  font-size: 1.2em;
}

.stars-badge.pop {
  animation: starPop 0.5s ease;
}

@keyframes starPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.35) rotate(8deg); }
  70% { transform: scale(0.95) rotate(-4deg); }
  100% { transform: scale(1) rotate(0); }
}

/* ---------- Message ---------- */
.message {
  text-align: center;
  font-size: clamp(1.05rem, 3.2vw, 1.4rem);
  font-weight: 700;
  color: var(--purple-dark);
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  margin: 0;
  box-shadow: 0 5px 0 rgba(167, 139, 250, 0.18);
  transition: transform 0.2s ease;
}

/* ---------- Game card ---------- */
.game-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: clamp(16px, 4vw, 30px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(16px, 3vw, 26px);
  box-shadow: 0 10px 0 rgba(255, 143, 199, 0.25);
}

.challenge-area {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

/* ---------- Analog clock (SVG) ---------- */
.clock-svg {
  display: block;
}

.big-clock {
  width: min(72vw, 56vh, 340px);
  height: min(72vw, 56vh, 340px);
}

.small-clock {
  width: min(28vw, 110px);
  height: min(28vw, 110px);
}

.clock-face {
  fill: #fffaf0;
  stroke: var(--purple);
  stroke-width: 4;
}

.clock-number {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 17px;
  fill: var(--purple-dark);
}

.clock-tick {
  stroke: #c9bce6;
  stroke-width: 3;
  stroke-linecap: round;
}

.clock-hand {
  stroke-linecap: round;
}

.hour-hand {
  stroke: var(--coral);
  stroke-width: 9;
}

.minute-hand {
  stroke: var(--blue);
  stroke-width: 5;
}

.clock-center {
  fill: var(--coral);
}

/* ---------- Digital display (for "modo inverso") ---------- */
.digital-display {
  font-size: clamp(3rem, 13vw, 5.5rem);
  font-weight: 900;
  color: var(--purple-dark);
  background: var(--turquoise-soft);
  border-radius: var(--radius-md);
  padding: 10px 30px;
  letter-spacing: 2px;
}

/* ---------- Options ---------- */
.options-area {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  width: 100%;
}

.option-btn {
  font-family: inherit;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background-color 0.2s ease;
}

.option-btn:focus-visible {
  outline: 3px solid var(--purple-dark);
  outline-offset: 2px;
}

/* Digital-time options (modo normal) */
.digital-options {
  flex-direction: column;
  max-width: 360px;
  margin: 0 auto;
}

.digital-option {
  width: 100%;
  background: var(--turquoise);
  color: #fff;
  font-size: clamp(1.4rem, 5vw, 1.9rem);
  font-weight: 800;
  padding: 16px 10px;
  box-shadow: 0 6px 0 #2bab98;
}

.digital-option:hover {
  background: #3fc6b3;
}

.digital-option:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #2bab98;
}

/* Clock options (modo inverso) */
.clock-options {
  justify-content: center;
}

.clock-option {
  background: var(--purple-soft, #ede7fb);
  padding: 10px;
  box-shadow: 0 6px 0 #8b6fd6;
}

.clock-option:hover {
  background: #e2d9fb;
}

.clock-option:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #8b6fd6;
}

/* Feedback states */
.option-btn.wrong {
  animation: shake 0.4s ease;
  background-color: #ffd6d6 !important;
  box-shadow: 0 6px 0 #e08a8a !important;
}

.option-btn.correct-flash {
  animation: correctPop 0.5s ease;
  background-color: #b9f6c5 !important;
  box-shadow: 0 6px 0 #57c97a !important;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

@keyframes correctPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* ---------- Footer ---------- */
.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  text-align: center;
  font-size: 0.85rem;
  color: #8a7aab;
  padding: 6px 0 16px;
}

.reset-link {
  background: none;
  border: none;
  color: #8a7aab;
  text-decoration: underline;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px;
}

.reset-link:hover {
  color: var(--purple-dark);
}

/* ---------- Confetti ---------- */
.confetti-layer {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 999;
}

.confetti-piece {
  position: absolute;
  top: -16px;
  width: 10px;
  height: 14px;
  opacity: 0.95;
  border-radius: 2px;
  animation-name: confettiFall;
  animation-timing-function: ease-in;
  animation-fill-mode: forwards;
}

@keyframes confettiFall {
  to {
    transform: translateY(105vh) rotate(var(--rot, 360deg));
    opacity: 0.85;
  }
}

/* ---------- Responsive tweaks ---------- */
@media (min-width: 560px) {
  .digital-options {
    max-width: 420px;
  }
}

@media (max-width: 380px) {
  .logo {
    font-size: 1.2rem;
  }
}
