/* The Exodus Trail — kid-friendly retro desert aesthetic */

:root {
  --sand: #f4e4bc;
  --sand-dark: #e8c98a;
  --clay: #c47b4a;
  --night: #1a2744;
  --deep: #0f1a2e;
  --sky: #5eb3e4;
  --gold: #f0c14e;
  --green: #3d9a6a;
  --red: #d94f3d;
  --blue: #3a8fd6;
  --purple: #7b5ea7;
  --cream: #fff8e7;
  --ink: #1f2430;
  --muted: #5c6578;
  --panel: rgba(255, 248, 231, 0.96);
  --shadow: 0 12px 40px rgba(15, 26, 46, 0.25);
  --radius: 18px;
  --font-display: "Press Start 2P", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, sans-serif;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(ellipse at 20% 0%, #3d5a80 0%, transparent 50%),
    radial-gradient(ellipse at 80% 10%, #c47b4a55 0%, transparent 40%),
    linear-gradient(180deg, #1a2744 0%, #3d5a80 35%, #c47b4a 70%, #e8c98a 100%);
  background-attachment: fixed;
}

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 16px;
  padding-top: 72px; /* room for sound + voice controls */
}

#app {
  width: min(720px, 100%);
  position: relative;
}

/* Top controls — sound + voice */
.top-controls {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 200;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: min(100vw - 16px, 420px);
}

.btn-mute,
.btn-voice,
.btn-read {
  margin: 0;
  min-height: 36px;
  padding: 6px 10px;
  font-size: 0.78rem;
  background: var(--panel);
  color: var(--night);
  box-shadow: 2px 2px 0 var(--night);
}

.btn-mute[aria-pressed="true"],
.btn-voice[aria-pressed="true"] {
  background: #e5e0d4;
  color: var(--muted);
}

.btn-read {
  font-size: 0.8rem;
  min-height: 34px;
  background: #e8f4ff;
}

.btn-read.reading {
  background: #fff3c4;
  animation: pulse 1s ease infinite;
}

.voice-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--cream);
  text-shadow: 1px 1px 0 var(--night);
  background: rgba(15, 26, 46, 0.55);
  border: 2px solid var(--night);
  border-radius: 10px;
  padding: 4px 6px;
}

.voice-select {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  max-width: 130px;
  border: 2px solid var(--night);
  border-radius: 6px;
  padding: 2px 4px;
  background: #fff;
}

.read-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

@media (max-width: 560px) {
  .top-controls {
    top: 4px;
    right: 4px;
    left: 4px;
    max-width: none;
    justify-content: flex-start;
  }

  .btn-mute,
  .btn-voice,
  .btn-read {
    font-size: 0.7rem;
    padding: 5px 8px;
  }

  .voice-select {
    max-width: 100px;
  }

  .voice-label {
    font-size: 0.65rem;
  }
}

.screen {
  display: none;
  animation: fadeIn 0.35s ease;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* Title */
#screen-title {
  min-height: calc(100vh - 32px);
  display: none;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

#screen-title.active {
  display: flex;
}

.stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 20% 30%, #fff8, transparent),
    radial-gradient(2px 2px at 60% 20%, #fff6, transparent),
    radial-gradient(1px 1px at 80% 40%, #fff5, transparent),
    radial-gradient(2px 2px at 40% 60%, #fff4, transparent),
    radial-gradient(1px 1px at 10% 70%, #fff5, transparent),
    radial-gradient(1.5px 1.5px at 72% 55%, #fffc, transparent),
    radial-gradient(1px 1px at 35% 18%, #fff7, transparent);
  pointer-events: none;
  animation: twinkle 4s ease-in-out infinite alternate;
}

.title-clouds {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.title-cloud {
  position: absolute;
  border-radius: 40px;
  background: rgba(255, 248, 231, 0.14);
  filter: blur(1px);
  animation: cloudDrift linear infinite;
  box-shadow:
    18px 6px 0 rgba(255, 248, 231, 0.1),
    -14px 4px 0 rgba(255, 248, 231, 0.08);
}

.title-cloud.c1 {
  width: 90px;
  height: 28px;
  top: 12%;
  left: -20%;
  animation-duration: 28s;
}

.title-cloud.c2 {
  width: 120px;
  height: 34px;
  top: 22%;
  left: -30%;
  animation-duration: 36s;
  animation-delay: -8s;
  opacity: 0.85;
}

.title-cloud.c3 {
  width: 70px;
  height: 22px;
  top: 8%;
  left: -15%;
  animation-duration: 22s;
  animation-delay: -14s;
  opacity: 0.7;
}

@keyframes cloudDrift {
  from { transform: translateX(0); }
  to { transform: translateX(140vw); }
}

.title-sun {
  position: absolute;
  top: 10%;
  right: 12%;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff8e7, #f0c14e 55%, #c47b4a 100%);
  box-shadow: 0 0 24px 8px rgba(240, 193, 78, 0.45);
  animation: sunPulse 3.5s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

@keyframes sunPulse {
  from { transform: scale(1); filter: brightness(1); }
  to { transform: scale(1.08); filter: brightness(1.12); }
}

.title-card {
  position: relative;
  z-index: 1;
  text-align: center;
  background: var(--panel);
  border: 4px solid var(--night);
  border-radius: var(--radius);
  padding: 36px 28px 28px;
  box-shadow: var(--shadow);
  max-width: 480px;
  width: 100%;
}

.eyebrow {
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--clay);
  margin: 0 0 12px;
}

.title-card h1 {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 5vw, 1.85rem);
  line-height: 1.45;
  margin: 0 0 16px;
  color: var(--night);
  text-shadow: 3px 3px 0 var(--sand-dark);
}

.tagline {
  font-size: 1.05rem;
  color: var(--muted);
  margin: 0 0 20px;
  line-height: 1.5;
}

.title-hero {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 auto 16px;
  border-radius: 14px;
  overflow: hidden;
  border: 3px solid var(--night);
  box-shadow: 3px 3px 0 var(--night), 0 0 20px rgba(240, 193, 78, 0.25);
  aspect-ratio: 16 / 9;
  background: #1a2744;
}

.title-banner {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  animation: titleKenBurns 14s ease-in-out infinite alternate;
  transform-origin: 40% 55%;
}

.title-hero-shine {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    110deg,
    transparent 35%,
    rgba(255, 248, 231, 0.18) 48%,
    transparent 62%
  );
  background-size: 200% 100%;
  animation: sceneShimmer 5s ease-in-out infinite;
}

@keyframes titleKenBurns {
  from { transform: scale(1) translate(0, 0); }
  to { transform: scale(1.08) translate(-2%, -1%); }
}

.pixel-caravan {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
  animation: bob 2.5s ease-in-out infinite;
}

.pixel-caravan canvas,
.pixel-sprite {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
}

.pixel-caravan canvas {
  border: 3px solid var(--night);
  border-radius: 10px;
  background: #5eb3e4;
  box-shadow: 3px 3px 0 var(--night);
  max-width: 100%;
  height: auto;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 1rem;
  border: 3px solid var(--night);
  border-radius: 12px;
  padding: 12px 20px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  box-shadow: 3px 3px 0 var(--night);
  margin: 6px;
  min-height: 48px;
}

.btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--night);
}

.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--night);
}

.btn-primary {
  background: var(--gold);
  color: var(--night);
}

.btn-secondary {
  background: var(--cream);
  color: var(--night);
}

.btn-ghost {
  background: transparent;
  box-shadow: none;
  border-color: transparent;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-ghost:hover {
  box-shadow: none;
  color: var(--night);
}

.btn-danger {
  background: #f8c4bc;
}

.btn-success {
  background: #b8e6c8;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.hidden {
  display: none !important;
}

.save-hint {
  margin: 12px 0 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.4;
}

.btn-header {
  margin: 0;
  min-height: 36px;
  padding: 6px 10px;
  font-size: 0.8rem;
  background: var(--panel);
  color: var(--night);
  box-shadow: 2px 2px 0 var(--night);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Family guide */
.family-panel {
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.family-select-field {
  margin-top: 8px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  margin: 12px 0 16px;
  cursor: pointer;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--clay);
}

.family-guide-body {
  background: #fff;
  border: 3px solid var(--night);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  text-align: left;
}

.family-stop-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.family-art {
  flex-shrink: 0;
  border: 3px solid var(--night);
  border-radius: 10px;
  overflow: hidden;
  width: 96px;
  height: 80px;
  background: #5eb3e4;
}

.family-art canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.family-guide-body h3 {
  margin: 0 0 6px;
  font-size: 1.15rem;
}

.family-guide-body h4 {
  margin: 14px 0 8px;
  font-size: 1rem;
  color: var(--clay);
}

.family-verse {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.family-story-snip {
  line-height: 1.5;
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.family-learn {
  margin-bottom: 12px !important;
}

.family-questions {
  margin: 0 0 12px;
  padding-left: 1.25rem;
  line-height: 1.55;
}

.family-questions li {
  margin-bottom: 8px;
}

.family-tip {
  background: #fff3c4;
  border: 2px dashed var(--clay);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.92rem;
  margin: 0 0 12px;
}

.family-answer {
  background: #e8f4ff;
  border-left: 4px solid var(--blue);
  padding: 10px 12px;
  border-radius: 0 8px 8px 0;
  font-size: 0.92rem;
}

.family-answer-hidden {
  font-size: 0.88rem;
  color: var(--muted);
  font-style: italic;
  margin: 0;
}

.family-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

@media print {
  body {
    background: #fff !important;
    padding: 0;
  }

  .btn-mute,
  .family-actions,
  #btn-mute,
  .screen:not(.active) {
    display: none !important;
  }

  #screen-family.active {
    display: block !important;
  }

  .family-panel {
    box-shadow: none;
    border: none;
    max-width: 100%;
  }

  .family-guide-body {
    break-inside: avoid;
  }
}

/* Panels */
.panel {
  background: var(--panel);
  border: 4px solid var(--night);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow);
  margin-top: 24px;
}

.panel h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  line-height: 1.5;
  margin: 0 0 12px;
  color: var(--night);
}

.sub {
  color: var(--muted);
  margin: 0 0 20px;
  line-height: 1.5;
}

.howto-list {
  padding-left: 1.2rem;
  line-height: 1.7;
  margin: 0 0 16px;
}

.howto-list li {
  margin-bottom: 10px;
}

.hint {
  background: #fff3c4;
  border: 2px dashed var(--clay);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0 0 20px;
  font-size: 0.95rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  font-weight: 700;
}

.field input,
.field select {
  font-family: var(--font-body);
  font-size: 1.05rem;
  padding: 12px 14px;
  border: 3px solid var(--night);
  border-radius: 10px;
  background: #fff;
}

/* Game header */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  color: var(--cream);
}

.brand {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
}

.day-badge {
  background: var(--night);
  color: var(--gold);
  font-weight: 800;
  padding: 8px 14px;
  border-radius: 999px;
  border: 2px solid var(--gold);
  font-size: 0.95rem;
}

/* Status meters */
.status-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.stat {
  background: var(--panel);
  border: 3px solid var(--night);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.stat-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon.pixel-icon {
  width: 28px;
  height: 28px;
}

.stat-icon.pixel-icon canvas {
  width: 24px;
  height: 24px;
}

.stat-meta {
  min-width: 0;
  flex: 1;
}

.stat-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.stat-num {
  font-size: 0.8rem;
  font-weight: 800;
}

.meter {
  height: 8px;
  background: #e5e0d4;
  border-radius: 999px;
  overflow: hidden;
  margin: 3px 0;
  border: 1px solid #cfc6b4;
}

.meter-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  transition: width 0.4s ease, background 0.3s ease;
}

.meter-fill.food { background: linear-gradient(90deg, #e8a838, #f0c14e); }
.meter-fill.water { background: linear-gradient(90deg, #2f7ec4, #5eb3e4); }
.meter-fill.faith { background: linear-gradient(90deg, #6b4fa0, #b08de8); }
.meter-fill.health { background: linear-gradient(90deg, #c93b3b, #e86a6a); }

.meter-fill.low {
  animation: pulse 1s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* Map */
.map-strip {
  background: var(--deep);
  border: 3px solid var(--night);
  border-radius: 14px;
  padding: 12px 10px 8px;
  margin-bottom: 12px;
  color: var(--cream);
}

.map-track {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.map-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 56px;
  position: relative;
  flex-shrink: 0;
}

.map-thumb {
  width: 28px;
  height: 24px;
  border-radius: 4px;
  overflow: hidden;
  border: 2px solid #8aa0c0;
  background: #4a5d7a;
  z-index: 1;
  image-rendering: pixelated;
}

.map-thumb-canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}

.map-node.done .map-thumb {
  border-color: #8fd9b0;
  box-shadow: 0 0 0 1px var(--green);
}

.map-node.current .map-thumb {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px #f0c14e66;
  transform: scale(1.15);
}

.map-node .dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #4a5d7a;
  border: 2px solid #8aa0c0;
  z-index: 1;
}

.map-node.done .dot {
  background: var(--green);
  border-color: #8fd9b0;
}

.map-node.current .dot {
  background: var(--gold);
  border-color: #fff;
  box-shadow: 0 0 0 3px #f0c14e66;
  transform: scale(1.25);
}

.map-node .connector {
  position: absolute;
  top: 12px;
  left: calc(50% + 14px);
  width: calc(100% - 16px);
  height: 3px;
  background: #4a5d7a;
}

.map-node.done .connector {
  background: var(--green);
}

.map-node:last-child .connector {
  display: none;
}

.map-node .label {
  font-size: 0.55rem;
  margin-top: 6px;
  text-align: center;
  max-width: 56px;
  line-height: 1.2;
  opacity: 0.75;
}

.map-node.current .label {
  opacity: 1;
  font-weight: 800;
  color: var(--gold);
}

.location-name {
  text-align: center;
  margin: 4px 0 0;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--gold);
}

/* Story */
.story-panel {
  background: var(--panel);
  border: 4px solid var(--night);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.scene-art {
  width: 148px;
  height: 120px;
  border-radius: 12px;
  background: linear-gradient(145deg, #fff3c4, #e8c98a);
  border: 3px solid var(--night);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 3px 3px 0 rgba(26, 39, 68, 0.35);
  position: relative;
}

.scene-art.has-photo,
.scene-art.scene-art-photo {
  width: min(200px, 42vw);
  height: 148px;
  box-shadow:
    3px 3px 0 rgba(26, 39, 68, 0.35),
    0 0 0 1px rgba(240, 193, 78, 0.35);
}

.scene-art canvas,
.scene-art .scene-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  image-rendering: auto;
}

.scene-photo {
  animation: scenePhotoIn 0.45s ease both;
}

@keyframes scenePhotoIn {
  from { opacity: 0; transform: scale(1.04); }
  to { opacity: 1; transform: none; }
}

.map-thumb.has-photo-thumb {
  padding: 0;
  overflow: hidden;
}

.map-thumb .scene-photo-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  image-rendering: auto;
}

.story-text h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  color: var(--night);
}

.enemy-tag {
  display: inline-block;
  margin: 0 0 8px;
  padding: 4px 10px;
  font-size: 0.82rem;
  font-weight: 800;
  color: #7a2418;
  background: #ffe0d6;
  border: 2px solid var(--red);
  border-radius: 999px;
}

.story-text p {
  margin: 0 0 8px;
  line-height: 1.55;
  font-size: 0.98rem;
}

.learn {
  background: #e8f4ff;
  border-left: 4px solid var(--blue);
  padding: 8px 10px;
  border-radius: 0 8px 8px 0;
  font-size: 0.9rem !important;
  color: #1a4a72;
}

/* Party */
.party-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.member {
  background: var(--panel);
  border: 2px solid var(--night);
  border-radius: 10px;
  padding: 4px 10px 4px 4px;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.member-face {
  border-radius: 6px;
  border: 2px solid var(--night);
  background: #5eb3e4;
  flex-shrink: 0;
}

.member.ill {
  border-color: var(--red);
  background: #ffe8e4;
}

.member.strong {
  border-color: var(--green);
}

/* Actions */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.actions .btn {
  margin: 0;
  flex: 1 1 auto;
  min-width: 120px;
}

/* Log */
.log {
  background: rgba(15, 26, 46, 0.75);
  color: #d8e4f5;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.85rem;
  max-height: 110px;
  overflow-y: auto;
  line-height: 1.45;
  border: 2px solid #2a3d5c;
}

.log .entry {
  margin-bottom: 4px;
}

.log .entry:last-child {
  margin-bottom: 0;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 16, 30, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}

.modal.hidden {
  display: none;
}

.modal-card {
  background: var(--cream);
  border: 4px solid var(--night);
  border-radius: var(--radius);
  padding: 24px 20px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow);
  text-align: center;
}

.modal-emoji {
  font-size: 2.5rem;
  margin-bottom: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 48px;
}

.modal-emoji canvas {
  border: 3px solid var(--night);
  border-radius: 10px;
  image-rendering: pixelated;
  max-width: 160px;
  height: auto;
}

.modal-emoji.modal-art-photo {
  min-height: 120px;
}

.modal-emoji .scene-photo {
  width: min(220px, 70vw);
  height: 140px;
  object-fit: cover;
  border: 3px solid var(--night);
  border-radius: 12px;
  box-shadow: 3px 3px 0 rgba(26, 39, 68, 0.3);
}

.modal-card h3 {
  margin: 0 0 10px;
  font-size: 1.25rem;
}

.modal-card p {
  margin: 0 0 16px;
  line-height: 1.55;
  color: var(--muted);
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-actions .btn {
  margin: 0;
  width: 100%;
}

.quiz-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.quiz-choices .btn {
  margin: 0;
  width: 100%;
  text-align: left;
  justify-content: flex-start;
}

/* High scores */
.high-scores-panel {
  margin-top: 16px;
  text-align: left;
}

.high-scores-panel h3 {
  font-family: var(--font-display);
  font-size: 0.7rem;
  margin: 0 0 10px;
  color: var(--night);
  text-align: center;
}

.title-scores {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 2px dashed var(--sand-dark);
  max-height: 160px;
  overflow-y: auto;
}

.high-scores-empty {
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
  margin: 0;
}

.score-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.score-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  padding: 8px 10px;
  background: #fff;
  border: 2px solid var(--night);
  border-radius: 10px;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.score-name {
  font-weight: 800;
}

.score-meta {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

/* End */
.end-panel {
  text-align: center;
  margin-top: 40px;
}

.end-emoji {
  font-size: 3.5rem;
  margin-bottom: 12px;
  display: flex;
  justify-content: center;
}

.end-emoji canvas {
  border: 3px solid var(--night);
  border-radius: 12px;
  image-rendering: pixelated;
  max-width: 220px;
  height: auto;
  box-shadow: 3px 3px 0 var(--night);
}

.end-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 20px 0;
  text-align: left;
}

.end-stat {
  background: #fff;
  border: 2px solid var(--night);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.9rem;
}

.end-stat strong {
  display: block;
  font-size: 1.1rem;
  margin-top: 2px;
}

/* ---------- Polish animations & FX ---------- */

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

.fx-particle {
  position: absolute;
  border-radius: 2px;
  border: 1px solid rgba(26, 39, 68, 0.35);
  image-rendering: pixelated;
  animation: fxParticle 1s ease-out forwards;
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.15);
}

@keyframes fxParticle {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--dx), var(--dy)) scale(0.4);
    opacity: 0;
  }
}

.fx-pop {
  animation: fxPop 0.4s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}

@keyframes fxPop {
  0% {
    opacity: 0;
    transform: scale(0.92) translateY(8px);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

.fx-shake {
  animation: fxShake 0.4s ease both;
}

@keyframes fxShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px) rotate(-0.5deg); }
  40% { transform: translateX(5px) rotate(0.5deg); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

.fx-flash,
.fx-arrive {
  animation: fxArrive 0.55s ease both;
}

@keyframes fxArrive {
  0% {
    box-shadow: 0 0 0 0 rgba(240, 193, 78, 0.8);
    filter: brightness(1.3);
  }
  100% {
    box-shadow: 3px 3px 0 rgba(26, 39, 68, 0.35);
    filter: none;
  }
}

.fx-meter-bump {
  animation: fxMeterBump 0.35s ease;
}

@keyframes fxMeterBump {
  0% { filter: brightness(1); }
  40% { filter: brightness(1.45); transform: scaleY(1.25); transform-origin: left center; }
  100% { filter: brightness(1); transform: none; }
}

.fx-log-in {
  animation: fxLogIn 0.35s ease both;
}

@keyframes fxLogIn {
  from {
    opacity: 0;
    transform: translateX(-8px);
    color: var(--gold);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.fx-celebrate {
  animation: fxCelebrate 0.9s ease both;
}

@keyframes fxCelebrate {
  0% { transform: scale(0.8) rotate(-4deg); }
  40% { transform: scale(1.08) rotate(3deg); }
  100% { transform: scale(1) rotate(0); }
}

/* Title caravan polish */
.pixel-caravan {
  position: relative;
}

.pixel-caravan canvas {
  transition: transform 0.15s steps(2);
}

.pixel-caravan.caravan-step canvas {
  transform: translateY(-2px);
}

.title-card h1 {
  animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
  from { text-shadow: 3px 3px 0 var(--sand-dark); }
  to { text-shadow: 3px 3px 0 var(--sand-dark), 0 0 18px rgba(240, 193, 78, 0.45); }
}

@keyframes twinkle {
  from { opacity: 0.7; }
  to { opacity: 1; }
}

/* Map current node pulse */
.map-node.current .map-thumb {
  animation: mapPulse 1.4s ease-in-out infinite;
}

@keyframes mapPulse {
  0%, 100% { box-shadow: 0 0 0 3px #f0c14e66; }
  50% { box-shadow: 0 0 0 6px #f0c14e33; }
}

.map-node.done .map-thumb {
  transition: transform 0.2s ease, border-color 0.2s ease;
}

/* Scene living border */
.scene-art {
  position: relative;
}

.scene-art::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 9px;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

/* Party member hover / enter */
.member {
  animation: fxPop 0.35s ease both;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.member:nth-child(1) { animation-delay: 0.02s; }
.member:nth-child(2) { animation-delay: 0.06s; }
.member:nth-child(3) { animation-delay: 0.1s; }
.member:nth-child(4) { animation-delay: 0.14s; }
.member:nth-child(5) { animation-delay: 0.18s; }

.member:hover {
  transform: translateY(-2px);
  box-shadow: 2px 2px 0 var(--night);
}

.member.ill {
  animation: illPulse 1.6s ease-in-out infinite;
}

@keyframes illPulse {
  0%, 100% { background: #ffe8e4; }
  50% { background: #ffd0c8; }
}

/* Modal polish */
.modal:not(.hidden) .modal-card {
  animation: modalIn 0.3s cubic-bezier(0.22, 1.2, 0.36, 1) both;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Travel overlay */
.travel-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.travel-overlay.hidden {
  display: none;
}

.travel-sky {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #1a2744 0%, #5eb3e4 45%, #e8c98a 100%);
  animation: skyShift 1.65s ease both;
}

.travel-still {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

.travel-still-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(1.05) brightness(0.92);
  transform: scale(1.05);
}

.travel-still.ken-burns-run .travel-still-img {
  animation: travelKenBurns 2.1s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes travelKenBurns {
  0% {
    transform: scale(1.05) translate(0, 2%);
    filter: saturate(1) brightness(0.75);
  }
  40% {
    filter: saturate(1.08) brightness(0.95);
  }
  100% {
    transform: scale(1.18) translate(-3%, -2%);
    filter: saturate(1.1) brightness(1);
  }
}

.travel-overlay.travel-active .travel-sky {
  opacity: 0.35;
}

@keyframes skyShift {
  0% { filter: brightness(0.8) saturate(0.9); }
  40% { filter: brightness(1.05) saturate(1.1); }
  100% { filter: brightness(1); }
}

.travel-sun {
  position: absolute;
  top: 12%;
  left: 50%;
  width: 48px;
  height: 48px;
  margin-left: -24px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff8e7, #f0c14e 60%, #e08a2a);
  box-shadow: 0 0 28px 10px rgba(240, 193, 78, 0.5);
  z-index: 1;
  animation: travelSun 1.65s ease both;
  pointer-events: none;
}

@keyframes travelSun {
  0% { transform: translateY(12px) scale(0.9); opacity: 0.6; }
  40% { transform: translateY(0) scale(1.05); opacity: 1; }
  100% { transform: translateY(-8px) scale(1); opacity: 0.95; }
}

.travel-ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 38%;
  background:
    repeating-linear-gradient(
      90deg,
      #c47b4a 0 12px,
      #d4925c 12px 24px
    );
  background-size: 48px 100%;
  animation: groundScroll 1.65s linear both;
  border-top: 4px solid var(--night);
}

@keyframes groundScroll {
  from { background-position: 0 0; }
  to { background-position: -180px 0; }
}

.travel-heat {
  position: absolute;
  inset: 30% 0 40%;
  background: linear-gradient(180deg, transparent, rgba(255, 248, 231, 0.12), transparent);
  animation: heatWave 0.8s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes heatWave {
  from { transform: scaleY(1) translateY(0); opacity: 0.4; }
  to { transform: scaleY(1.08) translateY(-6px); opacity: 0.7; }
}

.travel-birds {
  position: absolute;
  top: 22%;
  left: 0;
  right: 0;
  height: 40px;
  z-index: 2;
  pointer-events: none;
  animation: birdsFly 1.65s ease-in both;
}

.travel-birds span {
  position: absolute;
  width: 10px;
  height: 4px;
  border-radius: 2px;
  background: transparent;
  border-bottom: 2px solid rgba(26, 39, 68, 0.55);
  border-left: 2px solid transparent;
  border-right: 2px solid transparent;
}

.travel-birds span:nth-child(1) { left: 20%; top: 8px; }
.travel-birds span:nth-child(2) { left: 28%; top: 0; width: 12px; }
.travel-birds span:nth-child(3) { left: 35%; top: 14px; }

@keyframes birdsFly {
  0% { transform: translateX(-10vw); opacity: 0; }
  20% { opacity: 0.9; }
  100% { transform: translateX(70vw); opacity: 0.3; }
}

.travel-caravan {
  position: relative;
  z-index: 3;
  image-rendering: pixelated;
}

.travel-caption {
  z-index: 3;
}

.travel-caravan.travel-run {
  animation: caravanCross 1.55s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.travel-sprite {
  border: 3px solid var(--night);
  border-radius: 10px;
  box-shadow: 4px 4px 0 rgba(15, 26, 46, 0.4);
  background: #5eb3e4;
  image-rendering: pixelated;
  max-width: min(90vw, 420px);
  height: auto;
}

@keyframes caravanCross {
  0% {
    transform: translateX(-55vw) translateY(10px) rotate(-1deg);
    opacity: 0;
  }
  12% { opacity: 1; }
  25% { transform: translateX(-20vw) translateY(2px) rotate(0.5deg); }
  50% { transform: translateX(0) translateY(0) rotate(0); }
  75% { transform: translateX(22vw) translateY(-2px) rotate(-0.4deg); }
  88% { opacity: 1; }
  100% {
    transform: translateX(58vw) translateY(-6px) rotate(1deg);
    opacity: 0;
  }
}

.travel-overlay.travel-fade-out {
  animation: travelFadeOut 0.22s ease both;
}

@keyframes travelFadeOut {
  to { opacity: 0; }
}

.travel-caption {
  position: relative;
  z-index: 2;
  margin-top: 20px;
  font-family: var(--font-display);
  font-size: 0.65rem;
  color: var(--cream);
  text-shadow: 2px 2px 0 var(--night);
  animation: fadeIn 0.4s ease both, captionBob 0.9s ease-in-out infinite alternate;
}

@keyframes captionBob {
  from { transform: translateY(0); }
  to { transform: translateY(-4px); }
}

/* Day badge tick */
.day-badge {
  transition: transform 0.2s ease, background 0.2s ease;
}

#screen-game .day-badge {
  animation: dayTick 0.45s ease;
}

@keyframes dayTick {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); background: #2a3d5c; }
  100% { transform: scale(1); }
}

/* Buttons subtle press sparkle on primary */
.btn-primary:active {
  filter: brightness(1.05);
}

/* End screen stats cascade */
.end-stat {
  animation: fxPop 0.4s ease both;
}

.end-stat:nth-child(1) { animation-delay: 0.05s; }
.end-stat:nth-child(2) { animation-delay: 0.1s; }
.end-stat:nth-child(3) { animation-delay: 0.15s; }
.end-stat:nth-child(4) { animation-delay: 0.2s; }
.end-stat:nth-child(5) { animation-delay: 0.25s; }
.end-stat:nth-child(6) { animation-delay: 0.3s; }

/* ---------- Amalek / Rephidim hands minigame ---------- */

.amalek-wrap {
  background: var(--panel);
  border: 4px solid var(--night);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-top: 12px;
}

.amalek-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.amalek-header h2 {
  font-family: var(--font-display);
  font-size: 0.72rem;
  line-height: 1.45;
  margin: 4px 0 0;
}

.amalek-time {
  min-width: 150px;
  text-align: right;
  font-size: 0.85rem;
  font-weight: 800;
}

.amalek-time-track {
  height: 10px;
  background: #e5e0d4;
  border: 2px solid var(--night);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 4px;
}

.amalek-time-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #f0c14e, #d94f3d);
  transition: width 0.05s linear;
}

.amalek-status {
  background: #fff8e7;
  border: 2px solid var(--night);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0 0 12px;
  font-size: 0.95rem;
  line-height: 1.45;
}

.amalek-status.good {
  background: #e3f6ea;
  border-color: var(--green);
}

.amalek-status.wrong {
  background: #ffe8e4;
  border-color: var(--red);
}

/* Amalek battle sky + animated Moshe */
.amalek-sky {
  --sunset: 0;
  --israel-boost: 0.4;
  --foe-boost: 0.4;
  position: relative;
  height: 220px;
  border: 3px solid var(--night);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, #5eb3e4 calc((1 - var(--sunset)) * 100%), #c47b4a) 0%,
    color-mix(in srgb, #87ceeb calc((1 - var(--sunset)) * 100%), #e8a838) 50%,
    #e8c98a 100%
  );
}

.amalek-sky.has-art-bg {
  background-image:
    linear-gradient(
      180deg,
      rgba(26, 39, 68, calc(0.2 + var(--sunset) * 0.3)),
      rgba(196, 123, 74, calc(0.25 + var(--sunset) * 0.4))
    ),
    var(--art-bg);
  background-size: cover;
  background-position: center;
}

.amalek-flash-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
  opacity: 0;
  background: transparent;
}

.amalek-sky.battle-clash .amalek-flash-layer {
  animation: amalekClash 0.28s ease;
  background: radial-gradient(circle at 70% 60%, rgba(217, 79, 61, 0.45), transparent 55%);
}

.amalek-sky.battle-divine .amalek-flash-layer {
  animation: amalekDivine 0.4s ease;
  background: radial-gradient(circle at 50% 30%, rgba(240, 193, 78, 0.65), rgba(255, 248, 231, 0.2) 50%, transparent 70%);
}

@keyframes amalekClash {
  0% { opacity: 0; }
  30% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes amalekDivine {
  0% { opacity: 0; filter: brightness(1); }
  35% { opacity: 1; filter: brightness(1.25); }
  100% { opacity: 0; filter: brightness(1); }
}

.amalek-sky.battle-divine .amalek-figure .fig-moshe {
  animation: figurePower 0.45s ease;
}

@keyframes figurePower {
  0%, 100% { filter: drop-shadow(0 0 0 transparent); transform: scale(1); }
  40% { filter: drop-shadow(0 0 14px #f0c14e); transform: scale(1.06); }
}

.amalek-clash-sparks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 7;
}

.amalek-sky.battle-clash .amalek-clash-sparks::before,
.amalek-sky.battle-clash .amalek-clash-sparks::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  background: #f0c14e;
  border: 1px solid var(--night);
  animation: clashSpark 0.35s ease-out forwards;
}

.amalek-sky.battle-clash .amalek-clash-sparks::before {
  left: 55%;
  top: 55%;
  --sx: -28px;
  --sy: -22px;
}

.amalek-sky.battle-clash .amalek-clash-sparks::after {
  left: 62%;
  top: 58%;
  background: #d94f3d;
  --sx: 24px;
  --sy: -18px;
}

@keyframes clashSpark {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--sx), var(--sy)) scale(0.3); opacity: 0; }
}

.amalek-sun {
  position: absolute;
  font-size: 1.9rem;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 10px #f0c14e);
  transition: left 0.08s linear, top 0.08s linear, filter 0.2s ease;
  z-index: 2;
}

.amalek-clouds {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.35;
}

.amalek-clouds span {
  position: absolute;
  width: 56px;
  height: 18px;
  border-radius: 20px;
  background: rgba(255, 248, 231, 0.45);
  animation: cloudDriftAmalek 12s linear infinite;
}

.amalek-clouds span:nth-child(1) { top: 18%; left: -20%; animation-duration: 14s; }
.amalek-clouds span:nth-child(2) { top: 28%; left: -30%; width: 72px; animation-duration: 18s; animation-delay: -6s; }

@keyframes cloudDriftAmalek {
  from { transform: translateX(0); }
  to { transform: translateX(130vw); }
}

.amalek-hill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 36%;
  background: linear-gradient(180deg, #c47b4a, #8b6914);
  border-radius: 50% 50% 0 0 / 40% 40% 0 0;
  transform: scaleX(1.4) translateY(20%);
  z-index: 2;
}

.hill-dust {
  position: absolute;
  inset: 20% 10% auto;
  height: 40%;
  background: radial-gradient(ellipse, rgba(244, 228, 188, 0.35), transparent 70%);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.amalek-figure.hands-high ~ .amalek-hill .hill-dust,
.amalek-sky:has(.amalek-figure.hands-high) .hill-dust {
  opacity: 0.6;
  animation: dustPuff 1.2s ease-in-out infinite alternate;
}

@keyframes dustPuff {
  from { transform: scaleX(1); opacity: 0.35; }
  to { transform: scaleX(1.15); opacity: 0.7; }
}

/* ---- Moshe figure: continuous arm raise ---- */
.amalek-figure {
  --raise: 0.7;
  --arm-raise: 70%;
  position: absolute;
  left: 50%;
  bottom: 14%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 4;
  width: min(280px, 90%);
}

.fig-power-rays {
  position: absolute;
  left: 50%;
  top: -8%;
  width: 120px;
  height: 120px;
  margin-left: -60px;
  background: conic-gradient(from 0deg, transparent, rgba(240, 193, 78, 0.35), transparent 30%, rgba(255, 248, 231, 0.25), transparent 60%);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.25s ease;
}

.amalek-figure.hands-high .fig-power-rays {
  opacity: calc(0.35 + var(--raise) * 0.55);
  animation: raysSpin 4s linear infinite;
}

@keyframes raysSpin {
  to { transform: rotate(360deg); }
}

.fig-aura {
  position: absolute;
  left: 50%;
  top: 10%;
  width: 90px;
  height: 90px;
  margin-left: -45px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(240, 193, 78, 0.45), transparent 70%);
  opacity: 0;
  z-index: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.amalek-figure.hands-high .fig-aura {
  opacity: calc(var(--raise) * 0.9);
  animation: auraPulse 1.1s ease-in-out infinite alternate;
}

.amalek-figure.hands-low .fig-aura {
  opacity: 0;
}

@keyframes auraPulse {
  from { transform: scale(0.92); opacity: 0.45; }
  to { transform: scale(1.12); opacity: 0.85; }
}

.fig-stage {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  min-height: 130px;
}

.fig-moshe {
  position: relative;
  width: 100px;
  height: 120px;
  flex-shrink: 0;
}

.fig-arms-layer {
  position: absolute;
  left: 50%;
  top: 28px;
  width: 0;
  height: 0;
  z-index: 3;
}

/* Arms: --raise 0 (down) → 1 (up). Left swings CCW-ish when raising */
.fig-arm {
  position: absolute;
  width: 10px;
  height: 48px;
  transform-origin: 50% 100%;
  transition: transform 0.08s linear;
  will-change: transform;
}

.fig-arm .arm-bone {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #e8c98a, #c47b4a);
  border: 2px solid var(--night);
  border-radius: 6px;
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.15);
}

.fig-arm .arm-hand {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.15rem;
  line-height: 1;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.2));
}

.fig-arm.arm-l {
  left: -8px;
  /* down ~95deg, up ~-55deg */
  transform: rotate(calc(95deg - var(--raise) * 150deg));
}

.fig-arm.arm-r {
  left: -2px;
  transform: rotate(calc(-95deg + var(--raise) * 150deg));
}

.amalek-figure.tap-boost .fig-arm.arm-l {
  animation: armPumpL 0.18s ease;
}

.amalek-figure.tap-boost .fig-arm.arm-r {
  animation: armPumpR 0.18s ease;
}

@keyframes armPumpL {
  0% { transform: rotate(calc(95deg - var(--raise) * 150deg)); }
  50% { transform: rotate(calc(95deg - var(--raise) * 150deg - 12deg)); }
  100% { transform: rotate(calc(95deg - var(--raise) * 150deg)); }
}

@keyframes armPumpR {
  0% { transform: rotate(calc(-95deg + var(--raise) * 150deg)); }
  50% { transform: rotate(calc(-95deg + var(--raise) * 150deg + 12deg)); }
  100% { transform: rotate(calc(-95deg + var(--raise) * 150deg)); }
}

.fig-staff-wrap {
  position: absolute;
  left: 50%;
  bottom: 38px;
  width: 8px;
  height: 72px;
  margin-left: -4px;
  z-index: 2;
  transform-origin: 50% 100%;
  transform: rotate(calc((1 - var(--raise)) * 25deg - 8deg));
  transition: transform 0.1s linear;
}

.fig-staff {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #a67c3d, #5c4033);
  border: 2px solid var(--night);
  border-radius: 4px;
  position: relative;
}

.staff-glow {
  position: absolute;
  top: -6px;
  left: 50%;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: radial-gradient(circle, #f0c14e, transparent 70%);
  opacity: calc(var(--raise) * 0.9);
  transition: opacity 0.15s ease;
}

.amalek-figure.hands-high .staff-glow {
  animation: staffGlow 0.9s ease-in-out infinite alternate;
}

@keyframes staffGlow {
  from { transform: scale(1); opacity: 0.55; }
  to { transform: scale(1.35); opacity: 1; }
}

.fig-torso {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.fig-head {
  position: relative;
  font-size: 1.55rem;
  line-height: 1;
  z-index: 2;
  transition: transform 0.12s ease;
}

.amalek-figure.hands-high .fig-head {
  transform: translateY(calc(var(--raise) * -4px));
}

.amalek-figure.hands-low .fig-face {
  filter: grayscale(0.15);
}

.fig-sweat {
  position: absolute;
  right: -10px;
  top: 4px;
  font-size: 0.7rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.amalek-figure.hands-low .fig-sweat {
  opacity: 1;
  animation: sweatDrop 0.9s ease-in-out infinite;
}

.amalek-figure.hands-mid .fig-sweat {
  opacity: 0.45;
}

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

.fig-robe {
  width: 36px;
  height: 40px;
  margin-top: -4px;
  background: linear-gradient(180deg, #e8e0d4, #c4b8a4);
  border: 2px solid var(--night);
  border-radius: 10px 10px 6px 6px;
  box-shadow: 1px 2px 0 rgba(0, 0, 0, 0.15);
}

.fig-name {
  margin-top: 2px;
  font-size: 0.68rem;
  font-weight: 800;
  background: var(--cream);
  border: 2px solid var(--night);
  border-radius: 6px;
  padding: 1px 6px;
  color: var(--night);
}

/* Helpers Aaron & Hur lift with raise */
.fig-helper {
  position: relative;
  width: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1;
}

.helper-label {
  font-size: 0.55rem;
  font-weight: 800;
  color: #fff8e7;
  text-shadow: 1px 1px 0 var(--night);
  margin-bottom: 2px;
}

.helper-body {
  font-size: 1.35rem;
  line-height: 1;
  z-index: 1;
}

.helper-arm {
  position: absolute;
  top: 28px;
  width: 28px;
  height: 6px;
  background: linear-gradient(90deg, #e8c98a, #c47b4a);
  border: 2px solid var(--night);
  border-radius: 4px;
  transform-origin: left center;
  transition: transform 0.1s linear;
}

.fig-aaron .helper-arm {
  right: -6px;
  transform-origin: right center;
  transform: rotate(calc(-20deg - var(--raise) * 40deg));
}

.fig-hur .helper-arm {
  left: -6px;
  transform: rotate(calc(20deg + var(--raise) * 40deg));
}

.amalek-figure.hands-high .fig-helper {
  animation: helperBob 1s ease-in-out infinite alternate;
}

.fig-hur {
  animation-delay: 0.15s;
}

@keyframes helperBob {
  from { transform: translateY(0); }
  to { transform: translateY(-3px); }
}

.fig-helpers-note {
  margin-top: 4px;
  font-size: 0.62rem;
  font-weight: 700;
  color: #fff8e7;
  text-shadow: 1px 1px 0 var(--night);
  opacity: 0.95;
}

.amalek-figure.hands-low .fig-helpers-note {
  color: #ffe8e4;
}

.amalek-figure.hands-high .fig-name {
  box-shadow: 0 0 8px rgba(240, 193, 78, 0.5);
}

/* Battle troops animate with scores */
.amalek-battle-field {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  z-index: 5;
  pointer-events: none;
}

.bf-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 72px;
}

.bf-israel .bf-troop {
  display: inline-block;
  animation: troopAdvance 0.9s ease-in-out infinite alternate;
  animation-play-state: running;
  transform: translateX(calc(var(--israel-boost) * 6px));
  filter: drop-shadow(0 0 calc(var(--israel-boost) * 4px) #5eb3e4);
}

.bf-foe .bf-troop {
  display: inline-block;
  animation: troopAdvance 0.85s ease-in-out infinite alternate-reverse;
  transform: translateX(calc(var(--foe-boost) * -6px));
  filter: drop-shadow(0 0 calc(var(--foe-boost) * 4px) #d94f3d);
}

.bf-troop.t2 { animation-delay: 0.12s; font-size: 0.95rem; }
.bf-troop.t3 { animation-delay: 0.24s; }

@keyframes troopAdvance {
  from { transform: translateY(0) translateX(var(--tx, 0)); }
  to { transform: translateY(-3px) translateX(var(--tx, 0)); }
}

.bf-name {
  font-size: 0.68rem;
  font-weight: 800;
  color: #fff8e7;
  text-shadow: 1px 1px 0 var(--night);
}

.bf-vs {
  font-size: 0.7rem;
  font-weight: 800;
  color: #fff8e7;
  text-shadow: 1px 1px 0 var(--night);
  align-self: center;
  margin-bottom: 10px;
  opacity: 0.9;
}

.amalek-figure.shake-tired {
  animation: tiredShake 0.4s ease;
}

@keyframes tiredShake {
  0%, 100% { transform: translateX(-50%); }
  25% { transform: translateX(calc(-50% - 3px)); }
  75% { transform: translateX(calc(-50% + 3px)); }
}

.amalek-meters {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px;
  margin-bottom: 12px;
  align-items: center;
}

.meter-title {
  display: block;
  font-size: 0.75rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.meter-sub {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

.amalek-hands-meter {
  width: 36px;
  height: 100px;
  margin: 0 auto;
  border: 3px solid var(--night);
  border-radius: 10px;
  background: #e5e0d4;
  position: relative;
  overflow: hidden;
}

.amalek-hands-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 70%;
  background: linear-gradient(180deg, #3d9a6a, #8fd9b0);
  transition: height 0.05s linear;
}

.amalek-hands-meter.danger .amalek-hands-fill {
  background: linear-gradient(180deg, #d94f3d, #f0a090);
}

.amalek-hands-meter.strong .amalek-hands-fill {
  background: linear-gradient(180deg, #f0c14e, #3d9a6a);
}

.amalek-battle-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.battle-row {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 8px;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 800;
}

.battle-track {
  height: 14px;
  background: #e5e0d4;
  border: 2px solid var(--night);
  border-radius: 999px;
  overflow: hidden;
}

.battle-fill {
  height: 100%;
  width: 40%;
  transition: width 0.05s linear;
}

.battle-fill.israel {
  background: linear-gradient(90deg, #3a8fd6, #5eb3e4);
}

.battle-fill.foe {
  background: linear-gradient(90deg, #d94f3d, #e88a6a);
}

.amalek-tap {
  width: 100%;
  min-height: 76px !important;
  font-size: 1.15rem !important;
  margin: 0 0 8px !important;
  user-select: none;
  touch-action: manipulation;
  -webkit-user-select: none;
  background: linear-gradient(180deg, #f0c14e, #c47b4a) !important;
  border-color: var(--night) !important;
  color: var(--night) !important;
  box-shadow: 3px 3px 0 var(--night), 0 0 0 0 rgba(240, 193, 78, 0.4);
  animation: amalekBtnInvite 1.8s ease-in-out infinite;
}

.amalek-tap.tap-pulse {
  animation: amalekTap 0.14s ease;
}

@keyframes amalekTap {
  0% { transform: scale(1); }
  40% { transform: scale(0.94); filter: brightness(1.12); }
  100% { transform: scale(1); }
}

@keyframes amalekBtnInvite {
  0%, 100% { box-shadow: 3px 3px 0 var(--night), 0 0 0 0 rgba(240, 193, 78, 0.35); }
  50% { box-shadow: 3px 3px 0 var(--night), 0 0 0 6px rgba(240, 193, 78, 0.22); }
}

.amalek-hands-meter.strong {
  box-shadow: 0 0 12px rgba(61, 154, 106, 0.45);
}

.amalek-hands-meter.danger {
  animation: meterDanger 0.5s ease infinite alternate;
}

@keyframes meterDanger {
  from { box-shadow: 0 0 0 transparent; }
  to { box-shadow: 0 0 10px rgba(217, 79, 61, 0.55); }
}

.amalek-tip {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 8px;
}

.amalek-result {
  text-align: center;
  background: #e8f4ff;
  border: 3px solid var(--night);
  border-radius: 12px;
  padding: 16px;
  margin-top: 8px;
  animation: fxPop 0.35s ease both;
}

.amalek-result h3 {
  font-family: var(--font-display);
  font-size: 0.8rem;
  line-height: 1.4;
  margin: 0 0 8px;
}

.amalek-result p {
  margin: 0 0 12px;
  line-height: 1.5;
  color: var(--muted);
}

.amalek-stats {
  font-size: 0.9rem !important;
}

@media (max-width: 560px) {
  .amalek-header h2 {
    font-size: 0.62rem;
  }

  .amalek-sky {
    height: 240px;
  }

  .fig-stage {
    min-height: 120px;
  }

  .fig-helpers-note {
    font-size: 0.58rem;
  }

  .amalek-tap {
    min-height: 80px !important;
    font-size: 1.05rem !important;
  }
}

/* ---------- Mishkan build minigame (magnificent) ---------- */

.mishkan-wrap {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(240, 193, 78, 0.22), transparent 55%),
    radial-gradient(ellipse at 80% 100%, rgba(123, 94, 167, 0.12), transparent 45%),
    var(--panel);
  border: 4px solid var(--night);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow), 0 0 0 1px rgba(218, 165, 32, 0.35);
  margin-top: 12px;
  position: relative;
  overflow: hidden;
}

.mishkan-grand .mishkan-rays {
  position: absolute;
  inset: -20% -10% auto;
  height: 55%;
  background: conic-gradient(
    from 200deg at 50% 100%,
    transparent 0deg,
    rgba(240, 193, 78, 0.12) 20deg,
    transparent 40deg,
    rgba(255, 248, 231, 0.18) 60deg,
    transparent 80deg,
    rgba(240, 193, 78, 0.1) 110deg,
    transparent 140deg
  );
  pointer-events: none;
  animation: mishkanRays 8s linear infinite;
  opacity: 0.85;
}

@keyframes mishkanRays {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.mishkan-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

.mishkan-header h2 {
  font-family: var(--font-display);
  font-size: 0.75rem;
  line-height: 1.45;
  margin: 4px 0 0;
  color: var(--night);
  text-shadow: 0 0 12px rgba(240, 193, 78, 0.45);
}

.mishkan-subtitle {
  margin: 8px 0 0;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--muted);
  max-width: 28em;
}

.mishkan-header .eyebrow {
  color: #a67c00;
  letter-spacing: 0.14em;
}

.mishkan-progress {
  min-width: 140px;
  text-align: right;
  font-size: 0.85rem;
  font-weight: 800;
}

.mishkan-progress-track {
  height: 12px;
  background: #e5e0d4;
  border: 2px solid var(--night);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 4px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12);
}

.mishkan-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #7b5ea7, #daa520, #f0c14e, #fff8e7);
  background-size: 200% 100%;
  transition: width 0.35s ease;
  animation: progressSheen 2.4s linear infinite;
}

@keyframes progressSheen {
  from { background-position: 0% 0; }
  to { background-position: 200% 0; }
}

.mishkan-status {
  background: linear-gradient(180deg, #fffdf6, #fff8e7);
  border: 2px solid #daa520;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0 0 12px;
  font-size: 0.95rem;
  line-height: 1.45;
  min-height: 3.2em;
  position: relative;
  z-index: 1;
  box-shadow: 0 0 0 1px rgba(240, 193, 78, 0.25);
}

.mishkan-status.good {
  background: linear-gradient(180deg, #f0fff5, #e3f6ea);
  border-color: var(--green);
}

.mishkan-status.wrong {
  background: #ffe8e4;
  border-color: var(--red);
}

.mishkan-status.hint {
  background: #e8f4ff;
  border-color: var(--blue);
}

.mishkan-board-wrap {
  position: relative;
  margin-bottom: 12px;
  z-index: 1;
}

.mishkan-glory-cloud {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 0;
  opacity: 0;
  overflow: hidden;
  transition: height 0.5s ease, opacity 0.5s ease, margin 0.4s ease;
  pointer-events: none;
}

.mishkan-board-wrap.glory-active .mishkan-glory-cloud {
  height: 52px;
  opacity: 1;
  margin-bottom: 8px;
}

.glory-puff {
  display: inline-block;
  width: 36px;
  height: 22px;
  border-radius: 40px;
  background: rgba(255, 248, 231, 0.92);
  box-shadow:
    0 0 16px 6px rgba(240, 193, 78, 0.55),
    12px 4px 0 rgba(255, 255, 255, 0.7),
    -10px 2px 0 rgba(230, 220, 255, 0.65);
  animation: gloryBob 2.2s ease-in-out infinite;
}

.glory-puff.p2 {
  width: 48px;
  height: 26px;
  animation-delay: 0.2s;
}

.glory-puff.p3 {
  width: 32px;
  animation-delay: 0.4s;
}

.glory-label {
  font-size: 0.72rem;
  font-weight: 800;
  color: #6b4fa0;
  text-shadow: 0 0 8px rgba(240, 193, 78, 0.8);
  margin-left: 6px;
  animation: gloryBob 2s ease-in-out infinite;
}

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

.mishkan-compass {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  font-weight: 800;
  color: #6b4fa0;
  margin-bottom: 6px;
  padding: 0 4px;
}

.mishkan-board {
  background:
    radial-gradient(ellipse at 30% 40%, rgba(240, 193, 78, 0.2), transparent 50%),
    linear-gradient(145deg, #f8edd0 0%, #e8c98a 45%, #d4a574 100%);
  border: 4px solid #1a2744;
  border-radius: 14px;
  padding: 12px;
  overflow-x: auto;
  position: relative;
  box-shadow:
    inset 0 0 0 2px rgba(218, 165, 32, 0.55),
    inset 0 0 24px rgba(123, 94, 167, 0.08),
    4px 4px 0 rgba(26, 39, 68, 0.25);
  transition: box-shadow 0.4s ease, filter 0.4s ease;
}

.mishkan-board-wrap::before {
  content: "";
  display: block;
  height: 88px;
  margin-bottom: 8px;
  border-radius: 12px;
  border: 3px solid var(--night);
  background:
    linear-gradient(180deg, rgba(15, 26, 46, 0.15), rgba(15, 26, 46, 0.45)),
    url("../img/scenes/mishkan.jpg") center/cover no-repeat;
  box-shadow: 0 0 16px rgba(240, 193, 78, 0.25);
}

.mishkan-board[data-placed="4"],
.mishkan-board[data-placed="5"] {
  box-shadow:
    inset 0 0 0 2px rgba(218, 165, 32, 0.7),
    0 0 16px rgba(240, 193, 78, 0.25),
    4px 4px 0 rgba(26, 39, 68, 0.25);
}

.mishkan-board[data-placed="6"],
.mishkan-board[data-placed="7"] {
  box-shadow:
    inset 0 0 0 2px #daa520,
    0 0 22px rgba(240, 193, 78, 0.4),
    4px 4px 0 rgba(26, 39, 68, 0.25);
}

.mishkan-board.mishkan-glory {
  filter: brightness(1.06) saturate(1.1);
  box-shadow:
    inset 0 0 0 3px #f0c14e,
    0 0 32px rgba(240, 193, 78, 0.65),
    0 0 60px rgba(123, 94, 167, 0.35),
    4px 4px 0 rgba(26, 39, 68, 0.25);
  animation: gloryBoard 1.8s ease-in-out infinite alternate;
}

@keyframes gloryBoard {
  from { filter: brightness(1.04) saturate(1.05); }
  to { filter: brightness(1.12) saturate(1.15); }
}

.mishkan-posts {
  position: absolute;
  inset: 8px;
  pointer-events: none;
  z-index: 0;
}

.mishkan-posts span {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: linear-gradient(135deg, #f0c14e, #8b6914);
  border: 1px solid #1a2744;
  box-shadow: 0 0 6px rgba(240, 193, 78, 0.5);
}

.mishkan-posts span:nth-child(1) { top: 0; left: 0; }
.mishkan-posts span:nth-child(2) { top: 0; right: 0; }
.mishkan-posts span:nth-child(3) { bottom: 0; left: 0; }
.mishkan-posts span:nth-child(4) { bottom: 0; right: 0; }

.mishkan-courtyard {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 10px;
  min-width: 300px;
  min-height: 300px;
  position: relative;
  z-index: 1;
  border: 3px solid #8b6914;
  border-radius: 10px;
  padding: 12px 10px 10px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 248, 231, 0.35) 0 10px,
      rgba(244, 228, 188, 0.45) 10px 20px
    );
  box-shadow: inset 0 0 0 1px rgba(255, 248, 231, 0.6);
}

.zone-label {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #8b5a2b;
  grid-column: 1 / -1;
}

.zone-mini {
  display: block;
  font-size: 0.65rem;
  font-weight: 800;
  color: #5c4a7a;
  margin-bottom: 4px;
  letter-spacing: 0.03em;
}

.mishkan-tent-area {
  background:
    linear-gradient(180deg, rgba(123, 94, 167, 0.12), rgba(196, 123, 74, 0.18));
  border: 3px solid #6b4fa0;
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow:
    inset 0 0 0 1px rgba(240, 193, 78, 0.35),
    0 0 12px rgba(123, 94, 167, 0.12);
}

.holy-of-holies {
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255, 248, 231, 0.95), rgba(240, 193, 78, 0.45));
  border: 3px solid #daa520;
  border-radius: 10px;
  padding: 8px 6px;
  text-align: center;
  position: relative;
  box-shadow:
    0 0 14px rgba(240, 193, 78, 0.45),
    inset 0 0 12px rgba(255, 255, 255, 0.35);
  animation: holyGlow 2.8s ease-in-out infinite alternate;
}

.holy-of-holies .cherubim {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 2px;
  opacity: 0.9;
  filter: drop-shadow(0 0 4px rgba(240, 193, 78, 0.8));
}

@keyframes holyGlow {
  from { box-shadow: 0 0 10px rgba(240, 193, 78, 0.35), inset 0 0 8px rgba(255, 255, 255, 0.25); }
  to { box-shadow: 0 0 20px rgba(240, 193, 78, 0.65), inset 0 0 16px rgba(255, 255, 255, 0.45); }
}

.holy-place {
  background:
    linear-gradient(180deg, rgba(123, 94, 167, 0.2), rgba(91, 75, 154, 0.12));
  border: 2px solid #7b5ea7;
  border-radius: 8px;
  padding: 6px;
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(176, 141, 232, 0.35);
}

.holy-place-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.courtyard-east {
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  align-items: stretch;
  gap: 8px;
  padding: 8px 4px;
}

.mishkan-slot {
  min-height: 56px;
  border: 3px dashed #7a6a50;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.62);
  cursor: pointer;
  font-family: var(--font-body);
  padding: 6px;
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  position: relative;
}

.mishkan-slot:hover,
.mishkan-slot:focus-visible {
  outline: none;
  border-color: var(--night);
  transform: scale(1.03);
  box-shadow: 0 0 0 2px rgba(240, 193, 78, 0.35);
}

.mishkan-slot.target-glow {
  border-style: solid;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px #f0c14e66, 0 0 14px rgba(240, 193, 78, 0.55);
  animation: mapPulse 1.2s ease-in-out infinite;
  background: rgba(255, 248, 231, 0.9);
}

.mishkan-slot.filled {
  border-style: solid;
  border-color: #daa520;
  background: linear-gradient(180deg, #fffef8, #f3e6b8);
  cursor: default;
  animation: none;
  box-shadow: 0 0 10px rgba(240, 193, 78, 0.35);
}

.mishkan-slot.mishkan-place-burst {
  animation: placeBurst 0.65s cubic-bezier(0.22, 1.3, 0.36, 1) both;
}

@keyframes placeBurst {
  0% { transform: scale(0.92); filter: brightness(1.4); }
  40% { transform: scale(1.08); filter: brightness(1.2); }
  100% { transform: scale(1); filter: none; }
}

.slot-hint {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

.slot-fill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 1.4rem;
  font-weight: 800;
}

.slot-gem {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2em;
  height: 2em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--gem, #f0c14e));
  box-shadow: 0 0 8px var(--gem, #f0c14e), 0 2px 0 rgba(26, 39, 68, 0.25);
  animation: gemShine 2s ease-in-out infinite alternate;
}

@keyframes gemShine {
  from { filter: brightness(1); }
  to { filter: brightness(1.15); }
}

.slot-fill small {
  font-size: 0.7rem;
  color: var(--night);
}

.slot-ark {
  min-height: 64px;
  border-color: #daa520;
}

.slot-veil {
  background: linear-gradient(90deg, rgba(123, 94, 167, 0.2), rgba(91, 75, 154, 0.35), rgba(123, 94, 167, 0.2));
  border-color: #6b3fa0;
  min-height: 40px;
}

.slot-gate {
  min-height: 48px;
  background: rgba(123, 94, 167, 0.15);
  border-color: #5b4b9a;
}

.slot-altar {
  min-height: 64px;
  background: rgba(184, 115, 51, 0.12);
}

.slot-tent {
  min-height: 44px;
  border-color: #8b6914;
  background: rgba(232, 201, 138, 0.35);
}

.mishkan-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  min-height: 52px;
  position: relative;
  z-index: 1;
}

.mishkan-piece {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 76px;
  padding: 8px 10px;
  border: 3px solid var(--night);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff, #fff8e7);
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.75rem;
  box-shadow: 2px 2px 0 var(--night);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.mishkan-piece:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--night), 0 0 0 2px rgba(240, 193, 78, 0.35);
}

.mishkan-piece.selected {
  background: linear-gradient(180deg, #fff8d0, #ffe08a);
  box-shadow: 0 0 0 3px #f0c14e99, 2px 2px 0 var(--night);
  animation: gemShine 0.8s ease-in-out infinite alternate;
}

.mishkan-piece-emoji {
  font-size: 1.45rem;
  filter: drop-shadow(0 1px 0 rgba(26, 39, 68, 0.25));
}

.mishkan-icon {
  width: 52px;
  height: 52px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 2px rgba(26, 39, 68, 0.3));
  image-rendering: auto;
}

.mishkan-piece .mishkan-icon {
  width: 48px;
  height: 48px;
}

.slot-fill .mishkan-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto;
}

.mishkan-piece {
  min-width: 84px;
  padding: 10px 10px 8px;
}

.mishkan-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}

.mishkan-done-panel {
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(240, 193, 78, 0.35), transparent 55%),
    linear-gradient(180deg, #fff9e8, #e8f0ff);
  border: 3px solid #daa520;
  border-radius: 12px;
  padding: 18px 16px;
  margin-top: 8px;
  animation: fxPop 0.4s ease both;
  position: relative;
  z-index: 1;
  box-shadow: 0 0 24px rgba(240, 193, 78, 0.35);
}

.mishkan-done-glow {
  font-size: 1.8rem;
  animation: fxCelebrate 1s ease both;
  margin-bottom: 4px;
}

.mishkan-done-panel h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  line-height: 1.4;
  color: #6b4fa0;
  text-shadow: 0 0 10px rgba(240, 193, 78, 0.5);
}

.mishkan-done-panel p {
  margin: 0 0 14px;
  line-height: 1.5;
  color: var(--muted);
}

@media (max-width: 560px) {
  .mishkan-courtyard {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .mishkan-header h2 {
    font-size: 0.65rem;
  }

  .holy-place-row {
    grid-template-columns: 1fr 1fr;
  }

  .mishkan-subtitle {
    font-size: 0.8rem;
  }
}

/* ---------- Matzah bake minigame ---------- */

.matzah-wrap {
  background:
    radial-gradient(ellipse at 80% 0%, rgba(240, 193, 78, 0.18), transparent 45%),
    var(--panel);
  border: 4px solid var(--night);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-top: 12px;
}

.matzah-kitchen .matzah-header h2 {
  background: linear-gradient(90deg, #8b2419, #c47b4a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.matzah-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.matzah-header h2 {
  font-family: var(--font-display);
  font-size: 0.75rem;
  line-height: 1.45;
  margin: 4px 0 0;
  color: var(--night);
}

.matzah-progress {
  min-width: 140px;
  text-align: right;
  font-size: 0.85rem;
  font-weight: 800;
}

.matzah-progress-track {
  height: 10px;
  background: #e5e0d4;
  border: 2px solid var(--night);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 4px;
}

.matzah-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #e8c98a, #f0c14e, #c47b4a);
  transition: width 0.3s ease;
}

.matzah-time {
  margin: 0 0 12px;
  font-size: 0.9rem;
  font-weight: 800;
}

.matzah-time-track {
  height: 12px;
  background: #e5e0d4;
  border: 2px solid var(--night);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 4px;
}

.matzah-time-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #3d9a6a, #f0c14e);
  transition: width 0.05s linear;
}

.matzah-time-fill.urgent {
  background: linear-gradient(90deg, #d94f3d, #f0c14e);
}

.matzah-slots {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 0 0 12px;
  flex-wrap: wrap;
}

.matzah-slot {
  width: 84px;
  height: 88px;
  border: 3px solid var(--night);
  border-radius: 14px;
  background: linear-gradient(180deg, #fffdf6, #fff8e7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.72rem;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.25s ease;
  overflow: hidden;
}

.matzah-slot .ms-emoji {
  font-size: 1.7rem;
  line-height: 1.2;
  position: relative;
  z-index: 1;
}

.matzah-slot .ms-label {
  position: relative;
  z-index: 1;
}

.matzah-slot .ms-empty {
  opacity: 0.45;
}

.matzah-slot .ms-matzah {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #fff8e7, #e8c98a 55%, #c47b4a);
  border: 2px solid #8b6914;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  position: relative;
  animation: matzahPopIn 0.45s cubic-bezier(0.22, 1.3, 0.36, 1) both;
}

.matzah-slot .ms-matzah::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 1px dashed rgba(139, 105, 20, 0.45);
}

.matzah-slot .ms-ring {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: conic-gradient(
    #d94f3d calc(var(--pct, 0) * 1%),
    #e5e0d4 0
  );
  opacity: 0.9;
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  transition: background 0.15s ease;
}

.matzah-slot.done {
  background: linear-gradient(180deg, #f0fff5, #e8f8ee);
  border-color: #3d9a6a;
  box-shadow: 0 0 0 3px rgba(61, 154, 106, 0.28), 0 4px 12px rgba(61, 154, 106, 0.15);
}

.matzah-slot.current {
  border-color: #d94f3d;
  box-shadow: 0 0 0 3px rgba(217, 79, 61, 0.25);
  animation: matzahBounce 0.7s ease infinite;
}

.matzah-slot.current.stage-mix {
  border-color: #5eb3e4;
  box-shadow: 0 0 0 3px rgba(94, 179, 228, 0.3);
}

.matzah-slot.current.stage-press {
  border-color: #c47b4a;
}

.matzah-slot.current.stage-bake {
  border-color: #d94f3d;
}

@keyframes matzahPopIn {
  from { transform: scale(0.5) rotate(-12deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}

.matzah-word-card {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 3px solid var(--night);
  background: linear-gradient(135deg, #fff8e7, #e8f4ff);
  box-shadow: 3px 3px 0 rgba(26, 26, 34, 0.12);
}

.matzah-word-card .mw-en {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--night);
  line-height: 1.2;
}

.matzah-word-card .mw-say {
  font-family: var(--font-display);
  font-size: 0.55rem;
  color: #5b4b9a;
  letter-spacing: 0.02em;
}

.matzah-word-card .mw-he {
  font-size: 0.95rem;
  font-weight: 700;
  color: #3d6b9a;
}

.matzah-step-title {
  font-family: var(--font-display);
  font-size: 0.65rem;
  line-height: 1.45;
  margin: 0 0 6px;
  color: var(--night);
}

.matzah-choice-good {
  border-color: #3d9a6a !important;
}

.matzah-done-words {
  font-size: 0.85rem !important;
  font-weight: 700;
  color: #5b4b9a !important;
  margin: 0 0 14px !important;
  line-height: 1.45 !important;
}

.matzah-teach {
  margin: 0 0 8px;
  line-height: 1.5;
  color: var(--muted);
  font-size: 0.95rem;
}

.matzah-status {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff8e7;
  border: 2px solid #e8c98a;
  font-weight: 700;
  line-height: 1.45;
  min-height: 2.8em;
}

.matzah-status.good {
  background: #e8f8ee;
  border-color: #3d9a6a;
  color: #1a5c3a;
}

.matzah-status.wrong {
  background: #fdecea;
  border-color: #d94f3d;
  color: #8b2419;
}

.matzah-status.hint {
  background: #eef3ff;
  border-color: #5eb3e4;
  color: #1a3a5c;
}

/* Matzah kitchen scene + race UI */
.matzah-scene {
  --heat: 0.35;
  position: relative;
  height: 200px;
  border-radius: 16px;
  border: 3px solid var(--night);
  background: linear-gradient(180deg, #3d2a1f 0%, #6b4030 42%, #c47b4a 42%, #a86538 100%);
  background-size: cover;
  background-position: center;
  margin-bottom: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  transition: filter 0.2s ease, box-shadow 0.2s ease;
}

.matzah-scene.has-art-bg {
  background-color: #3a1820;
}

.matzah-scene.has-art-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(26, 15, 20, 0.25), rgba(26, 15, 20, 0.55));
  pointer-events: none;
  z-index: 0;
}

.matzah-scene[data-step="learn"] {
  background: linear-gradient(180deg, #2a3d5c 0%, #5eb3e4 50%, #e8c98a 50%, #c47b4a 100%);
}

.matzah-scene[data-step="bake"],
.matzah-scene.baking-hot,
.matzah-scene.race-live {
  box-shadow: 0 0 calc(10px + var(--heat) * 28px) rgba(217, 79, 61, calc(0.25 + var(--heat) * 0.45));
  filter: brightness(calc(1 + var(--heat) * 0.1));
}

.matzah-scene.matzah-bake-flash {
  animation: matzahOvenFlash 0.55s ease;
}

@keyframes matzahOvenFlash {
  0% { filter: brightness(1); }
  30% { filter: brightness(1.4) saturate(1.25); }
  100% { filter: brightness(1); }
}

.matzah-heat {
  position: absolute;
  left: 5%;
  right: 5%;
  bottom: 28%;
  height: 40%;
  background: linear-gradient(180deg, transparent, rgba(240, 193, 78, calc(0.15 + var(--heat) * 0.35)), transparent);
  animation: heatWaver 0.7s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
}

.matzah-scene.race-live .matzah-heat,
.matzah-scene.baking-hot .matzah-heat {
  opacity: calc(0.45 + var(--heat) * 0.55);
}

.matzah-heat-2 {
  left: 15%;
  right: 15%;
  bottom: 36%;
  animation-duration: 0.95s;
  animation-delay: 0.15s;
  background: linear-gradient(180deg, transparent, rgba(217, 79, 61, 0.25), transparent);
}

@keyframes heatWaver {
  from { transform: scaleY(1) translateY(0); }
  to { transform: scaleY(1.15) translateY(-6px); }
}

.matzah-embers {
  position: absolute;
  left: 8%;
  bottom: 36%;
  width: 70px;
  height: 60px;
  pointer-events: none;
  z-index: 2;
}

.matzah-embers span {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: #f0c14e;
  border: 1px solid #8b2419;
  animation: emberRise 1.4s ease-out infinite;
  opacity: 0;
}

.matzah-embers span:nth-child(1) { left: 4px; animation-delay: 0s; }
.matzah-embers span:nth-child(2) { left: 14px; animation-delay: 0.25s; background: #d94f3d; }
.matzah-embers span:nth-child(3) { left: 24px; animation-delay: 0.5s; }
.matzah-embers span:nth-child(4) { left: 36px; animation-delay: 0.75s; background: #fff8e7; }
.matzah-embers span:nth-child(5) { left: 48px; animation-delay: 1s; }

.matzah-scene.race-live .matzah-embers span,
.matzah-scene.baking-hot .matzah-embers span {
  opacity: 1;
}

@keyframes emberRise {
  0% { transform: translateY(0) scale(1); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translateY(-42px) scale(0.35); opacity: 0; }
}

.kitchen-stage {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1.4fr 0.9fr;
  gap: 6px;
  align-items: end;
  padding: 10px 10px 0;
  min-height: 150px;
}

.kitchen-oven {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transform: translateY(4px);
}

.oven-body {
  width: 72px;
  height: 78px;
  background: linear-gradient(180deg, #4a4a52, #2a2a32);
  border: 3px solid var(--night);
  border-radius: 10px 10px 6px 6px;
  position: relative;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.oven-glow {
  position: absolute;
  inset: 18px 10px 12px;
  background: radial-gradient(circle at 50% 80%, #f0c14e, #d94f3d 60%, transparent 75%);
  opacity: 0.35;
  transition: opacity 0.25s ease;
}

.kitchen-oven.oven-hot .oven-glow {
  opacity: 0.95;
  animation: ovenGlowPulse 0.8s ease-in-out infinite alternate;
}

@keyframes ovenGlowPulse {
  from { filter: brightness(1); }
  to { filter: brightness(1.25); }
}

.oven-door {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 16px;
  height: 44px;
  background: linear-gradient(180deg, #6a6a72, #3a3a42);
  border: 2px solid #1a1a22;
  border-radius: 4px;
  transform-origin: bottom center;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.kitchen-oven.oven-open .oven-door {
  transform: perspective(120px) rotateX(55deg);
  opacity: 0.5;
}

.oven-flame {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.1rem;
  filter: drop-shadow(0 0 6px #f0c14e);
  opacity: 0.5;
}

.kitchen-oven.oven-hot .oven-flame {
  opacity: 1;
  animation: ovenFlameBob 0.6s ease infinite alternate;
}

.oven-label {
  font-size: 0.62rem;
  font-weight: 800;
  color: #fff8e7;
  text-shadow: 1px 1px 0 #1a1a22;
}

@keyframes ovenFlameBob {
  from { transform: translateX(-50%) scale(1); }
  to { transform: translateX(-50%) scale(1.12); filter: drop-shadow(0 0 12px #d94f3d); }
}

.kitchen-workbench {
  position: relative;
  height: 120px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.kitchen-table-top {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28px;
  background: linear-gradient(180deg, #a67c3d, #6b4423);
  border: 2px solid var(--night);
  border-radius: 6px 6px 0 0;
  box-shadow: inset 0 2px 0 rgba(255, 248, 231, 0.2);
  z-index: 0;
}

.dough-blob {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 0.25s ease, height 0.25s ease, border-radius 0.25s ease;
}

.dough-blob.stage-empty { display: none; }

.dough-blob.stage-mix {
  width: 56px;
  height: 48px;
  border-radius: 40% 40% 45% 45%;
  background: linear-gradient(180deg, #f4e4bc, #e8c98a);
  border: 2px solid #8b6914;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
}

.dough-blob.stage-ball {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f0d9a8, #c47b4a);
  border: 2px solid #8b6914;
}

.dough-blob.pop-in {
  animation: matzahPopIn 0.35s cubic-bezier(0.22, 1.3, 0.36, 1) both;
}

.dough-face {
  font-size: 1.35rem;
  line-height: 1;
}

.dough-flat {
  position: absolute;
  bottom: 30px;
  left: 50%;
  width: 64px;
  height: 18px;
  margin-left: -32px;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 40%, #f4e4bc, #e0b86a 70%);
  border: 2px solid #8b6914;
  z-index: 2;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.22, 1.2, 0.36, 1);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}

.dough-flat.show {
  opacity: 1;
  transform: scale(1);
}

.dough-flat.into-oven {
  animation: doughToOven 0.4s ease forwards;
}

.flat-holes {
  position: absolute;
  inset: 4px 10px;
  background:
    radial-gradient(circle, #c47b4a 1.5px, transparent 2px) 0 0 / 10px 8px,
    radial-gradient(circle, #c47b4a 1.2px, transparent 1.8px) 5px 4px / 10px 8px;
  opacity: 0.55;
  border-radius: 50%;
}

@keyframes doughToOven {
  0% { transform: scale(1) translate(0, 0); opacity: 1; }
  100% { transform: scale(0.5) translate(-70px, -36px); opacity: 0; }
}

.matzah-ready-piece {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%) scale(0.4);
  font-size: 2.4rem;
  z-index: 3;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.2));
}

.matzah-ready-piece.show { opacity: 1; }

.matzah-ready-piece.pop-ready {
  animation: readyPop 0.55s cubic-bezier(0.22, 1.35, 0.36, 1) both;
}

@keyframes readyPop {
  0% { transform: translateX(-50%) scale(0.3) translateY(10px); opacity: 0; }
  50% { transform: translateX(-50%) scale(1.2) translateY(-8px); opacity: 1; }
  100% { transform: translateX(-50%) scale(1) translateY(0); opacity: 1; }
}

.kitchen-basket {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-bottom: 4px;
}

.basket-fill {
  min-width: 64px;
  min-height: 48px;
  background: linear-gradient(180deg, #c47b4a, #8b5a2b);
  border: 3px solid var(--night);
  border-radius: 8px 8px 12px 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px 4px;
  box-shadow: inset 0 2px 0 rgba(255, 248, 231, 0.2);
  position: relative;
}

.basket-fill::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 8px;
  right: 8px;
  height: 8px;
  border: 2px solid var(--night);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: #a06730;
}

.basket-matzah {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff8e7, #e8c98a 60%, #c47b4a);
  border: 1.5px solid #8b6914;
  animation: matzahPopIn 0.4s cubic-bezier(0.22, 1.3, 0.36, 1) both;
}

.basket-label {
  font-size: 0.62rem;
  font-weight: 800;
  color: #fff8e7;
  text-shadow: 1px 1px 0 #1a1a22;
}

.kitchen-basket.has-loaves .basket-fill {
  box-shadow:
    inset 0 2px 0 rgba(255, 248, 231, 0.2),
    0 0 12px rgba(240, 193, 78, 0.35);
}

.matzah-stage-pills {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 6px 8px 8px;
  flex-wrap: wrap;
}

.matzah-stage-pills[aria-hidden="true"] {
  display: none;
}

.matzah-stage-pills span {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 248, 231, 0.2);
  color: #fff8e7;
  border: 2px solid rgba(255, 248, 231, 0.35);
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.35);
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.matzah-stage-pills span.active {
  background: #f0c14e;
  color: #1a1a22;
  border-color: #1a1a22;
  transform: scale(1.06);
  text-shadow: none;
}

.matzah-stage-pills span.done {
  background: #3d9a6a;
  border-color: #1a1a22;
  color: #fff;
}

.matzah-visual-legacy[hidden] {
  display: none !important;
}

.matzah-visual {
  position: relative;
  z-index: 2;
  font-size: 3rem;
  margin-bottom: 28px;
  line-height: 1;
}

.matzah-action-area {
  text-align: center;
  margin-bottom: 10px;
}

.matzah-learn-emoji {
  font-size: 2.6rem;
  line-height: 1;
  margin: 0 0 8px;
  filter: drop-shadow(0 3px 0 rgba(26, 39, 68, 0.15));
}

.matzah-learn-emoji.pop-in {
  animation: matzahPopIn 0.4s cubic-bezier(0.22, 1.3, 0.36, 1) both;
}

.matzah-prompt {
  font-weight: 800;
  margin: 0 0 10px;
  font-size: 1rem;
}

.matzah-prompt-quiz {
  color: #8b2419;
}

.matzah-combo {
  min-height: 1.2em;
  font-family: var(--font-display);
  font-size: 0.55rem;
  color: #d94f3d;
  margin: 0 0 6px;
  opacity: 0;
  transform: translateY(4px);
}

.matzah-combo.show {
  animation: comboPop 0.7s ease both;
}

@keyframes comboPop {
  0% { opacity: 0; transform: translateY(6px) scale(0.9); }
  25% { opacity: 1; transform: translateY(0) scale(1.08); }
  100% { opacity: 0; transform: translateY(-10px) scale(1); }
}

.matzah-action-btn {
  min-width: min(100%, 340px);
  min-height: 76px !important;
  font-size: 1.2rem !important;
  font-weight: 800 !important;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.2s ease !important;
}

.matzah-action-btn.hold-btn {
  color: #1a1a22 !important;
  border-color: #1a1a22 !important;
}

.matzah-action-btn.stage-mix {
  background: linear-gradient(180deg, #8fd9b0, #5eb3e4) !important;
  box-shadow: 3px 3px 0 #1a3a5c !important;
}

.matzah-action-btn.stage-press {
  background: linear-gradient(180deg, #f0c14e, #c47b4a) !important;
  box-shadow: 3px 3px 0 #5c4033 !important;
}

.matzah-action-btn.stage-bake,
.matzah-action-btn.hold-btn:not(.stage-mix):not(.stage-press) {
  background: linear-gradient(180deg, #f0c14e, #d94f3d) !important;
  box-shadow: 3px 3px 0 #8b2419 !important;
}

.matzah-action-btn.tap-pulse {
  animation: matzahBounce 0.2s ease;
}

.matzah-action-btn.tap-boom {
  animation: tapBoom 0.35s cubic-bezier(0.22, 1.3, 0.36, 1);
}

@keyframes tapBoom {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); filter: brightness(1.15); }
  100% { transform: scale(1); }
}

.matzah-status-pop {
  animation: fxPop 0.35s ease both;
}

.matzah-word-card.card-pop {
  animation: fxPop 0.35s ease both;
}

.matzah-done-burst {
  font-size: 1.6rem;
  letter-spacing: 0.12em;
  margin-bottom: 6px;
  animation: matzahBounce 0.8s ease infinite;
}

.matzah-tip {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.matzah-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.matzah-choice {
  width: 100%;
  text-align: left;
  min-height: 48px;
  font-weight: 700;
}

.matzah-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.matzah-done-panel {
  margin-top: 12px;
  padding: 18px 16px;
  border-radius: 12px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(240, 193, 78, 0.35), transparent 55%),
    linear-gradient(180deg, #fff9e8, #e8f8ee);
  border: 3px solid #3d9a6a;
  text-align: center;
  box-shadow: 0 0 20px rgba(61, 154, 106, 0.2);
  animation: fxPop 0.4s ease both;
}

.matzah-done-panel h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  line-height: 1.4;
}

.matzah-done-panel p {
  margin: 0 0 14px;
  line-height: 1.5;
  color: var(--muted);
}

@keyframes matzahBounce {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.12) rotate(-3deg);
  }
  100% {
    transform: scale(1);
  }
}

@media (max-width: 560px) {
  .matzah-header h2 {
    font-size: 0.62rem;
  }

  .matzah-scene {
    height: 220px;
  }

  .kitchen-stage {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    justify-items: center;
    min-height: 170px;
  }

  .kitchen-oven {
    order: 1;
  }

  .kitchen-workbench {
    order: 2;
    width: 100%;
  }

  .kitchen-basket {
    order: 3;
    flex-direction: row;
    gap: 8px;
  }

  .matzah-action-btn {
    min-height: 80px !important;
    font-size: 1.05rem !important;
    width: 100%;
  }
}

/* ---------- Extra life animations ---------- */

/* Full-screen battle / divine flashes */
.fx-screen-flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 310;
  animation: screenFlash 0.28s ease forwards;
}

.fx-flash-hit {
  background: radial-gradient(circle at 50% 40%, rgba(240, 193, 78, 0.25), transparent 60%);
}

.fx-flash-danger {
  background: radial-gradient(circle at 50% 50%, rgba(217, 79, 61, 0.28), transparent 55%);
}

.fx-flash-divine {
  background: radial-gradient(circle at 50% 30%, rgba(255, 248, 231, 0.45), rgba(240, 193, 78, 0.2) 40%, transparent 70%);
  animation-duration: 0.4s;
}

@keyframes screenFlash {
  0% { opacity: 0; }
  30% { opacity: 1; }
  100% { opacity: 0; }
}

/* Ambient desert motes / sparks (spawned by FX.startAmbient) */
.fx-mote {
  position: absolute;
  border-radius: 2px;
  background: #e8c98a;
  opacity: 0.85;
  pointer-events: none;
  image-rendering: pixelated;
  box-shadow: 1px 1px 0 rgba(26, 39, 68, 0.25);
  animation: fxMoteDrift ease-out forwards;
  z-index: 1;
}

.fx-mote-spark {
  border-radius: 50%;
  background: #fff8e7;
  box-shadow: 0 0 6px 2px rgba(240, 193, 78, 0.55);
}

@keyframes fxMoteDrift {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 0;
  }
  12% { opacity: 0.9; }
  100% {
    transform: translate(var(--dx, 20px), var(--dy, -60px)) scale(0.4);
    opacity: 0;
  }
}

/* Floating +N / −N meter text */
.fx-float-text {
  position: fixed;
  z-index: 320;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  color: #3d9a6a;
  text-shadow:
    2px 2px 0 var(--night),
    -1px -1px 0 #fff8e7;
  pointer-events: none;
  white-space: nowrap;
  transform: translate(-50%, 0);
  animation: fxFloatText 1.05s cubic-bezier(0.22, 1.15, 0.36, 1) forwards;
}

@keyframes fxFloatText {
  0% {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.85);
  }
  15% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1.08);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -42px) scale(1);
  }
}

.fx-correct-pop {
  animation: fxCorrectPop 0.55s cubic-bezier(0.22, 1.3, 0.36, 1) both;
}

@keyframes fxCorrectPop {
  0% { transform: scale(0.92); filter: brightness(1); }
  40% { transform: scale(1.06); filter: brightness(1.15); }
  100% { transform: scale(1); filter: none; }
}

.fx-action-in {
  animation: fxActionIn 0.38s cubic-bezier(0.22, 1.25, 0.36, 1) both;
}

@keyframes fxActionIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.fx-location-pop {
  animation: fxLocationPop 0.55s cubic-bezier(0.22, 1.3, 0.36, 1) both;
}

@keyframes fxLocationPop {
  0% { transform: scale(0.9); color: var(--gold); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.fx-stat-nudge {
  animation: fxStatNudge 0.35s ease both;
}

@keyframes fxStatNudge {
  0% { transform: scale(1); }
  40% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

/* Living scene art */
.scene-art.fx-scene-alive,
.scene-art:has(canvas) {
  animation: sceneBreathe 3.2s ease-in-out infinite;
}

.scene-art::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 9px;
  pointer-events: none;
  background: linear-gradient(
    120deg,
    transparent 30%,
    rgba(255, 248, 231, 0.18) 48%,
    transparent 62%
  );
  background-size: 200% 100%;
  animation: sceneShimmer 4.5s ease-in-out infinite;
  z-index: 1;
  opacity: 0.7;
}

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

@keyframes sceneShimmer {
  0% { background-position: 100% 0; opacity: 0.25; }
  40% { opacity: 0.75; }
  100% { background-position: -100% 0; opacity: 0.25; }
}

/* Map path energy */
.map-node.done .connector {
  background: linear-gradient(90deg, var(--green), #8fd9b0, var(--green));
  background-size: 200% 100%;
  animation: pathGlow 2.2s linear infinite;
}

.map-node.current .map-thumb {
  animation: mapPulse 1.4s ease-in-out infinite, mapBob 1.1s ease-in-out infinite;
}

@keyframes pathGlow {
  from { background-position: 0% 0; }
  to { background-position: 200% 0; }
}

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

.map-node.current .label {
  animation: mapLabelPulse 1.4s ease-in-out infinite;
}

@keyframes mapLabelPulse {
  0%, 100% { color: var(--clay); }
  50% { color: #a85a28; }
}

/* Party idle life */
.member .mem-emoji {
  display: inline-block;
  animation: partyEmojiBob 2s ease-in-out infinite;
}

.member:nth-child(1) .mem-emoji { animation-delay: 0s; }
.member:nth-child(2) .mem-emoji { animation-delay: 0.15s; }
.member:nth-child(3) .mem-emoji { animation-delay: 0.3s; }
.member:nth-child(4) .mem-emoji { animation-delay: 0.45s; }
.member:nth-child(5) .mem-emoji { animation-delay: 0.6s; }
.member:nth-child(6) .mem-emoji { animation-delay: 0.75s; }

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

/* Stat icons gentle bob */
.stat-icon.pixel-icon {
  animation: iconBob 2.4s ease-in-out infinite;
}

.stat:nth-child(1) .stat-icon { animation-delay: 0s; }
.stat:nth-child(2) .stat-icon { animation-delay: 0.2s; }
.stat:nth-child(3) .stat-icon { animation-delay: 0.4s; }
.stat:nth-child(4) .stat-icon { animation-delay: 0.6s; }

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

/* Primary button idle invite */
.btn-primary {
  position: relative;
}

#screen-title .btn-primary {
  animation: primaryInvite 2.4s ease-in-out infinite;
}

#actions .btn-primary {
  box-shadow: 3px 3px 0 var(--night), 0 0 0 0 rgba(240, 193, 78, 0);
  transition: box-shadow 0.25s ease, transform 0.12s ease, background 0.12s ease;
}

#actions .btn-primary:hover {
  box-shadow: 3px 3px 0 var(--night), 0 0 0 4px rgba(240, 193, 78, 0.3);
}

@keyframes primaryInvite {
  0%, 100% { box-shadow: 3px 3px 0 var(--night); }
  50% { box-shadow: 3px 3px 0 var(--night), 0 0 0 4px rgba(240, 193, 78, 0.28); }
}

/* Story text soft enter */
.story-text h3,
#story-body {
  animation: storyFade 0.45s ease both;
}

@keyframes storyFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* Quiz / event choice cascade */
#quiz-choices .btn,
#modal-actions .btn {
  animation: fxActionIn 0.35s cubic-bezier(0.22, 1.25, 0.36, 1) both;
}

#quiz-choices .btn:nth-child(1),
#modal-actions .btn:nth-child(1) { animation-delay: 0.02s; }
#quiz-choices .btn:nth-child(2),
#modal-actions .btn:nth-child(2) { animation-delay: 0.07s; }
#quiz-choices .btn:nth-child(3),
#modal-actions .btn:nth-child(3) { animation-delay: 0.12s; }
#quiz-choices .btn:nth-child(4),
#modal-actions .btn:nth-child(4) { animation-delay: 0.17s; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .travel-overlay {
    display: none !important;
  }

  .stars,
  .title-card h1,
  .title-cloud,
  .title-sun,
  .title-banner,
  .title-hero-shine,
  .map-node.current .map-thumb,
  .map-node.done .connector,
  .member.ill,
  .member .mem-emoji,
  .stat-icon.pixel-icon,
  .scene-art.fx-scene-alive,
  .scene-art:has(canvas),
  .scene-art::before,
  #screen-title .btn-primary,
  #actions .btn-primary,
  .fx-mote,
  .mishkan-grand .mishkan-rays,
  .holy-of-holies,
  .mishkan-progress-fill,
  .matzah-heat,
  .matzah-embers span,
  .kitchen-oven.oven-hot .oven-glow,
  .kitchen-oven.oven-hot .oven-flame,
  .matzah-slot.current,
  .matzah-done-burst,
  .amalek-clouds span,
  .fig-power-rays,
  .fig-aura,
  .bf-troop,
  .amalek-tap,
  .glory-puff,
  .slot-gem,
  .travel-still.ken-burns-run .travel-still-img {
    animation: none !important;
  }
}

/* Responsive */
@media (max-width: 560px) {
  .status-bar {
    grid-template-columns: 1fr 1fr;
  }

  .story-panel {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .scene-art {
    margin: 0 auto;
    width: min(280px, 100%);
    height: 160px;
  }

  .scene-art.has-photo,
  .scene-art.scene-art-photo {
    width: min(320px, 100%);
    height: 180px;
  }

  .learn {
    text-align: left;
  }

  .title-card h1 {
    font-size: 1.2rem;
  }

  .travel-caption {
    font-size: 0.55rem;
    padding: 0 12px;
    text-align: center;
  }
}
