:root {
  color-scheme: light;
  --ink: #2e2234;
  --muted: #665a6f;
  --paper: #fffdf8;
  --surface: #ffffff;
  --rose: #f7c7d5;
  --rose-strong: #e65e88;
  --violet: #7451a6;
  --sky: #6cb7d8;
  --sky-dark: #287ea3;
  --mint: #93d8bb;
  --mint-dark: #1f7f61;
  --gold: #f7c948;
  --coral: #ff8a6b;
  --line: #eadfeb;
  --shadow: 0 16px 38px rgba(50, 35, 60, 0.16);
  --soft-shadow: 0 8px 18px rgba(50, 35, 60, 0.11);
  --radius: 8px;
  --tap: 56px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(251, 244, 247, 0.96)),
    repeating-linear-gradient(
      90deg,
      rgba(116, 81, 166, 0.05) 0,
      rgba(116, 81, 166, 0.05) 1px,
      transparent 1px,
      transparent 42px
    );
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family:
    "Tahoma",
    "Arial",
    "Segoe UI",
    sans-serif;
}

button {
  font: inherit;
}

.app-frame {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 68px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 12px;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 10px 18px;
}

.topbar-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--violet);
  font-size: 1.15rem;
  font-weight: 800;
}

.brand-mark {
  width: 42px;
  height: 42px;
  position: relative;
  border: 2px solid rgba(116, 81, 166, 0.2);
  border-radius: 50%;
  background: var(--paper);
  box-shadow: var(--soft-shadow);
}

.brand-thread {
  position: absolute;
  inset: 11px 8px 8px 10px;
  border: 4px solid var(--rose-strong);
  border-left-color: transparent;
  border-radius: 50%;
}

.brand-needle {
  position: absolute;
  width: 25px;
  height: 3px;
  left: 8px;
  top: 19px;
  border-radius: 20px;
  background: var(--sky-dark);
  transform: rotate(-28deg);
}

.brand-needle::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  right: 1px;
  top: -1px;
  border: 1px solid var(--paper);
  border-radius: 50%;
}

.icon-button {
  min-width: 44px;
  min-height: 44px;
  display: inline-grid;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 50%;
  color: var(--violet);
  background: var(--surface);
  box-shadow: var(--soft-shadow);
  cursor: pointer;
}

.icon-button[aria-pressed="true"] {
  color: var(--muted);
  background: #f0ecf2;
}

.app {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 8px 18px 26px;
  flex: 1;
  display: flex;
}

.screen {
  width: 100%;
  min-height: calc(100vh - 102px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.stage-track {
  width: min(560px, 100%);
  display: grid;
  grid-template-columns: repeat(var(--stage-count, 6), 1fr);
  gap: 8px;
  align-self: center;
  margin-bottom: 2px;
}

.stage-dot {
  height: 8px;
  border-radius: 999px;
  background: #e9ddec;
}

.stage-dot.is-active {
  background: var(--coral);
}

.stage-dot.is-done {
  background: var(--mint-dark);
}

.primary-button,
.secondary-button {
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: var(--radius);
  padding: 14px 24px;
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--soft-shadow);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.primary-button {
  color: #ffffff;
  background: var(--sky-dark);
}

.primary-button:hover,
.secondary-button:hover,
.icon-button:hover,
.name-card:hover,
.drop-zone:hover,
.lesson-card:hover,
.choice-card:hover,
.step-card:hover,
.order-slot:hover,
.swatch:hover,
.fabric-patch:hover,
.sew-hole:hover {
  transform: translateY(-1px);
}

.primary-button:active,
.secondary-button:active,
.icon-button:active,
.name-card:active,
.drop-zone:active,
.lesson-card:active,
.choice-card:active,
.step-card:active,
.order-slot:active,
.swatch:active,
.fabric-patch:active,
.sew-hole:active {
  transform: translateY(1px);
  box-shadow: none;
}

.secondary-button {
  color: var(--violet);
  background: #ffffff;
  border: 2px solid var(--line);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.small-button {
  min-height: 48px;
  padding: 10px 16px;
  font-size: 1rem;
}

.welcome-screen {
  justify-content: center;
}

.welcome-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(320px, 1.08fr);
  gap: 28px;
  align-items: center;
  min-height: 620px;
}

.welcome-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
}

.eyebrow {
  margin: 0;
  color: var(--sky-dark);
  font-size: 1.12rem;
  font-weight: 800;
}

h1,
h2 {
  margin: 0;
  color: var(--violet);
  line-height: 1.15;
  letter-spacing: 0;
}

h1 {
  font-size: 3.4rem;
}

h2 {
  font-size: 2.2rem;
}

.lead {
  max-width: 26rem;
  margin: 0;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1.65;
}

.workshop-scene {
  min-height: 470px;
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(116, 81, 166, 0.12);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, #fff7d8 0 32%, #d8f2ed 32% 58%, #f6d4dc 58% 100%);
  box-shadow: var(--shadow);
}

.workshop-table {
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: 28px;
  height: 104px;
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.22), transparent 30%),
    #c87957;
  box-shadow: inset 0 8px 0 rgba(255, 255, 255, 0.18);
}

.workshop-shelf {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 58px;
  height: 18px;
  border-radius: 999px;
  background: #b86d56;
  box-shadow: 0 30px 0 #c67b5f;
}

.spool {
  position: absolute;
  width: 46px;
  height: 58px;
  top: 12px;
  border: 5px solid #ffffff;
  border-radius: var(--radius);
  box-shadow: var(--soft-shadow);
}

.spool::before,
.spool::after {
  content: "";
  position: absolute;
  left: -8px;
  right: -8px;
  height: 8px;
  border-radius: 999px;
  background: #ffffff;
}

.spool::before {
  top: -9px;
}

.spool::after {
  bottom: -9px;
}

.spool-one {
  right: 18%;
  background: var(--rose-strong);
}

.spool-two {
  right: 31%;
  background: var(--sky);
}

.spool-three {
  right: 44%;
  background: var(--gold);
}

.window {
  position: absolute;
  left: 9%;
  top: 96px;
  width: 128px;
  height: 112px;
  border: 8px solid #ffffff;
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, transparent 47%, #ffffff 47% 53%, transparent 53%),
    linear-gradient(180deg, transparent 47%, #ffffff 47% 53%, transparent 53%),
    #bfe8f5;
  box-shadow: var(--soft-shadow);
}

.fajr-figure {
  position: absolute;
  width: min(330px, 64%);
  right: 10%;
  bottom: 86px;
}

.scene-tool {
  position: absolute;
  width: 90px;
  height: 90px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(116, 81, 166, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--soft-shadow);
}

.scene-tool.needle {
  left: 17%;
  bottom: 64px;
}

.scene-tool.button {
  left: 36%;
  bottom: 82px;
}

.scene-tool.thread {
  right: 7%;
  bottom: 62px;
}

.tool-svg {
  width: 100%;
  max-width: 140px;
  height: auto;
  display: block;
}

.tool-svg.small {
  max-width: 76px;
}

.tool-svg.medium {
  max-width: 116px;
}

.lesson-screen,
.lesson-menu-screen,
.instruction-screen,
.game-screen,
.success-screen {
  justify-content: center;
}

.menu-header,
.game-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.progress-badge {
  min-height: 58px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 2px solid rgba(247, 201, 72, 0.55);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: #7d5b00;
  background: #fff6c9;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: var(--soft-shadow);
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.lesson-card {
  min-height: 260px;
  position: relative;
  display: grid;
  grid-template-rows: auto 88px auto 1fr auto;
  gap: 10px;
  align-items: center;
  justify-items: center;
  border: 2px solid rgba(116, 81, 166, 0.16);
  border-radius: var(--radius);
  padding: 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--soft-shadow);
  cursor: pointer;
  text-align: center;
}

.lesson-card strong {
  color: var(--violet);
  font-size: 1.08rem;
  line-height: 1.25;
}

.lesson-card > span:not(.lesson-number):not(.lesson-icon):not(.lesson-status) {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.lesson-card.is-done {
  border-color: rgba(31, 127, 97, 0.35);
  background: #f0fff8;
}

.lesson-number {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--violet);
  font-weight: 900;
}

.lesson-icon {
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: #fff7d8;
}

.lesson-status {
  width: 100%;
  min-height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: #ffffff;
  background: var(--sky-dark);
  font-weight: 900;
}

.lesson-card.is-done .lesson-status {
  background: var(--mint-dark);
}

.lesson-layout,
.instruction-layout,
.success-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.15fr);
  gap: 24px;
  align-items: center;
}

.side-character,
.reward-panel {
  min-height: 420px;
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(116, 81, 166, 0.12);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, #fef1c7 0 36%, #d7f3ea 36% 100%);
  box-shadow: var(--soft-shadow);
}

.side-character .fajr-figure,
.reward-panel .fajr-figure {
  right: 50%;
  bottom: 30px;
  transform: translateX(50%);
  width: min(290px, 80%);
}

.video-panel,
.instruction-copy,
.success-copy {
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: flex-start;
}

.video-player {
  width: 100%;
  overflow: hidden;
  border: 2px solid #ffffff;
  border-radius: var(--radius);
  background: #2e2234;
  box-shadow: var(--shadow);
}

.video-stage {
  min-height: 320px;
  position: relative;
  display: grid;
  grid-template-columns: minmax(170px, 0.8fr) minmax(0, 1.2fr);
  gap: 18px;
  align-items: center;
  padding: 24px;
  color: #ffffff;
  background:
    linear-gradient(180deg, rgba(108, 183, 216, 0.26), rgba(116, 81, 166, 0.3)),
    #3a2848;
}

.video-visual {
  min-height: 210px;
  position: relative;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.12);
}

.video-visual .fajr-figure {
  position: static;
  width: min(250px, 88%);
}

.video-visual .tool-svg {
  max-width: 220px;
}

.video-caption {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.video-caption strong {
  font-size: 2rem;
  line-height: 1.2;
}

.video-caption span {
  font-size: 1.25rem;
  line-height: 1.65;
}

.safety-note {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: #392819;
  background: #ffe4a4;
  font-weight: 800;
}

.video-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(56px, auto)) 1fr;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: #241b2c;
}

.control-button {
  min-width: 50px;
  min-height: 48px;
  border: 0;
  border-radius: var(--radius);
  color: #ffffff;
  background: var(--violet);
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
}

.control-button[hidden] {
  display: none;
}

.video-progress-shell {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}

.video-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
  transition: width 120ms linear;
}

.tool-strip {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(68px, 1fr));
  gap: 10px;
}

.mini-tool {
  min-height: 86px;
  display: grid;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.game-area {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.game-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.feedback {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  background: var(--surface);
  box-shadow: var(--soft-shadow);
  color: var(--muted);
  font-size: 1.18rem;
  font-weight: 800;
}

.feedback.success {
  border-color: rgba(31, 127, 97, 0.32);
  color: var(--mint-dark);
}

.feedback.try {
  border-color: rgba(255, 138, 107, 0.35);
  color: #9a5939;
}

.star-counter {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 2px solid rgba(247, 201, 72, 0.52);
  border-radius: var(--radius);
  padding: 8px 12px;
  background: #fff6c9;
  color: #7d5b00;
  font-weight: 900;
  white-space: nowrap;
}

.drop-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.drop-zone {
  min-height: 220px;
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: center;
  justify-items: center;
  gap: 12px;
  border: 3px dashed #d8c8dc;
  border-radius: var(--radius);
  padding: 14px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--soft-shadow);
  cursor: pointer;
}

.drop-zone.is-matched {
  border-style: solid;
  border-color: rgba(31, 127, 97, 0.36);
  background: #f0fff8;
}

.drop-zone.is-selected-target {
  border-color: var(--sky-dark);
  background: #eef9fd;
}

.drop-zone.is-nudged {
  animation: nudge 330ms ease;
}

.drop-label {
  min-height: 44px;
  width: 100%;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  padding: 8px 10px;
  color: var(--muted);
  background: #f4eef5;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.25;
}

.drop-zone.is-matched .drop-label {
  color: #ffffff;
  background: var(--mint-dark);
  font-size: 1.2rem;
}

.matched-star {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #7d5b00;
  background: var(--gold);
  box-shadow: var(--soft-shadow);
}

.name-bank {
  min-height: 116px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  border: 2px solid rgba(116, 81, 166, 0.13);
  border-radius: var(--radius);
  padding: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.name-card,
.drag-ghost {
  min-width: 132px;
  min-height: 64px;
  border: 3px solid #ffffff;
  border-radius: var(--radius);
  color: #ffffff;
  background: var(--rose-strong);
  box-shadow: var(--soft-shadow);
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1.15;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.name-card.is-selected {
  outline: 4px solid var(--gold);
  background: var(--violet);
}

.name-card.is-origin {
  opacity: 0.3;
}

.drag-ghost {
  position: fixed;
  z-index: 20;
  display: grid;
  place-items: center;
  pointer-events: none;
  transform: rotate(-2deg);
}

.empty-bank {
  min-height: 64px;
  display: grid;
  place-items: center;
  color: var(--mint-dark);
  font-size: 1.25rem;
  font-weight: 900;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.choice-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.choice-card {
  min-height: 190px;
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 10px;
  align-items: center;
  justify-items: center;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--soft-shadow);
  cursor: pointer;
  text-align: center;
}

.choice-card strong {
  color: var(--violet);
  font-size: 1.12rem;
  line-height: 1.35;
}

.choice-card.is-correct {
  border-color: rgba(31, 127, 97, 0.36);
  background: #f0fff8;
}

.order-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.order-slot {
  min-height: 210px;
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  align-items: center;
  justify-items: center;
  border: 3px dashed #d8c8dc;
  border-radius: var(--radius);
  padding: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--soft-shadow);
  cursor: pointer;
  text-align: center;
  font-weight: 800;
}

.order-slot.is-filled {
  border-style: solid;
  border-color: rgba(31, 127, 97, 0.36);
  color: var(--mint-dark);
  background: #f0fff8;
}

.slot-number {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--violet);
  font-weight: 900;
}

.order-bank {
  min-height: 126px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  border: 2px solid rgba(116, 81, 166, 0.13);
  border-radius: var(--radius);
  padding: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.step-card {
  min-width: 220px;
  min-height: 78px;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 3px solid #ffffff;
  border-radius: var(--radius);
  padding: 10px 14px;
  color: #ffffff;
  background: var(--rose-strong);
  box-shadow: var(--soft-shadow);
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1.25;
  text-align: start;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.step-card.is-selected {
  outline: 4px solid var(--gold);
  background: var(--violet);
}

.button-sewing {
  min-height: 460px;
  position: relative;
  display: grid;
  place-items: center;
  border: 2px solid rgba(116, 81, 166, 0.13);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(108, 183, 216, 0.13) 1px, transparent 1px),
    linear-gradient(180deg, rgba(108, 183, 216, 0.13) 1px, transparent 1px),
    #fffdf8;
  background-size: 34px 34px;
  box-shadow: var(--soft-shadow);
}

.fabric-panel {
  position: absolute;
  width: min(520px, 82%);
  height: min(330px, 78%);
  border: 4px solid rgba(31, 127, 97, 0.24);
  border-radius: var(--radius);
  background: #d7f3ea;
}

.big-button {
  width: min(300px, 70vw);
  aspect-ratio: 1;
  position: relative;
  border: 10px solid #b98200;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: var(--shadow);
}

.sew-hole {
  width: 64px;
  height: 64px;
  position: absolute;
  display: grid;
  place-items: center;
  border: 5px solid #b98200;
  border-radius: 50%;
  color: #7d5b00;
  background: #fffdf8;
  font-weight: 900;
  cursor: pointer;
  box-shadow: var(--soft-shadow);
}

.sew-hole.topLeft {
  top: 24%;
  right: 58%;
}

.sew-hole.topRight {
  top: 24%;
  right: 20%;
}

.sew-hole.bottomLeft {
  top: 58%;
  right: 58%;
}

.sew-hole.bottomRight {
  top: 58%;
  right: 20%;
}

.sew-hole.is-next {
  outline: 6px solid rgba(230, 94, 136, 0.35);
  background: #ffe4ef;
}

.sew-hole.is-tapped {
  color: #ffffff;
  background: var(--mint-dark);
  border-color: var(--mint-dark);
}

.thread-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.thread-lines::before,
.thread-lines::after {
  content: "";
  position: absolute;
  height: 7px;
  border-radius: 999px;
  background: var(--rose-strong);
  opacity: 0.72;
}

.thread-lines::before {
  width: 42%;
  right: 29%;
  top: 47%;
  transform: rotate(38deg);
}

.thread-lines::after {
  width: 42%;
  right: 29%;
  top: 47%;
  transform: rotate(-38deg);
  opacity: 0.42;
}

.decorator {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.palette {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.swatch {
  min-height: 72px;
  display: grid;
  place-items: center;
  border: 3px solid #ffffff;
  border-radius: var(--radius);
  color: #ffffff;
  background: var(--swatch);
  box-shadow: var(--soft-shadow);
  font-weight: 900;
  cursor: pointer;
}

.swatch.is-selected {
  outline: 5px solid var(--violet);
}

.patch-board {
  min-height: 430px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  border: 2px solid rgba(116, 81, 166, 0.13);
  border-radius: var(--radius);
  padding: 18px;
  background:
    linear-gradient(90deg, rgba(108, 183, 216, 0.12) 1px, transparent 1px),
    linear-gradient(180deg, rgba(108, 183, 216, 0.12) 1px, transparent 1px),
    #fffdf8;
  background-size: 28px 28px;
}

.fabric-patch {
  min-height: 160px;
  border: 4px dashed rgba(116, 81, 166, 0.24);
  border-radius: var(--radius);
  color: #ffffff;
  background: var(--patch);
  box-shadow: var(--soft-shadow);
  font-size: 2.5rem;
  cursor: pointer;
}

.patch-2,
.patch-3 {
  border-radius: 50% 8px 50% 8px;
}

.builder-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.75fr) minmax(0, 1.25fr);
  gap: 18px;
  align-items: stretch;
}

.pouch-preview {
  min-height: 360px;
  display: grid;
  place-items: center;
  gap: 12px;
  border: 2px solid rgba(116, 81, 166, 0.13);
  border-radius: var(--radius);
  padding: 18px;
  background: #fffdf8;
  box-shadow: var(--soft-shadow);
  color: var(--violet);
  font-size: 1.3rem;
  font-weight: 900;
}

.pouch-preview.is-ready {
  border-color: rgba(31, 127, 97, 0.36);
  background: #f0fff8;
  color: var(--mint-dark);
}

.review-panel {
  display: grid;
  gap: 18px;
  border: 2px solid rgba(116, 81, 166, 0.13);
  border-radius: var(--radius);
  padding: 22px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--soft-shadow);
}

.review-panel h2 {
  text-align: center;
  font-size: 1.75rem;
}

.reward-star {
  width: min(300px, 70vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin: 0 auto;
  color: #7d5b00;
  filter: drop-shadow(0 18px 24px rgba(125, 91, 0, 0.18));
  animation: starPop 680ms ease both;
}

.reward-star svg {
  width: 100%;
  height: 100%;
}

.success-copy {
  align-items: center;
  text-align: center;
}

.success-copy .lead {
  max-width: 33rem;
}

.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 22% 26%, var(--coral) 0 5px, transparent 6px),
    radial-gradient(circle at 76% 21%, var(--sky) 0 5px, transparent 6px),
    radial-gradient(circle at 18% 68%, var(--mint-dark) 0 5px, transparent 6px),
    radial-gradient(circle at 82% 72%, var(--gold) 0 6px, transparent 7px);
}

@keyframes nudge {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-7px);
  }
  55% {
    transform: translateX(7px);
  }
}

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

@media (max-width: 920px) {
  .welcome-layout,
  .lesson-layout,
  .instruction-layout,
  .success-layout {
    grid-template-columns: 1fr;
  }

  .welcome-layout {
    min-height: auto;
  }

  .welcome-copy,
  .video-panel,
  .instruction-copy {
    align-items: center;
    text-align: center;
  }

  .lead {
    max-width: 100%;
  }

  .workshop-scene {
    min-height: 410px;
    order: -1;
  }

  .side-character,
  .reward-panel {
    min-height: 300px;
  }

  .lesson-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .drop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .drop-zone {
    min-height: 190px;
  }

  .choice-grid,
  .choice-grid.compact,
  .order-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .decorator,
  .builder-layout {
    grid-template-columns: 1fr;
  }

  .palette {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .topbar {
    min-height: 60px;
    grid-template-columns: 40px minmax(0, 1fr) 44px;
    padding-inline: 12px;
  }

  .app {
    padding-inline: 12px;
  }

  .screen {
    min-height: calc(100vh - 86px);
  }

  h1 {
    font-size: 2.35rem;
  }

  h2 {
    font-size: 1.75rem;
  }

  .lead {
    font-size: 1.08rem;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
    font-size: 1.02rem;
  }

  .menu-header,
  .game-title-row {
    grid-template-columns: 1fr;
  }

  .lesson-grid {
    grid-template-columns: 1fr;
  }

  .lesson-card {
    min-height: 220px;
  }

  .video-stage {
    grid-template-columns: 1fr;
    min-height: 430px;
    padding: 16px;
  }

  .video-caption {
    text-align: center;
  }

  .video-caption strong {
    font-size: 1.55rem;
  }

  .video-caption span {
    font-size: 1.05rem;
  }

  .video-controls {
    grid-template-columns: repeat(3, 1fr);
  }

  .video-progress-shell {
    grid-column: 1 / -1;
  }

  .tool-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .game-header {
    grid-template-columns: 1fr;
  }

  .drop-grid {
    gap: 10px;
  }

  .choice-grid,
  .choice-grid.compact,
  .order-board {
    grid-template-columns: 1fr;
  }

  .choice-card {
    min-height: 150px;
  }

  .order-slot {
    min-height: 150px;
  }

  .order-bank {
    padding: 12px;
  }

  .step-card {
    width: 100%;
    min-width: 0;
  }

  .button-sewing {
    min-height: 360px;
  }

  .big-button {
    width: min(250px, 76vw);
  }

  .sew-hole {
    width: 54px;
    height: 54px;
  }

  .palette {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .patch-board {
    min-height: 360px;
    padding: 12px;
  }

  .fabric-patch {
    min-height: 120px;
  }

  .drop-zone {
    min-height: 168px;
    padding: 10px;
  }

  .drop-label {
    font-size: 0.9rem;
  }

  .name-card,
  .drag-ghost {
    min-width: 124px;
    min-height: 58px;
    font-size: 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}
