.sr-ruler-native-shell {
  --ink: #22304A;
  --paper: #F4F8FC;
  --grid: #DCE8F4;
  --grid-strong: #C7DAEC;
  --yellow: #FFC940;
  --yellow-soft: #FFE9A8;
  --yellow-deep: #E8A825;
  --mint: #74E0C8;
  --mint-soft: #C9F3E9;
  --teal: #12A594;
  --red: #E8484F;
  --red-soft: #FFD9D9;
  --blue: #2D7FF9;
  --blue-soft: #DCEBFF;
  --pink: #FF8FA3;
  --purple: #8768E8;
  --green: #3DBE6C;
  --card: #FFFFFF;
  --shadow: 8px 8px 0 rgba(34, 48, 74, .13);
}

.sr-ruler-native-shell,
.sr-ruler-native-shell * { box-sizing: border-box; }
.sr-ruler-native-shell {
  margin: 0;
  min-height: 0;
  font-family: 'Nunito', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--paper);
}
.sr-ruler-native-shell button,
.sr-ruler-native-shell input { font: inherit; }
.sr-ruler-native-shell button { color: inherit; }
.sr-ruler-native-shell button:focus-visible,
.sr-ruler-native-shell [tabindex]:focus-visible {
  outline: 4px dashed var(--blue);
  outline-offset: 4px;
}
.sr-ruler-native-shell [hidden] { display: none !important; }

.sr-game {
  width: 100%;
  min-height: 680px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(var(--grid-strong) 1.5px, transparent 1.5px) 0 0 / 120px 120px,
    linear-gradient(90deg, var(--grid-strong) 1.5px, transparent 1.5px) 0 0 / 120px 120px,
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--paper);
}
.sr-game::before,
.sr-game::after {
  content: '';
  position: absolute;
  z-index: -1;
  border: 4px solid rgba(34, 48, 74, .08);
  pointer-events: none;
}
.sr-game::before {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  left: -70px;
  top: 18%;
}
.sr-game::after {
  width: 110px;
  height: 110px;
  transform: rotate(25deg);
  right: -35px;
  bottom: 12%;
}

/* Loading */
.sr-loading {
  position: absolute;
  inset: 0;
  z-index: 100;
  min-height: 680px;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(116, 224, 200, .38), transparent 24%),
    radial-gradient(circle at 82% 78%, rgba(255, 201, 64, .34), transparent 26%),
    var(--paper);
  transition: opacity .55s ease, visibility .55s ease;
}
.sr-loading.is-leaving { opacity: 0; visibility: hidden; }
.sr-ruler-start-layer {
  z-index: 200;
  border-radius: 22px;
}
.sr-ruler-start-layer[hidden] { display: none; }
.loading-ruler {
  width: min(430px, 88vw);
  transform: rotate(-3deg);
  animation: loaderBob 1.25s ease-in-out infinite;
}
.loading-ruler svg { width: 100%; height: auto; display: block; }
.loading-brand {
  margin-top: 20px;
  font-family: 'Lilita One', cursive;
  font-size: clamp(2rem, 7vw, 3.5rem);
  letter-spacing: .6px;
  text-shadow: 4px 4px 0 #fff;
}
.loading-brand span { color: var(--red); }
.sr-loading p { margin: 8px 0 0; font-weight: 900; color: #60708B; }
.loading-dots { display: flex; gap: 8px; margin-top: 18px; }
.loading-dots i {
  width: 13px;
  height: 13px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--mint);
  animation: dotHop .8s ease-in-out infinite alternate;
}
.loading-dots i:nth-child(2) { animation-delay: .15s; background: var(--yellow); }
.loading-dots i:nth-child(3) { animation-delay: .3s; background: var(--pink); }
@keyframes loaderBob { 50% { transform: translateY(-12px) rotate(2deg); } }
@keyframes dotHop { to { transform: translateY(-10px); } }

/* Shell and header */
.game-shell {
  width: min(1180px, 100%);
  min-height: 680px;
  margin: 0 auto;
  padding: 14px clamp(12px, 2.4vw, 28px) 18px;
  display: flex;
  flex-direction: column;
}
.game-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 76px;
}
.brand-lockup { display: flex; align-items: center; justify-content: center; gap: 10px; color: inherit; text-decoration: none; border-radius: 10px; }
.brand-lockup[href]:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.brand-lockup.is-disabled { cursor: default; }
.brand-ruler { width: 50px; filter: drop-shadow(3px 3px 0 rgba(34,48,74,.14)); }
.brand-lockup strong {
  display: block;
  font: 400 clamp(1.25rem, 3vw, 1.75rem)/1 'Lilita One', cursive;
  letter-spacing: .5px;
}
.brand-lockup strong em { color: var(--red); font-style: normal; }
.brand-lockup small { display: block; font-size: .72rem; font-weight: 900; color: #687791; letter-spacing: .08em; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.round-btn {
  width: 44px;
  height: 44px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
  font-size: 1.25rem;
  font-weight: 900;
  transition: transform .15s, box-shadow .15s;
}
.round-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); }
.round-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.score-chip {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 3px 3px 0 rgba(34,48,74,.14);
  font-weight: 900;
}
.score-chip b { color: var(--yellow-deep); font-size: 1.1rem; }

.screen-stage { flex: 1; position: relative; }
.screen { display: none; animation: screenIn .38s ease both; }
.active-screen { display: block; }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px) scale(.99); } }

/* Welcome */
.welcome-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr);
  gap: clamp(18px, 4vw, 46px);
  align-items: center;
  padding: clamp(22px, 4vw, 44px);
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 26px;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}
.welcome-layout::before {
  content: '';
  position: absolute;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  right: -80px;
  top: -80px;
  background: var(--mint-soft);
}
.eyebrow, .section-kicker {
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .18em;
  color: var(--blue);
}
.welcome-copy h1 {
  margin: 8px 0 12px;
  font: 400 clamp(2.55rem, 6vw, 5rem)/.95 'Lilita One', cursive;
  letter-spacing: .4px;
  text-shadow: 4px 4px 0 var(--yellow-soft);
}
.welcome-copy h1 span { color: var(--red); }
.welcome-copy p { max-width: 630px; margin: 0; color: #53637E; font-weight: 800; line-height: 1.58; }
.welcome-facts { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 20px; }
.welcome-facts span {
  padding: 7px 13px;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-weight: 900;
  font-size: .9rem;
}
.welcome-facts b { color: var(--teal); }
.welcome-art { min-height: 250px; position: relative; z-index: 1; }
.welcome-ruler-host {
  position: absolute;
  width: min(430px, 98%);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-8deg);
  animation: heroFloat 3.6s ease-in-out infinite;
}
.welcome-ruler-host svg { width: 100%; height: auto; display: block; }
.hero-pencil { position: absolute; font-size: 3.9rem; right: 0; bottom: 14px; transform: rotate(22deg); animation: pencilWiggle 2.8s ease-in-out infinite; }
.hero-orbit {
  position: absolute;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: 50%;
  font: 400 1.2rem 'Lilita One', cursive;
  box-shadow: 4px 4px 0 rgba(34,48,74,.13);
  animation: orbitBob 2.6s ease-in-out infinite;
}
.orbit-one { left: 2%; top: 8%; background: var(--pink); }
.orbit-two { right: 9%; top: 2%; background: var(--mint); animation-delay: -.9s; }
.orbit-three { left: 15%; bottom: 2%; background: var(--blue-soft); animation-delay: -1.6s; }
@keyframes heroFloat { 50% { transform: translate(-50%, -56%) rotate(-3deg); } }
@keyframes pencilWiggle { 50% { transform: translateY(-12px) rotate(13deg); } }
@keyframes orbitBob { 50% { transform: translateY(-10px) rotate(8deg); } }
.mode-heading { text-align: center; margin: 30px 0 14px; }
.mode-heading h2 { margin: 0; font: 400 2rem 'Lilita One', cursive; }
.mode-heading p { margin: 4px 0 0; font-weight: 800; color: #65748E; }
.mode-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.mode-card {
  min-height: 238px;
  position: relative;
  padding: 24px 20px 20px;
  text-align: left;
  border: 3px solid var(--ink);
  border-radius: 22px;
  box-shadow: 0 7px 0 var(--ink);
  cursor: pointer;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
}
.mode-card:hover { transform: translateY(-7px) rotate(-.5deg); box-shadow: 0 14px 0 var(--ink); }
.mode-card:active { transform: translateY(3px); box-shadow: 0 3px 0 var(--ink); }
.learning-card { background: var(--yellow-soft); }
.measure-card { background: var(--mint-soft); }
.object-card { background: var(--blue-soft); }
.quiz-card { background: #E8E0FF; }
.mode-icon { display: inline-grid; place-items: center; width: 60px; height: 60px; border: 3px solid var(--ink); border-radius: 17px; background: #fff; font-size: 1.8rem; box-shadow: 4px 4px 0 rgba(34,48,74,.13); }
.mode-number { position: absolute; right: 18px; top: 13px; font: 400 3.5rem 'Lilita One', cursive; color: rgba(34,48,74,.11); }
.mode-card strong { display: block; margin: 17px 0 7px; font: 400 1.55rem 'Lilita One', cursive; }
.mode-card small { display: block; min-height: 60px; color: #52627B; font-weight: 800; line-height: 1.45; }
.mode-card > b { display: block; margin-top: 16px; font-size: .78rem; letter-spacing: .08em; }

/* Shared screens */
.screen-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 8px 0 15px; }
.screen-toolbar h2 { margin: 2px 0 0; font: 400 clamp(1.7rem, 4vw, 2.5rem) 'Lilita One', cursive; }
.compact-toolbar { align-items: flex-end; }
.mini-stats { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.mini-stats span {
  padding: 7px 12px;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  font-size: .84rem;
  font-weight: 900;
}
.mini-stats b { color: var(--red); }
.primary-btn, .secondary-btn, .speaker-btn {
  border: 3px solid var(--ink);
  cursor: pointer;
  font-weight: 900;
  transition: transform .14s, box-shadow .14s;
}
.primary-btn {
  min-height: 48px;
  padding: 11px 21px;
  border-radius: 14px;
  background: var(--red);
  color: #fff;
  box-shadow: 0 5px 0 var(--ink);
}
.secondary-btn {
  min-height: 44px;
  padding: 9px 16px;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 4px 0 var(--ink);
}
.speaker-btn {
  width: 43px;
  height: 43px;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 4px 0 var(--ink);
}
.primary-btn:hover:not(:disabled), .secondary-btn:hover, .speaker-btn:hover { transform: translateY(-2px); }
.primary-btn:active:not(:disabled), .secondary-btn:active, .speaker-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.primary-btn:disabled { cursor: not-allowed; opacity: .48; }
.nav-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.progress-track { height: 16px; margin-bottom: 14px; border: 3px solid var(--ink); border-radius: 999px; background: #fff; overflow: hidden; }
.progress-track i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(45deg, var(--yellow) 0 11px, #FFD969 11px 22px); transition: width .35s ease; }

/* Learning */
.lesson-progress { display: flex; gap: 8px; margin: 0 0 14px; }
.lesson-progress button {
  flex: 1;
  height: 12px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
  padding: 0;
}
.lesson-progress button.done, .lesson-progress button.active { background: var(--yellow); }
.lesson-progress button.active { box-shadow: 0 0 0 4px var(--yellow-soft); }
.lesson-card {
  min-height: 460px;
  padding: clamp(20px, 4vw, 36px);
  border: 3px solid var(--ink);
  border-radius: 24px;
  background: #fff;
  box-shadow: var(--shadow);
}
.lesson-card h3 { margin: 0 0 8px; font: 400 clamp(1.8rem, 4vw, 2.8rem) 'Lilita One', cursive; }
.lesson-card > p { margin: 0; color: #566680; font-weight: 800; line-height: 1.55; }
.lesson-visual { margin-top: 24px; }
.real-ruler-lesson { width: 100%; }
.real-ruler-lesson > svg,
.demo-board > svg { width: 100%; height: auto; display: block; }
.real-fact-line {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.real-fact-line span,
.measure-guide-strip span {
  padding: 10px 12px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--paper);
  text-align: center;
  font-size: .88rem;
  font-weight: 800;
}
.real-fact-line b { color: var(--red); }
.conversion-rule-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-top: 12px;
}
.conversion-rule-grid.single {
  grid-template-columns: minmax(0, 620px);
  justify-content: center;
}
.conversion-rule-grid div {
  padding: 11px 12px;
  border: 2px solid var(--ink);
  border-radius: 13px;
  background: var(--paper);
  text-align: center;
}
.conversion-rule-grid strong {
  display: block;
  margin-bottom: 5px;
  color: var(--red);
  font: 400 1rem 'Lilita One', cursive;
}
.conversion-rule-grid b {
  display: block;
  font-size: .9rem;
  line-height: 1.45;
}
.conversion-rule-grid small {
  display: block;
  margin-top: 5px;
  color: #5A6A84;
  font-size: .73rem;
  font-weight: 800;
  line-height: 1.35;
}
.scale-note {
  max-width: 850px;
  margin: 12px auto 0;
  padding: 11px 14px;
  border-left: 5px solid var(--red);
  border-radius: 8px;
  background: var(--paper);
  color: #52617A;
  font-weight: 800;
  line-height: 1.5;
}
.measure-guide-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.measure-guide-strip b {
  display: inline-grid;
  place-items: center;
  width: 25px;
  height: 25px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
}
.demo-board { padding: 14px; border: 2px solid #C7D1DD; border-radius: 18px; background: #fff; overflow: hidden; }
.demo-caption { margin-top: 14px; text-align: center; font-weight: 900; color: #52617A; }
.demo-caption b { color: var(--red); }
.demo-object { transform-origin: left center; animation: objectSlide 4.6s ease-in-out infinite; }
.demo-pointer { animation: pointerMove 4.6s ease-in-out infinite; }
.demo-highlight { animation: highlightGrow 4.6s ease-in-out infinite; }
@keyframes objectSlide { 0%,15% { transform: translateX(85px); } 36%,100% { transform: translateX(0); } }
@keyframes pointerMove { 0%,42% { transform: translateX(-360px); opacity: 0; } 48% { opacity: 1; } 75%,100% { transform: translateX(0); opacity: 1; } }
@keyframes highlightGrow { 0%,48% { transform: scaleX(0); } 78%,100% { transform: scaleX(1); } }

/* Challenges */
.challenge-card {
  padding: clamp(18px, 3.5vw, 34px);
  border: 3px solid var(--ink);
  border-radius: 24px;
  background: #fff;
  box-shadow: var(--shadow);
}
.question-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.unit-badge {
  display: inline-flex;
  align-items: center;
  min-height: 37px;
  padding: 5px 13px;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: var(--yellow);
  font: 400 .92rem 'Lilita One', cursive;
  letter-spacing: .08em;
}
.unit-badge.mm { background: var(--pink); }
.unit-badge.in { background: var(--mint); }
.unit-badge.purple { background: #E8E0FF; }
.challenge-card h3 { margin: 15px 0 4px; font: 400 clamp(1.55rem, 4vw, 2.35rem) 'Lilita One', cursive; }
.challenge-card > p { margin: 0; color: #5A6A84; font-weight: 800; }
.ruler-host { margin-top: 22px; width: 100%; overflow: visible; }
.ruler-host svg { width: 100%; height: auto; display: block; touch-action: none; }
.selectable-host { cursor: crosshair; user-select: none; }
.ruler-hint-line {
  animation: rulerHintBlink .85s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes rulerHintBlink {
  from { opacity: .2; }
  to { opacity: 1; }
}
.selection-readout { width: fit-content; margin: 13px auto 0; padding: 7px 14px; border: 2.5px solid var(--ink); border-radius: 999px; background: var(--paper); font-weight: 900; }
.selection-readout strong { color: var(--red); }
.challenge-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.feedback-box { margin-top: 16px; padding: 14px 16px; border: 3px solid var(--ink); border-radius: 16px; font-weight: 800; line-height: 1.5; animation: feedbackIn .3s ease; }
.feedback-box.good { background: #DFF6E7; }
.feedback-box.bad { background: #FFE4E5; }
.feedback-box b { font-family: 'Lilita One', cursive; font-size: 1.12rem; }
@keyframes feedbackIn { from { opacity: 0; transform: translateY(8px); } }
.quiz-visual { margin-top: 20px; }
.conversion-board {
  min-height: 180px;
  display: block;
  padding: 24px;
  border: 3px dashed var(--ink);
  border-radius: 18px;
  background: var(--paper);
}
.conversion-equation { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; }
.conversion-equation span {
  padding: 14px 20px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: var(--yellow-soft);
  font: 400 clamp(1.5rem, 5vw, 2.7rem) 'Lilita One', cursive;
  box-shadow: 5px 5px 0 rgba(34,48,74,.12);
}
.conversion-equation span:last-child { background: var(--mint-soft); }
.conversion-equation b { font: 400 2.2rem 'Lilita One', cursive; color: var(--red); }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.choice-btn {
  min-height: 58px;
  padding: 11px 12px;
  border: 3px solid var(--ink);
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 5px 0 var(--ink);
  cursor: pointer;
  font-weight: 900;
  font-size: 1.03rem;
  transition: transform .13s, box-shadow .13s, background .13s;
}
.choice-btn:hover:not(:disabled) { transform: translateY(-3px); box-shadow: 0 8px 0 var(--ink); background: #FFF9E4; }
.choice-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.choice-btn:disabled { cursor: default; opacity: .82; }
.choice-btn.correct { background: #DFF6E7; border-color: var(--green); }
.choice-btn.wrong { background: #FFE4E5; border-color: var(--red); }

/* Measure objects mode */
.object-board {
  position: relative;
  height: clamp(310px, 42vw, 410px);
  margin-top: 12px;
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 18px;
  background:
    linear-gradient(rgba(199, 218, 236, .55) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(199, 218, 236, .55) 1px, transparent 1px) 0 0 / 24px 24px,
    #F8FBFE;
  user-select: none;
  touch-action: none;
}
.scene-object {
  position: absolute;
  left: 18%;
  top: 24%;
  width: 34%;
  height: 46px;
  transform-origin: center;
  z-index: 1;
  pointer-events: none;
}
.scene-object .object-body {
  position: absolute;
  inset: 4px 0;
  filter: drop-shadow(4px 5px 0 rgba(34, 48, 74, .14));
}
.scene-object > span {
  position: absolute;
  left: 50%;
  top: calc(100% + 7px);
  transform: translateX(-50%);
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .9);
  color: #5A6A84;
  font-size: .72rem;
  font-weight: 900;
  white-space: nowrap;
}
.scene-object.pencil .object-body {
  background: linear-gradient(90deg, var(--pink) 0 9%, var(--yellow) 9% 88%, #EAC08B 88%);
  clip-path: polygon(0 15%, 88% 15%, 100% 50%, 88% 85%, 0 85%);
  border: 3px solid var(--ink);
}
.scene-object.crayon .object-body,
.scene-object.marker .object-body {
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: repeating-linear-gradient(90deg, #8768E8 0 14%, #A58FEF 14% 20%);
}
.scene-object.marker .object-body {
  background: linear-gradient(90deg, #22304A 0 14%, #2D7FF9 14% 84%, #22304A 84%);
  border-radius: 14px;
}
.scene-object.eraser .object-body {
  border: 3px solid var(--ink);
  border-radius: 11px;
  background: linear-gradient(90deg, var(--pink) 0 68%, var(--blue-soft) 68%);
}
.scene-object.book .object-body {
  border: 3px solid var(--ink);
  border-radius: 5px 13px 13px 5px;
  background: linear-gradient(90deg, #8768E8 0 12%, #E8E0FF 12%);
  box-shadow: inset -7px 0 0 rgba(34, 48, 74, .12);
}
.scene-object.key .object-body::before,
.scene-object.spoon .object-body::before,
.scene-object.toothbrush .object-body::before,
.scene-object.paintbrush .object-body::before {
  content: '';
  position: absolute;
}
.scene-object.key .object-body::before {
  left: 0;
  top: 1px;
  width: 32px;
  height: 32px;
  border: 8px solid #E8A825;
  border-radius: 50%;
}
.scene-object.key .object-body::after {
  content: '';
  position: absolute;
  left: 30px;
  right: 0;
  top: 15px;
  height: 11px;
  background: #FFC940;
  border: 3px solid var(--ink);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 83% 100%, 83% 58%, 70% 58%, 70% 100%, 0 100%);
}
.scene-object.spoon .object-body::before {
  left: 0;
  top: 0;
  width: 34px;
  height: 38px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: #DCE8F4;
}
.scene-object.spoon .object-body::after {
  content: '';
  position: absolute;
  left: 29px;
  right: 0;
  top: 16px;
  height: 8px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #C7DAEC;
}
.scene-object.toothbrush .object-body::before {
  left: -33.333%;
  top: 4px;
  width: 35%;
  height: 22px;
  border: 3px solid var(--ink);
  border-radius: 10px 5px 5px 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .7), transparent 45%),
    #DDF9F3;
}
.scene-object.toothbrush .object-body::after {
  content: '';
  position: absolute;
  left: -30%;
  top: -7px;
  width: 29%;
  height: 13px;
  border-bottom: 3px solid var(--ink);
  border-radius: 4px 4px 0 0;
  background: repeating-linear-gradient(
    90deg,
    #35BFA4 0 3px,
    #8BE8D5 3px 6px,
    transparent 6px 8px
  );
}
.scene-object.toothbrush .object-body {
  left: 25%;
  top: 7px;
  right: 0;
  bottom: auto;
  height: 27px;
  border: 3px solid var(--ink);
  border-radius: 9px 999px 999px 9px;
  background:
    radial-gradient(ellipse at 72% 50%, rgba(255, 255, 255, .5) 0 18%, transparent 19%),
    linear-gradient(180deg, #53A1FF 0 48%, #2D7FF9 49% 70%, #1764C9 71%);
  transform: skewX(-7deg);
}
.scene-object.paintbrush .object-body::before {
  left: 0;
  top: 3px;
  width: 27%;
  height: 34px;
  border: 3px solid var(--ink);
  background: linear-gradient(90deg, #E8484F 0 62%, #C7DAEC 62%);
  clip-path: polygon(0 50%, 22% 0, 100% 12%, 100% 88%, 22% 100%);
}
.scene-object.paintbrush .object-body::after {
  content: '';
  position: absolute;
  left: 25%;
  right: 0;
  top: 15px;
  height: 12px;
  border: 3px solid var(--ink);
  border-radius: 0 999px 999px 0;
  background: #EAC08B;
}
.scene-object.paperclip .object-body {
  border: 5px solid #8D98A8;
  border-radius: 999px;
  box-shadow: inset 0 0 0 4px #F8FBFE;
}
.scene-object.leaf .object-body {
  border: 3px solid var(--ink);
  border-radius: 100% 0 100% 0;
  background: linear-gradient(135deg, #74E0C8, #3DBE6C);
}
.scene-object.leaf .object-body::after {
  content: '';
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  height: 2px;
  background: var(--ink);
  transform: rotate(-3deg);
}
.portable-ruler {
  position: absolute;
  left: 0;
  top: 0;
  width: 82%;
  z-index: 3;
  cursor: grab;
  transform-origin: center;
  touch-action: none;
  outline-offset: 2px;
}
.portable-ruler.is-dragging { cursor: grabbing; }
.portable-ruler svg {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 5px 5px rgba(34, 48, 74, .15));
}
.ruler-rotate-handle {
  position: absolute;
  right: -18px;
  top: 50%;
  z-index: 4;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 3px 3px 0 rgba(34, 48, 74, .18);
  cursor: crosshair;
  font-weight: 900;
  touch-action: none;
}
.object-control-note {
  margin: 8px 0 0 !important;
  text-align: center;
  font-size: .76rem !important;
}
.object-answer-form {
  max-width: 560px;
  margin: 12px auto 0;
}
.object-answer-form label {
  display: block;
  margin-bottom: 5px;
  font-weight: 900;
}
.object-answer-row { display: flex; gap: 9px; }
.object-answer-row input {
  min-width: 0;
  flex: 1;
  min-height: 48px;
  padding: 9px 13px;
  border: 3px solid var(--ink);
  border-radius: 13px;
  background: #fff;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 900;
}
.object-answer-form small {
  display: block;
  margin-top: 5px;
  color: #5A6A84;
  font-size: .76rem;
  font-weight: 800;
}

/* Results */
.results-screen { text-align: center; padding: 30px 20px; }
.result-medal { font-size: clamp(5rem, 15vw, 8rem); animation: medalPop .6s cubic-bezier(.3,1.5,.5,1); filter: drop-shadow(6px 7px 0 rgba(34,48,74,.12)); }
@keyframes medalPop { from { opacity: 0; transform: scale(0) rotate(-25deg); } }
.results-screen h2 { margin: 7px 0 4px; font: 400 clamp(2.2rem, 6vw, 4rem) 'Lilita One', cursive; text-shadow: 4px 4px 0 var(--yellow-soft); }
.results-screen > p { margin: 0; font-weight: 800; color: #5D6D86; }
.result-score { display: inline-flex; align-items: baseline; gap: 7px; margin: 18px 0; padding: 12px 24px; border: 3px solid var(--ink); border-radius: 18px; background: #fff; box-shadow: var(--shadow); }
.result-score span { font-size: 1.7rem; }
.result-score b { font: 400 3rem 'Lilita One', cursive; color: var(--yellow-deep); }
.result-score small { font-weight: 900; color: #6A7890; }
.result-grid { max-width: 620px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0 auto 20px; }
.result-grid div { padding: 16px 10px; border: 3px solid var(--ink); border-radius: 16px; background: var(--paper); }
.result-grid b { display: block; font: 400 1.65rem 'Lilita One', cursive; }
.result-grid span { font-size: .75rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: #63728B; }
.result-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }

.confetti-piece { position: fixed; z-index: 999; width: 11px; height: 15px; border: 1.5px solid rgba(34,48,74,.35); pointer-events: none; }
.bump { animation: bump .35s ease; }
@keyframes bump { 45% { transform: scale(1.35) rotate(-5deg); } }
.shake { animation: shake .42s ease; }
@keyframes shake { 20%,60% { transform: translateX(-7px); } 40%,80% { transform: translateX(7px); } }

@media (max-width: 850px) {
  .sr-game, .sr-loading, .game-shell { min-height: 720px; }
  .welcome-layout { grid-template-columns: 1fr; }
  .welcome-art { min-height: 210px; }
  .mode-grid { grid-template-columns: 1fr; }
  .mode-card { min-height: 184px; }
  .mode-card small { min-height: auto; }
  .unit-cards, .measure-steps { grid-template-columns: 1fr; }
  .lesson-card { min-height: 520px; }
}

@media (max-width: 560px) {
  .sr-game, .sr-loading, .game-shell { min-height: 760px; }
  .game-shell { padding-inline: 9px; }
  .game-header { grid-template-columns: 44px 1fr 44px; }
  .brand-ruler { display: none; }
  .brand-lockup small { display: none; }
  .brand-lockup strong { font-size: 1.14rem; text-align: center; }
  .score-chip { position: absolute; right: 57px; top: 65px; z-index: 3; min-height: 34px; padding: 3px 9px; }
  .welcome-layout { padding: 22px 17px; }
  .welcome-copy h1 { font-size: 2.75rem; }
  .welcome-art { min-height: 180px; }
  .hero-pencil { font-size: 3rem; }
  .hero-orbit { width: 48px; height: 48px; font-size: 1rem; }
  .screen-toolbar { align-items: flex-start; }
  .compact-toolbar { flex-direction: column; }
  .mini-stats { justify-content: flex-start; }
  .lesson-card { min-height: 555px; padding: 20px 15px; }
  .unit-cards { gap: 9px; }
  .unit-card { padding: 13px; }
  .equal-row { grid-template-columns: 86px 1fr; }
  .choice-grid { grid-template-columns: 1fr; gap: 10px; }
  .result-grid { grid-template-columns: 1fr; }
  .nav-row { align-items: stretch; }
  .nav-row button { flex: 1; padding-inline: 10px; }
}

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

.conversion-reference-ruler { width: 100%; margin-top: 16px; }
.conversion-reference-ruler svg { width: 100%; height: auto; display: block; }
@media (max-width: 620px) {
  .real-fact-line, .measure-guide-strip { grid-template-columns: 1fr; }
  .welcome-ruler-host { width: min(390px, 104%); }
}

/* Native game window inside the shared SumReflex page layout. */
.sr-ruler-native-shell {
  width: 100%;
  display: grid;
  place-items: center;
  padding: clamp(6px, 1.5vw, 18px);
  scroll-margin-top: 96px;
  overflow: clip;
  border-radius: 22px;
  background:
    radial-gradient(circle at 12% 18%, rgba(116, 224, 200, .3), transparent 22rem),
    radial-gradient(circle at 88% 82%, rgba(255, 201, 64, .28), transparent 24rem),
    #DCE8F4;
}
.sr-game {
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 680px;
  border: 4px solid var(--ink);
  border-radius: 26px;
  box-shadow:
    0 12px 0 rgba(34, 48, 74, .18),
    0 24px 50px rgba(34, 48, 74, .2);
}
.sr-loading {
  min-height: 0;
  border-radius: 22px;
}
.game-shell {
  width: 100%;
  height: auto;
  min-height: 680px;
  padding: 0;
}
.game-header {
  flex: 0 0 auto;
  min-height: 62px;
  padding: 7px 14px;
  border-bottom: 3px solid var(--ink);
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 5px 0 rgba(34, 48, 74, .08);
  position: relative;
  z-index: 5;
}
.brand-ruler { width: 42px; }
.brand-lockup strong { font-size: clamp(1.15rem, 2.6vw, 1.55rem); }
.round-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
}
.screen-stage {
  flex: 0 0 auto;
  min-height: 614px;
  overflow: visible;
  overscroll-behavior: auto;
  padding: 12px 16px 16px;
}
.screen { min-height: 0; }
.welcome-layout {
  grid-template-columns: minmax(0, 1.12fr) minmax(230px, .88fr);
  gap: clamp(14px, 3vw, 32px);
  padding: clamp(16px, 3vw, 28px);
  border-radius: 19px;
  box-shadow: 5px 5px 0 rgba(34, 48, 74, .13);
}
.welcome-copy h1 {
  margin: 6px 0 9px;
  font-size: clamp(2.2rem, 5vw, 4rem);
}
.welcome-copy p {
  font-size: clamp(.8rem, 1.6vw, .95rem);
  line-height: 1.42;
}
.welcome-facts { margin-top: 12px; }
.welcome-art { min-height: 174px; }
.mode-heading { margin: 15px 0 8px; }
.mode-heading h2 { font-size: 1.6rem; }
.mode-heading p { font-size: .82rem; }
.mode-grid { gap: 10px; }
.mode-card {
  min-height: 148px;
  padding: 13px 14px 12px;
  border-radius: 16px;
  box-shadow: 0 5px 0 var(--ink);
}
.mode-card:hover { transform: translateY(-3px); box-shadow: 0 8px 0 var(--ink); }
.mode-icon {
  width: 43px;
  height: 43px;
  border-radius: 12px;
  font-size: 1.3rem;
}
.mode-number { right: 13px; top: 6px; font-size: 2.7rem; }
.mode-card strong { margin: 9px 0 4px; font-size: 1.25rem; }
.mode-card small {
  min-height: 38px;
  font-size: .76rem;
  line-height: 1.3;
}
.mode-card > b { margin-top: 7px; font-size: .67rem; }

.screen-toolbar { margin: 0 0 8px; }
.screen-toolbar h2 { font-size: clamp(1.45rem, 3vw, 2rem); }
.progress-track { height: 13px; margin-bottom: 9px; }
.lesson-progress { margin-bottom: 9px; }
.lesson-card {
  min-height: 0;
  padding: clamp(15px, 2.5vw, 24px);
  border-radius: 18px;
  box-shadow: 5px 5px 0 rgba(34, 48, 74, .13);
}
.lesson-card h3 { font-size: clamp(1.55rem, 3.4vw, 2.25rem); }
.lesson-card > p { font-size: .9rem; line-height: 1.42; }
.lesson-visual { margin-top: 12px; }
.nav-row { margin-top: 10px; }
.challenge-card {
  padding: clamp(14px, 2.5vw, 24px);
  border-radius: 18px;
  box-shadow: 5px 5px 0 rgba(34, 48, 74, .13);
}
.challenge-card h3 {
  margin: 9px 0 3px;
  font-size: clamp(1.4rem, 3vw, 2rem);
}
.challenge-card > p { font-size: .88rem; }
.ruler-host,
.quiz-visual { margin-top: 11px; }
.selection-readout { margin-top: 8px; }
.challenge-actions { margin-top: 9px; }
.feedback-box { margin-top: 9px; padding: 10px 13px; }
.choice-grid { gap: 9px; margin-top: 11px; }
.choice-btn { min-height: 48px; }
.conversion-board { min-height: 0; padding: 16px; }
.conversion-reference-ruler { margin-top: 8px; }
.results-screen { padding: 14px 16px; }
.result-medal { font-size: clamp(4rem, 12vw, 6.5rem); }
.results-screen h2 { font-size: clamp(2rem, 5vw, 3.2rem); }
.result-score { margin: 11px 0; }

@media (max-width: 850px) {
  .sr-game,
  .sr-loading,
  .game-shell { min-height: 620px; }
  .screen-stage { min-height: 554px; }
  .welcome-layout {
    grid-template-columns: minmax(0, 1.12fr) minmax(230px, .88fr);
  }
  .welcome-art { min-height: 170px; }
  .mode-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mode-card { min-height: 148px; }
  .lesson-card { min-height: 0; }
}

@media (max-height: 650px) and (min-width: 701px) {
  .screen-stage { padding-top: 9px; }
  .welcome-layout { padding-block: 13px; }
  .welcome-copy h1 { font-size: clamp(2.15rem, 5vw, 3rem); }
  .welcome-art { min-height: 155px; }
  .mode-heading { margin-top: 10px; }
  .mode-card { min-height: 138px; }
  .mode-card small { min-height: 34px; }
}

@media (max-width: 700px) {
  .sr-ruler-native-shell { display: block; min-height: 0; padding: 0; }
  .sr-game {
    width: 100%;
    height: auto;
    min-height: 560px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .sr-loading { min-height: 560px; border-radius: 0; }
  .game-shell { min-height: 560px; }
  .game-header { min-height: 58px; padding: 6px 9px; }
  .screen-stage {
    min-height: 502px;
    overflow: visible;
    padding: 9px 10px 14px;
  }
  .welcome-layout {
    grid-template-columns: 1fr;
    padding: 16px 14px;
  }
  .welcome-copy h1 { font-size: clamp(2.25rem, 12vw, 3.25rem); }
  .welcome-art { min-height: 145px; }
  .mode-grid { grid-template-columns: 1fr; gap: 9px; }
  .mode-card {
    min-height: 112px;
    padding: 12px 52px 10px 72px;
  }
  .mode-icon {
    position: absolute;
    left: 13px;
    top: 18px;
  }
  .mode-number { font-size: 2.4rem; }
  .mode-card strong { margin: 0 0 3px; }
  .mode-card small { min-height: auto; }
  .mode-card > b { margin-top: 6px; }
  .lesson-card { padding: 15px 12px; }
  .real-fact-line,
  .measure-guide-strip { gap: 7px; }
  .conversion-rule-grid { grid-template-columns: 1fr; }
  .challenge-card { padding: 13px 11px; }
  .object-board { height: 330px; }
  .portable-ruler { width: 90%; }
  .ruler-host { max-width: 100%; overflow: visible; padding-bottom: 3px; }
  .choice-grid { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: repeat(3, 1fr); gap: 7px; }
  .result-grid div { padding: 11px 4px; }
  .result-grid b { font-size: 1.35rem; }
  .result-grid span { font-size: .62rem; }
}

@media (max-width: 560px) {
  .game-header { grid-template-columns: 42px 1fr 42px; }
  .score-chip { display: none !important; }
  .compact-toolbar { gap: 7px; }
  .lesson-card { min-height: 0; }
  .result-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 390px) {
  .brand-lockup strong { font-size: 1.02rem; }
  .screen-stage { padding-inline: 7px; }
  .mini-stats span { padding: 5px 8px; font-size: .76rem; }
  .primary-btn,
  .secondary-btn { padding-inline: 11px; }
  .welcome-art { min-height: 130px; }
  .object-answer-row { align-items: stretch; }
  .object-answer-row .primary-btn { padding-inline: 10px; }
}

/* Keep the page as the only scroll container while retaining direct touch gestures. */
.sr-ruler-native-shell .object-board,
.sr-ruler-native-shell .portable-ruler,
.sr-ruler-native-shell .ruler-rotate-handle,
.sr-ruler-native-shell .ruler-host svg {
  -webkit-user-select: none;
  user-select: none;
}
