:root {
  --paper: #FBF3E2;
  --paper-2: #F6EBD4;
  --paper-deep: #EFE0C4;
  --ink: #23315B;
  --ink-soft: rgba(35, 49, 91, 0.72);
  --ink-faint: rgba(35, 49, 91, 0.18);
  --green: #2F5D4A;
  --orange: #E4572E;
  --yellow: #F4B942;
  --teal: #2E9E8F;
  --pink: #D65A9B;
  --kraft: #D9C7A0;
  --tile: clamp(54px, 6.1vw, 88px);
  --shadow-soft: 0 14px 26px -12px rgba(16, 34, 24, 0.62), 0 2px 5px rgba(16, 34, 24, 0.16);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Andika", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background-color: #2F5D4A;
  background-image: url("art/desk_mat.webp");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

button { font-family: inherit; }

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

/* ---------- scene ---------- */

.desk {
  min-height: 100vh;
  padding: 0 0 18px;
}

.scene {
  width: min(1680px, 100%);
  margin: 0 auto;
  padding: 0 clamp(10px, 2vw, 30px);
  position: relative;
}

/* ---------- grade tabs ---------- */

.tabs {
  position: absolute;
  top: 2px;
  right: clamp(18px, 4vw, 72px);
  z-index: 9;
  display: flex;
  align-items: flex-start;
  gap: 3px;
}

.tab {
  position: relative;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  transform-origin: 50% 100%;
  filter: drop-shadow(0 5px 4px rgba(20, 40, 25, 0.28));
  transition: transform 0.16s ease;
}

.tab img {
  display: block;
  height: clamp(76px, 8.6vw, 108px);
  width: auto;
  position: relative;
  z-index: 2;
}

.tab.is-active { transform: translateY(12px); }
.tab.is-active img { height: clamp(82px, 9.2vw, 116px); }
.tab.tab-next { transform: translateY(-6px); }
.tab.tab-next:hover { transform: translateY(-10px) rotate(-1deg); }
.tab.tab-next img { height: clamp(68px, 7.8vw, 96px); }

.tab-crayon {
  position: absolute;
  z-index: 3;
  left: 18%;
  right: 18%;
  bottom: 3px;
  height: 3px;
  border-radius: 50% 40% 60% 45%;
  background: var(--ink);
  transform: rotate(-1deg);
  opacity: 0.8;
}

.next-slip {
  position: absolute;
  z-index: 1;
  right: 2px;
  bottom: -3px;
  padding: 1px 6px 2px;
  background: var(--paper);
  color: var(--ink-soft);
  font-family: "Baloo 2", sans-serif;
  font-weight: 600;
  font-size: 10px;
  border-radius: 2px 4px 3px 2px;
  transform: rotate(6deg);
  box-shadow: 0 1px 0 rgba(35, 49, 91, 0.1);
}

.tab.is-active .next-slip { display: none; }

/* ---------- sheet ---------- */

.sheet {
  position: relative;
  z-index: 2;
  width: min(1400px, 92%);
  margin: 56px auto 0;
  padding: 20px clamp(18px, 2.2vw, 34px) 20px clamp(26px, 4.4vw, 72px);
  background-color: var(--paper);
  background-image:
    var(--grain),
    repeating-linear-gradient(to bottom, transparent 0 39px, rgba(58, 101, 160, 0.13) 39px 40px);
  border: 1px solid rgba(35, 49, 91, 0.14);
  border-radius: 5px 4px 6px 3px;
  box-shadow: var(--shadow-soft);
  transform: rotate(-0.18deg);
}

.sheet::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: clamp(16px, 3.3vw, 54px);
  width: 12px;
  border-left: 1px solid rgba(214, 90, 155, 0.35);
  border-right: 1px solid rgba(58, 101, 160, 0.2);
  pointer-events: none;
}

.tape {
  position: absolute;
  z-index: 4;
  top: -13px;
  width: clamp(78px, 10vw, 128px);
  height: 30px;
  background: rgba(239, 224, 196, 0.78);
  border: 1px solid rgba(217, 199, 160, 0.55);
  box-shadow: 0 2px 4px rgba(30, 40, 30, 0.12);
  transform: rotate(-2.2deg);
  pointer-events: none;
  clip-path: polygon(2% 12%, 98% 0, 100% 88%, 96% 100%, 3% 94%, 0 52%);
}

.tape-left { left: 12%; }
.tape-right { right: 13%; transform: rotate(1.6deg); }

.holes {
  position: absolute;
  left: clamp(3px, 1.7vw, 26px);
  top: 12%;
  display: flex;
  flex-direction: column;
  gap: clamp(90px, 15vh, 140px);
  pointer-events: none;
}

.holes i {
  display: block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: rgba(217, 199, 160, 0.5);
  box-shadow: inset 1px 2px 2px rgba(70, 60, 35, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.4);
}

/* ---------- header ---------- */

.sheet-head {
  position: relative;
  min-height: 162px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.title-art {
  display: block;
  width: clamp(250px, 26vw, 390px);
  aspect-ratio: 2.35 / 1;
  object-fit: cover;
  object-position: center 47%;
  mix-blend-mode: multiply;
  transform: rotate(-1.1deg);
  margin-top: -2px;
  user-select: none;
}

.tools {
  position: absolute;
  top: 54px;
  right: 0;
  display: flex;
  align-items: flex-end;
  gap: clamp(4px, 0.8vw, 10px);
  z-index: 8;
}

.tool {
  width: clamp(35px, 3.4vw, 46px);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  color: var(--ink);
  position: relative;
  transition: transform 0.12s ease;
}

.tool:hover { transform: translateY(-2px) rotate(-1.5deg); }
.tool:active { transform: translateY(1px); }

.tool img {
  display: block;
  width: 100%;
  height: clamp(32px, 3.1vw, 42px);
  object-fit: contain;
  filter: drop-shadow(0 2px 1px rgba(35, 49, 91, 0.18));
}

.tool-name {
  font-family: "Baloo 2", sans-serif;
  font-size: clamp(8px, 0.72vw, 10px);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  line-height: 1;
}

.mute-line {
  display: none;
  position: absolute;
  left: -1px;
  right: 2px;
  top: 16px;
  height: 3px;
  background: var(--pink);
  border-radius: 3px;
  transform: rotate(-38deg);
  box-shadow: 0 0 0 1px rgba(251, 243, 226, 0.6);
}

.tool.is-muted .mute-line { display: block; }

.pencil-pair {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  height: clamp(32px, 3.1vw, 42px);
}

.pencil-pair i {
  display: block;
  width: 9px;
  height: 30px;
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 3px 3px 2px 2px;
  position: relative;
  transform: rotate(-2deg);
}

.pencil-pair i + i { transform: rotate(2deg); }

.pencil-pair i::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  width: 7px;
  height: 4px;
  transform: translateX(-50%);
  background: var(--pink);
  border: 2px solid var(--ink);
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
}

.pencil-pair i::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid var(--ink);
}

/* ---------- lessons ---------- */

.lesson-row {
  margin-top: 2px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(10px, 1.6vw, 24px);
  align-items: center;
}

.lessons {
  display: flex;
  align-items: center;
  gap: clamp(7px, 1.3vw, 17px);
  padding: 12px 4px 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.lessons::-webkit-scrollbar { display: none; }

.lesson-card {
  position: relative;
  flex: 0 0 auto;
  width: clamp(90px, 8.9vw, 138px);
  aspect-ratio: 0.98;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transform: rotate(var(--tilt, 0deg));
  filter: drop-shadow(0 6px 4px rgba(50, 40, 15, 0.18));
  transition: transform 0.14s ease;
}

.lesson-card:nth-child(1) { --tilt: -1.4deg; }
.lesson-card:nth-child(2) { --tilt: 1.3deg; }
.lesson-card:nth-child(3) { --tilt: -0.9deg; }
.lesson-card:nth-child(4) { --tilt: 1.6deg; }

.lesson-card:hover { transform: translateY(-4px) rotate(var(--tilt, 0deg)); }
.lesson-card[aria-selected="true"] {
  transform: translateY(-9px) rotate(-1deg) scale(1.04);
  z-index: 3;
}

.lesson-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 5px;
  user-select: none;
}

.card-patch {
  position: absolute;
  z-index: 3;
  left: 5%;
  right: 5%;
  bottom: 2%;
  min-height: 30%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px 2px;
  background: #FCF5E6;
  color: var(--ink);
  font-family: "Baloo 2", sans-serif;
  font-weight: 700;
  font-size: clamp(10px, 0.92vw, 14px);
  line-height: 1;
  text-align: center;
  border-radius: 4px 6px 3px 5px;
  transform: rotate(-1.2deg);
  box-shadow: 0 1px 0 rgba(35, 49, 91, 0.18);
}

.card-circle {
  position: absolute;
  inset: -9px;
  z-index: 4;
  color: var(--orange);
  pointer-events: none;
  display: none;
}

.lesson-card[aria-selected="true"] .card-circle { display: block; }
.card-circle svg { width: 100%; height: 100%; display: block; }

.card-check {
  position: absolute;
  z-index: 6;
  top: -5px;
  right: -6px;
  padding: 2px 6px 3px;
  background: var(--yellow);
  color: var(--ink);
  font-family: "Baloo 2", sans-serif;
  font-weight: 800;
  font-size: 9px;
  line-height: 1;
  border: 2px solid var(--ink);
  border-radius: 50% 44% 52% 48%;
  transform: rotate(8deg);
  display: none;
}

.lesson-card.is-done .card-check { display: block; }

.chart-poster {
  width: clamp(96px, 9.6vw, 150px);
  transform: rotate(2.4deg);
  filter: drop-shadow(0 5px 5px rgba(40, 40, 20, 0.22));
  align-self: center;
}

.chart-poster img { display: block; width: 100%; height: auto; }

/* ---------- play area ---------- */

.play {
  display: grid;
  grid-template-columns: clamp(100px, 10vw, 146px) minmax(0, 1fr) clamp(96px, 10.6vw, 146px);
  gap: clamp(7px, 1.5vw, 22px);
  align-items: center;
  min-height: clamp(210px, 27vh, 292px);
  padding: 4px 0 2px;
}

.mascot-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  align-self: end;
}

.buddy {
  width: 100%;
  max-width: 138px;
  aspect-ratio: 390 / 446;
  background-image: url("art/eraser_buddy_01_idle.webp");
  background-size: 100% 200%;
  background-repeat: no-repeat;
  background-position: center bottom;
  transition: transform 0.16s ease;
  filter: drop-shadow(0 4px 2px rgba(35, 49, 91, 0.14));
}

.buddy[data-mood="sleepy"] {
  background-image: url("art/eraser_buddy_01_idle.webp");
  background-position: center top;
  transform: rotate(-4deg) translateY(3px);
}

.buddy[data-mood="idle"] {
  background-image: url("art/eraser_buddy_01_idle.webp");
  background-position: center bottom;
  animation: buddyBob 3.4s ease-in-out infinite;
}

.buddy[data-mood="cheer"] {
  background-image: url("art/eraser_buddy_02_cheer.webp");
  background-position: center bottom;
  animation: buddyHop 0.45s cubic-bezier(0.28, 1.5, 0.5, 1);
}

.buddy[data-mood="oops"] {
  background-image: url("art/eraser_buddy_03_wince.webp");
  background-position: center top;
  animation: buddyWince 0.34s ease;
}

.buddy[data-mood="point"] {
  background-image: url("art/eraser_buddy_03_wince.webp");
  background-position: center bottom;
  transform: scaleX(-1) rotate(-2deg);
}

.speech {
  position: relative;
  width: 100%;
  max-width: 146px;
  min-height: 42px;
  padding: 6px 8px 7px;
  background: #FCF5E6;
  border: 1px solid rgba(35, 49, 91, 0.2);
  border-radius: 3px 6px 4px 5px;
  color: var(--ink);
  font-family: "Baloo 2", sans-serif;
  font-weight: 600;
  font-size: clamp(10px, 0.86vw, 13px);
  line-height: 1.16;
  transform: rotate(-2.2deg);
  box-shadow: 1px 2px 0 rgba(35, 49, 91, 0.12);
  text-align: center;
}

.speech::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 14px;
  width: 22px;
  height: 10px;
  background: rgba(239, 224, 196, 0.85);
  transform: rotate(-8deg);
  border: 1px solid rgba(217, 199, 160, 0.5);
}

.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, 0.8vh, 10px);
  min-height: 100%;
  width: 100%;
}

.stage-meta {
  width: 100%;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink-soft);
  font-family: "Space Mono", monospace;
  font-size: clamp(8px, 0.78vw, 11px);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.streak-label { white-space: nowrap; }

.tiles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: clamp(4px, 0.68vw, 10px);
  width: 100%;
  min-height: calc(var(--tile) * 1.04 + 14px);
  padding-top: 14px;
}

.tile {
  position: relative;
  width: var(--tile);
  height: calc(var(--tile) * 1.04);
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  background-position: center;
  transition: transform 0.12s ease;
  will-change: transform;
}

.tile[data-state="upcoming"] { background-image: url("art/word_tile_plates_01_upcoming_tile.webp"); }
.tile[data-state="current"] { background-image: url("art/word_tile_plates_02_current_tile.webp"); }
.tile[data-state="correct"] { background-image: url("art/word_tile_plates_03_correct_tile.webp"); }
.tile[data-state="wrong"] { background-image: url("art/word_tile_plates_04_wrong_tile.webp"); }

.tile-letter {
  position: relative;
  z-index: 2;
  font-family: "Andika", sans-serif;
  font-weight: 700;
  font-size: calc(var(--tile) * 0.5);
  line-height: 1;
  color: var(--ink);
  text-shadow: 0 0 9px var(--paper), 0 0 4px var(--paper), 0 0 2px var(--paper);
  transform: translateY(3%);
  user-select: none;
}

.tile.is-current .tile-letter { font-size: calc(var(--tile) * 0.54); }

.tile.is-current {
  transform: translateY(-9px);
  z-index: 2;
}

.tile.shake { animation: tileShake 0.36s ease; }

.tile.is-current::after {
  content: "";
  position: absolute;
  z-index: 3;
  left: 16%;
  right: 16%;
  bottom: -11px;
  height: 6px;
  border-radius: 50% 40% 60% 45%;
  background: var(--finger, var(--orange));
  transform: rotate(-1.6deg);
  animation: underlineBreathe 1.9s ease-in-out infinite;
}

.tile.pop { animation: tileHop 0.34s cubic-bezier(0.3, 1.5, 0.45, 1); }

.hint {
  margin: 0;
  min-height: 18px;
  font-family: "Andika", sans-serif;
  font-size: clamp(11px, 0.95vw, 14px);
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.2;
}

.mobile-stamp {
  display: none;
  position: absolute;
  top: -8px;
  right: 0;
  width: 54px;
  height: 56px;
  z-index: 5;
  pointer-events: none;
}

.stamp-col {
  position: relative;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 100%;
}

.stamp-stage {
  position: relative;
  width: 100%;
  height: clamp(74px, 9vw, 118px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stamp {
  position: absolute;
  display: block;
  height: clamp(66px, 8.4vw, 112px);
  width: auto;
  opacity: 0;
  filter: drop-shadow(1px 2px 0 rgba(35, 49, 91, 0.14));
  mix-blend-mode: multiply;
  transform-origin: 50% 50%;
  pointer-events: none;
}

.stamp.land { animation: stampLand var(--stamp-hold, 1.4s) ease-out forwards; }

.stamp-note {
  min-height: 17px;
  font-family: "Baloo 2", sans-serif;
  font-weight: 700;
  font-size: clamp(11px, 0.95vw, 14px);
  color: var(--ink);
  text-align: center;
  transform: rotate(-2deg);
}

.stat-slip {
  padding: 2px 8px 3px;
  background: #FCF5E6;
  border: 1px solid rgba(35, 49, 91, 0.22);
  border-radius: 2px 4px 3px 4px;
  font-family: "Space Mono", monospace;
  font-size: clamp(9px, 0.76vw, 11px);
  color: var(--ink-soft);
  transform: rotate(1.6deg);
  box-shadow: 0 1px 0 rgba(35, 49, 91, 0.12);
}

/* ---------- keyboard ---------- */

.keyboard-wrap {
  position: relative;
  z-index: 5;
  width: min(1180px, 78%);
  margin: 8px auto 0;
}

.keyboard-strip {
  position: relative;
  padding: 9px clamp(9px, 1.4vw, 18px) 11px;
  background-color: #F7EEDB;
  border: 1px solid rgba(35, 49, 91, 0.16);
  border-radius: 6px 5px 7px 4px;
  box-shadow: 0 12px 22px -10px rgba(16, 34, 24, 0.55), 0 2px 4px rgba(16, 34, 24, 0.14);
  transform: rotate(-0.28deg);
  overflow: hidden;
}

.keyboard-strip::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 54px;
  background-image: url("art/keyboard_board.webp");
  background-size: 100% auto;
  background-position: top center;
  background-repeat: no-repeat;
  mix-blend-mode: multiply;
  opacity: 0.34;
  pointer-events: none;
}

.kb-head {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 0 4px 5px;
  margin-bottom: 7px;
  border-bottom: 2px solid rgba(58, 101, 160, 0.32);
  font-family: "Baloo 2", sans-serif;
  font-weight: 600;
  font-size: clamp(10px, 0.86vw, 12px);
  color: var(--ink);
}

.kb-home {
  font-family: "Andika", sans-serif;
  font-weight: 700;
  font-size: 0.92em;
  color: var(--orange);
  transform: rotate(-1.5deg);
}

.keyboard {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: clamp(3px, 0.48vw, 7px);
}

.kb-row {
  display: flex;
  justify-content: center;
  gap: clamp(3px, 0.44vw, 7px);
  width: 100%;
}

.key {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: clamp(37px, 3.5vw, 52px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: #FBF4E3;
  border: 2.5px solid var(--ink);
  border-radius: 8px 10px 7px 11px;
  color: var(--ink);
  font-family: "Space Mono", monospace;
  font-weight: 700;
  font-size: clamp(12px, 1.05vw, 19px);
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 3px 0 #D8C7A3, 0 1px 0 rgba(255, 255, 255, 0.5) inset;
  transform: rotate(var(--wobble, 0deg));
  transition: transform 0.06s ease, box-shadow 0.06s ease, background 0.08s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

.key:nth-child(4n+1) { --wobble: -0.45deg; }
.key:nth-child(4n+2) { --wobble: 0.3deg; }
.key:nth-child(4n+3) { --wobble: 0.5deg; }
.key:nth-child(4n+4) { --wobble: -0.3deg; }

.key.pressed,
.key:active {
  transform: translateY(3px) rotate(var(--wobble, 0deg));
  box-shadow: 0 0 0 #D8C7A3;
  background: #F3E8CF;
}

.key.next {
  z-index: 3;
  background: #FFF9EC;
}

.key.next::before {
  content: "";
  position: absolute;
  inset: -5px;
  border: 3px solid var(--finger, var(--orange));
  border-radius: 50% 44% 54% 47%;
  transform: rotate(-2deg);
  opacity: 0.92;
  pointer-events: none;
}

.key.wrong { animation: keyShake 0.26s ease; border-color: var(--orange); }

.key.home-dot .dot {
  position: absolute;
  bottom: 16%;
  left: 50%;
  width: clamp(3px, 0.32vw, 5px);
  height: clamp(3px, 0.32vw, 5px);
  transform: translateX(-50%);
  border-radius: 50%;
  background: var(--finger, var(--orange));
}

.key[data-finger="pinky"] { --finger: var(--pink); }
.key[data-finger="ring"] { --finger: var(--yellow); }
.key[data-finger="middle"] { --finger: var(--teal); }
.key[data-finger="index"] { --finger: var(--orange); }

.key-space { flex: 0 0 58%; }

.key-space .key-legend {
  font-family: "Andika", sans-serif;
  font-size: clamp(9px, 0.8vw, 12px);
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

/* ---------- sticker chart ---------- */

.sticker-chart {
  position: absolute;
  right: clamp(6px, 1.8vw, 26px);
  bottom: clamp(12px, 2.2vh, 26px);
  z-index: 7;
  width: clamp(94px, 8.4vw, 124px);
  transform: rotate(2.1deg);
}

.chart-card {
  padding: 8px 8px 7px;
  background-color: #FCF5E6;
  background-image: var(--grain);
  border: 1px solid rgba(35, 49, 91, 0.3);
  border-radius: 3px 5px 4px 6px;
  box-shadow: 0 7px 12px -5px rgba(16, 34, 24, 0.6);
}

.chart-title {
  margin: 0;
  font-family: "Baloo 2", sans-serif;
  font-weight: 700;
  font-size: clamp(12px, 1vw, 16px);
  line-height: 1;
  text-align: center;
  color: var(--ink);
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: clamp(4px, 0.5vw, 7px);
  margin: 7px 1px 6px;
}

.slot {
  position: relative;
  aspect-ratio: 1;
  border: 2px solid var(--ink);
  border-radius: 50% 46% 54% 47%;
  transform: rotate(var(--slot-tilt, 0deg));
  background: rgba(255, 255, 255, 0.18);
}

.slot:nth-child(3n) { --slot-tilt: 4deg; border-radius: 46% 54% 48% 52%; }
.slot:nth-child(3n+1) { --slot-tilt: -3deg; }

.slot img {
  position: absolute;
  inset: -6%;
  width: 112%;
  height: 112%;
  object-fit: cover;
  mix-blend-mode: multiply;
  pointer-events: none;
}

.slot.star { border-color: transparent; }
.slot.pencil { border-color: rgba(35, 49, 91, 0.5); }
.slot.pop { animation: starPop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1); }

.chart-caption {
  margin: 0;
  font-family: "Andika", sans-serif;
  font-size: clamp(7px, 0.58vw, 9px);
  line-height: 1.1;
  text-align: center;
  color: var(--ink-soft);
}

/* ---------- desk scraps ---------- */

.practice-scrap {
  position: absolute;
  z-index: 1;
  left: -4px;
  bottom: 34px;
  width: clamp(130px, 14vw, 210px);
  height: auto;
  transform: rotate(-3deg);
  filter: drop-shadow(0 8px 8px rgba(16, 34, 24, 0.35));
  pointer-events: none;
  opacity: 0.97;
}

.keyboard-scrap { display: none; }

/* ---------- modals ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(19, 40, 29, 0.58);
}

.modal[hidden] { display: none; }

.modal-card {
  position: relative;
  width: min(560px, 94vw);
  max-height: 88vh;
  overflow: auto;
  padding: clamp(20px, 3vw, 32px);
  background-color: var(--paper);
  background-image: var(--grain);
  border: 1px solid rgba(35, 49, 91, 0.22);
  border-radius: 4px 6px 5px 3px;
  box-shadow: 0 26px 50px rgba(0, 0, 0, 0.42);
  transform: rotate(-0.4deg);
}

.modal-card::before {
  content: "";
  position: absolute;
  top: -11px;
  left: 50%;
  width: 110px;
  height: 24px;
  transform: translateX(-50%) rotate(-1.6deg);
  background: rgba(239, 224, 196, 0.82);
  border: 1px solid rgba(217, 199, 160, 0.5);
}

.modal-card h2 {
  margin: 0 0 10px;
  font-family: "Baloo 2", sans-serif;
  font-weight: 800;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.05;
  color: var(--ink);
}

.modal-x {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 50% 46% 52% 48%;
  background: #FCF5E6;
  color: var(--ink);
  font-family: "Baloo 2", sans-serif;
  font-weight: 800;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transform: rotate(4deg);
}

.help-list {
  margin: 0 0 16px;
  padding-left: 24px;
  font-size: clamp(14px, 1.2vw, 16px);
  line-height: 1.5;
}

.help-list li { margin-bottom: 7px; }

.help-figure {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding: 10px 12px;
  background: #F5EAD3;
  border: 1px dashed rgba(35, 49, 91, 0.32);
  transform: rotate(0.6deg);
}

.help-figure img {
  width: clamp(86px, 12vw, 130px);
  height: auto;
  flex: 0 0 auto;
}

.help-figure p {
  margin: 0;
  font-size: clamp(13px, 1.1vw, 15px);
  line-height: 1.35;
}

.note-text {
  margin: 0 0 18px;
  font-size: clamp(15px, 1.25vw, 17px);
  line-height: 1.5;
}

.paper-btn {
  display: inline-block;
  padding: 9px 22px 11px;
  border: 2.5px solid var(--ink);
  border-radius: 14px 11px 16px 10px;
  background: var(--yellow);
  color: var(--ink);
  font-family: "Baloo 2", sans-serif;
  font-weight: 700;
  font-size: clamp(16px, 1.5vw, 19px);
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 0 #C99B2F;
  transform: rotate(-0.6deg);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.paper-btn:hover { transform: rotate(0.4deg) translateY(-1px); }
.paper-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #C99B2F; }

/* ---------- animations ---------- */

@keyframes buddyBob {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-3px) rotate(1deg); }
}

.buddy[data-mood="idle"] { animation-name: buddyBob; }
.buddy[data-mood="idle"] { animation-duration: 3.4s; }
.buddy[data-mood="idle"] { animation-timing-function: ease-in-out; }
.buddy[data-mood="idle"] { animation-iteration-count: infinite; }

@keyframes buddyHop {
  0% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-14px) scale(1.03, 0.97); }
  65% { transform: translateY(0) scale(0.98, 1.02); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes buddyWince {
  0%, 100% { transform: rotate(0) translateX(0); }
  30% { transform: rotate(5deg) translateX(-3px); }
  70% { transform: rotate(-3deg) translateX(2px); }
}

@keyframes tileHop {
  0% { transform: translateY(0) scale(1); }
  40% { transform: translateY(-10px) scale(1.04, 0.96); }
  70% { transform: translateY(0) scale(0.98, 1.02); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes tileShake {
  0%, 100% { transform: translate(0, -9px) rotate(0); }
  20% { transform: translate(-7px, -9px) rotate(-3deg); }
  45% { transform: translate(6px, -9px) rotate(2.5deg); }
  70% { transform: translate(-4px, -9px) rotate(-2deg); }
  88% { transform: translate(3px, -9px) rotate(1deg); }
}

@keyframes tileShakeMobile {
  0%, 100% { transform: translate(0, -6px) rotate(0); }
  20% { transform: translate(-6px, -6px) rotate(-3deg); }
  45% { transform: translate(5px, -6px) rotate(2.5deg); }
  70% { transform: translate(-3px, -6px) rotate(-2deg); }
  88% { transform: translate(2px, -6px) rotate(1deg); }
}

@keyframes keyShake {
  0%, 100% { transform: translateX(0) rotate(var(--wobble, 0deg)); }
  30% { transform: translateX(-3px) rotate(calc(var(--wobble, 0deg) - 2deg)); }
  65% { transform: translateX(3px) rotate(calc(var(--wobble, 0deg) + 2deg)); }
}

@keyframes underlineBreathe {
  0%, 100% { transform: scaleX(0.94) rotate(-1.6deg); opacity: 0.55; }
  50% { transform: scaleX(1.03) rotate(-1.6deg); opacity: 0.95; }
}

@keyframes stampLand {
  0% { opacity: 0; transform: scale(1.7) rotate(-10deg); }
  16% { opacity: 1; transform: scale(0.94) rotate(-2deg); }
  24% { opacity: 1; transform: scale(1) rotate(-1deg); }
  74% { opacity: 1; transform: scale(1) rotate(-1deg); }
  100% { opacity: 0; transform: scale(1.03) rotate(-1deg); }
}

@keyframes starPop {
  0% { transform: scale(0.4) rotate(-18deg); }
  55% { transform: scale(1.18) rotate(4deg); }
  100% { transform: scale(1) rotate(var(--slot-tilt, 0deg)); }
}

/* ---------- responsive ---------- */

@media (max-width: 1240px) {
  .practice-scrap { display: none; }
  .sheet { width: 94%; }
  .keyboard-wrap { width: 95%; }
}

@media (max-width: 900px) {
  .sticker-chart {
    position: static;
    width: min(360px, 92%);
    margin: 9px auto 0;
    transform: rotate(-0.5deg);
  }
  .chart-grid {
    grid-template-columns: repeat(10, 1fr);
    gap: 4px;
    margin: 5px 0 4px;
  }
  .chart-title, .chart-caption { display: inline; }
  .chart-title { font-size: 13px; margin-right: 6px; }
  .chart-caption { font-size: 8px; }
  .chart-card { padding: 6px 9px 7px; }
  .keyboard-wrap { margin-top: 8px; width: 95%; }
}

@media (max-width: 820px) {
  .scene { padding: 0 8px; }

  .tabs {
    position: relative;
    top: auto;
    right: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 4px;
    height: 88px;
    margin-bottom: -22px;
  }

  .tab img { height: 72px; }
  .tab.is-active { transform: translateY(8px); }
  .tab.is-active img { height: 80px; }
  .tab.tab-next { transform: translateY(0); }
  .tab.tab-next img { height: 64px; }
  .next-slip { font-size: 9px; }

  .sheet {
    width: 100%;
    margin-top: 0;
    padding: 10px 12px 12px 20px;
    transform: rotate(-0.1deg);
  }

  .sheet::before { left: 12px; width: 7px; }
  .holes { display: none; }
  .tape { width: 72px; height: 22px; top: -9px; }
  .tape-left { left: 8%; }
  .tape-right { right: 9%; }

  .sheet-head {
    min-height: 96px;
    gap: 6px;
    align-items: flex-start;
  }

  .title-art {
    width: clamp(200px, 54vw, 270px);
    margin-top: 6px;
  }

  .tools {
    top: 2px;
    right: 0;
    gap: 2px;
  }

  .tool { width: 34px; }
  .tool img, .pencil-pair { height: 30px; }
  .tool-name { font-size: 8px; }
  .pencil-pair i { width: 7px; height: 24px; }
  .mute-line { top: 13px; }

  .lesson-row { display: block; margin-top: 0; }
  .lessons { padding: 9px 0 6px; gap: 8px; }
  .lesson-card { width: clamp(92px, 25vw, 112px); }
  .card-patch { font-size: clamp(9px, 2.5vw, 12px); }
  .chart-poster { display: none; }

  .play {
    grid-template-columns: 1fr;
    gap: 0;
    min-height: 0;
    padding: 4px 0 0;
  }

  .mascot-col {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    height: 62px;
    padding: 0 2px;
  }

  .buddy {
    width: 52px;
    max-width: 52px;
    align-self: flex-end;
    margin-bottom: 0;
  }

  .speech {
    flex: 1 1 auto;
    max-width: none;
    min-height: 0;
    padding: 5px 8px 6px;
    font-size: 12px;
    text-align: left;
    transform: rotate(-0.8deg);
  }

  .speech::before { left: auto; right: 18px; }

  .stage { gap: 3px; padding-top: 4px; }

  .stage-meta {
    font-size: 9px;
    padding-right: 0;
  }

  .stage-meta .streak-label { margin-right: 54px; }

  .tiles {
    --tile: clamp(43px, 11vw, 58px);
    gap: 5px;
    padding-top: 12px;
    min-height: calc(var(--tile) * 1.04 + 12px);
  }

  .tile[data-state="current"] { transform: translateY(-6px); }
  .tile.is-current::after { bottom: -8px; height: 5px; }

  .hint {
    font-size: 11px;
    min-height: 14px;
    margin-top: 2px;
  }

  .stamp-col { display: none; }

  .mobile-stamp { display: block; top: -6px; width: 44px; height: 46px; }

  .mobile-stamp img {
    position: absolute;
    height: 44px;
    width: auto;
    opacity: 0;
    mix-blend-mode: multiply;
    transform-origin: 50% 50%;
  }

  .mobile-stamp img.land { animation: stampLand var(--stamp-hold, 1.4s) ease-out forwards; }

  .keyboard-wrap {
    width: 100%;
    margin-top: 8px;
  }

  .keyboard-strip {
    padding: 7px 7px 8px;
    transform: rotate(-0.2deg);
  }

  .kb-head {
    font-size: 10px;
    padding-bottom: 3px;
    margin-bottom: 5px;
  }

  .keyboard { gap: 3px; }
  .kb-row { gap: 3px; }

  .key {
    height: 37px;
    border-width: 2px;
    border-radius: 6px 8px 5px 9px;
    font-size: 12px;
    box-shadow: 0 2px 0 #D8C7A3;
  }

  .key.next::before { inset: -3px; border-width: 2.5px; }
  .key-space { flex-basis: 62%; }
  .key-space .key-legend { font-size: 9px; }

  .chart-grid { grid-template-columns: repeat(10, 1fr); }
  .sticker-chart { width: min(330px, 96%); margin-top: 7px; }
}

@media (max-width: 430px) {
  .scene { padding: 0 6px; }
  .sheet { padding: 8px 9px 10px 16px; }
  .title-art { width: 54vw; }
  .tool { width: 31px; }
  .tool img, .pencil-pair { height: 27px; }
  .tool-name { font-size: 7px; }
  .lesson-card { width: 92px; }
  .card-patch { font-size: 9.5px; min-height: 32%; }
  .buddy { width: 46px; max-width: 46px; }
  .mascot-col { height: 56px; }
  .speech { font-size: 11px; padding: 4px 7px; }
  .key { height: 34px; font-size: 11px; }
  .keyboard-strip { padding: 6px 5px 8px; }
  .kb-head { font-size: 9px; }
  .stage-meta { font-size: 8px; }
  .stage-meta .streak-label { margin-right: 48px; }
  .mobile-stamp { width: 40px; height: 42px; }
  .mobile-stamp img { height: 40px; }
  .chart-card { padding: 6px 8px 7px; }
}

@media (max-height: 640px) and (min-width: 821px) {
  .scene { padding: 0 10px; }
  .sheet { margin-top: 42px; padding-top: 12px; padding-bottom: 12px; }
  .tabs { top: -4px; }
  .tab img { height: 66px; }
  .tab.is-active img { height: 72px; }
  .tab.tab-next img { height: 58px; }
  .sheet-head { min-height: 100px; }
  .title-art { width: clamp(200px, 22vw, 300px); }
  .tools { top: 42px; }
  .tool { width: 34px; }
  .tool img, .pencil-pair { height: 30px; }
  .tools { top: 42px; }
  .lesson-card { width: clamp(74px, 7.6vw, 106px); }
  .lessons { padding: 6px 4px 4px; }
  .play { min-height: 190px; }
  .tiles { --tile: clamp(46px, 5.4vw, 70px); }
  .buddy { max-width: 104px; }
  .key { height: clamp(32px, 3.1vw, 44px); }
  .keyboard-strip { padding-top: 6px; padding-bottom: 8px; }
  .kb-head { font-size: 10px; margin-bottom: 4px; }
  .sticker-chart { width: 88px; }
  .chart-title { font-size: 12px; }
}

@media (max-height: 640px) and (max-width: 820px) {
  .tabs { height: 68px; margin-bottom: -18px; }
  .tab img { height: 54px; }
  .tab.is-active img { height: 60px; }
  .tab.tab-next img { height: 48px; }
  .title-art { width: 46vw; }
  .sheet-head { min-height: 76px; }
  .lessons { padding: 5px 0 4px; }
  .lesson-card { width: 76px; }
  .mascot-col { height: 46px; }
  .buddy { width: 38px; max-width: 38px; }
  .speech { font-size: 10px; }
  .key { height: 31px; font-size: 10px; }
  .sticker-chart { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .buddy, .tile, .key, .slot { animation: none !important; }
  .tile.is-current::after { animation: none; opacity: 0.8; }
  .tab, .lesson-card, .tool, .paper-btn { transition: none; }
}
