/* ═══ RESET & GLOBAL ═══ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

html, body {
  overflow: hidden;
  height: 100%;
  width: 100%;
}

/* ═══ CSS CUSTOM PROPERTIES ═══ */
:root {
  --bg: #FFF8F0;
  --clock-face-day: rgba(255,252,245,0.94);
  --clock-face-night: rgba(12,16,38,0.92);
  --hand-hour: #E85D4A;
  --hand-minute: #4A90D9;
  --feedback-correct: #6BCB77;
  --feedback-incorrect: #F4845F;
  --primary-action: #2EC4B6;
  --text-dark: #2D3436;
  --text-muted: #8395A7;
  --badge-day: rgba(255,255,255,0.72);
  --badge-night: rgba(12,16,38,0.7);
  --font: 'Nunito', sans-serif;
}

/* ═══ APP SHELL ═══ */
#app {
  height: 100vh;
  width: 100vw;
  background: var(--bg);
  font-family: var(--font);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#scene-container {
  width: 100%;
  height: 60%;
  position: relative;
  overflow: hidden;
  transition: background 0.8s ease;
}

#bottom-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 20px 16px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ═══ SCENE ELEMENTS ═══ */
.scene-stars {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transition: opacity 1s;
}

.scene-celestial {
  position: absolute;
  border-radius: 50%;
  transition: left 0.8s ease, top 0.8s ease;
}

.scene-sun {
  background: radial-gradient(circle, #FFF4B0 22%, #FFD93D 60%, #F0A020 100%);
  box-shadow: 0 0 32px 14px rgba(255,217,61,0.3);
}

.scene-moon {
  background: #E0D8C0;
  box-shadow: 0 0 18px 6px rgba(224,216,192,0.22);
}

.scene-moon-overlay {
  position: absolute;
  top: -3px;
  left: 8px;
  border-radius: 50%;
  transition: background 0.8s ease;
}

.scene-ground {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 22%;
  transition: background 0.8s ease;
}

.scene-tree {
  position: absolute;
  bottom: 2%;
  left: 50%;
  transform: translateX(-50%);
  width: 92%;
  max-width: 440px;
  pointer-events: none;
  opacity: 0.78;
  transition: filter 0.8s ease;
}

.scene-tree svg {
  width: 100%;
  height: auto;
  display: block;
}

.scene-clock-wrap {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -48%);
  z-index: 5;
}

/* ═══ BADGES ═══ */
.badge {
  position: absolute;
  top: 10px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 800;
  font-family: var(--font);
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background 0.8s, color 0.8s;
}

.badge-period {
  top: auto;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
}

.badge-period-icon {
  font-size: 15px;
}

.badge-metrics {
  right: 10px;
  font-size: 11px;
  font-weight: 700;
  gap: 8px;
}

.badge-sep {
  opacity: 0.5;
}

/* ═══ CLOCK SVG ═══ */
.clock-svg {
  display: block;
  overflow: visible;
}

/* ═══ ANSWER BUTTONS ═══ */
.answer-row {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 580px;
}

.answer-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 320px;
}

.answer-grid-4 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  max-width: 380px;
}

.answer-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 8px;
  font-size: 17px;
  font-family: var(--font);
  font-weight: 800;
  color: var(--text-dark);
  background: white;
  border: 2.5px solid #DDD5CA;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  touch-action: manipulation;
  min-height: 46px;
  outline: none;
  letter-spacing: 0.2px;
}

.answer-label {
  font-size: 17px;
  font-weight: 800;
  white-space: nowrap;
}

.answer-subtitle {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 1px;
  white-space: nowrap;
}

.answer-btn.correct .answer-subtitle {
  color: var(--feedback-correct);
}
.answer-btn.incorrect .answer-subtitle {
  color: rgba(255,255,255,0.85);
}

.answer-btn.dimmed .answer-subtitle {
  color: #B8B0A8;
}

.answer-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.answer-btn.correct {
  background: white;
  border-color: var(--feedback-correct);
  border-width: 2.5px;
  color: var(--feedback-correct);
  transform: scale(1.03);
  box-shadow: none;
}

.answer-btn.incorrect {
  background: var(--feedback-incorrect);
  border-color: var(--feedback-incorrect);
  color: white;
  transform: scale(0.97);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.answer-btn.dimmed {
  background: #F0ECE6;
  border-color: #E0DAD2;
  color: #A09890;
  box-shadow: none;
}

/* ═══ FEEDBACK ═══ */
.feedback-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  margin-bottom: 10px;
}

.feedback-msg-wrap {
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feedback-msg {
  font-size: 16px;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 5px;
  animation: fadeIn 0.2s ease;
}

.feedback-msg.correct {
  color: var(--feedback-correct);
}

.feedback-msg.incorrect {
  color: var(--feedback-incorrect);
}

.feedback-correction {
  font-size: 13px;
  font-weight: 700;
  opacity: 0.7;
}

.prompt-text {
  font-size: 14px;
  color: #6B6560;
  font-weight: 700;
  text-align: center;
  margin: 0;
  line-height: 1.2;
}

/* ═══ MILESTONE POPUP ═══ */
.milestone-popup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--primary-action);
  color: white;
  padding: 10px 24px;
  border-radius: 24px;
  font-size: 18px;
  font-weight: 900;
  font-family: var(--font);
  white-space: nowrap;
  z-index: 25;
  box-shadow: 0 4px 24px rgba(46,196,182,0.5);
  animation: spop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.unlock-notification {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: #333;
  padding: 12px 28px;
  border-radius: 24px;
  font-size: 17px;
  font-weight: 900;
  font-family: var(--font);
  white-space: nowrap;
  z-index: 30;
  box-shadow: 0 4px 24px rgba(255,165,0,0.5);
  animation: spop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.4s, transform 0.4s;
}

.unlock-notification .unlock-icon {
  font-size: 22px;
}

/* ═══ ONBOARDING ═══ */
.onboarding {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  padding: 24px;
}

.onboarding-card {
  background: white;
  border-radius: 24px;
  padding: 40px 32px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
  text-align: center;
  max-width: 360px;
  width: 100%;
}

.onboarding-card h1 {
  font-size: 22px;
  font-weight: 900;
  color: var(--text-dark);
  margin-bottom: 24px;
}

.onboarding-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 18px;
  font-family: var(--font);
  font-weight: 700;
  border: 2.5px solid #DDD5CA;
  border-radius: 14px;
  outline: none;
  text-align: center;
  margin-bottom: 20px;
  -webkit-user-select: text;
  user-select: text;
}

.onboarding-input:focus {
  border-color: var(--primary-action);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 32px;
  font-size: 18px;
  font-family: var(--font);
  font-weight: 800;
  color: white;
  background: var(--primary-action);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  touch-action: manipulation;
  min-height: 46px;
  box-shadow: 0 4px 16px rgba(46,196,182,0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ═══ PHASE SELECTOR ═══ */
.phase-selector {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 160px;
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.phase-greeting {
  font-size: 22px;
  font-weight: 900;
  color: var(--text-dark);
  margin-bottom: 24px;
}

.phase-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 400px;
}

.phase-card {
  background: white;
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  transition: opacity 0.3s;
}

.phase-card.locked {
  opacity: 0.55;
  padding: 14px 20px;
}

.phase-card.locked .phase-card-desc {
  margin-bottom: 0;
}

.phase-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.phase-card-name {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-dark);
}

.phase-lock-icon {
  font-size: 16px;
}

.phase-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 12px;
}

.phase-progress-bar {
  height: 6px;
  background: #EDE8E2;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 14px;
}

.phase-progress-fill {
  height: 100%;
  background: var(--primary-action);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.phase-progress-text {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin: 4px 0 2px;
  text-align: left;
}

.phase-progress-text.unlocked {
  color: var(--feedback-correct);
}

.phase-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  gap: 10px;
}

.info-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font);
  color: var(--text-muted);
  cursor: pointer;
  touch-action: manipulation;
  padding: 4px 0;
  min-height: 38px;
  border: none;
  background: none;
}

.info-toggle .chevron {
  display: inline-block;
  font-size: 10px;
  transition: transform 0.3s ease;
}

.info-toggle.active .chevron {
  transform: rotate(180deg);
}

.btn-play {
  background: var(--primary-action);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 800;
  font-family: var(--font);
  cursor: pointer;
  touch-action: manipulation;
  min-height: 38px;
  box-shadow: 0 2px 10px rgba(46,196,182,0.25);
  transition: transform 0.15s ease;
}

.btn-play:active {
  transform: scale(0.97);
}

.phase-info-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 0;
}

.phase-info-panel.expanded {
  max-height: 500px;
  padding: 10px 0 0;
}

.phase-info-panel p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  font-weight: 600;
  margin-bottom: 6px;
}

.phase-info-panel p:last-child {
  margin-bottom: 0;
}

.phase-modes {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.btn-mode {
  flex: 1;
  padding: 10px 8px;
  font-size: 14px;
  font-family: var(--font);
  font-weight: 800;
  border: 2.5px solid var(--primary-action);
  border-radius: 12px;
  cursor: pointer;
  touch-action: manipulation;
  min-height: 46px;
  transition: all 0.2s ease;
}

.btn-mode-read {
  background: var(--primary-action);
  color: white;
}

.btn-mode-set {
  background: white;
  color: var(--primary-action);
}

.btn-mode-play {
  background: var(--primary-action);
  color: white;
  width: 100%;
}

.btn-mode:active {
  transform: scale(0.97);
}

.gear-btn {
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.06);
  font-size: 20px;
  cursor: pointer;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

/* ═══ GAME HEADER (back button) ═══ */
.game-back-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 8;
  background: rgba(0,0,0,0.15);
  border: none;
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 800;
  font-family: var(--font);
  color: white;
  cursor: pointer;
  touch-action: manipulation;
  min-height: 34px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* ═══ SET MODE ═══ */
.set-target {
  font-size: 18px;
  font-weight: 900;
  color: var(--text-dark);
  margin-bottom: 10px;
  text-align: center;
}

/* ── Set mode controls ── */
.set-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  width: 100%;
}

.set-hint {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-align: center;
}

.set-buttons-row {
  display: grid;
  grid-template-columns: 46px 70px 46px;
  align-items: center;
  justify-items: center;
  gap: 8px;
}

.set-buttons-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 700;
}

.btn-set-adjust {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  font-size: 22px;
  font-family: var(--font);
  font-weight: 900;
  color: var(--primary-action);
  background: white;
  border: 2.5px solid var(--primary-action);
  border-radius: 50%;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.15s ease;
}

.btn-set-adjust:active {
  transform: scale(0.92);
}

.btn-validate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 32px;
  font-size: 17px;
  font-family: var(--font);
  font-weight: 800;
  color: white;
  background: var(--primary-action);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  touch-action: manipulation;
  min-height: 46px;
  box-shadow: 0 4px 16px rgba(46,196,182,0.3);
  transition: transform 0.15s ease, opacity 0.2s ease;
}

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

.btn-validate:active:not(:disabled) {
  transform: scale(0.97);
}

/* ═══ NUMPAD (Phases 5+) ═══ */
.numpad-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  max-width: 280px;
}

.numpad-display {
  width: 100%;
  text-align: center;
  font-size: 22px;
  font-family: var(--font);
  font-weight: 800;
  color: var(--text-dark);
  padding: 4px 12px;
  border: none;
  border-bottom: 3px solid #DDD5CA;
  background: transparent;
  letter-spacing: 2px;
  min-height: 34px;
  outline: none;
  -webkit-user-select: none;
  user-select: none;
}

.numpad-display.placeholder {
  color: var(--text-muted);
  letter-spacing: 0;
}

.numpad-display.error {
  border-bottom-color: var(--feedback-incorrect);
  animation: numpadShake 0.3s ease;
}

.numpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 100%;
}

.numpad-key {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  font-size: 20px;
  font-family: var(--font);
  font-weight: 800;
  color: var(--text-dark);
  background: white;
  border: 2px solid #E8E2DB;
  border-radius: 10px;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.1s ease, background 0.1s ease;
}

.numpad-key:active {
  transform: scale(0.93);
  background: #F5F0EB;
}

.numpad-key-back {
  font-size: 22px;
}

.numpad-validate {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 8px;
  margin-top: 2px;
  font-size: 17px;
  font-family: var(--font);
  font-weight: 800;
  color: white;
  background: var(--primary-action);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  touch-action: manipulation;
  min-height: 46px;
  box-shadow: 0 3px 12px rgba(46,196,182,0.25);
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.numpad-validate:disabled {
  opacity: 0.4;
  cursor: default;
}

.numpad-validate:active:not(:disabled) {
  transform: scale(0.97);
}

.numpad-feedback {
  font-size: 13px;
  font-weight: 700;
  color: var(--feedback-incorrect);
  min-height: 18px;
  text-align: center;
}

.numpad-correction {
  text-align: center;
  margin-top: 2px;
}

.numpad-correction-typed {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-dark);
}

.numpad-correction-spoken {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

@keyframes numpadShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}

/* ═══ CONTINUE BUTTON (wrong answer) ═══ */
.btn-continue-next {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 280px;
  margin: 8px auto 0;
  padding: 10px;
  font-size: 17px;
  font-family: var(--font);
  font-weight: 800;
  color: #5DADE2;
  background: white;
  border: 2.5px solid #5DADE2;
  border-radius: 12px;
  cursor: pointer;
  touch-action: manipulation;
  min-height: 46px;
  box-shadow: none;
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.btn-continue-next:active {
  transform: scale(0.97);
}

/* ═══ BREAK OVERLAY ═══ */
.break-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.break-card {
  background: white;
  border-radius: 24px;
  padding: 36px 28px;
  text-align: center;
  max-width: 340px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.break-card h2 {
  font-size: 18px;
  font-weight: 900;
  color: var(--text-dark);
  margin-bottom: 24px;
  line-height: 1.4;
}

.break-buttons {
  display: flex;
  gap: 12px;
}

.break-buttons button {
  flex: 1;
  padding: 12px 8px;
  font-size: 15px;
  font-family: var(--font);
  font-weight: 800;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
  min-height: 46px;
}

.btn-continue {
  background: var(--primary-action);
  color: white;
}

.btn-stop {
  background: #EDE8E2;
  color: var(--text-dark);
}

/* ═══ PARENT DASHBOARD ═══ */
.dashboard {
  padding: 24px 16px;
  max-width: 600px;
  margin: 0 auto;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  -webkit-user-select: text;
  user-select: text;
}

.dashboard h1 {
  font-size: 20px;
  font-weight: 900;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.dashboard-sub {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 24px;
}

.dashboard-section {
  background: white;
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}

.dashboard-section h2 {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 12px;
}

.dashboard-stat {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  font-weight: 700;
  color: #6B6560;
  border-bottom: 1px solid #F0ECE6;
}

.dashboard-stat:last-child {
  border-bottom: none;
}

.dashboard-stat-value {
  color: var(--text-dark);
  font-weight: 800;
}

.dashboard-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 100px;
  padding-top: 10px;
}

.dashboard-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.dashboard-bar-fill {
  width: 100%;
  max-width: 40px;
  background: var(--primary-action);
  border-radius: 6px 6px 0 0;
  transition: height 0.5s ease;
}

.dashboard-bar-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.btn-reset {
  display: block;
  width: 100%;
  padding: 14px;
  margin-top: 16px;
  font-size: 14px;
  font-family: var(--font);
  font-weight: 800;
  color: var(--feedback-incorrect);
  background: white;
  border: 2px solid var(--feedback-incorrect);
  border-radius: 14px;
  cursor: pointer;
  touch-action: manipulation;
  min-height: 46px;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  font-size: 14px;
  font-family: var(--font);
  font-weight: 800;
  color: var(--text-dark);
  background: #EDE8E2;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  touch-action: manipulation;
  min-height: 46px;
  margin-bottom: 20px;
}

/* ═══ DRAG FEEDBACK ═══ */
.hand-pulse {
  animation: handPulse 0.3s ease;
}

.hand-wobble {
  animation: handWobble 0.4s ease;
}

/* ═══ KEYFRAMES ═══ */
@keyframes spop {
  0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
  60% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes fadeIn {
  0% { opacity: 0; transform: translateY(3px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes handPulse {
  0% { stroke-width: inherit; }
  50% { stroke-width: calc(inherit * 1.4); }
  100% { stroke-width: inherit; }
}

@keyframes handWobble {
  0% { transform: rotate(0deg); }
  25% { transform: rotate(5deg); }
  50% { transform: rotate(-5deg); }
  75% { transform: rotate(3deg); }
  100% { transform: rotate(0deg); }
}

/* ═══ RESPONSIVE ═══ */

/* Mobile: scene 50%, bottom panel 50% */
@media (max-height: 700px) {
  #scene-container {
    height: 45%;
  }
  #bottom-panel {
    padding: 8px 12px 4px;
  }
  .feedback-area {
    margin-bottom: 2px;
  }
  .answer-btn {
    padding: 8px 6px;
    min-height: 42px;
  }
  .answer-label {
    font-size: 15px;
  }
  .answer-col {
    gap: 6px;
  }
  .set-target {
    font-size: 16px;
    margin-bottom: 6px;
  }
  .numpad-wrap {
    gap: 2px;
    max-width: 240px;
  }
  .numpad-key {
    height: 36px;
    font-size: 18px;
  }
  .numpad-display {
    font-size: 19px;
    min-height: 28px;
    padding: 2px 8px;
  }
  .numpad-validate {
    padding: 6px;
    min-height: 36px;
    font-size: 15px;
  }
  .numpad-grid {
    gap: 3px;
  }
}

@media (max-height: 900px) and (min-height: 701px) {
  #scene-container {
    height: 50%;
  }
  #bottom-panel {
    padding: 16px 14px 12px;
  }
  .feedback-area {
    margin-bottom: 6px;
  }
}

@media (min-width: 520px) {
  .answer-col {
    flex-direction: row;
    max-width: 580px;
    gap: 10px;
  }
  .answer-grid-4 {
    max-width: 500px;
  }
}

@media (min-width: 1024px) {
  #scene-container {
    height: 60vh;
  }
}

/* Safe area for phones with bottom bars */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  #bottom-panel {
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}
