@font-face {
  font-family: "EasyReading";
  src: local("EasyReading"), local("EasyReading Regular");
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --yellow: #f7c928;
  --red: #ef4b45;
  --red-text: #a92d2a;
  --ink: #10283a;
  --aqua: #bee8f1;
  --lilac: #dcc7e8;
  --paper: #f8f6f0;
  --green: #2f7d57;
  --orange: #f28a2e;
  --blue: #2764cc;
  --purple: #6d47b8;
  --error: #a52b32;
  --well: #e8e4db;
  --success-bg: #e6f3ea;
  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius-panel: 16px;
  --fs-label-small: .78rem;
  --fs-body: 1rem;
  --fs-body-medium: 1.08rem;
  --fs-body-large: 1.16rem;
  --fs-title: 1.25rem;
  --fs-title-large: 1.45rem;
  --fs-lead: clamp(1.08rem, 1.8vw, 1.45rem);
  --fs-topbar: clamp(1.1rem, 1.7vw, 1.65rem);
  --fs-panel-title: clamp(2.2rem, 4vw, 4rem);
  --fs-student-title: clamp(2.25rem, 7vw, 4.2rem);
  --fs-stage-title: clamp(2.7rem, 5vw, 5.5rem);
  --fs-hero: clamp(3.8rem, 7vw, 7rem);
  --fs-pause: clamp(3rem, 8vw, 7rem);
  --shadow-art: 0 24px 60px rgba(16, 40, 58, .18);
  --shadow-menu: 0 16px 40px rgba(16, 40, 58, .2);
  --lesson-artwork-size: min(55vh, 510px);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body, #app { width: 100%; height: 100%; overflow: hidden; }

.boot-splash { width: 100%; height: 100%; display: grid; align-content: center; justify-items: center; gap: 14px; background: var(--paper); color: var(--ink); }
.boot-splash p { margin: 0; font-size: 1rem; font-weight: 700; }
.boot-mark { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%; background: var(--red); color: white; font-size: 1.8rem; font-weight: 850; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "EasyReading", "Atkinson Hyperlegible", "Avenir Next", "Trebuchet MS", sans-serif;
  font-weight: 500;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.display {
  margin: 0;
  font-family: "EasyReading", "Atkinson Hyperlegible", "Avenir Next", "Trebuchet MS", sans-serif;
  font-weight: 800;
  line-height: .92;
  letter-spacing: -.035em;
  text-wrap: balance;
}

.paper {
  background: var(--paper);
  border-radius: var(--radius-panel);
}

.btn {
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  padding: 12px 22px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 750;
  cursor: pointer;
  transition: transform .28s var(--ease), background .2s, color .2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.ui-icon { width: 1.35em; height: 1.35em; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.btn:hover { transform: scale(1.035); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--yellow); color: var(--ink); }
.btn.yellow { background: var(--yellow); }
.btn.dark { background: var(--ink); color: var(--paper); }
.btn:disabled { cursor: not-allowed; opacity: .4; transform: none; }
.btn.icon { width: 50px; padding: 8px; }

.room-label,
.brand-kicker,
.program-name {
  margin: 0;
  font-size: var(--fs-label-small);
  font-weight: 750;
  letter-spacing: .11em;
  text-transform: uppercase;
}

/* Entrance */
.landing {
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(340px, .65fr);
  background: var(--ink);
  overflow: hidden;
}

.landing-copy {
  position: relative;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(300px, .85fr) minmax(300px, 1.15fr);
  align-items: center;
  gap: clamp(24px, 4vw, 72px);
  padding: clamp(36px, 5vw, 78px);
  color: var(--paper);
}

.landing-copy::before {
  content: "";
  position: absolute;
  width: 48%;
  aspect-ratio: 1;
  left: -17%;
  top: -24%;
  border: clamp(38px, 7vw, 100px) solid var(--yellow);
  border-radius: 50%;
  opacity: .95;
}

.landing-title { position: relative; z-index: 3; padding: 18px 24px 22px 0; background: var(--ink); box-shadow: -42px 0 0 var(--ink), 28px 0 0 var(--ink); }
.landing .brand-kicker { margin-bottom: 30px; color: var(--yellow); }
.landing h1 { max-width: 720px; font-size: var(--fs-hero); }
.landing .lead { max-width: 35ch; margin: 30px 0 0; color: #dbe5e9; font-size: var(--fs-lead); }

.landing-artwork {
  position: relative;
  z-index: 2;
  margin: 0;
  transform: rotate(2.5deg);
}

.landing-artwork::before {
  content: "";
  position: absolute;
  inset: -24px 30% 22% -24px;
  z-index: -1;
  background: var(--red);
  clip-path: polygon(0 10%, 100% 0, 84% 100%, 8% 88%);
}

.landing-artwork img {
  display: block;
  width: min(100%, 560px);
  aspect-ratio: 4 / 5;
  object-fit: cover;
  box-shadow: 0 36px 90px rgba(0, 0, 0, .35);
}

.landing-artwork figcaption { margin-top: 16px; color: var(--yellow); font-size: var(--fs-label-small); font-weight: 750; letter-spacing: .12em; }

.role-panel {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  padding: clamp(30px, 4vw, 58px);
  background: var(--paper);
  height: 100%;
  max-height: none;
  overflow: hidden;
}

.role-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 9px;
  height: 34%;
  background: var(--yellow);
}

.role-panel .room-label { color: var(--red-text); }
.role-panel h2 { margin: 8px 0 18px; font-size: var(--fs-panel-title); }
.role-choice { padding: 18px 22px; text-align: left; border-radius: var(--radius-sm); }
.role-choice.primary { background: var(--ink); color: var(--paper); }
.role-choice.yellow { background: var(--yellow); }
.role-choice strong { display: block; font-size: var(--fs-title-large); }
.role-choice span { display: block; margin-top: 4px; opacity: .72; }
.join-form { display: grid; gap: 13px; margin-top: 10px; }
.teacher-setup { min-width: 0; display: grid; gap: 14px; }
.teacher-setup h3 { margin: 4px 0 0; font-size: clamp(1.7rem, 3vw, 2.5rem); line-height: 1; }
.teacher-setup > p { margin: 0; color: #526772; }
.setup-back { justify-self: start; display: inline-flex; align-items: center; gap: 8px; border: 0; padding: 6px 0; background: none; font-weight: 700; cursor: pointer; }
.mode-grid { min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mode-choice { min-width: 0; min-height: 132px; display: grid; grid-template-columns: 62px minmax(0, 1fr); align-items: center; gap: 4px 10px; border: 1px solid #cbd3d6; border-radius: var(--radius-panel); padding: 14px; background: white; text-align: left; cursor: pointer; transition: transform .24s var(--ease), background .2s, border-color .2s; }
.mode-choice:hover, .mode-choice.selected { border-color: var(--ink); background: var(--aqua); }
.mode-choice:hover { transform: translateY(-3px) rotate(-.5deg); }
.mode-choice:nth-child(2):hover { transform: translateY(-3px) rotate(.5deg); }
.mode-choice .mode-icon { grid-row: 1 / span 2; width: 56px; height: 56px; overflow: visible; }
.mode-choice strong { font-size: 1.05rem; }
.mode-choice span { color: #415965; font-size: .8rem; line-height: 1.25; }
.age-grid { display: grid; gap: 9px; }
.age-choice { min-height: 102px; display: grid; grid-template-columns: 74px 1fr; grid-template-rows: auto auto auto; align-items: center; column-gap: 12px; border: 1px solid #cbd3d6; border-radius: var(--radius-panel); padding: 12px 14px; background: white; text-align: left; cursor: pointer; transition: transform .24s var(--ease), background .2s, border-color .2s; }
.age-choice:hover, .age-choice.selected { border-color: var(--ink); background: var(--aqua); }
.age-choice:hover { transform: translateX(5px); }
.age-choice .age-icon { grid-row: 1 / span 3; width: 62px; height: 62px; justify-self: center; overflow: visible; }
.age-choice strong { font-size: 1.25rem; }
.age-choice > span:not(.age-icon) { color: #415965; font-weight: 650; }
.age-choice small { font-size: .67rem; font-weight: 750; letter-spacing: .08em; }

.role-panel.setup-open { justify-content: center; gap: 0; padding: clamp(20px, 2.6vh, 34px) clamp(24px, 3vw, 46px); }
.role-panel.setup-open > .room-label, .role-panel.setup-open > #role-title { display: none; }
.role-panel.setup-open .teacher-setup { max-height: 100%; align-content: center; gap: clamp(7px, 1vh, 11px); }
.role-panel.setup-open .teacher-setup h3 { font-size: clamp(1.45rem, 2.3vw, 2rem); }
.role-panel.setup-open .mode-choice { min-height: clamp(88px, 11.5vh, 108px); }
.role-panel.setup-open .age-choice { min-height: clamp(68px, 8.8vh, 84px); grid-template-columns: 58px 1fr; padding-block: 8px; }
.role-panel.setup-open .age-choice .age-icon { width: 48px; height: 48px; }
.role-panel.setup-open #create-class { min-height: 52px; }
.role-panel.setup-open #create-class { width: 100%; min-width: 0; }

@media (max-height: 760px) and (min-width: 1101px) {
  .role-panel.setup-open { padding-block: 12px; }
  .role-panel.setup-open .teacher-setup { gap: 5px; }
  .role-panel.setup-open .teacher-setup h3 { font-size: 1.3rem; }
  .role-panel.setup-open .teacher-setup > p { font-size: .85rem; line-height: 1.25; }
  .role-panel.setup-open .mode-choice { min-height: 76px; grid-template-columns: 42px minmax(0,1fr); padding: 8px; }
  .role-panel.setup-open .mode-choice .mode-icon { width: 38px; height: 38px; }
  .role-panel.setup-open .mode-choice strong { font-size: .86rem; }
  .role-panel.setup-open .mode-choice span { font-size: .66rem; }
  .role-panel.setup-open .age-choice { min-height: 58px; }
  .role-panel.setup-open .age-choice .age-icon { width: 38px; height: 38px; }
  .role-panel.setup-open .age-choice strong { font-size: 1rem; }
  .role-panel.setup-open #create-class { min-height: 46px; }
}

.field { display: grid; gap: 7px; font-weight: 700; }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 50px;
  border: 1px solid rgba(16, 40, 58, .32);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: white;
  color: var(--ink);
}
.field textarea { min-height: 100px; resize: vertical; }
.form-error { min-height: 24px; margin: 0; color: var(--error); font-weight: 700; }

/* Shared chrome */
.app-shell { min-height: 100vh; background: var(--aqua); }
.topbar {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px clamp(18px, 3vw, 40px);
  background: var(--paper);
}
.topbar-brand { display: flex; align-items: center; gap: 14px; }
.topbar-brand .mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--red);
  color: white;
  font: 800 1.45rem "EasyReading", "Avenir Next", sans-serif;
}
.program-name { display: block; margin-bottom: 1px; color: #62737d; font-size: .65rem; }
.topbar h1 { font-size: var(--fs-topbar); }
.session-badge { display: flex; align-items: center; gap: 12px; }
.role-label { color: #526772; font-size: .82rem; font-weight: 700; }
.topbar-pause { min-height: 46px; padding: 8px 18px; background: var(--yellow); }
.session-code {
  padding: 8px 12px;
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: .14em;
}
.solo-badge { display: inline-flex; align-items: center; gap: 7px; padding: 0; background: transparent; color: #526772; font-size: .78rem; font-weight: 750; letter-spacing: .06em; cursor: default; user-select: none; }
.solo-badge .ui-icon { width: 24px; height: 24px; }

/* Teacher exhibition */
.teacher-layout {
  display: grid;
  grid-template-columns: clamp(140px, 12vw, 174px) minmax(0, 1fr) clamp(240px, 22vw, 320px);
  height: calc(100vh - 74px);
  min-height: 0;
}

.teacher-rail {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 26px 12px 18px;
  background: var(--ink);
  color: var(--paper);
}

.teacher-rail::before {
  content: "";
  position: absolute;
  top: 56px;
  bottom: 170px;
  left: 38px;
  width: 1px;
  background: rgba(248, 246, 240, .28);
}

.phase-tab {
  position: relative;
  z-index: 1;
  min-height: 82px;
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  gap: 6px;
  border: 0;
  padding: 7px 2px;
  background: transparent;
  color: rgba(248, 246, 240, .58);
  text-align: left;
  font-size: clamp(.88rem, 1vw, 1.05rem);
  font-weight: 700;
  cursor: pointer;
}
.phase-tab:hover { background: rgba(248, 246, 240, .08); color: var(--paper); }

.phase-symbol {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(248, 246, 240, .55);
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-size: 1.3rem;
}
.phase-symbol .ui-icon { width: 25px; height: 25px; }

.phase-tab.active { color: var(--paper); }
.phase-tab.active .phase-symbol { border-color: var(--yellow); background: var(--yellow); color: var(--ink); }
.phase-tab.done .phase-symbol { border-color: var(--green); background: var(--green); }
.phase-tab.color-wheel-tab { min-height: 82px; grid-template-columns: 52px 1fr; gap: 6px; margin-left: 0; padding: 7px 2px; font-size: clamp(.88rem, 1vw, 1.05rem); line-height: 1.2; }
.phase-tab.color-wheel-tab .phase-symbol { width: 46px; height: 46px; }
.phase-tab.color-wheel-tab .phase-symbol .ui-icon { width: 25px; height: 25px; }
.age-lock { display: grid; grid-template-columns: 42px 1fr; align-items: center; gap: 2px 8px; margin-top: 14px; padding: 12px 10px; border-radius: var(--radius-sm); background: rgba(248, 246, 240, .1); }
.age-lock > .ui-icon { grid-row: 1 / span 2; width: 30px; height: 30px; }
.age-lock strong { font-size: 1rem; }
.age-lock small { color: rgba(248, 246, 240, .62); font-size: .68rem; line-height: 1.15; }

.session-tools { position: relative; margin-top: auto; }
.session-tools summary {
  display: grid;
  place-items: center;
  min-height: 44px;
  border-radius: 999px;
  background: rgba(248, 246, 240, .1);
  color: var(--paper);
  font-size: var(--fs-title);
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}
.session-tools summary::-webkit-details-marker { display: none; }
.session-tools-menu {
  position: absolute;
  z-index: 12;
  left: calc(100% + 14px);
  bottom: 0;
  width: 240px;
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: var(--radius-panel);
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-menu);
}
.session-action { min-height: 44px; display: flex; align-items: center; gap: 9px; padding: 10px 12px; border: 0; border-radius: var(--radius-sm); background: var(--aqua); text-align: left; font-weight: 700; cursor: pointer; }
.session-action.danger { background: #f9dfdc; color: var(--error); }

.teacher-main {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
  background: var(--aqua);
}
.phase-1 .teacher-main { background: var(--yellow); }
.phase-2 .teacher-main { background: var(--paper); }
.phase-3 .teacher-main { background: var(--lilac); }

.stage { min-height: 0; display: grid; place-items: center; padding: clamp(22px, 3vw, 42px); animation: room-in .6s var(--ease) both; }
@keyframes room-in { from { opacity: .82; transform: translateY(8px); filter: saturate(.65); } to { opacity: 1; transform: translateY(0); filter: saturate(1); } }

.stage-intro {
  position: relative;
  width: 100%;
  grid-template-columns: minmax(240px, .85fr) minmax(360px, 1.15fr);
  align-items: center;
  gap: clamp(18px, 4vw, 64px);
}
.stage-intro::before {
  content: "";
  position: absolute;
  z-index: 0;
  width: 58%;
  height: 112%;
  right: -12%;
  top: -6%;
  background: var(--yellow);
  clip-path: polygon(18% 0, 100% 0, 100% 100%, 0 82%);
}
.stage-copy { position: relative; z-index: 2; width: 100%; max-width: none; justify-self: stretch; }
.stage-copy .room-label { margin-bottom: 24px; color: #546b77; }
.stage-copy h2 { font-size: var(--fs-stage-title); }
.stage-copy p:last-child { max-width: 43ch; margin: 26px 0 0; font-size: var(--fs-lead); }
.lim-visual-cues { display: flex; align-items: center; gap: 16px; margin-top: 28px; }
.lim-visual-cues span { width: 105px; aspect-ratio: 1; display: grid; place-items: center; align-content: center; gap: 5px; border-radius: 50%; background: var(--paper); font-size: 2.8rem; }
.lim-visual-cues small { font-size: .68rem; font-weight: 800; letter-spacing: .08em; }
.lim-visual-cues .ui-icon { width: 46px; height: 46px; }
.lim-visual-cues > .cue-arrow { width: 34px; height: 34px; }
.artwork-frame { position: relative; z-index: 2; width: min(100%, var(--lesson-artwork-size)); margin: 0; padding: 12px; box-shadow: var(--shadow-art); transform: rotate(1deg); }
.artwork-visual { position: relative; overflow: hidden; border-radius: var(--radius-sm); }
.artwork-frame img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.artwork-visual canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; object-fit: cover; transition: opacity .3s var(--ease); }
.artwork-visual canvas.ready { opacity: 1; }
.artwork-caption { padding: 10px 3px 1px; color: #5f6e76; font-size: var(--fs-label-small); font-weight: 650; }

/* Mixing room */
.palette-stage { position: relative; width: 100%; align-content: center; grid-template-columns: minmax(210px, .55fr) minmax(420px, 1.45fr); gap: clamp(20px, 4vw, 58px); overflow: hidden; }
.palette-stage.solo-mode { grid-template-columns: minmax(300px, .8fr) minmax(390px, 1.2fr); gap: clamp(18px, 2.5vw, 36px); }
.palette-stage.solo-mode .palette-title h2 { font-size: clamp(3rem, 4.2vw, 4.8rem); }
.palette-title { position: relative; z-index: 4; }
.palette-title .room-label { margin-bottom: 22px; }
.palette-title h2 { font-size: var(--fs-stage-title); }
.teacher-challenge { max-width: 28ch; margin: 20px 0 0; font-size: var(--fs-title); font-weight: 650; }
.shared-palette { position: relative; width: 100%; min-height: min(58vh, 550px); display: grid; place-items: center; }
.shared-palette::before {
  content: "";
  position: absolute;
  inset: 8% -12% 5% 12%;
  background: var(--red);
  clip-path: polygon(12% 0, 100% 10%, 85% 100%, 0 83%);
}
.mix-artwork { position: relative; z-index: 2; width: min(55vh, 520px); margin: 0; padding: 10px; background: var(--paper); box-shadow: var(--shadow-art); transform: rotate(-1deg); }
.mix-artwork-surface { position: relative; overflow: hidden; aspect-ratio: 1; background: var(--paper); }
.mix-artwork img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.mix-artwork.touch-mix-ready { transform: rotate(0); }
#mix-canvas { position: absolute; z-index: 3; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
#mix-canvas:focus-visible { outline: 5px solid var(--ink); outline-offset: -5px; }
.mix-gesture-hint { position: absolute; z-index: 4; left: 50%; bottom: 18px; min-height: 52px; display: flex; align-items: center; gap: 9px; padding: 10px 16px; border-radius: 999px; background: var(--paper); color: var(--ink); font-size: .78rem; font-weight: 800; box-shadow: 0 8px 24px rgba(16,40,58,.2); transform: translateX(-50%); pointer-events: none; white-space: nowrap; transition: opacity .25s var(--ease), transform .25s var(--ease); }
.mix-gesture-hint .ui-icon { width: 28px; height: 28px; color: var(--red-text); }
.mix-artwork.has-mixed .mix-gesture-hint { opacity: 0; transform: translate(-50%, 10px); }
.mix-color-wash { position: absolute; inset: 10px; z-index: 2; background: linear-gradient(115deg, var(--first), var(--second)); mix-blend-mode: color; opacity: .42; pointer-events: none; animation: wash-in .55s cubic-bezier(.16,1,.3,1) both; }
@keyframes wash-in { from { opacity: 0; clip-path: circle(0 at 50% 50%); } to { opacity: .42; clip-path: circle(75% at 50% 50%); } }
.mix-core { position: absolute; inset: 0; z-index: 2; overflow: hidden; pointer-events: none; }
.mix-core.solo-blend { z-index: 1; overflow: visible; }
.mix-halo { position: absolute; left: 50%; top: 50%; width: min(67vh, 640px); aspect-ratio: 1.15; border: clamp(24px, 3.5vw, 52px) solid var(--trace); border-radius: 48% 52% 44% 56%; opacity: .82; transform: translate(-50%,-50%) rotate(-10deg); animation: halo-in .65s cubic-bezier(.16,1,.3,1) both; }
.mix-halo.halo-2 { width: min(57vh, 550px); border-radius: 58% 42% 55% 45%; opacity: .74; transform: translate(-50%,-50%) rotate(18deg); animation-delay: .08s; }
@keyframes halo-in { from { opacity: 0; scale: .72; filter: blur(8px); } }
.paint-splash {
  position: absolute;
  width: 44%;
  height: 9px;
  border-radius: 999px;
  background: var(--trace);
  transform: rotate(var(--turn));
  transform-origin: left center;
  filter: drop-shadow(0 5px 6px rgba(16, 40, 58, .14));
  animation: trace-in .8s var(--ease) both;
}
.paint-splash::after { content: ""; position: absolute; right: -9px; top: -6px; width: 21px; height: 21px; border-radius: 50%; background: inherit; }
@keyframes trace-in { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(-20px); } }
.empty-mix { position: absolute; right: 4%; bottom: 3%; max-width: 190px; margin: 0; padding: 12px; border-radius: var(--radius-sm); background: var(--paper); font-weight: 700; }
.contribution-tag {
  position: static;
  min-width: 100px;
  max-width: 155px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--paper);
  font-size: .78rem;
  font-weight: 700;
  animation: tag-in .5s var(--ease) both;
}
@keyframes tag-in { from { opacity: 0; transform: translateY(14px); } }
.contribution-tag::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 50%; background: var(--tag-color); }
.contribution-labels { grid-column: 2; display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; min-height: 30px; margin-top: -10px; }
.contribution-labels.solo-result { position: relative; z-index: 4; margin-top: -4px; }
.blend-result { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; background: var(--paper); color: var(--ink); box-shadow: 0 10px 30px rgba(16,40,58,.14); animation: confirmation-in .38s cubic-bezier(.16,1,.3,1); }
.blend-result > span { width: 34px; height: 34px; border: 2px solid var(--ink); border-radius: 50%; }
.blend-result .ui-icon { width: 24px; height: 24px; }
.blend-result b { font-size: 1.25rem; }
.blend-result .blend-result-color { width: 40px; height: 40px; box-shadow: 0 0 0 4px var(--yellow); }

/* Sala 2: banco di restauro cromatico */
.recolor-stage { position: relative; width: 100%; grid-template-columns: minmax(320px, .8fr) minmax(390px, 1.2fr); align-items: center; gap: clamp(24px, 3vw, 48px); overflow: hidden; }
.recolor-stage::before { content: ""; position: absolute; right: -14%; top: 8%; width: 58%; height: 82%; background: var(--red); clip-path: polygon(14% 0, 100% 8%, 84% 100%, 0 85%); }
.recolor-copy { position: relative; z-index: 3; min-width: 0; }
.recolor-copy .room-label { margin-bottom: 14px; }
.recolor-copy h2 { max-width: 9ch; font-size: clamp(2.8rem, 3.6vw, 4rem); }
.recolor-copy > p:not(.room-label) { max-width: 38ch; margin: 18px 0 0; font-size: var(--fs-body-medium); }
.color-wheel-stage { position: relative; isolation: isolate; width: 100%; grid-template-columns: minmax(250px, .82fr) minmax(330px, 1.18fr); align-items: center; gap: clamp(22px, 4vw, 58px); overflow: hidden; }
.color-wheel-stage::before { content: ""; position: absolute; z-index: -2; top: -4%; right: -9%; width: 65%; height: 108%; background: var(--yellow); clip-path: polygon(23% 0, 100% 0, 100% 100%, 0 100%); }
.color-wheel-stage::after { content: ""; position: absolute; z-index: -1; right: -8%; bottom: -35%; width: 42%; height: 48%; background: var(--red); clip-path: polygon(12% 0, 100% 10%, 84% 100%, 0 82%); transform: rotate(4deg); }
.wheel-lesson-copy, .wheel-interaction { position: relative; z-index: 1; min-width: 0; }
.wheel-lesson-copy .room-label { margin-bottom: 18px; color: #405b6a; }
.wheel-lesson-copy h2 { max-width: 9ch; font-size: clamp(2.8rem, 4vw, 4.6rem); }
.wheel-intro { max-width: 37ch; margin: 20px 0; font-size: clamp(1.2rem, 1.6vw, 1.55rem); line-height: 1.4; }
.wheel-fact-line { max-width: 39ch; margin: 14px 0; font-size: clamp(1.05rem, 1.35vw, 1.3rem); line-height: 1.45; }
.wheel-current-pair { display: grid; grid-template-columns: auto auto auto auto auto; justify-content: start; align-items: center; gap: 10px; margin-top: 25px; font-size: clamp(1.05rem, 1.3vw, 1.3rem); }
.wheel-current-pair .wheel-pair-detail { grid-column: 1 / -1; margin-top: 1px; color: #344e5e; font-size: clamp(1rem, 1.2vw, 1.15rem); font-weight: 650; }
.wheel-interaction { display: grid; justify-items: center; gap: 14px; }
.wheel-assembly { position: relative; width: min(100%, calc(clamp(140px, 21vh, 210px) * 2 + 56px)); aspect-ratio: 1; display: grid; place-items: center; }
.color-wheel { --wheel-radius: clamp(140px, 21vh, 210px); position: relative; width: calc(var(--wheel-radius) * 2 + 56px); aspect-ratio: 1; border: 2px solid var(--ink); border-radius: 50%; background: var(--wheel-paint); box-shadow: 0 0 0 9px var(--paper); cursor: grab; touch-action: none; transform: rotate(var(--wheel-turn, 0deg)); transition: transform .28s ease; }
.color-wheel:active { cursor: grabbing; }
.wheel-color { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; border: 4px solid var(--paper); border-radius: 50%; background: var(--wheel-color); box-shadow: 0 0 0 2px var(--ink); cursor: pointer; transform: translate(-50%,-50%) rotate(var(--wheel-angle)) translateY(calc(-1 * var(--wheel-radius))) rotate(calc(-1 * var(--wheel-angle))); transition: box-shadow .16s ease, scale .16s ease; }
.wheel-color.is-selected { z-index: 2; scale: 1.22; box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px var(--yellow); }
.wheel-color.is-complement { z-index: 1; box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--ink); }
.wheel-center { position: absolute; z-index: 3; left: 50%; top: 50%; width: 30%; min-height: 30%; display: grid; align-content: center; justify-items: center; gap: 5px; padding: 7px; border-radius: 50%; background: var(--paper); text-align: center; transform: translate(-50%,-50%) rotate(calc(-1 * var(--wheel-turn, 0deg))); pointer-events: none; }
.wheel-pair-title { font-size: clamp(1rem, 1.4vw, 1.3rem); font-weight: 850; line-height: 1.1; }
.wheel-center .wheel-pair-detail { max-width: 18ch; margin: 0; font-size: clamp(.78rem, .95vw, .92rem); line-height: 1.25; }
.wheel-current-pair .wheel-pair-detail { max-width: 40ch; }
.wheel-reading-dot { width: 18px; height: 18px; border: 1px solid var(--ink); border-radius: 50%; background: var(--wheel-color); }
.wheel-color:focus-visible { outline: 4px solid var(--ink); outline-offset: 4px; }
.wheel-reading { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 0; font-size: clamp(.9rem, 1vw, 1rem); text-align: center; }
.recolor-controls { display: grid; gap: 18px; margin-top: 28px; }
.mix-wells { display: flex; align-items: center; gap: 12px; }
.mix-well, .mix-result { min-width: 112px; min-height: 80px; display: grid; grid-template-columns: 38px 1fr; grid-template-rows: auto auto; align-items: center; gap: 2px 10px; border: 2px solid var(--ink); border-radius: var(--radius-sm); padding: 9px 11px; background: var(--paper); color: var(--ink); text-align: left; }
.mix-well { cursor: pointer; }
.mix-well strong { font-size: 1rem; }
.mix-well.active { outline: 5px solid var(--paper); box-shadow: 0 0 0 8px var(--ink); transform: translateY(-3px); }
.mix-well small, .mix-result small { grid-column: 1 / -1; font-size: .58rem; font-weight: 800; letter-spacing: .05em; }
.mix-result strong { min-width: 0; overflow: hidden; font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.mix-well > span, .mix-result > span { width: 38px; height: 38px; border: 2px solid var(--ink); border-radius: 50%; background: var(--well-color); }
.mix-result { min-width: 98px; border: 0; background: var(--ink); color: var(--paper); }
.mix-result > span { background: var(--result-color); border-color: var(--paper); }
.mix-equation { font-size: 1.35rem; font-weight: 800; }
.recolor-palette { width: min(470px, 100%); display: grid; grid-template-columns: repeat(auto-fit, minmax(54px, 1fr)); gap: 7px; }
.recolor-palette.palette-6-7 { width: min(330px, 100%); grid-template-columns: repeat(3, minmax(72px, 1fr)); gap: 10px; }
.recolor-swatch { min-width: 0; min-height: 62px; display: grid; justify-items: center; align-content: center; gap: 3px; border: 2px solid var(--ink); border-radius: var(--radius-sm); padding: 5px 3px; background: var(--paper); color: var(--ink); cursor: pointer; }
.recolor-swatch > span { width: 30px; height: 30px; border: 1px solid rgba(16,40,58,.3); border-radius: 50%; background: var(--swatch); }
.recolor-swatch small { max-width: 100%; font-size: .58rem; font-weight: 750; letter-spacing: -.02em; white-space: nowrap; }
.recolor-swatch.selected { background: var(--ink); color: var(--paper); transform: translateY(-3px); }
.recolor-swatch.selected > span { box-shadow: 0 0 0 2px var(--paper); }
.recolor-workbench { position: relative; z-index: 2; width: 100%; min-width: 0; display: grid; justify-items: center; gap: 10px; }
.recolor-artwork { position: relative; width: min(100%, var(--lesson-artwork-size)); margin: 0; padding: 10px; background: var(--paper); box-shadow: var(--shadow-art); transform: rotate(.5deg); }
.recolor-surface { position: relative; overflow: hidden; width: 100%; aspect-ratio: 1; background: var(--paper); }
.recolor-surface img, #recolor-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
#recolor-canvas { z-index: 2; touch-action: none; cursor: crosshair; transition: opacity .3s var(--ease); }
#recolor-canvas:focus-visible { outline: 5px solid var(--yellow); outline-offset: -5px; }
.recolor-artwork.show-original #recolor-canvas { opacity: 0; }
.recolor-original { position: absolute; z-index: 5; left: 24px; top: 24px; min-height: 48px; border: 2px solid var(--ink); padding: 8px 14px; box-shadow: 0 8px 24px rgba(16,40,58,.2); }
.recolor-original[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.recolor-gesture { position: absolute; z-index: 4; left: 50%; bottom: 18px; min-height: 50px; display: flex; align-items: center; gap: 8px; border-radius: 999px; padding: 9px 15px; background: var(--paper); font-size: var(--fs-label-small); font-weight: 800; box-shadow: 0 8px 24px rgba(16,40,58,.2); transform: translateX(-50%); pointer-events: none; white-space: nowrap; transition: opacity .25s var(--ease), transform .25s var(--ease); }
.recolor-gesture .ui-icon { width: 27px; height: 27px; }
.recolor-artwork.has-color .recolor-gesture { opacity: 0; transform: translate(-50%, 10px); }
.recolor-footer { width: min(510px, 100%); display: flex; justify-content: center; align-items: center; gap: 10px; }
.recolor-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 18px; }
.recolor-actions .recolor-stats,
.recolor-actions .recolor-reset { min-height: 48px; }
.recolor-eraser .eraser-chip { display: grid; place-items: center; background: var(--paper); }
.recolor-eraser .ui-icon { width: 24px; height: 24px; }
.recolor-eraser[aria-pressed="true"] { background: var(--ink); color: var(--paper); outline: 3px solid var(--paper); outline-offset: -5px; }
.recolor-artwork.is-drawing .recolor-original,
.recolor-artwork.is-drawing .recolor-gesture { visibility: hidden; opacity: 0; pointer-events: none; }
.recolor-artwork.eraser-active #recolor-canvas { cursor: cell; }
.recolor-stats { min-height: 44px; display: flex; align-items: center; gap: 16px; border-radius: 999px; padding: 8px 16px; background: var(--paper); font-size: .72rem; font-weight: 750; }
.recolor-stats strong { font-size: 1.05rem; }
.recolor-reset { min-height: 44px; padding: 8px 15px; background: var(--ink); color: var(--paper); font-size: .72rem; }
.restore-arrivals { width: fit-content; display: flex; align-items: baseline; gap: 8px; margin-top: 22px; padding: 10px 16px; border-radius: 999px; background: var(--paper); }
.restore-arrivals strong { font-size: 1.5rem; }
.restore-thumbs { display: flex; align-items: center; }
.restore-thumbs:empty { display: none; }
.restore-thumbs img { width: 42px; height: 42px; border: 3px solid var(--paper); border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px var(--ink); }
.restore-thumbs img + img { margin-left: -10px; }

.student-recolor { display: grid; grid-template-columns: minmax(250px, .85fr) minmax(300px, 1.15fr); grid-template-rows: auto minmax(0, 1fr) auto; align-items: center; gap: 14px 22px; }
.student-recolor > header, .student-recolor > .recolor-controls { grid-column: 1; }
.student-recolor > header h2 { font-size: clamp(2rem, 4.5vw, 3.25rem); }
.student-recolor > header p { margin-block: 8px 0; }
.student-recolor > .recolor-controls { align-self: start; margin-top: 0; }
.student-recolor > .recolor-artwork { grid-column: 2; grid-row: 1 / span 2; width: min(38vh, 390px); max-width: 100%; }
.student-recolor > .recolor-footer { grid-column: 1 / -1; }
.student-restored { text-align: center; }

/* Distance room */
.phase-2 .teacher-main { background: var(--aqua); }
.distance-stage { --distance-accent: var(--yellow); position: relative; isolation: isolate; width: 100%; grid-template-columns: minmax(270px, .78fr) minmax(420px, 1.22fr); grid-template-rows: minmax(0, 1fr); align-items: stretch; column-gap: clamp(24px, 3vw, 52px); overflow: hidden; animation: none; }
.distance-stage.step-1 { --distance-accent: var(--red); }
.distance-stage.step-2 { --distance-accent: var(--purple); }
.distance-stage::before { content: ""; position: absolute; z-index: -2; top: -18%; right: -8%; width: 48%; height: 72%; background: var(--yellow); clip-path: polygon(16% 0, 100% 8%, 82% 100%, 0 78%); transform: rotate(4deg); }
.distance-stage::after { content: ""; position: absolute; z-index: -1; left: -8%; bottom: -32%; width: 42%; aspect-ratio: 1; border: clamp(38px, 5vw, 78px) solid var(--red); border-radius: 50%; }
.distance-left { position: relative; z-index: 2; grid-column: 1; grid-row: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: clamp(18px, 2.5vh, 26px); padding-left: clamp(8px, 2vw, 34px); }
.distance-title { display: grid; align-content: center; justify-items: start; width: 100%; height: min(39vh, 350px); min-height: 0; text-align: left; }
.distance-title .room-label { margin-bottom: 7px; color: var(--ink); }
.distance-title h2 { max-width: 10ch; font-size: clamp(2.6rem, 4vw, 4.6rem); }
.distance-title > p:last-child { max-width: 34ch; margin: 18px 0 0; font-size: 1rem; }
.distance-progress { display: flex; gap: 7px; margin-bottom: 8px; }
.distance-progress span { width: 38px; height: 7px; border-radius: 999px; background: rgba(16, 40, 58, .22); }
.distance-progress span.active { background: var(--distance-accent); box-shadow: 0 0 0 2px var(--ink); }
.nested-gallery { position: relative; grid-column: 2; grid-row: 1; width: 100%; min-height: min(47vh, 460px); display: grid; place-items: center; perspective: 1100px; }
.distance-frame { position: absolute; overflow: hidden; margin: 0; padding: 8px; background: var(--paper); box-shadow: var(--shadow-art); transition: transform .65s var(--ease), opacity .45s, filter .45s; }
.distance-frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
.distance-frame.whole { width: min(34vh, 330px); aspect-ratio: 1; transform: translateX(-62%) rotate(-4deg); }
.distance-frame.compose { width: min(40vh, 400px); aspect-ratio: 1; z-index: 2; }
.distance-frame.detail { width: min(34vh, 330px); aspect-ratio: 1; transform: translateX(62%) rotate(4deg); }
.distance-frame.compose img { transform: scale(1.45); object-position: 53% 36%; }
.distance-frame.detail img { transform: scale(3.2); object-position: 78% 20%; }
.distance-frame.active { z-index: 5; width: min(100%, var(--lesson-artwork-size)); box-shadow: 0 0 0 9px var(--distance-accent), var(--shadow-art); transform: translateX(0) rotate(0); }
.distance-frame:not(.active) { opacity: .28; filter: saturate(.35); }
.distance-label { position: absolute; z-index: 2; top: 15px; left: 15px; padding: 7px 11px; border-radius: 999px; background: var(--distance-accent); color: var(--ink); font-size: .72rem; font-weight: 750; }
.distance-controls { position: absolute; z-index: 7; left: 50%; bottom: calc((100% - var(--lesson-artwork-size)) / 2 + 18px); width: min(100%, var(--lesson-artwork-size)); display: flex; justify-content: flex-end; gap: 10px; padding: 0 16px; transform: translateX(-50%); pointer-events: none; }
.distance-controls .zoom-control { width: 64px; height: 64px; min-width: 64px; min-height: 64px; display: grid; place-items: center; border: 3px solid var(--ink); border-radius: 50%; padding: 0; background: var(--paper); color: var(--ink); box-shadow: 0 8px 0 rgba(16, 40, 58, .26); pointer-events: auto; }
.distance-controls .zoom-in { background: var(--yellow); }
.distance-controls .zoom-control .ui-icon { width: 30px; height: 30px; stroke-width: 2.6; }
.distance-controls .zoom-control:active:not(:disabled) { background: var(--aqua); box-shadow: 0 8px 0 rgba(16, 40, 58, .26); }
.distance-controls .btn:disabled { opacity: .48; border-color: #526875; background: var(--well); color: #526875; box-shadow: none; cursor: not-allowed; }
.distance-stage .btn:active { transform: none; }
.observation-wall { width: 100%; display: flex; flex-wrap: wrap; gap: 8px; overflow: hidden; padding: 4px 2px 8px; }
.observation-wall > p { width: 100%; margin: 0; color: #667982; text-align: center; }
.observation-note { min-width: 145px; max-width: 210px; padding: 10px 12px; border: 0; border-radius: var(--radius-sm); background: var(--aqua); text-align: left; cursor: pointer; }
.observation-note:nth-child(even) { background: var(--lilac); }
.observation-note strong, .observation-note span { display: block; }
.observation-note span { margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.observation-spotlight { max-width: 620px; padding: 12px 18px; box-shadow: 0 10px 30px rgba(16, 40, 58, .12); }
.observation-spotlight strong { display: block; color: var(--purple); }

.solo-lim-controls { margin-top: 26px; display: grid; gap: 10px; }
.solo-lim-controls > :last-child { box-sizing: border-box; min-height: 46px; display: flex; align-items: center; }
.solo-prompt { font-size: 1rem; font-weight: 800; }
.solo-color-row { display: grid; grid-template-columns: repeat(6, minmax(66px, 76px)); gap: 10px; }
.solo-color { min-width: 0; width: 100%; min-height: 76px; display: grid; place-items: center; gap: 3px; border: 2px solid var(--ink); border-radius: var(--radius-sm); padding: 8px; background: var(--paper); cursor: pointer; }
.solo-color > span { width: 34px; height: 34px; border-radius: 50%; background: var(--solo-color); box-shadow: 0 0 0 1px rgba(16,40,58,.28); }
.solo-color strong { font-size: .76rem; }
.solo-color:hover { transform: translateY(-3px); }
.solo-color.selected { background: var(--ink); color: var(--paper); transform: translateY(-6px) rotate(-2deg); box-shadow: 0 9px 0 var(--solo-color); }
.solo-color.selected > span { box-shadow: 0 0 0 3px var(--paper); animation: chosen-color .5s cubic-bezier(.16,1,.3,1); }
.choice-hint { color: #415965; font-size: .82rem; font-weight: 700; }
.choice-confirmation { width: fit-content; display: flex; align-items: center; gap: 9px; border: 3px solid var(--choice); border-radius: 999px; padding: 8px 14px; background: var(--paper); color: var(--ink); font-weight: 700; }
.choice-confirmation .ui-icon { width: 22px; height: 22px; color: var(--green); }
.solo-observation-controls { width: min(420px, 100%); display: grid; grid-template-columns: 1fr; gap: 10px; }
.solo-observation-controls .solo-prompt { text-align: left; }
.solo-observation-controls .btn { min-height: 64px; border: 2px solid var(--ink); border-radius: var(--radius-sm); }
.solo-observation-controls .btn.is-sending { transform: none; }
.solo-observation-controls .btn.selected { background: var(--ink); color: var(--paper); box-shadow: inset 6px 0 0 var(--distance-accent); }

.phase-2 .solo-observation-controls { margin-top: 0; }
.phase-2 .nested-gallery { min-height: var(--lesson-artwork-size); }
.phase-2 .distance-frame.whole,
.phase-2 .distance-frame.detail { width: min(27vh, 255px); }
.phase-2 .distance-frame.compose { width: min(31vh, 295px); }
.phase-2 .distance-frame.active { width: min(100%, var(--lesson-artwork-size)); }
.phase-2 .solo-observation-controls .btn { min-height: 56px; padding-block: 8px; }
.solo-paint-stage { width: 100%; grid-template-columns: minmax(230px, .55fr) minmax(420px, 1.45fr); gap: 32px; }
.solo-paint-stage header h2 { font-size: var(--fs-stage-title); }
.solo-paint-stage header > p:last-child { font-size: var(--fs-body-large); }
.solo-canvas-area { display: grid; gap: 12px; }

.artwork-frame.choice-active { box-shadow: 0 0 0 10px var(--choice), var(--shadow-art); animation: artwork-answer .65s cubic-bezier(.16,1,.3,1); }
.original-toggle { position: absolute; z-index: 6; left: 24px; top: 24px; min-height: 50px; border: 2px solid var(--ink); padding: 9px 16px; background: var(--paper); font-size: var(--fs-label-small); box-shadow: 0 8px 24px rgba(16,40,58,.2); }
.original-toggle .ui-icon { width: 26px; height: 26px; }
.original-toggle[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.stage-intro.show-original .artwork-frame { box-shadow: var(--shadow-art); }
.stage-intro.show-original .artwork-visual canvas { opacity: 0; }
.stage-intro.show-original .choice-flash { opacity: 0; }
.choice-flash { position: absolute; inset: 12px 12px 42px; z-index: 3; overflow: hidden; pointer-events: none; }
.choice-flash > span { position: absolute; left: 50%; top: 50%; width: 34%; aspect-ratio: 1; border: 18px solid var(--choice); border-radius: 50%; transform: translate(-50%,-50%) scale(.15); animation: color-ripple .75s cubic-bezier(.16,1,.3,1) forwards; }
.choice-flash strong { position: absolute; right: 16px; bottom: 16px; padding: 10px 16px; border-radius: 999px; background: var(--paper); color: var(--ink); font-size: var(--fs-title-large); box-shadow: 0 8px 24px rgba(16,40,58,.22); animation: color-name-in .48s .08s cubic-bezier(.16,1,.3,1) both; }
@keyframes chosen-color { 0% { transform: scale(.6); } 70% { transform: scale(1.22); } 100% { transform: scale(1); } }
@keyframes confirmation-in { from { opacity: .2; transform: translateY(8px) scale(.92); } }
@keyframes artwork-answer { 0% { transform: rotate(1deg) scale(.97); filter: saturate(.7); } 65% { transform: rotate(-1deg) scale(1.025); filter: saturate(1.3); } 100% { transform: rotate(1deg) scale(1); filter: none; } }
@keyframes color-ripple { 75% { opacity: .65; } 100% { opacity: 0; transform: translate(-50%,-50%) scale(5); } }
@keyframes color-name-in { from { opacity: 0; transform: translateX(24px) rotate(5deg); } }

/* Final room */
.gallery-stage { position: relative; width: 100%; grid-template-columns: minmax(230px, .7fr) minmax(320px, 1.3fr); align-content: center; gap: 8px 28px; overflow: hidden; }
.gallery-stage .room-label { margin-bottom: 14px; }
.gallery-stage > .room-label, .gallery-stage > h2, .gallery-stage > .gallery-lead { grid-column: 1; justify-self: stretch; text-align: left; }
.gallery-stage h2 { font-size: var(--fs-stage-title); }
.gallery-lead { width: 100%; margin: 10px 0 18px; font-size: var(--fs-body-large); }
.finale-reveal { position: relative; grid-column: 1; width: min(32vh, 280px); margin: 0; isolation: isolate; }
.finale-reveal img { position: relative; z-index: 2; display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 50%; box-shadow: var(--shadow-art); animation: finale-glow 1.3s var(--ease) both; }
.finale-reveal span { position: absolute; z-index: 1; left: 50%; top: 50%; width: 145%; height: 4px; border-radius: 999px; background: var(--final-color); transform: translate(-50%, -50%) rotate(var(--final-turn)); transform-origin: center; }
@keyframes finale-glow { from { filter: saturate(.25); transform: scale(.88); } to { filter: saturate(1.12); transform: scale(1); } }
.class-gallery { grid-column: 2; grid-row: 1 / span 4; width: 100%; height: min(68vh, 610px); min-height: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); align-content: center; gap: 14px; overflow: hidden; padding: 18px 14px 26px; }
.class-gallery[data-count="1"] { grid-template-columns: minmax(0, 680px); grid-template-rows: minmax(0, 1fr); justify-content: center; }
.class-gallery[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr); }
.class-gallery[data-count="3"], .class-gallery[data-count="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); }
.student-art { min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; overflow: hidden; margin: 0; padding: 9px; background: var(--paper); box-shadow: 0 14px 35px rgba(16, 40, 58, .13); transform: rotate(var(--tilt)); }
.student-art img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; border-radius: var(--radius-xs); }
.student-art figcaption { padding: 8px 3px 1px; font-weight: 700; }
.gallery-overflow-note { position: absolute; right: 24px; bottom: 6px; margin: 0; font-size: var(--fs-label-small); font-weight: 750; }
.empty-gallery { padding: 42px; text-align: center; font-size: var(--fs-title); }

.teacher-controls {
  position: relative;
  z-index: 8;
  min-height: 82px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  background: var(--ink);
  color: var(--paper);
}
.teacher-controls .btn { min-height: 58px; padding-inline: 28px; font-size: 1rem; }
.teacher-controls .status { min-width: 100px; text-align: center; font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }

.guide-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  padding: 24px 18px 16px;
  background: var(--paper);
  overflow: hidden;
}
.guide-panel img { align-self: end; justify-self: center; width: auto; height: min(48vh, 420px); max-width: 100%; object-fit: contain; object-position: bottom; transition: transform .55s var(--ease); }
.phase-0 .guide-panel img { align-self: end; justify-self: start; width: auto; height: min(48vh, 420px); transform: scaleX(-1); }
.phase-1 .guide-panel img { align-self: end; justify-self: start; width: auto; height: min(48vh, 420px); transform: scaleX(-1); }
.phase-2 .guide-panel img { align-self: end; justify-self: start; width: auto; height: min(48vh, 420px); transform: scaleX(-1); }
.phase-3 .guide-panel img { align-self: end; justify-self: start; width: auto; height: min(48vh, 420px); transform: scaleX(-1); }
.guide-bubble { position: relative; z-index: 2; padding: 0; background: transparent; font-size: clamp(1.08rem, 1.35vw, 1.35rem); font-weight: 700; line-height: 1.42; }
.guide-bubble::before { content: "LIA · GUIDA"; display: block; margin-bottom: 10px; color: var(--red-text); font-size: .68rem; font-weight: 800; letter-spacing: .12em; }
.presence { align-self: end; display: flex; align-items: center; gap: 7px; padding: 12px 14px; border-radius: 999px; background: #e7efe9; font-size: .9rem; font-weight: 700; }
.presence-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--green); margin-right: 7px; }

.pause-overlay { position: fixed; inset: 74px 0 0; z-index: 20; display: grid; place-items: center; background: rgba(16, 40, 58, .97); color: white; text-align: center; }
.pause-overlay > div { display: grid; justify-items: center; gap: 18px; }
.pause-icon { width: 92px; height: 92px; display: grid; place-items: center; border-radius: 50%; background: var(--yellow); color: var(--ink); font-size: 3.2rem; font-weight: 800; }
.pause-icon .ui-icon { width: 50px; height: 50px; }
.pause-overlay h2 { font-size: var(--fs-pause); }
.pause-overlay p { margin: 0; font-size: var(--fs-title-large); }
.resume-mission { min-height: 72px; padding: 18px 36px; font-size: 1.35rem; }

/* Student */
.student-shell { height: 100dvh; min-height: 0; overflow: hidden; background: var(--yellow); }
.student-shell .topbar { position: sticky; top: 0; z-index: 10; }
.student-main { width: min(820px, 100%); height: calc(100dvh - 74px); min-height: 0; display: grid; place-items: center; margin: 0 auto; padding: clamp(16px, 3vh, 36px); }
.student-prompt { width: 100%; max-height: 100%; overflow: hidden; padding: clamp(20px, 3.5vh, 40px); box-shadow: 0 24px 60px rgba(16, 40, 58, .14); }
.student-prompt .brand-kicker { margin-bottom: 22px; color: var(--red-text); }
.student-prompt h2 { font-size: var(--fs-student-title); }
.student-prompt > p { max-width: 60ch; font-size: var(--fs-body-medium); }
.color-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 26px 0; }
.color-choice { min-height: 90px; display: grid; place-items: center; gap: 7px; border: 1px solid #d2d2cc; border-radius: var(--radius-sm); background: white; font-weight: 700; cursor: pointer; transition: transform .25s var(--ease), background .2s; }
.color-choice:hover { transform: translateY(-3px); }
.color-choice .swatch { width: 40px; height: 40px; border-radius: 50%; background: var(--swatch); }
.color-choice.selected { background: var(--ink); color: white; transform: translateY(-3px); }
.response-options { display: grid; gap: 9px; margin: 20px 0; }
.reason-choice { min-height: 52px; padding: 12px 16px; border: 1px solid #d2d2cc; border-radius: var(--radius-sm); background: white; text-align: left; font-weight: 650; cursor: pointer; }
.reason-choice.selected { border-color: var(--ink); background: var(--aqua); }
.visual-first { grid-template-columns: repeat(2, 1fr); }
.child-instruction { display: flex; align-items: center; gap: 18px; margin: 20px 0 8px; }
.child-instruction .ui-icon { width: 48px; height: 48px; }
.child-instruction > .ui-icon { width: 34px; height: 34px; color: var(--red-text); }
.visual-first .color-choice { min-height: 132px; font-size: 1.1rem; }
.visual-first .swatch { width: 68px; height: 68px; }
.visual-reasons { grid-template-columns: repeat(3, 1fr); }
.visual-reasons .reason-choice { min-height: 125px; display: grid; place-items: center; align-content: center; gap: 7px; text-align: center; }
.reason-icon .ui-icon { width: 42px; height: 42px; }
.contrast-lab { margin: 10px 0 24px; padding: 20px; border-radius: var(--radius-panel); background: var(--ink); color: var(--paper); }
.contrast-lab > p { margin: 12px 0; }
.contrast-preview { min-height: 94px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; padding: 14px; border-radius: var(--radius-sm); background: linear-gradient(110deg, var(--first) 0 47%, var(--second) 53% 100%); color: white; text-shadow: 0 2px 8px rgba(0,0,0,.6); font-size: 1.1rem; font-weight: 800; }
.contrast-preview span:last-child { text-align: right; }
.contrast-preview > .ui-icon { width: 42px; height: 42px; padding: 9px; border-radius: 50%; background: var(--paper); color: var(--ink); filter: drop-shadow(0 1px 2px rgba(0,0,0,.2)); }
.secondary-colors { display: flex; gap: 12px; flex-wrap: wrap; }
.submit-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 24px; }
.live-mini { display: flex; align-items: center; gap: 9px; font-weight: 700; }
.mini-dots { display: flex; }
.mini-dots span { width: 20px; height: 20px; margin-left: -5px; border: 2px solid var(--paper); border-radius: 50%; }
.success-note { padding: 18px; background: var(--success-bg); border-radius: var(--radius-sm); font-size: var(--fs-body-large); font-weight: 700; }
.student-distance { display: grid; gap: 18px; }
.student-artwork { position: relative; overflow: hidden; width: min(100%, 46vh); max-height: 42vh; justify-self: center; margin: 0; padding: 8px; background: var(--paper); box-shadow: var(--shadow-art); }
.student-artwork img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; transition: transform .6s var(--ease), object-position .6s var(--ease); }
.student-artwork[data-distance="1"] img { transform: scale(1.55); object-position: 55% 35%; }
.student-artwork[data-distance="2"] img { transform: scale(3.4); object-position: 76% 19%; }
.distance-chip { position: absolute; top: 16px; left: 16px; padding: 8px 12px; background: var(--yellow); border-radius: 999px; font-size: .78rem; font-weight: 750; }
.paint-area { display: grid; gap: 16px; }
.paint-toolbar, .stamp-toolbar { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.stamp-toolbar span { font-weight: 700; }
.stamp-toolbar .btn { min-height: 40px; padding: 8px 12px; background: var(--aqua); font-size: var(--fs-label-small); }
.stamp-toolbar .btn .ui-icon { width: 20px; height: 20px; }
.paint-color { width: 48px; height: 48px; border: 4px solid var(--paper); border-radius: 50%; background: var(--paint); box-shadow: 0 0 0 1px #c7c7c1; cursor: pointer; }
.paint-color.selected { box-shadow: 0 0 0 3px var(--ink); }
#paint-canvas { width: auto; max-width: 100%; height: min(42vh, 480px); aspect-ratio: 4 / 3; justify-self: center; display: block; border: 1px solid #d4d3cd; border-radius: var(--radius-sm); background: var(--paper); box-shadow: var(--shadow-art); touch-action: none; }
.connection-toast { position: fixed; left: 50%; bottom: 20px; z-index: 40; transform: translateX(-50%); padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--paper); font-weight: 700; box-shadow: var(--shadow-menu); }

/* Lia introduces the real lesson before the first room */
.mascot-intro-shell { background: var(--yellow); }
.mascot-intro { min-height: calc(100vh - 74px); display: grid; grid-template-columns: minmax(330px, .8fr) minmax(540px, 1.2fr); align-items: center; gap: clamp(30px, 5vw, 84px); overflow: hidden; padding: clamp(34px, 5vw, 76px); background: linear-gradient(108deg, var(--aqua) 0 42%, var(--yellow) 42% 100%); }
.mascot-portrait { position: relative; align-self: end; justify-self: center; height: min(72vh, 690px); }
.mascot-portrait::before { content: ""; position: absolute; z-index: 0; width: 88%; aspect-ratio: 1; left: 4%; top: 4%; border-radius: 50%; background: var(--paper); }
.mascot-portrait img { position: relative; z-index: 1; display: block; height: 100%; max-width: 100%; object-fit: contain; object-position: bottom; filter: drop-shadow(0 24px 24px rgba(16,40,58,.16)); animation: lia-arrives .7s cubic-bezier(.16,1,.3,1) both; }
.mascot-name { position: absolute; z-index: 2; left: 0; top: 10%; min-width: 102px; display: grid; place-items: center; aspect-ratio: 1; border-radius: 50%; background: var(--red); color: var(--paper); font-size: 2rem; font-weight: 800; transform: rotate(-8deg); }
.mascot-welcome { position: relative; max-width: 760px; padding: clamp(30px, 4vw, 58px); padding-bottom: clamp(42px, 5vw, 68px); background: var(--paper); }
.mascot-welcome::after { content: ""; position: absolute; left: 0; bottom: -28px; width: 72px; height: 30px; background: var(--paper); clip-path: polygon(0 0, 100% 0, 0 100%); }
.mascot-welcome .brand-kicker { margin-bottom: 18px; color: var(--red-text); }
.mascot-welcome h2 { max-width: 12ch; font-size: clamp(3.2rem, 5vw, 6rem); }
.mascot-promise { max-width: 48ch; margin: 24px 0; font-size: var(--fs-lead); font-weight: 650; }
.lesson-map { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 26px 0 32px; }
.lesson-step { min-width: 0; display: grid; justify-items: center; align-content: center; gap: 8px; text-align: center; }
.lesson-step > span { width: 76px; height: 76px; display: grid; place-items: center; border-radius: 50%; background: var(--aqua); }
.lesson-step:nth-child(2) > span { background: var(--yellow); }
.lesson-step:nth-child(3) > span { background: var(--lilac); }
.lesson-step:nth-child(4) > span { background: #f9dfdc; }
.lesson-step .ui-icon { width: 42px; height: 42px; }
.lesson-step strong { font-size: .72rem; line-height: 1.2; }
.mascot-join-actions { display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.start-with-lia { flex: 0 0 auto; min-height: 70px; margin: 0; padding-inline: 34px; font-size: 1.25rem; box-shadow: 0 10px 0 var(--ink); }
.start-with-lia:active { transform: translateY(6px); box-shadow: 0 4px 0 var(--ink); }
.mascot-portrait .tablet-join-qr { position: absolute; z-index: 5; top: 18%; right: -102px; width: 210px; display: grid; justify-items: center; gap: 7px; padding: 14px; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); text-align: center; box-shadow: var(--shadow-art); transform: rotate(1deg); }
.tablet-join-qr > span { font-size: var(--fs-label-small); font-weight: 800; letter-spacing: .045em; }
.mascot-portrait .tablet-join-qr img { position: static; z-index: auto; display: block; width: 180px; height: 180px; max-width: 100%; aspect-ratio: 1; padding: 4px; border: 1px solid var(--ink); background: #fff; filter: none; image-rendering: pixelated; animation: none; }
.tablet-join-qr small { font-size: .68rem; font-weight: 800; letter-spacing: .09em; }
.tablet-join-qr strong { font-size: 2.2rem; font-weight: 850; letter-spacing: .12em; line-height: 1; }
.tablet-qr-fallback { max-width: 180px; color: var(--red-text); font-size: .72rem; line-height: 1.2; letter-spacing: 0; }
.student-lia-wait { display: grid; grid-template-columns: 180px 1fr; align-items: center; gap: 24px; }
.student-lia-wait img { width: 100%; max-height: 260px; object-fit: contain; }
@keyframes lia-arrives { from { opacity: .2; transform: translateX(-40px); filter: saturate(.5); } }

@media (max-width: 1100px) {
  .landing.setup-active { grid-template-columns: 1fr; }
  .landing.setup-active .landing-copy { display: none; }
  .landing.setup-active .role-panel { width: 100%; }
  .landing.setup-active .teacher-setup { width: min(760px, 100%); justify-self: center; }
  .teacher-layout { grid-template-columns: 140px minmax(0, 1fr); }
  .teacher-rail { padding-inline: 10px; }
  .phase-tab { grid-template-columns: 48px 1fr; font-size: .88rem; }
  .phase-symbol { width: 42px; height: 42px; }
  .phase-tab.color-wheel-tab { grid-template-columns: 48px 1fr; }
  .phase-tab.color-wheel-tab .phase-symbol { width: 42px; height: 42px; }
  .guide-panel { display: none; }
  .guide-bubble { font-size: 1.02rem; }
  .guide-panel img { width: min(100%, 210px); }
  .palette-stage { grid-template-columns: minmax(180px, .5fr) minmax(350px, 1.5fr); }
  .recolor-stage { grid-template-columns: minmax(220px, .8fr) minmax(300px, 1.2fr); gap: 18px; }
  .recolor-copy h2 { font-size: clamp(2.4rem, 4vw, 3.7rem); }
  .mix-wells { flex-wrap: wrap; }
  .mix-result { flex-basis: 100%; width: 100%; }
  .mix-wells .mix-equation:last-of-type { display: none; }
  .recolor-artwork { max-width: 100%; }
  .stage-intro { grid-template-columns: minmax(210px, .75fr) minmax(320px, 1.25fr); }
  .distance-title h2 { font-size: clamp(2rem, 3.6vw, 3.6rem); }
  .distance-stage { grid-template-columns: minmax(190px, .72fr) minmax(300px, 1.28fr); column-gap: 14px; }
  .distance-title { padding-left: 0; }
  .distance-title > p:last-child { margin-top: 10px; font-size: .88rem; }
  .nested-gallery { min-height: min(39vh, 380px); }
  .distance-frame.active { width: min(39vh, 390px); }
  .solo-color-row { grid-template-columns: repeat(3, minmax(66px, 76px)); }
  .teacher-controls { min-height: 76px; }
  .teacher-controls .btn { min-height: 54px; padding-inline: 20px; }
}

/* Short classroom displays: keep every action above the fixed lesson controls. */
@media (max-height: 800px) {
  :root { --lesson-artwork-size: min(50vh, 420px); }
  .stage { padding: 16px 22px; }
  .stage-intro { gap: 20px; }
  .stage-copy .room-label { margin-bottom: 8px; }
  .stage-copy h2 { font-size: clamp(2.7rem, 4vw, 3.75rem); }
  .stage-copy p:last-child { margin-top: 10px; font-size: .96rem; }
  .lim-visual-cues { gap: 10px; margin-top: 12px; }
  .lim-visual-cues span { width: 66px; font-size: 1.7rem; }
  .lim-visual-cues .ui-icon { width: 32px; height: 32px; }
  .lim-visual-cues > .cue-arrow { width: 24px; height: 24px; }
  .lim-visual-cues small { font-size: .55rem; }
  .artwork-frame { width: min(100%, var(--lesson-artwork-size)); padding: 9px; }
  .artwork-caption { padding-top: 6px; }
  .solo-lim-controls { margin-top: 12px; gap: 6px; }
  .solo-color-row { grid-template-columns: repeat(3, minmax(60px, 72px)); gap: 7px; }
  .solo-color { min-height: 58px; padding: 5px; }
  .solo-color > span { width: 25px; height: 25px; }
  .solo-color strong { font-size: .66rem; }
  .choice-hint { font-size: .72rem; }
  .choice-confirmation { padding: 5px 11px; font-size: .8rem; }
  .recolor-stage { gap: 18px; }
  .recolor-copy .room-label { margin-bottom: 7px; }
  .recolor-copy h2 { font-size: clamp(2.25rem, 3.4vw, 3.35rem); }
  .recolor-copy > p:not(.room-label) { margin-top: 8px; font-size: .9rem; }
  .recolor-controls { gap: 7px; margin-top: 10px; }
  .mix-well, .mix-result { min-width: 104px; min-height: 70px; grid-template-columns: 32px 1fr; padding: 7px 9px; }
  .mix-well > span, .mix-result > span { width: 32px; height: 32px; }
  .mix-well small, .mix-result small { font-size: .5rem; }
  .recolor-palette { gap: 5px; }
  .recolor-swatch { min-height: 51px; }
  .recolor-swatch > span { width: 24px; height: 24px; }
  .recolor-artwork { width: min(100%, var(--lesson-artwork-size)); padding: 8px; }
  .recolor-original { left: 16px; top: 16px; min-height: 42px; padding: 6px 11px; }
  .recolor-gesture { bottom: 12px; min-height: 42px; padding: 6px 11px; }
  .recolor-footer { gap: 7px; }
  .recolor-stats, .recolor-reset { min-height: 38px; padding-block: 6px; }
  .phase-2 .distance-stage { column-gap: 14px; row-gap: 8px; padding-block: 10px; }
  .phase-2 .distance-title .room-label { margin-bottom: 4px; }
  .phase-2 .distance-title { height: min(36vh, 280px); }
  .phase-2 .nested-gallery { min-height: var(--lesson-artwork-size); }
  .phase-2 .distance-frame.whole,
  .phase-2 .distance-frame.detail { width: min(25vh, 205px); }
  .phase-2 .distance-frame.compose { width: min(28vh, 230px); }
  .phase-2 .distance-frame.active { width: min(100%, var(--lesson-artwork-size)); }
  .phase-2 .solo-observation-controls { gap: 6px; }
  .phase-2 .solo-observation-controls .btn { min-height: 50px; }
}

@media (max-width: 900px) {
  .teacher-layout { grid-template-columns: 140px minmax(0, 1fr); }
  .guide-panel { display: none; }
  .palette-stage { grid-template-columns: 1fr; }
  .recolor-stage { grid-template-columns: minmax(205px, .75fr) minmax(270px, 1.25fr); padding-inline: 16px; }
  .color-wheel-stage { grid-template-columns: minmax(190px, .8fr) minmax(230px, 1.2fr); gap: 18px; padding-inline: 16px; }
  .wheel-lesson-copy h2 { font-size: clamp(2rem, 5vw, 3rem); }
  .color-wheel { --wheel-radius: clamp(90px, 16vh, 138px); }
  .wheel-assembly { width: min(100%, calc(clamp(90px, 16vh, 138px) * 2 + 56px)); }
  .wheel-fact-line { font-size: 1rem; }
  .wheel-current-pair, .wheel-current-pair .wheel-pair-detail { font-size: 1rem; }
  .recolor-copy h2 { font-size: clamp(2.1rem, 5vw, 3.1rem); }
  .palette-title { position: absolute; z-index: 6; left: 28px; top: 28px; max-width: 300px; color: var(--paper); text-shadow: 0 2px 10px rgba(16, 40, 58, .35); }
  .palette-title .room-label { color: var(--yellow); }
  .contribution-labels { grid-column: 1; }
  .gallery-stage { grid-template-columns: 1fr; overflow: auto; }
  .gallery-stage > .room-label, .gallery-stage > h2, .gallery-stage > .gallery-lead, .finale-reveal, .class-gallery { grid-column: 1; }
  .class-gallery { grid-row: auto; height: min(48vh, 420px); }
  .solo-paint-stage { grid-template-columns: 1fr; overflow: auto; }
  .mascot-intro { grid-template-columns: .65fr 1.35fr; padding: 28px; }
  .mascot-welcome { padding: 32px; }
  .lesson-step > span { width: 60px; height: 60px; }
}

@media (max-width: 760px) {
  .landing { grid-template-columns: 1fr; }
  .landing-copy { min-height: 68vh; grid-template-columns: .85fr 1.15fr; padding: 42px 22px; }
  .landing h1 { font-size: clamp(3rem, 12vw, 5rem); }
  .landing .lead { margin-top: 20px; }
  .landing-artwork img { aspect-ratio: 4 / 5; }
  .role-panel { min-height: 32vh; padding: 34px 22px 46px; }
  .topbar { min-height: 66px; }
  .topbar-brand .mark { width: 40px; height: 40px; }
  .program-name, .session-badge .role-label { display: none; }
  .student-main { padding: 18px; }
  .student-prompt { padding: 26px 20px; }
  .student-recolor { grid-template-columns: minmax(210px, .8fr) minmax(250px, 1.2fr); padding: 18px; gap: 10px 14px; }
  .student-recolor > header h2 { font-size: clamp(1.7rem, 5vw, 2.5rem); }
  .student-recolor > header > p:last-child { font-size: .82rem; }
  .student-recolor .mix-wells { gap: 5px; }
  .student-recolor .mix-well, .student-recolor .mix-result { min-width: 68px; min-height: 54px; grid-template-columns: 24px 1fr; padding: 4px 6px; }
  .student-recolor .mix-well > span, .student-recolor .mix-result > span { width: 23px; height: 23px; }
  .student-recolor .recolor-swatch { min-height: 46px; }
  .student-recolor .recolor-swatch > span { width: 22px; height: 22px; }
  .student-recolor > .recolor-artwork { width: min(42vh, 350px); }
  .student-recolor .recolor-footer { flex-wrap: wrap; }
  .color-grid { gap: 8px; }
  .color-choice { min-height: 82px; font-size: var(--fs-label-small); }
  .submit-row { align-items: stretch; flex-direction: column; }
  .submit-row .btn { width: 100%; }
  .mascot-intro { min-height: calc(100vh - 66px); grid-template-columns: 1fr; align-content: start; gap: 12px; padding: 22px; background: var(--yellow); }
  .mascot-portrait { height: 220px; align-self: start; }
  .mascot-name { min-width: 68px; font-size: 1.3rem; }
  .mascot-welcome { padding: 26px 22px 40px; }
  .mascot-welcome h2 { font-size: clamp(2.5rem, 11vw, 4rem); }
  .lesson-map { grid-template-columns: repeat(2, 1fr); }
  .student-lia-wait { grid-template-columns: 100px 1fr; }
}

@media (max-width: 560px) {
  .landing-copy { grid-template-columns: 1fr; }
  .landing-artwork { display: none; }
  .topbar-brand h1 { font-size: 1rem; }
  .session-code { font-size: 1rem; padding: 8px 11px; }
  .mode-grid { grid-template-columns: 1fr; }
  .solo-observation-controls { grid-template-columns: 1fr; }
  .student-recolor { grid-template-columns: 1fr 1fr; align-content: center; }
  .student-recolor > header { grid-column: 1 / -1; }
  .student-recolor > header > p:last-child { display: none; }
  .student-recolor > .recolor-controls { grid-column: 1; }
  .student-recolor > .recolor-artwork { grid-column: 2; grid-row: 2; }
  .student-recolor .recolor-palette { grid-template-columns: repeat(3, 1fr); }
  .student-recolor .recolor-swatch small { display: none; }
}

@media (max-width: 900px), (max-height: 650px) {
  .mascot-intro { position: relative; display: block; min-height: calc(100dvh - 74px); height: calc(100dvh - 74px); padding: 18px; background: var(--yellow); }
  .mascot-portrait { position: absolute; z-index: 4; right: 24px; top: 24px; width: 150px; height: 164px; }
  .mascot-portrait::before { width: 100%; left: 0; top: 0; }
  .mascot-portrait img { width: 100%; height: 100%; }
  .mascot-name { left: -10px; top: 0; min-width: 54px; font-size: 1rem; }
  .mascot-welcome { width: 100%; height: 100%; max-width: none; display: flex; flex-direction: column; justify-content: center; padding: 24px 190px 24px 28px; }
  .mascot-welcome::after { display: none; }
  .mascot-welcome .brand-kicker { margin-bottom: 8px; }
  .mascot-welcome h2 { max-width: 10ch; font-size: clamp(2.5rem, 7vw, 4rem); }
  .mascot-promise { max-width: 45ch; margin: 12px 0; font-size: 1rem; line-height: 1.35; }
  .lesson-map { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 12px 0 16px; }
  .lesson-step > span { width: 52px; height: 52px; }
  .lesson-step .ui-icon { width: 30px; height: 30px; }
  .lesson-step strong { font-size: .58rem; }
  .start-with-lia { align-self: flex-start; min-height: 54px; padding: 10px 24px; font-size: 1rem; box-shadow: 0 7px 0 var(--ink); }
  .mascot-portrait .tablet-join-qr { top: 100%; right: -8px; width: 112px; gap: 4px; padding: 7px; transform: rotate(1deg); }
  .tablet-join-qr > span { font-size: .5rem; }
  .mascot-portrait .tablet-join-qr img { width: 92px; height: 92px; padding: 3px; }
  .tablet-join-qr small { font-size: .46rem; }
  .tablet-join-qr strong { font-size: 1.3rem; }
}

@media (max-width: 620px) {
  .mascot-intro { min-height: calc(100dvh - 66px); height: calc(100dvh - 66px); }
  .mascot-portrait { width: 112px; height: 126px; right: 18px; top: 18px; }
  .mascot-welcome { padding-right: 140px; }
  .mascot-join-actions { flex-wrap: wrap; gap: 10px; }
  .mascot-portrait .tablet-join-qr { width: 86px; right: -4px; gap: 3px; padding: 5px; }
  .tablet-join-qr > span { font-size: .38rem; }
  .mascot-portrait .tablet-join-qr img { width: 70px; height: 70px; padding: 2px; }
  .tablet-join-qr small { font-size: .38rem; }
  .tablet-join-qr strong { font-size: .95rem; letter-spacing: .08em; }
  .lesson-map { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Tablet companion: the artwork and the task share the viewport, never a clipped card. */
.mascot-intro-shell { height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.mascot-intro { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); height: auto; min-height: 0; overflow: auto; padding: clamp(20px, 3vw, 48px); gap: clamp(24px, 4vw, 64px); }
.mascot-portrait { position: relative; top: auto; right: auto; align-self: center; width: 100%; height: min(68dvh, 640px); padding-right: clamp(130px, 10vw, 180px); }
.mascot-portrait img { width: 100%; height: 100%; }
.mascot-portrait .tablet-join-qr { top: 18%; right: 0; width: clamp(210px, 16vw, 260px); gap: 8px; padding: 16px; transform: none; }
.mascot-portrait .tablet-join-qr img { width: 100%; height: auto; aspect-ratio: 1; padding: 0; border: none; }
.tablet-join-qr > span { font-size: .75rem; }
.tablet-join-qr small { font-size: .72rem; }
.tablet-join-qr strong { font-size: clamp(1.8rem, 2.4vw, 2.5rem); }
.mascot-welcome { padding: clamp(24px, 3vw, 48px); }
.mascot-welcome h2 { font-size: clamp(2.4rem, 4.6vw, 5.2rem); }
@media (max-width: 900px) {
  .mascot-intro { grid-template-columns: minmax(0, 1fr); align-content: start; padding: 20px; gap: 24px; }
  .mascot-portrait { width: min(100%, 580px); height: 340px; padding-right: 180px; }
  .mascot-portrait .tablet-join-qr { top: 24px; width: 220px; }
  .mascot-name { min-width: 70px; font-size: 1.4rem; }
  .mascot-welcome { width: 100%; max-width: none; padding: 24px; }
}
@media (max-width: 440px) {
  .mascot-portrait { height: 300px; padding-right: 160px; }
  .mascot-portrait .tablet-join-qr { width: 200px; padding: 12px; }
  .mascot-name { min-width: 48px; font-size: 1rem; }
}
.invite-tablets { min-height: 44px; padding: 10px 16px; background: var(--aqua); font-size: .85rem; }
.tablet-invite-dialog { width: min(960px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow: auto; padding: clamp(20px, 3vw, 40px); border: 2px solid var(--ink); border-radius: 16px; color: var(--ink); background: var(--paper); }
.tablet-invite-dialog::backdrop { background: rgba(16,40,58,.75); }
.tablet-invite-dialog > header { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.tablet-invite-dialog h2 { font-size: clamp(2rem, 4vw, 3.2rem); }
.invite-content { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: center; }
.invite-qr { display: block; width: 100%; aspect-ratio: 1; background: white; }
.invite-content p { font-size: 1.2rem; margin: 0 0 16px; }
.invite-content a { display: block; overflow-wrap: anywhere; font-weight: 750; margin-bottom: 16px; }
.invite-content .invite-network { font-size: 1rem; }
.invite-code { display: block; font-size: clamp(2rem, 5vw, 4rem); letter-spacing: .1em; background: white; padding: 8px 16px; }
[data-invite-presence] { border-top: 2px solid var(--ink); padding-top: 20px; font-size: 1.1rem; font-weight: 750; }
.tablet-join-card { max-width: 600px; }
.tablet-join-card > p { margin: 20px 0; }
.tablet-join-card form { display: grid; gap: 20px; }
.tablet-join-card input { min-height: 56px; font-size: 1.15rem; }
@media (max-width: 640px) {
  .invite-content { grid-template-columns: 1fr; gap: 20px; }
  .invite-qr { width: min(100%, 320px); justify-self: center; }
  .tablet-invite-dialog > header { align-items: start; gap: 12px; }
  .invite-tablets { font-size: .7rem; padding: 8px; }
}
.student-shell { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100dvh; background: var(--aqua); }
body:has(.student-shell) { overflow: hidden; }
.student-shell, .student-shell * { scrollbar-width: none; }
.student-shell::-webkit-scrollbar, .student-shell *::-webkit-scrollbar { display: none; width: 0; height: 0; }
.student-shell .topbar { position: relative; min-height: 64px; padding: 10px clamp(16px, 3vw, 36px); }
.student-shell .session-code { font-size: 1.1rem; letter-spacing: .08em; }
.student-main { display: block; width: 100%; height: auto; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: 24px max(20px, env(safe-area-inset-left)) max(24px, env(safe-area-inset-bottom)); }
.student-prompt { width: min(1140px, 100%); max-height: none; overflow: visible; margin-inline: auto; padding: clamp(20px, 3vw, 32px); border-radius: 16px; box-shadow: none; }
.student-task-header { margin-bottom: 24px; }
.student-prompt .brand-kicker { margin: 0 0 8px; font-size: .85rem; }
.student-prompt h2, .student-recolor > header h2 { font-size: clamp(1.85rem, 3.8vw, 3rem); line-height: 1.08; max-width: 26ch; }
.student-task-header > p:last-child, .student-recolor > header > p:last-child { display: block; margin: 12px 0 0; font-size: 1rem; max-width: 65ch; }
.student-color-workspace, .student-observation-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); align-items: start; gap: 32px; }
.tablet-reference { margin: 0; min-width: 0; }
.tablet-reference img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border: 8px solid white; }
.tablet-reference figcaption { margin-top: 10px; font-size: 1rem; }
.tablet-choices { min-width: 0; }
.tablet-step-label { margin: 0 0 12px; font-weight: 750; font-size: 1.05rem; }
.student-shell .color-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0 0 24px; }
.student-shell .color-choice { min-height: 88px; padding: 10px; font-size: 1rem; border: 2px solid var(--ink); transform: none; transition: background .15s ease, color .15s ease; }
.student-shell .color-choice .swatch { width: 40px; height: 40px; }
.student-shell .color-choice.selected { transform: none; box-shadow: inset 0 0 0 2px var(--paper); }
.student-shell .response-options { margin: 0; grid-template-columns: 1fr; gap: 10px; }
.student-shell .reason-choice { min-height: 56px; padding: 12px 16px; border: 2px solid var(--ink); font-size: 1rem; }
.student-shell .visual-reasons .reason-choice { display: flex; justify-content: flex-start; align-items: center; gap: 12px; text-align: left; }
.student-shell .reason-icon .ui-icon { width: 28px; height: 28px; }
.student-shell button { touch-action: manipulation; }
.student-shell button:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
.student-shell .btn { min-height: 52px; }
.tablet-submit { position: sticky; bottom: -1px; z-index: 4; margin-top: 24px; padding: 16px 0 0; border-top: 2px solid var(--ink); background: var(--paper); flex-direction: row; align-items: center; }
.tablet-submit p { margin: 0; font-size: 1rem; }
.tablet-submit .btn { flex: 0 0 auto; width: auto; }
.student-distance { display: block; }
.student-shell .student-artwork { width: 100%; max-height: none; aspect-ratio: 1; margin: 0; }
.student-shell .student-artwork img { width: 100%; height: 100%; }
.student-shell .distance-chip { z-index: 1; }
.tablet-observation-response { display: grid; gap: 20px; min-width: 0; }
.student-shell textarea, .student-shell select { font-size: 1rem; min-height: 52px; }
.student-shell textarea { min-height: 140px; resize: vertical; }
.student-shell .student-recolor { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); grid-template-rows: auto 1fr auto; gap: 24px 32px; }
.student-recolor > header { margin: 0; }
.student-shell .student-recolor > .recolor-artwork { width: 100%; grid-column: 2; grid-row: 1 / span 2; }
.student-shell .student-recolor .mix-wells { gap: 8px; }
.student-shell .student-recolor .mix-well, .student-shell .student-recolor .mix-result { min-width: 0; min-height: 80px; padding: 8px; grid-template-columns: 30px 1fr; }
.student-shell .student-recolor .mix-well > span, .student-shell .student-recolor .mix-result > span { width: 30px; height: 30px; }
.student-shell .student-recolor .recolor-palette { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.student-shell .student-recolor .recolor-swatch { min-height: 66px; padding: 8px; }
.student-shell .student-recolor .recolor-swatch > span { width: 30px; height: 30px; }
.student-shell .student-recolor .recolor-swatch small { display: block; font-size: .8rem; }
.student-shell .recolor-footer { margin: 0; padding-top: 16px; border-top: 2px solid var(--ink); justify-content: space-between; gap: 16px; }
.student-shell .paint-area { gap: 20px; }
.student-shell .paint-area .student-task-header { margin: 0; }
.student-shell .paint-color { width: 52px; height: 52px; }
.student-shell .stamp-toolbar .btn { min-height: 48px; font-size: .9rem; }
.student-shell #paint-canvas { width: min(100%, 800px); height: auto; aspect-ratio: 4 / 3; box-shadow: none; }
.student-shell #send-artwork { justify-self: end; }
.student-confirmation .submitted-summary { display: grid; gap: 8px; margin: 0 0 24px; font-size: 1.15rem; }
.student-confirmation [data-edit-submission] { margin-top: 16px; background: var(--aqua); border: 2px solid var(--ink); }
.student-confirmation > p:last-child { margin-top: 16px; font-size: 1rem; }
.submitted-preview { display: block; width: min(100%, 300px); max-height: 300px; object-fit: contain; }
.student-shell .tablet-color-lesson { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); width: min(1200px, 100%); padding: 0; border-radius: 16px; overflow: hidden; }
.tablet-color-identity { display: flex; flex-direction: column; min-width: 0; padding: clamp(24px, 3vw, 40px); background: white; container-type: inline-size; }
.tablet-color-identity header { margin-bottom: 24px; }
.student-shell .tablet-color-identity h2 { font-size: min(4.5rem, 10cqw); max-width: none; white-space: nowrap; overflow-wrap: normal; }
.tablet-color-lesson-body { display: flex; flex-direction: column; align-items: stretch; gap: 32px; min-width: 0; padding: clamp(24px, 3vw, 40px); }
.wheel-sync-status { position: absolute; z-index: 8; top: 12px; left: 20px; right: 20px; margin: 0; padding: 14px 20px; border: 2px solid var(--ink); background: var(--paper); color: var(--red-text); font-weight: 750; }
.tablet-color-sample { margin: 0; }
.tablet-color-field { width: 100%; aspect-ratio: 4 / 3; background: var(--lesson-color); border: 1px solid var(--ink); border-radius: 12px; }
.tablet-color-sample figcaption { margin-top: 12px; font-size: .95rem; }
.tablet-color-lesson-body h3 { margin: 0 0 12px; font-size: clamp(1.35rem, 2vw, 1.65rem); line-height: 1.2; }
.tablet-color-lesson-body ul { margin: 0; padding-left: 24px; font-size: 1.1rem; }
.tablet-color-lesson-body li + li { margin-top: 8px; }
.tablet-color-lesson-body p { margin: 0; font-size: 1.1rem; line-height: 1.55; max-width: 55ch; }
.tablet-complement { margin-top: 32px; }
.tablet-contrast-pair { display: flex; height: 64px; overflow: hidden; border: 1px solid var(--ink); border-radius: 8px; }
.tablet-contrast-pair span { flex: 1; background: var(--lesson-color); }
.tablet-contrast-pair span + span { background: var(--partner-color); }
.tablet-complement p { margin: 12px 0 0; font-size: 1.05rem; }
.tablet-color-challenge { padding: 24px; background: var(--yellow); border-radius: 12px; }
.student-shell .tablet-color-follow { margin-top: auto; padding: 0; border: 0; font-size: .9rem; line-height: 1.5; }
.tablet-results { margin-top: 24px; }
.tablet-results h3 { margin: 0 0 12px; font-size: 1.2rem; }
.tablet-results h3 span { font-weight: 500; }
.tablet-results > p { font-size: 1rem; }
.tablet-results-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(124px, 100%), 1fr)); align-content: start; gap: 12px; height: 208px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 8px 8px 12px; }
.tablet-result-row { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-height: 88px; width: 100%; padding: 10px 12px; border: 1px solid var(--ink); border-radius: 10px; background: var(--paper); color: var(--ink); text-align: left; cursor: pointer; transition: background 160ms ease, color 160ms ease; }
.tablet-result-row:hover { background: white; }
.tablet-result-row { transition: background 160ms ease, color 160ms ease, transform 220ms cubic-bezier(.16,1,.3,1), box-shadow 220ms cubic-bezier(.16,1,.3,1); }
.tablet-result-row.is-presented { z-index: 1; background: var(--ink); color: var(--paper); transform: translateY(-2px) rotate(-2deg); box-shadow: 0 6px 0 var(--result-color); }
.tablet-result-row.is-presented .tablet-result-swatch { animation: result-color-stamp 280ms cubic-bezier(.16,1,.3,1); border-color: var(--paper); }
@keyframes result-color-stamp { from { transform: scale(.8); } to { transform: scale(1); } }
.tablet-result-answer { display: none; }
.observation-artwork { position: relative; z-index: 2; width: min(100%, var(--lesson-artwork-size)); }
.observation-artwork .artwork-frame { width: 100%; }
.restoration-placeholder { filter: none; }
.tablet-restoration-stage .artwork-result-answer p { font-size: clamp(1.5rem, 2.2vw, 2rem); }
.tablet-creation-stage { grid-template-columns: minmax(240px, .85fr) minmax(360px, 1.15fr); align-items: center; gap: clamp(24px, 3vw, 48px); }
.tablet-creation-stage .artwork-visual img { aspect-ratio: 4 / 3; object-fit: contain; background: #fffdf8; }
.tablet-creation-stage .stage-copy > p:not(.room-label) { margin: 16px 0 0; }
.observation-artwork .artwork-frame.choice-active { animation: artwork-answer .65s cubic-bezier(.16,1,.3,1); }
.artwork-result-answer { height: 160px; padding: 24px 8px 0; text-align: center; overflow-wrap: anywhere; overflow-y: auto; overscroll-behavior: contain; }
.artwork-result-answer strong { display: block; font-size: clamp(1.2rem, 1.6vw, 1.6rem); }
.artwork-result-answer p { margin: 8px 0 0; font-size: clamp(1.5rem, 2.2vw, 2rem); font-weight: 750; line-height: 1.2; }
.tablet-result-answer strong { font-size: 1.1rem; }
.stage-copy .tablet-result-answer p { margin: 8px 0 0; font-size: 1.1rem; line-height: 1.4; }
.tablet-result-row > span:nth-child(2) { min-width: 0; flex: 1; }
.tablet-result-row strong, .tablet-result-row small { display: block; overflow-wrap: anywhere; }
.tablet-result-row strong { font-size: .95rem; line-height: 1.2; }
.tablet-result-row small { margin-top: 4px; font-size: .85rem; line-height: 1.2; }
.tablet-result-swatch { width: 24px; height: 24px; flex-shrink: 0; border: 1px solid var(--ink); border-radius: 50%; background: var(--result-color); }
.tablet-result-preview { display: block; width: 72px; height: 72px; object-fit: cover; border: 2px solid var(--paper); border-radius: 6px; }
.tablet-result-preview-missing { font-size: .8rem; }
.distance-stage .tablet-results { margin-top: 0; }
.distance-stage .tablet-results-list { height: 120px; }
.distance-display { position: relative; z-index: 2; grid-column: 2; grid-row: 1; align-self: center; display: grid; grid-template-columns: minmax(0, 1fr); justify-items: stretch; width: 100%; min-width: 0; }
.distance-display .nested-gallery { grid-column: 1; grid-row: 1; width: 100%; height: var(--lesson-artwork-size); min-height: 0; }
.distance-display .artwork-result-answer { grid-column: 1; grid-row: 2; justify-self: center; width: min(100%, var(--lesson-artwork-size)); }
.tablet-result-row.has-preview { min-height: 136px; }
.tablet-result-action { position: absolute; top: 12px; right: 12px; display: flex; align-items: center; font-size: .8rem; font-weight: 800; }
.group-result-dialog { width: min(900px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: clamp(24px, 4vw, 48px); border: 0; border-radius: 16px; background: var(--paper); color: var(--ink); overflow: auto; }
.group-result-dialog::backdrop { background: rgb(16 40 58 / .65); }
.group-result-dialog header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px; margin-bottom: 32px; }
.group-result-dialog h2 { font-size: clamp(2rem, 4vw, 3rem); overflow-wrap: anywhere; }
.group-result-body { display: flex; align-items: center; flex-wrap: wrap; gap: 32px; }
.group-result-color { width: 160px; aspect-ratio: 1; background: var(--result-color); border: 1px solid var(--ink); border-radius: 12px; }
.group-result-body > div:last-child { flex: 1; min-width: min(240px, 100%); }
.group-result-body h3 { font-size: 2rem; margin: 0 0 16px; }
.group-result-body p { font-size: 1.4rem; margin: 0; }
.group-result-dialog > img { display: block; width: min(100%, 600px); margin: 32px auto 0; }
@media (max-width: 760px) {
  .student-shell .tablet-color-lesson { grid-template-columns: minmax(0, 1fr); }
  .tablet-color-identity { padding: 24px; }
  .tablet-color-field { aspect-ratio: 3 / 1; }
  .tablet-color-identity header { margin-bottom: 20px; }
  .tablet-color-lesson-body { padding: 24px; gap: 24px; }
  .tablet-complement { margin-top: 20px; }
  .tablet-contrast-pair { height: 48px; }
}
@media (max-width: 420px) {
  .tablet-color-identity, .tablet-color-lesson-body { padding: 20px; }
  .tablet-color-challenge { padding: 20px; }
}
.student-wheel { background: var(--aqua); }
.student-wheel .color-wheel-stage { display: grid; height: auto; min-height: 0; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 20px; gap: 32px; overflow: visible; }
.student-wheel .color-wheel-stage::before, .student-wheel .color-wheel-stage::after { display: none; }
.student-wheel .wheel-lesson-copy h2 { max-width: 14ch; font-size: clamp(2rem, 3.5vw, 3rem); }
.student-wheel .wheel-intro, .student-wheel .wheel-fact-line { font-size: 1rem; }
.student-wheel .wheel-assembly { width: min(100%, 440px); container-type: inline-size; }
.student-wheel .color-wheel { --wheel-radius: calc(50cqw - 28px); width: 100%; }
.student-wheel .wheel-center { width: 36%; transform: translate(-50%, -50%); }
.student-wheel .wheel-center .wheel-pair-title { font-size: 1rem; }
.student-wheel .wheel-center .wheel-pair-detail { font-size: .8rem; }
.student-wheel .tablet-wheel-hint { margin: 24px 20px 0; font-size: 1rem; }
@media (max-width: 899px) {
  .student-wheel .color-wheel-stage { grid-template-columns: minmax(0, 1fr); padding: 12px; gap: 28px; }
  .student-wheel .wheel-lesson-copy h2 { max-width: none; }
  .student-wheel .wheel-interaction { padding: 12px; }
  .student-wheel .tablet-wheel-hint { margin-inline: 12px; }
}
@media (max-width: 540px) {
  .student-shell .student-wheel { padding: 12px; }
  .student-wheel .color-wheel-stage { padding: 0; }
  .student-wheel .wheel-interaction { padding: 10px; }
  .student-wheel .wheel-center .wheel-pair-detail { display: none; }
}

@media (max-width: 899px) {
  .student-main { padding: 18px; }
  .student-color-workspace, .student-observation-workspace { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .tablet-reference { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); align-items: center; gap: 20px; }
  .tablet-reference figcaption { margin: 0; }
  .student-shell .student-artwork { width: min(100%, 360px); justify-self: center; }
  .student-shell .student-recolor { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .student-shell .student-recolor > header, .student-shell .student-recolor > .recolor-controls, .student-shell .student-recolor > .recolor-artwork, .student-shell .student-recolor > .recolor-footer { grid-column: 1; grid-row: auto; }
  .student-shell .student-recolor > .recolor-artwork { width: min(100%, 540px); }
  .student-shell .student-recolor .recolor-palette { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 540px) {
  .student-main { padding: 12px; }
  .student-prompt { padding: 18px; }
  .student-shell .topbar-brand .mark { width: 32px; height: 32px; }
  .tablet-reference { grid-template-columns: 1fr; gap: 8px; }
  .tablet-reference img { max-height: 280px; width: auto; max-width: 100%; justify-self: center; }
  .tablet-reference figcaption { text-align: center; }
  .student-shell .color-grid { gap: 8px; }
  .student-shell .color-choice { padding: 8px 4px; font-size: .9rem; }
  .tablet-submit { flex-direction: column; align-items: stretch; }
  .tablet-submit .btn { width: 100%; }
  .student-shell .student-recolor .recolor-palette { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .student-shell .recolor-footer { flex-direction: column; align-items: stretch; }
}

/* Observation is a complete tablet screen: header, workspace and send stay together. */
.drawing-workspace { display: grid; grid-template-columns: minmax(220px, 260px) minmax(0, 1fr); min-height: 0; gap: 24px; }
.drawing-controls { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; }
.drawing-tools, .drawing-sizes, .drawing-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.student-shell .drawing-controls .btn { min-height: 44px; padding: 8px; font-size: .8rem; }
.drawing-controls .btn.selected { background: var(--ink); color: var(--paper); }
.drawing-setting { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 8px; font-weight: 700; font-size: .95rem; }
.drawing-setting input { width: 100%; min-width: 0; height: 40px; padding: 0; accent-color: var(--ink); }
.drawing-controls .stamp-toolbar { gap: 8px; }
.drawing-controls .stamp-toolbar > span { width: 100%; font-size: .9rem; }
.drawing-canvas-wrap { min-width: 0; min-height: 0; display: grid; place-items: center; container-type: size; }
.student-shell .paint-area #paint-canvas { width: min(100cqw, calc(100cqh * 4 / 3)); height: auto; max-height: 100%; aspect-ratio: 4 / 3; background: #fffdf8; }
@media (min-width: 700px) and (min-height: 600px) {
  .student-main:has(.paint-area) { padding: 16px; overflow: hidden; }
  .student-shell .paint-area { display: grid; height: 100%; padding: 24px; grid-template-rows: auto minmax(0, 1fr) auto; gap: 16px; }
  .student-shell .paint-area h2 { font-size: clamp(1.85rem, 3.2vw, 2.6rem); }
  .student-shell .paint-area .student-task-header > p:last-child { margin-top: 8px; max-width: 80ch; }
  .student-shell .paint-area .paint-toolbar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
  .student-shell .paint-area .paint-color { width: 44px; height: 44px; }
  .student-shell .paint-area[data-drawing-age="6-7"] .paint-toolbar { grid-template-columns: repeat(3, 1fr); }
  .student-shell .paint-area[data-drawing-age="6-7"] .paint-color { width: 52px; height: 52px; }
  .student-shell .paint-area[data-drawing-age="6-7"] .drawing-controls .btn { min-height: 52px; }
  .student-shell .paint-area #send-artwork { margin: 0; min-height: 52px; }
}
@media (max-width: 699px) {
  .drawing-workspace { grid-template-columns: 1fr; }
  .drawing-controls { overflow: visible; }
  .drawing-canvas-wrap { height: min(60vw, 420px); }
}
@media (min-width: 700px) and (max-height: 599px) {
  .drawing-canvas-wrap { height: min(60vh, 420px); }
}
@media (min-width: 700px) and (min-height: 700px) {
  .student-main:has(.student-color) { padding: 16px; overflow: hidden; }
  .student-shell .student-color { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 16px; padding: 24px; }
  .student-color .student-task-header { margin: 0; }
  .student-color .student-task-header h2 { font-size: clamp(1.85rem, 3.2vw, 2.6rem); }
  .student-color .student-task-header > p:last-child { margin-top: 8px; }
  .student-color .student-color-workspace { min-height: 0; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 24px; align-items: stretch; }
  .student-color .tablet-reference { min-height: 0; display: grid; grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; gap: 8px; }
  .student-color .tablet-reference img { height: 100%; width: auto; max-width: 100%; max-height: 100%; aspect-ratio: 1; object-fit: contain; justify-self: center; }
  .student-color .tablet-reference figcaption { margin: 0; font-size: .95rem; }
  .student-color .tablet-choices { align-self: center; }
  .student-color .tablet-step-label { margin-bottom: 8px; }
  .student-shell .student-color .color-grid { gap: 8px; margin-bottom: 16px; }
  .student-shell .student-color .color-choice { min-height: 72px; padding: 8px; }
  .student-shell .student-color .color-choice .swatch { width: 32px; height: 32px; }
  .student-shell .student-color .response-options { gap: 8px; }
  .student-shell .student-color .reason-choice { min-height: 48px; padding: 8px 12px; }
  .student-color .tablet-submit { position: static; margin: 0; padding-top: 12px; }
}

/* One activity shell and one send action across the tablet journey. */
.student-shell .activity-submit { display: flex; align-items: center; justify-content: space-between; flex-direction: row; gap: 16px; position: static; margin: 0; padding: 12px 0 0; border-top: 1px solid var(--ink); background: var(--paper); }
.activity-submit-summary { flex: 1; min-width: 0; font-size: .95rem; }
.student-shell .activity-submit .btn { min-height: 52px; min-width: 220px; padding: 14px 24px; font-size: 1rem; white-space: nowrap; flex: 0 0 auto; }
.activity-submit .ui-icon { width: 24px; height: 24px; }
.student-recolor-workspace { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); align-items: center; min-height: 0; gap: 24px; }
.student-recolor-workspace .recolor-artwork { width: min(100%, 480px); justify-self: center; }
.student-recolor-workspace .recolor-controls { min-height: 0; }
.student-shell .drawing-controls .btn:not(.selected) { background: var(--aqua); color: var(--ink); }
.student-shell .drawing-controls .btn { border: 1px solid var(--ink); border-radius: 10px; }
.student-shell .reason-choice.selected { background: var(--ink); color: var(--paper); }
.student-shell .student-task-header .brand-kicker { color: var(--red-text); }
@media (min-width: 700px) and (min-height: 700px) {
  .student-main:has(.student-activity) { padding: 16px; overflow: hidden; }
  .student-shell .student-activity { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; gap: 16px; width: min(1200px, 100%); height: 100%; padding: 24px; }
  .student-activity > .student-task-header { grid-column: 1; grid-row: 1; margin: 0; }
  .student-activity > .activity-submit { grid-column: 1; grid-row: 3; }
  .student-activity .student-task-header h2 { font-size: clamp(1.85rem, 3.2vw, 2.6rem); }
  .student-activity .student-task-header > p:last-child { margin-top: 8px; max-width: 80ch; }
  .student-activity .student-observation-workspace { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); align-items: center; min-height: 0; gap: 24px; }
  .student-shell .student-activity .student-artwork { width: min(100%, calc(100dvh - 320px), 480px); max-height: 100%; justify-self: center; }
  .student-activity .tablet-observation-response { align-self: center; }
  .student-recolor-workspace .recolor-artwork { width: min(100%, calc(100dvh - 320px), 480px); }
}
@media (max-width: 699px) {
  .student-recolor-workspace { grid-template-columns: 1fr; }
  .student-shell .activity-submit { position: sticky; bottom: 0; flex-direction: column; align-items: stretch; }
  .student-shell .activity-submit .btn { width: 100%; min-width: 0; }
}
/* LIM: same reading path and same artwork size in each room. */
.stage-intro, .tablet-restoration-stage, .distance-stage { grid-template-columns: minmax(240px, .85fr) minmax(360px, 1.15fr); column-gap: clamp(24px, 3vw, 48px); }
.distance-left { padding-left: 0; }
.stage-copy h2, .tablet-restoration-stage .recolor-copy h2, .distance-title h2 { font-size: clamp(2.6rem, 4vw, 4.6rem); max-width: 12ch; }
.tablet-restoration-stage .stage-copy > p, .tablet-restoration-stage .recolor-copy > p:not(.room-label) { font-size: 1rem; }

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