:root {
  color-scheme: light;
  --ink: #263a3b;
  --muted: #687574;
  --paper: #fffaf0;
  --teal: #157c78;
  --teal-dark: #0c4f4d;
  --coral: #ed6c55;
  --coral-dark: #9f3b2d;
  --gold: #efad2f;
  --cream: #f8e6bf;
  --grid: #c8baa0;
  font-family: "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; min-width: 920px; min-height: 640px; overflow: hidden; }
body { margin: 0; color: var(--ink); background: #e8b96c; }
button { color: inherit; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 4px solid #075f79; outline-offset: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.lesson { height: 100%; padding: 12px; }
.studio { position: relative; height: 100%; min-height: 616px; overflow: hidden; isolation: isolate; border: 1px solid #a96a31; border-radius: 25px; background: #eac27f url("art/studio-backdrop-01.webp") center/cover no-repeat; box-shadow: 0 8px 0 #9d632f, 0 25px 60px rgba(66,38,15,.3); }
.studio::after { position: absolute; z-index: -1; inset: 0; content: ""; background: linear-gradient(90deg,rgba(75,43,18,.12),rgba(255,248,220,.05) 30% 70%,rgba(75,43,18,.12)); }
.sunwash { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at 50% 20%,rgba(255,255,255,.38),transparent 39%); }

.studio-hud { position: absolute; z-index: 20; left: 18px; right: 18px; top: 16px; height: 68px; display: grid; grid-template-columns: 200px minmax(220px,1fr) minmax(260px,330px) auto; align-items: center; gap: 14px; }
.brand-card,.difficulty-card,.scoreboard,.commission-track { border: 1px solid rgba(73,48,27,.17); background: rgba(255,250,240,.94); box-shadow: 0 5px 0 rgba(92,57,27,.17); backdrop-filter: blur(9px); }
.brand-card { height: 68px; display: flex; flex-direction: column; justify-content: center; padding: 10px 15px; border-radius: 14px; }
.brand-card span,.difficulty-card span,.scoreboard span { color: var(--muted); font-size: 10px; font-weight: 1000; letter-spacing: .09em; text-transform: uppercase; }
.brand-card strong { margin-top: 3px; font-size: 16px; }
.commission-track { height: 48px; display: flex; align-items: center; justify-content: center; padding: 0 12px; border-radius: 999px; }
.commission-track i { flex: 0 0 22px; width: 22px; height: 22px; display: grid; place-items: center; border: 2px solid #b9a98c; border-radius: 50%; background: #fff; color: #7f725f; font-size: 8px; font-style: normal; font-weight: 1000; transition: 180ms ease-out; }
.commission-track i.is-done { transform: rotate(-7deg) scale(1.08); border-color: var(--teal-dark); color: #fff; background: var(--teal); box-shadow: 0 3px 0 var(--teal-dark); }
.commission-track b { flex: 1 1 12px; min-width: 3px; max-width: 22px; height: 3px; background: #d8cbb4; }
.difficulty-card { display: grid; grid-template-columns: 1fr auto; gap: 5px 10px; padding: 9px 13px; border-radius: 14px; }
.difficulty-card > i { grid-column: 1/-1; height: 7px; overflow: hidden; border-radius: 99px; background: #dfd7c9; }
.difficulty-card > i b { display: block; width: 18%; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--gold),var(--coral),var(--teal)); transition: width 220ms ease-out; }
.difficulty-card strong { font-size: 11px; }
.scoreboard { height: 68px; display: flex; padding: 7px; border-radius: 14px; }
.scoreboard > div { min-width: 65px; display: grid; place-content: center; padding: 0 9px; text-align: center; }
.scoreboard > div + div { border-left: 1px solid #ded4c2; }
.scoreboard strong { margin-top: 2px; font-size: 21px; line-height: 1; }
.scoreboard strong i { color: var(--gold); font-size: 14px; font-style: normal; }

.game-card { position: absolute; z-index: 3; left: 19px; right: 19px; top: 100px; bottom: 20px; display: grid; grid-template-columns: 230px minmax(0,1fr); gap: 16px; }
.mascot-zone { position: relative; overflow: hidden; border: 1px solid rgba(92,57,27,.22); border-radius: 20px; background: linear-gradient(rgba(255,248,225,.75),rgba(244,207,145,.68)); box-shadow: 0 7px 0 rgba(102,62,26,.18); }
.speech { position: absolute; z-index: 4; left: 13px; right: 13px; top: 13px; padding: 11px 13px; border: 2px solid #78522e; border-radius: 14px 14px 14px 5px; background: #fffaf0; box-shadow: 0 4px 0 rgba(90,55,25,.16); font-size: 12px; font-weight: 900; line-height: 1.3; }
.mascot { position: absolute; z-index: 3; left: -4px; top: 82px; width: 228px; height: 228px; object-fit: contain; filter: drop-shadow(0 8px 7px rgba(63,37,17,.22)); transform-origin: 50% 80%; transition: transform 180ms ease-out, filter 180ms ease-out; }
.mascot.is-happy { animation: mascot-cheer 650ms cubic-bezier(.2,.9,.3,1.2); }
.mascot.is-sad { animation: mascot-oops 330ms ease-out; filter: saturate(.75) drop-shadow(0 8px 7px rgba(63,37,17,.22)); }
.easel { position: absolute; left: 43px; bottom: -18px; width: 150px; height: 150px; object-fit: contain; filter: drop-shadow(0 6px 5px rgba(63,37,17,.22)); }

.play-panel { min-width: 0; display: grid; grid-template-rows: auto minmax(250px,1fr) auto auto; padding: 22px 28px 24px; overflow: hidden; border: 1px solid #c8b89c; border-radius: 20px; background: rgba(255,250,240,.97); box-shadow: 0 8px 0 rgba(99,61,29,.18), 0 24px 45px rgba(75,43,18,.16); }
.challenge-copy { text-align: center; }
.challenge-copy span { color: var(--coral-dark); font-size: 10px; font-weight: 1000; letter-spacing: .12em; text-transform: uppercase; }
.challenge-copy h1 { margin: 4px 0 4px; font-size: clamp(25px,3vw,40px); line-height: 1; letter-spacing: -.045em; }
.challenge-copy p { margin: 0; color: var(--muted); font-size: 13px; font-weight: 700; }
.art-stage { position: relative; min-height: 0; display: grid; place-items: center; padding: 9px 4px 5px; }
.shape-stage { position: relative; width: min(430px,72vh); aspect-ratio: 1.23; overflow: hidden; border: 2px solid #bda98a; border-radius: 20px; background: #fffdf7; box-shadow: inset 0 0 0 8px #f4ead7, 0 6px 0 #d7c7ad; }
#shapeSvg { width: 100%; height: 100%; display: block; padding: 20px; overflow: visible; }
.shape-fill { fill: #ed765d; stroke: #713c31; stroke-width: 5; stroke-linejoin: round; }
.shape-fill.alt { fill: #1e9991; }
.shape-dot { fill: #f7be3b; stroke: #713c31; stroke-width: 3; }
.axis-layer { position: absolute; inset: 0; }
.axis-choice { position: absolute; z-index: 3; min-width: 44px; min-height: 44px; padding: 0; border: 0; background: transparent; }
.axis-choice::before { position: absolute; content: ""; border-radius: 99px; background: repeating-linear-gradient(90deg,#236d83 0 9px,transparent 9px 15px); filter: drop-shadow(0 1px #fff); opacity: .58; transition: 140ms ease-out; }
.axis-choice::after { position: absolute; content: attr(data-short); display: grid; place-items: center; width: 27px; height: 27px; border: 2px solid #15536a; border-radius: 50%; color: #fff; background: #287d93; box-shadow: 0 3px 0 #15536a; font-size: 10px; font-weight: 1000; transition: 140ms ease-out; }
.axis-choice:hover::before,.axis-choice.is-selected::before { opacity: 1; background-color: #ed8b4d; }
.axis-choice.is-selected::after { transform: scale(1.12); background: var(--coral); border-color: var(--coral-dark); box-shadow: 0 3px 0 var(--coral-dark); }
.axis-choice.axis-vertical { left: calc(50% - 22px); top: 0; bottom: 0; width: 44px; }
.axis-choice.axis-vertical::before { left: 20px; top: 5px; bottom: 5px; width: 4px; background: repeating-linear-gradient(0deg,#236d83 0 9px,transparent 9px 15px); }
.axis-choice.axis-vertical::after { left: 28px; top: 8px; }
.axis-choice.axis-horizontal { left: 0; right: 0; top: calc(50% - 22px); height: 44px; }
.axis-choice.axis-horizontal::before { left: 5px; right: 5px; top: 20px; height: 4px; }
.axis-choice.axis-horizontal::after { right: 8px; top: 27px; }
.axis-choice.axis-diagonal-down,.axis-choice.axis-diagonal-up { left: 6%; top: 5%; width: 88%; height: 90%; }
.axis-choice.axis-diagonal-down::before,.axis-choice.axis-diagonal-up::before { left: 0; top: 50%; width: 100%; height: 4px; transform: rotate(38deg); }
.axis-choice.axis-diagonal-up::before { transform: rotate(-38deg); }
.axis-choice.axis-diagonal-down::after { right: 13%; top: 11%; }
.axis-choice.axis-diagonal-up::after { right: 13%; bottom: 11%; }
.fold-flap { position: absolute; z-index: 2; left: 50%; top: 0; bottom: 0; width: 50%; opacity: 0; transform-origin: left center; border-left: 3px solid rgba(255,255,255,.8); background: rgba(88,188,190,.18); pointer-events: none; }
.shape-stage.is-folding .fold-flap { animation: fold-over 720ms cubic-bezier(.4,0,.2,1); }
.shape-stage.is-rotating #shapeSvg { animation: half-turn 900ms cubic-bezier(.3,.7,.2,1); }

.mirror-grid { --size: 6; position: relative; width: min(390px,58vh); aspect-ratio: 1; display: grid; grid-template-columns: repeat(var(--size),1fr); grid-template-rows: repeat(var(--size),1fr); overflow: hidden; border: 5px solid #735136; border-radius: 14px; background: #fffdf5; box-shadow: 0 7px 0 #c0a27c, 0 12px 25px rgba(74,43,18,.15); }
.mirror-grid::after { position: absolute; z-index: 5; content: ""; pointer-events: none; border-radius: 99px; background: #1a7788; box-shadow: 0 0 0 2px #fff,0 0 0 4px #1a7788; }
.mirror-grid.axis-vertical::after { left: calc(50% - 2px); top: 0; bottom: 0; width: 4px; }
.mirror-grid.axis-horizontal::after { left: 0; right: 0; top: calc(50% - 2px); height: 4px; }
.mirror-grid.axis-diagonal-down::after,.mirror-grid.axis-diagonal-up::after { left: -20%; top: calc(50% - 2px); width: 140%; height: 4px; transform: rotate(45deg); }
.mirror-grid.axis-diagonal-up::after { transform: rotate(-45deg); }
.grid-cell { position: relative; min-width: 0; min-height: 0; border: 1px solid var(--grid); background: rgba(255,255,255,.72); transition: transform 120ms ease-out, background 120ms ease-out; }
button.grid-cell { padding: 0; }
button.grid-cell:hover { z-index: 2; background: #f8e9c3; box-shadow: inset 0 0 0 3px #e0a72f; }
.grid-cell.is-source::before,.grid-cell.is-painted::before { position: absolute; inset: 12%; content: ""; transform: rotate(-6deg); border: 2px solid #944132; border-radius: 42% 55% 45% 58%; background: var(--coral); box-shadow: inset 5px 4px rgba(255,255,255,.22),0 2px 0 rgba(86,48,28,.18); }
.grid-cell.is-painted::before { transform: rotate(6deg); background: var(--teal); border-color: var(--teal-dark); }
.grid-cell.is-pop::before { animation: paint-pop 220ms ease-out; }
.mirror-grid.is-wrong { animation: gentle-shake 300ms ease-out; }
.mirror-grid.is-folding { animation: grid-fold 650ms ease-out; }
.paint-burst { position: absolute; z-index: 20; width: min(430px,70%); opacity: 0; transform: scale(.35) rotate(-10deg); pointer-events: none; }
.studio.is-celebrating .paint-burst { animation: burst-in 800ms ease-out both; }

.line-counts { min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.count-choice { min-width: 66px; min-height: 44px; border: 2px solid #b8a98f; border-radius: 11px; background: #fff; box-shadow: 0 4px 0 #d8ccb8; font-size: 18px; font-weight: 1000; transition: 130ms ease-out; }
.count-choice:hover { transform: translateY(-2px); border-color: var(--teal); box-shadow: 0 6px 0 #c7ddd7; }
.feedback { min-height: 29px; display: grid; place-items: center; color: var(--teal-dark); font-size: 13px; font-weight: 900; text-align: center; }
.feedback.is-error { color: var(--coral-dark); }
.action-area { min-height: 61px; display: flex; align-items: center; justify-content: center; gap: 9px; }
.primary,.explain-choice { min-height: 52px; border: 2px solid var(--teal-dark); border-radius: 13px; color: #fff; background: var(--teal); box-shadow: 0 5px 0 var(--teal-dark); font-weight: 1000; transition: 140ms ease-out; }
.primary { min-width: 220px; padding: 0 22px; font-size: 15px; }
.primary:hover,.explain-choice:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--teal-dark); }
.primary:active,.explain-choice:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--teal-dark); }
.primary.is-coral { border-color: var(--coral-dark); background: var(--coral); box-shadow: 0 5px 0 var(--coral-dark); }
.explain-grid { width: min(650px,100%); display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
.explain-choice { padding: 7px 9px; border-color: #9e8a6d; color: var(--ink); background: #fff; box-shadow: 0 5px 0 #d7c8af; font-size: 12px; }
.explain-choice small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.toast { position: absolute; z-index: 40; left: 56%; bottom: 31px; max-width: 65%; padding: 10px 17px; opacity: 0; transform: translate(-50%,12px); border-radius: 999px; color: #fff; background: var(--ink); pointer-events: none; font-size: 13px; font-weight: 900; transition: 150ms ease-out; }
.toast.is-showing { opacity: 1; transform: translate(-50%,0); }

@keyframes mascot-cheer { 35% { transform: translateY(-12px) rotate(-5deg) scale(1.07); } 65% { transform: translateY(-4px) rotate(4deg); } }
@keyframes mascot-oops { 25% { transform: translateX(-5px) rotate(-2deg); } 55% { transform: translateX(5px) rotate(2deg); } }
@keyframes fold-over { 0% { opacity: 0; transform: perspective(500px) rotateY(0); } 35% { opacity: 1; } 70% { transform: perspective(500px) rotateY(-178deg); opacity: .85; } 100% { transform: perspective(500px) rotateY(-180deg); opacity: 0; } }
@keyframes half-turn { 60% { transform: rotate(180deg) scale(1.05); } 100% { transform: rotate(180deg); } }
@keyframes paint-pop { 50% { transform: scale(1.16) rotate(6deg); } }
@keyframes gentle-shake { 25% { transform: translateX(-7px) rotate(-.4deg); } 55% { transform: translateX(6px) rotate(.4deg); } 80% { transform: translateX(-3px); } }
@keyframes grid-fold { 50% { transform: perspective(600px) rotateY(9deg) scale(.98); filter: brightness(1.08); } }
@keyframes burst-in { 0% { opacity: 0; transform: scale(.3) rotate(-12deg); } 35% { opacity: 1; transform: scale(1.04) rotate(3deg); } 100% { opacity: 0; transform: scale(1.28) rotate(7deg); } }

@media (max-height: 735px) {
  .studio-hud { top: 11px; height: 60px; }.brand-card,.scoreboard { height: 60px; }
  .game-card { top: 84px; bottom: 16px; }.play-panel { padding-top: 16px; padding-bottom: 17px; }
  .challenge-copy h1 { font-size: 27px; }.mascot { top: 72px; width: 205px; height: 205px; }.easel { width: 130px; height: 130px; }
  .shape-stage { width: min(380px,64vh); }.mirror-grid { width: min(335px,54vh); }.action-area { min-height: 54px; }
}
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
