:root {
  color-scheme: light;
  --ink: #201918;
  --paper: #f7e7b7;
  --wall: #ddb56a;
  --board: #31564b;
  --board-dark: #203a34;
  --chalk: #ece8c9;
  --orange: #e97431;
  --orange-dark: #a94320;
  --yellow: #f3c94c;
  --red: #cf3c32;
  --red-dark: #7a2521;
  --green: #477d62;
  --blue: #3b7185;
  --skin: #c88359;
  --hair: #39251f;
  --uniform: #e97035;
  --desk: #865331;
  --desk-top: #b27743;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: #bb8c4d; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% -15%, rgba(255, 247, 197, .65), transparent 35rem),
    repeating-linear-gradient(90deg, rgba(71, 45, 26, .035) 0 1px, transparent 1px 5px),
    #c99b58;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

button { color: inherit; font: inherit; }
button, .hold-zone { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible { outline: 4px solid #fff; outline-offset: 3px; }

.game-shell {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 14px clamp(10px, 2vw, 24px) 18px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 0 5px 11px;
}

.brand-block { flex: 0 0 auto; }
.back-link {
  color: #694521;
  font-family: "Arial Narrow", "Segoe UI", sans-serif;
  font-size: .64rem;
  font-weight: 900;
  letter-spacing: .15em;
  text-decoration: none;
}
.back-link:hover { color: var(--ink); }
.topbar h1 {
  margin: 3px 0 0;
  font-size: clamp(2.2rem, 5vw, 4.15rem);
  font-weight: 950;
  line-height: .8;
  letter-spacing: -.055em;
  text-transform: lowercase;
  transform: skew(-3deg);
}
.topbar h1 span { color: var(--orange); }

.scoreboard {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(135px, .7fr) auto;
  align-items: stretch;
  overflow: hidden;
  border: 4px solid var(--ink);
  border-radius: 10px;
  background: var(--ink);
  box-shadow: 4px 5px 0 rgba(60, 35, 19, .24);
}
.scoreboard > div {
  display: grid;
  align-content: center;
  min-width: 0;
  padding: 8px 15px 7px;
  background: #fff4d2;
}
.scoreboard > div + div { border-left: 3px solid var(--ink); }
.scoreboard span, .cps-pill small {
  color: #765839;
  font-family: "Arial Narrow", "Segoe UI", sans-serif;
  font-size: .57rem;
  font-weight: 950;
  letter-spacing: .13em;
}
.scoreboard strong {
  display: block;
  overflow: hidden;
  font-size: clamp(1.3rem, 3.3vw, 2.4rem);
  line-height: 1;
  letter-spacing: -.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scoreboard .available-score strong { color: var(--green); }
.sound-button {
  display: grid;
  width: 69px;
  place-items: center;
  border: 0;
  border-left: 3px solid var(--ink);
  background: #f3c94c;
  cursor: pointer;
}
.sound-button svg { width: 25px; fill: none; stroke: var(--ink); stroke-linecap: round; stroke-linejoin: round; stroke-width: 3; }
.sound-button span { color: var(--ink); font-size: .5rem; }
.sound-button.muted { background: #d5c7a9; }
.sound-button.muted svg path { stroke-dasharray: 8 5; opacity: .5; }

.classroom {
  position: relative;
  overflow: hidden;
  border: 5px solid var(--ink);
  border-radius: 15px;
  background: var(--wall);
  box-shadow: 8px 10px 0 rgba(66, 40, 24, .22);
  isolation: isolate;
  user-select: none;
  -webkit-user-select: none;
}
.classroom::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 12;
  border: 2px solid rgba(255,255,255,.22);
  border-radius: 9px;
  pointer-events: none;
}
.classroom-art { display: block; width: 100%; height: auto; min-height: 405px; }
.wall { fill: var(--wall); }
.board-shadow { fill: #714529; opacity: .32; }
.board-frame { fill: #9a623b; stroke: var(--ink); stroke-width: 8; }
.board { fill: var(--board); stroke: #173029; stroke-width: 5; }
.chalk-writing { fill: none; stroke: var(--chalk); stroke-linecap: round; stroke-width: 7; opacity: .55; }
.chalk-equation text { fill: var(--chalk); font: 900 32px "Segoe UI", sans-serif; letter-spacing: 5px; opacity: .7; text-anchor: middle; }
.chalk-rail { fill: #b37a4c; stroke: var(--ink); stroke-width: 5; }
.eraser { fill: #262020; stroke: var(--ink); stroke-width: 4; }
.chalk-piece { fill: #f7edca; stroke: var(--ink); stroke-width: 3; }

.teacher { transform-origin: 607px 540px; }
.teacher-ground-shadow { fill: #201918; opacity: .22; }
.teacher-front { display: none; }
.teacher-body { fill: var(--uniform); stroke: var(--ink); stroke-linejoin: round; stroke-width: 11; }
.collar { fill: #f4ddad; stroke: var(--ink); stroke-linejoin: round; stroke-width: 7; }
.neck, .head-skin, .ear, .skin { fill: var(--skin); stroke: var(--ink); stroke-width: 8; }
.hair-back, .hair-front, .bun { fill: var(--hair); stroke: var(--ink); stroke-linejoin: round; stroke-width: 10; }
.bun-detail, .hair-shine { fill: none; stroke: #694236; stroke-linecap: round; stroke-width: 8; }
.sleeve { fill: var(--uniform); stroke: var(--ink); stroke-linejoin: round; stroke-width: 10; }
.chalk { fill: none; stroke: #f3edcc; stroke-linecap: round; stroke-width: 8; }
.skirt-line { fill: none; stroke: #a64426; stroke-width: 7; }
.eye { fill: var(--ink); }
.eyebrow, .nose, .mouth, .thumb-line, .finger-line { fill: none; stroke: var(--ink); stroke-linecap: round; stroke-linejoin: round; stroke-width: 8; }
.eyebrow { stroke-width: 10; }
.left-brow { transform-origin: 571px 197px; transform: rotate(7deg); }
.right-brow { transform-origin: 644px 198px; transform: rotate(-7deg); }
.mouth { stroke-width: 7; }
.writing-arm { transform-origin: 480px 390px; animation: write 1.1s ease-in-out infinite alternate; }

.desk-front { fill: var(--desk); stroke: var(--ink); stroke-width: 9; }
.desk-top { fill: var(--desk-top); stroke: var(--ink); stroke-width: 9; }
.desk-highlight { fill: none; stroke: #d79b5b; stroke-width: 5; }
.notebook > path:first-child { fill: #f6e9c7; stroke: var(--ink); stroke-width: 7; }
.paper-line { fill: none; stroke: #92a9a9; stroke-width: 3; }
.margin-line { fill: none; stroke: #d67468; stroke-width: 3; }
.wrist, .hand { fill: #d3956d; stroke: var(--ink); stroke-linecap: round; stroke-linejoin: round; stroke-width: 10; }
.thumb-line, .finger-line { stroke: #8d563f; stroke-width: 6; }
.player-hand { transform-origin: 832px 555px; }
.pen-shadow { fill: none; stroke: rgba(32,25,24,.25); stroke-linecap: round; stroke-width: 28; transform: translate(4px, 8px); }
.pen-body { fill: none; stroke: #287294; stroke-linecap: round; stroke-width: 24; }
.pen-grip { fill: none; stroke: #1f3a47; stroke-linecap: round; stroke-width: 29; }
.pen-clip { fill: none; stroke: var(--ink); stroke-linecap: round; stroke-linejoin: round; stroke-width: 8; }
.pen-tip { fill: #d7d0ba; stroke: var(--ink); stroke-linejoin: round; stroke-width: 6; }
.pen-clicker { fill: none; stroke: var(--ink); stroke-linecap: round; stroke-width: 11; }
.pen-core { display: none; fill: var(--yellow); stroke: var(--ink); stroke-width: 5; }
.speed-lines { opacity: 0; }
.speed-lines path { fill: none; stroke: #fff1ad; stroke-linecap: round; stroke-width: 8; }

.coffee-prop .cup { fill: #efe3c4; stroke: var(--ink); stroke-linejoin: round; stroke-width: 9; }
.coffee-prop .cup-rim { fill: none; stroke: var(--ink); stroke-linecap: round; stroke-width: 14; }
.coffee-prop .cup-band { fill: var(--orange); stroke: var(--ink); stroke-width: 6; }
.coffee-prop .cup-handle { fill: none; stroke: var(--ink); stroke-width: 13; }
.steam path { fill: none; stroke: #fff4d1; stroke-linecap: round; stroke-width: 8; }
.cup-label { fill: var(--paper); font: 900 23px Impact, sans-serif; text-anchor: middle; }

.status-ribbon {
  position: absolute;
  top: 14px;
  left: 50%;
  z-index: 15;
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 2px 8px;
  min-width: 190px;
  padding: 9px 14px;
  transform: translateX(-50%) rotate(-1deg);
  border: 4px solid var(--ink);
  border-radius: 7px;
  background: #f6e7bb;
  box-shadow: 4px 5px 0 rgba(32,25,24,.25);
  text-align: left;
  pointer-events: none;
}
.status-dot { grid-row: 1 / 3; width: 17px; height: 17px; border: 4px solid var(--ink); border-radius: 50%; background: #63a86f; }
.status-ribbon strong { font-size: .81rem; letter-spacing: .065em; }
.status-ribbon small { color: #79593b; font-family: "Arial Narrow", sans-serif; font-size: .6rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }

.hold-zone {
  position: absolute;
  right: 18px;
  bottom: 17px;
  left: 34%;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 80px;
  overflow: hidden;
  border: 5px solid var(--ink);
  border-radius: 12px;
  background: #f4cc4d;
  box-shadow: 5px 7px 0 rgba(32,25,24,.35);
  cursor: pointer;
  touch-action: none;
}
.hold-zone:active, .hold-zone.held { transform: translate(3px, 4px); box-shadow: 2px 3px 0 rgba(32,25,24,.35); }
.hold-copy { position: relative; z-index: 2; display: grid; gap: 2px; padding: 12px 18px; text-align: left; }
.hold-copy b { font-size: clamp(1.15rem, 3vw, 2rem); letter-spacing: .025em; }
.hold-copy small { font-family: "Arial Narrow", sans-serif; font-size: .55rem; font-weight: 900; letter-spacing: .15em; }
.cps-pill { position: relative; z-index: 2; display: grid; min-width: 105px; align-self: stretch; place-content: center; border-left: 4px solid var(--ink); background: #fff0bd; padding: 8px 15px; text-align: center; }
.cps-pill b { font-size: clamp(1.3rem, 3vw, 2.1rem); line-height: 1; }
.cps-pill small { color: #6f502e; }
.hold-progress { position: absolute; z-index: 1; inset: 0; transform: scaleX(0); transform-origin: left; background: #ef8b39; opacity: .6; pointer-events: none; }

.caught-flash {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  align-content: center;
  justify-items: center;
  background: rgba(111, 22, 20, .76);
  color: #fff4d0;
  opacity: 0;
  pointer-events: none;
  transform: scale(1.08);
}
.caught-flash strong { font-size: clamp(3.2rem, 11vw, 8rem); line-height: .85; letter-spacing: -.025em; text-shadow: 7px 8px 0 var(--ink); transform: rotate(-3deg); }
.caught-flash span { margin-top: 20px; border: 4px solid var(--ink); background: var(--paper); color: var(--red); padding: 8px 18px; font-size: clamp(1rem, 3vw, 1.8rem); box-shadow: 4px 5px 0 var(--ink); }
.click-float { position: absolute; z-index: 17; right: 25%; bottom: 28%; color: #fff4b4; font-size: 1.4rem; opacity: 0; pointer-events: none; text-shadow: 3px 3px 0 var(--ink); }

.shop {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px minmax(0, 1fr);
  gap: 10px;
  margin-top: 13px;
}
.upgrade-card {
  display: grid;
  grid-template-columns: 88px 1fr;
  grid-template-rows: 1fr auto;
  min-width: 0;
  overflow: hidden;
  border: 5px solid var(--ink);
  border-radius: 12px;
  background: #f7e7b7;
  box-shadow: 5px 6px 0 rgba(62,38,22,.25);
}
.upgrade-icon { display: grid; grid-row: 1 / 3; place-items: center; border-right: 4px solid var(--ink); background: #e9bd69; }
.upgrade-icon svg { width: 72px; overflow: visible; }
.mini-steam, .mini-handle, .mini-band, .mini-pen, .mini-grip, .mini-clip, .mini-click { fill: none; stroke: var(--ink); stroke-linecap: round; stroke-linejoin: round; }
.mini-steam { stroke: #fff1c6; stroke-width: 6; }
.mini-cup { fill: #f7e7b7; stroke: var(--ink); stroke-width: 7; }
.mini-handle { stroke-width: 7; }
.mini-band { stroke: var(--orange); stroke-width: 13; }
.mini-pen { stroke: #287294; stroke-width: 15; }
.mini-grip { stroke: #213e49; stroke-width: 18; }
.mini-clip { stroke-width: 5; }
.mini-click { stroke-width: 7; }
.mini-tip { fill: #d8cfb5; stroke: var(--ink); stroke-width: 5; }
.upgrade-copy { min-width: 0; padding: 11px 13px 9px; }
.eyebrow-label { color: #866238; font-family: "Arial Narrow", sans-serif; font-size: .55rem; font-weight: 900; letter-spacing: .13em; }
.upgrade-copy h2 { margin: 4px 0 5px; overflow: hidden; font-size: clamp(.88rem, 1.7vw, 1.17rem); line-height: 1; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.upgrade-stats { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.upgrade-stats strong { color: var(--orange-dark); font-size: clamp(1.25rem, 2.8vw, 1.85rem); line-height: 1; }
.upgrade-stats span { color: #806142; font-family: "Arial Narrow", sans-serif; font-size: .55rem; font-weight: 900; letter-spacing: .1em; }
.upgrade-copy p { margin: 5px 0 0; overflow: hidden; color: #71563d; font-family: "Segoe UI", sans-serif; font-size: .66rem; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.buy-button {
  display: flex;
  grid-column: 2;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  border: 0;
  border-top: 4px solid var(--ink);
  background: var(--green);
  color: #fff4cf;
  padding: 8px 12px;
  text-align: left;
  cursor: pointer;
}
.buy-button span { overflow: hidden; font-family: "Arial Narrow", sans-serif; font-size: .53rem; font-weight: 900; letter-spacing: .09em; }
.buy-button span b { display: block; overflow: hidden; max-width: 190px; margin-top: 2px; font-family: Impact, sans-serif; font-size: .69rem; letter-spacing: .025em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.buy-button > strong { flex: 0 0 auto; font-size: 1rem; }
.buy-button > strong::after { content: " CLICKS"; font-family: "Arial Narrow", sans-serif; font-size: .48rem; letter-spacing: .08em; }
.buy-button:not(:disabled):hover { filter: brightness(1.13); }
.buy-button:not(:disabled):active { transform: translateY(2px); }
.buy-button:disabled { background: #9d8e70; color: #ddd1b5; cursor: not-allowed; }
.buy-button.maxed { background: var(--ink); color: var(--yellow); justify-content: center; }
.buy-button.maxed span { font: 900 1rem Impact, sans-serif; letter-spacing: .1em; }
.buy-button.maxed > strong { display: none; }
.buy-button.penularity,
.buy-button.penularity:disabled {
  justify-content: space-between;
  background: linear-gradient(90deg, #7b347d 0 var(--penularity-progress, 0%), #211825 var(--penularity-progress, 0%) 100%);
  color: #f7d6ff;
  cursor: default;
  opacity: 1;
}
.buy-button.penularity span { font: 900 .72rem "Arial Narrow", "Segoe UI", sans-serif; letter-spacing: .13em; }
.buy-button.penularity > strong { display: block; color: #fff1a8; font-size: 1.23rem; letter-spacing: .04em; }
.buy-button.penularity > strong::after { content: " CLICKING"; }
.pen-card[data-tier="10"] { border-color: #2a172d; box-shadow: 5px 6px 0 rgba(62,38,22,.25), 0 0 22px rgba(137,65,163,.25); }

.rate-readout {
  display: grid;
  align-content: center;
  justify-items: center;
  border: 5px solid var(--ink);
  border-radius: 12px;
  background: #263d38;
  color: #fff0c2;
  padding: 8px;
  text-align: center;
  box-shadow: 5px 6px 0 rgba(62,38,22,.25);
}
.rate-readout div { display: grid; }
.rate-readout span, .rate-readout small { color: #b8c6a4; font-family: "Arial Narrow", sans-serif; font-size: .5rem; font-weight: 900; letter-spacing: .1em; }
.rate-readout strong { font-size: .86rem; }
.rate-readout i { color: var(--yellow); font-size: 1rem; font-style: normal; line-height: .8; transform: rotate(90deg); }
.rate-readout small { margin-top: 4px; color: var(--yellow); }
.rate-readout.capped { background: #592b25; }
.rate-readout.capped small { color: #ff9a6e; }

.footer-line { display: flex; justify-content: space-between; gap: 15px; padding: 11px 5px 0; color: #694724; font-family: "Arial Narrow", sans-serif; font-size: .56rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }

.classroom[data-teacher="micro"] .writing-arm { animation: arm-pause .2s steps(2) infinite; }
.classroom[data-teacher="micro"] .teacher-back { transform-origin: 610px 320px; animation: small-twitch .16s steps(2) 2; }
.classroom[data-teacher="warning"] .writing-arm { animation-play-state: paused; }
.classroom[data-teacher="warning"] .teacher-back { transform-origin: 610px 320px; animation: warning-twitch .19s steps(2) infinite; }
.classroom[data-teacher="warning"] .status-ribbon { background: var(--yellow); }
.classroom[data-teacher="warning"] .status-dot { background: var(--orange); }
.classroom[data-teacher="turning"] .teacher-back { animation: turn-squash .18s ease-in forwards; transform-origin: 608px 420px; }
.classroom[data-teacher="turning"] .status-ribbon,
.classroom[data-teacher="returning"] .status-ribbon { background: #ef9a42; }
.classroom[data-teacher="watching"] .teacher-back,
.classroom[data-teacher="caught"] .teacher-back { display: none; }
.classroom[data-teacher="watching"] .teacher-front,
.classroom[data-teacher="caught"] .teacher-front { display: block; }
.classroom[data-teacher="watching"] .teacher-front { animation: front-pop .16s ease-out; transform-origin: 608px 420px; }
.classroom[data-teacher="watching"] .status-ribbon { background: #d9613b; color: #fff3d0; }
.classroom[data-teacher="watching"] .status-dot { background: var(--red); }
.classroom[data-teacher="returning"] .teacher-back { animation: return-pop .26s ease-out; transform-origin: 608px 420px; }
.classroom[data-teacher="caught"] .teacher-front { animation: caught-lunge .2s ease-out forwards; transform-origin: 608px 420px; }
.classroom[data-teacher="caught"] .caught-flash { animation: caught-overlay 1.12s ease-out forwards; }
.classroom[data-teacher="caught"] { animation: scene-punch .12s steps(2) 5; }

.classroom.held .player-hand { animation: hand-click var(--click-speed, .18s) steps(2) infinite; }
.classroom.held .click-float { animation: float-click .6s ease-out infinite; }
.classroom.intensity-medium.held .player-hand { animation-name: hand-buzz; }
.classroom.intensity-high.held .player-hand { animation-duration: .07s; }
.classroom.intensity-high.held .speed-lines { opacity: .72; animation: speed-flicker .12s steps(2) infinite; }
.classroom.intensity-extreme.held .foreground { animation: desk-rattle .08s steps(2) infinite; }
.classroom.intensity-extreme.held .pen { filter: url(#pen-glow); }
.classroom.intensity-extreme.held .speed-lines { opacity: 1; }
.classroom.intensity-extreme.held .teacher-back { animation: bun-rattle .1s steps(2) infinite; }
.classroom[data-teacher="warning"] .foreground { animation: none !important; }

.classroom[data-pen-tier="2"] .pen-body, .classroom[data-pen-tier="2"] .mini-pen { stroke: #4c8370; }
.classroom[data-pen-tier="3"] .pen-body { stroke: #515767; }
.classroom[data-pen-tier="4"] .pen-body { stroke: #7e3943; }
.classroom[data-pen-tier="5"] .pen-body { stroke: #242b2c; }
.classroom[data-pen-tier="6"] .pen-body { stroke: #e15d2f; }
.classroom[data-pen-tier="7"] .pen-body { stroke: #6f735d; stroke-width: 29; }
.classroom[data-pen-tier="8"] .pen-body { stroke: #75358c; }
.classroom[data-pen-tier="8"] .pen-core,
.classroom[data-pen-tier="9"] .pen-core,
.classroom[data-pen-tier="10"] .pen-core { display: block; }
.classroom[data-pen-tier="9"] .pen-body { stroke: #171719; stroke-width: 29; }
.classroom[data-pen-tier="9"] .pen-core { fill: #e5663a; }
.classroom[data-pen-tier="10"] .pen-body { stroke: #0c0c12; stroke-width: 34; filter: url(#pen-glow); }
.classroom[data-pen-tier="10"] .pen-core { r: 12px; fill: #8e46bb; stroke: #efbbff; }

.classroom[data-coffee-tier="2"] .cup-band { fill: #bf5b2b; }
.classroom[data-coffee-tier="3"] .cup { fill: #f3b6a0; }
.classroom[data-coffee-tier="4"] .cup { fill: #e7d8bb; }
.classroom[data-coffee-tier="5"] .cup-band { fill: #2c6781; }
.classroom[data-coffee-tier="6"] .cup { fill: #ad4530; }
.classroom[data-coffee-tier="7"] .cup-band { fill: #73543d; }
.classroom[data-coffee-tier="8"] .cup { fill: #b7bdad; }
.classroom[data-coffee-tier="9"] .cup { fill: #282226; }
.classroom[data-coffee-tier="9"] .cup-label { fill: #e65243; }
.classroom[data-coffee-tier="10"] .cup { fill: #211728; }
.classroom[data-coffee-tier="10"] .cup-band { fill: #7541a0; }
.classroom[data-coffee-tier="10"] .steam path { stroke: #db9cff; }

.upgrade-card.purchased { animation: card-pop .38s ease-out; }
.score-bump { animation: score-pop .22s ease-out; }

.intro-layer, .win-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(34, 24, 18, .82);
  backdrop-filter: blur(6px);
  transition: opacity .25s;
}
.intro-layer.hidden, .win-layer { opacity: 0; pointer-events: none; }
.win-layer.visible { opacity: 1; pointer-events: auto; }
.intro-card, .win-card {
  width: min(570px, calc(100vw - 36px));
  max-width: 100%;
  border: 6px solid var(--ink);
  border-radius: 14px;
  background: #f6e8bd;
  padding: clamp(23px, 5vw, 42px);
  box-shadow: 10px 12px 0 rgba(0,0,0,.35);
  transform: rotate(-.6deg);
}
.detention-slip, .win-card > span { color: #805d34; font-family: "Arial Narrow", sans-serif; font-size: .62rem; font-weight: 950; letter-spacing: .16em; }
.intro-card h2, .win-card h2 { margin: 8px 0 22px; font-size: clamp(2.25rem, 9vw, 4.6rem); line-height: .87; letter-spacing: -.035em; text-transform: uppercase; }
.intro-card h2 em { color: var(--red); font-style: normal; }
.intro-rules { display: grid; gap: 8px; margin-bottom: 22px; }
.intro-rules p { display: grid; grid-template-columns: 42px 1fr; align-items: center; gap: 11px; margin: 0; font-family: "Segoe UI", sans-serif; font-size: .79rem; line-height: 1.35; }
.intro-rules p > b { display: grid; width: 38px; height: 38px; place-items: center; border: 3px solid var(--ink); border-radius: 50%; background: var(--yellow); font-family: Impact, sans-serif; }
.intro-card > button, .win-actions button {
  min-height: 55px;
  border: 4px solid var(--ink);
  border-radius: 7px;
  background: var(--green);
  color: #fff1c4;
  padding: 10px 22px;
  box-shadow: 4px 5px 0 var(--ink);
  letter-spacing: .08em;
  cursor: pointer;
}
.intro-card > button { width: 100%; }
.intro-card > button:active, .win-actions button:active { transform: translate(3px, 3px); box-shadow: 1px 2px 0 var(--ink); }
.intro-card > small { display: block; margin-top: 12px; color: #7d6244; font-family: "Segoe UI", sans-serif; font-size: .63rem; text-align: center; }
.win-card { text-align: center; transform: rotate(.5deg); }
.win-card h2 { margin-bottom: 12px; color: var(--ink); font-size: clamp(2.3rem, 7vw, 4.35rem); line-height: .83; }
.win-card h2 em { display: block; color: #7b347d; font-size: 1.18em; font-style: normal; }
.win-card > strong { font-size: clamp(1.15rem, 4vw, 2rem); }
.win-card > p { margin: 7px 0 18px; color: var(--green); font-size: 1.05rem; letter-spacing: .035em; }
.win-card > p.win-invite { margin: 15px auto 0; color: #70563b; font: 700 .76rem/1.45 "Segoe UI", sans-serif; letter-spacing: 0; }
.win-stats { display: grid; grid-template-columns: repeat(3, 1fr); overflow: hidden; border: 4px solid var(--ink); border-radius: 7px; background: var(--ink); gap: 3px; }
.win-stats div { display: grid; gap: 3px; background: #fff4d1; padding: 10px 6px; }
.win-stats span { color: #80613e; font-family: "Arial Narrow", sans-serif; font-size: .55rem; font-weight: 900; letter-spacing: .1em; }
.win-stats b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win-actions { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 10px; margin-top: 16px; }
.win-actions button:first-child { background: #7b347d; color: #f9dcff; }
.win-actions button:last-child { background: var(--paper); color: var(--ink); }

.classroom.penularity-active.held .classroom-art { animation: penularity-rattle .055s steps(2) infinite; }
.classroom.penularity-active.held[data-teacher="warning"] .classroom-art { animation-duration: .14s; }
.classroom.penularity-active.held .chalk-writing { animation: chalk-unravel .18s steps(2) infinite; }
.game-shell.penularity-live .rate-readout { animation: reality-pulse .55s ease-in-out infinite alternate; }
.game-shell.penularity-live .status-ribbon { box-shadow: 4px 5px 0 rgba(32,25,24,.25), 0 0 18px rgba(130,51,147,.35); }

.game-shell.penularity-ending .classroom { animation: singularity-shake .055s steps(2) 38; }
.game-shell.penularity-ending .teacher { animation: teacher-eject 1.75s cubic-bezier(.55,-.2,.75,.4) .35s forwards !important; transform-box: fill-box; transform-origin: center; }
.game-shell.penularity-ending .foreground { animation: desk-eject 1.8s ease-in .48s forwards !important; transform-box: fill-box; transform-origin: center bottom; }
.game-shell.penularity-ending .board,
.game-shell.penularity-ending .board-frame,
.game-shell.penularity-ending .board-shadow,
.game-shell.penularity-ending .chalk-writing,
.game-shell.penularity-ending .chalk-equation,
.game-shell.penularity-ending .chalk-rail { animation: board-eject 1.65s ease-in .55s forwards; transform-box: fill-box; transform-origin: center; }
.game-shell.penularity-ending .coffee-card { animation: card-eject-left 1.5s ease-in .65s forwards; }
.game-shell.penularity-ending .pen-card { animation: card-eject-right 1.5s ease-in .65s forwards; }
.game-shell.penularity-ending .rate-readout { animation: card-drop 1.35s ease-in .75s forwards; }
.game-shell.penularity-ending .status-ribbon { animation: status-spin 1.4s ease-in .7s forwards; }

@keyframes write { from { transform: rotate(-2deg) translate(-2px, 0); } to { transform: rotate(3deg) translate(4px, -5px); } }
@keyframes arm-pause { 50% { transform: translate(2px, -2px); } }
@keyframes small-twitch { 50% { transform: translate(4px, -3px) rotate(1deg); } }
@keyframes warning-twitch { 50% { transform: translate(-7px, 1px) rotate(-2deg); } }
@keyframes turn-squash { 45% { transform: scaleX(.18) translateX(35px); } 100% { transform: scaleX(0); } }
@keyframes front-pop { from { transform: scaleX(.15); } to { transform: scaleX(1); } }
@keyframes return-pop { from { transform: scaleX(.15); } to { transform: scaleX(1); } }
@keyframes caught-lunge { to { transform: translateY(15px) scale(1.12); } }
@keyframes caught-overlay { 0% { opacity: 0; transform: scale(1.1); } 13%, 75% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(.98); } }
@keyframes scene-punch { 25% { transform: translate(7px, -3px); } 75% { transform: translate(-6px, 4px); } }
@keyframes hand-click { 50% { transform: translate(3px, -4px) rotate(1deg); } }
@keyframes hand-buzz { 25% { transform: translate(-2px, 2px) rotate(-.7deg); } 75% { transform: translate(3px, -2px) rotate(.7deg); } }
@keyframes speed-flicker { 50% { opacity: .22; transform: translateX(7px); } }
@keyframes desk-rattle { 25% { transform: translate(1px, -1px); } 75% { transform: translate(-1px, 1px); } }
@keyframes bun-rattle { 50% { transform: translateX(2px); } }
@keyframes float-click { from { opacity: 0; transform: translateY(12px) rotate(-6deg); } 30% { opacity: 1; } to { opacity: 0; transform: translateY(-36px) rotate(4deg); } }
@keyframes card-pop { 45% { transform: translateY(-6px) rotate(-.5deg); } }
@keyframes score-pop { 50% { transform: scale(1.06); color: var(--orange); } }
@keyframes penularity-rattle {
  0% { transform: translate(-4px, 2px) rotate(-.12deg) scale(1.008); }
  50% { transform: translate(5px, -3px) rotate(.14deg) scale(1.008); }
  100% { transform: translate(-2px, -1px) rotate(-.08deg) scale(1.008); }
}
@keyframes chalk-unravel { 50% { stroke-dasharray: 18 5; stroke-dashoffset: 12; } }
@keyframes reality-pulse { to { border-color: #b36bc1; box-shadow: 0 0 22px rgba(134,69,153,.6); } }
@keyframes singularity-shake {
  0% { transform: translate(-7px, 4px) rotate(-.25deg); filter: hue-rotate(0); }
  50% { transform: translate(8px, -5px) rotate(.3deg); filter: hue-rotate(22deg); }
  100% { transform: translate(-5px, -3px) rotate(-.2deg); filter: hue-rotate(-18deg); }
}
@keyframes teacher-eject { to { transform: translate(110px, -730px) rotate(42deg) scale(.65); opacity: 0; } }
@keyframes desk-eject { to { transform: translateY(420px) rotate(-4deg); opacity: .1; } }
@keyframes board-eject { to { transform: translate(-80px, 480px) rotate(-8deg); opacity: 0; } }
@keyframes card-eject-left { to { transform: translate(-520px, 320px) rotate(-24deg); opacity: 0; } }
@keyframes card-eject-right { to { transform: translate(520px, 300px) rotate(22deg); opacity: 0; } }
@keyframes card-drop { to { transform: translateY(360px) rotate(12deg); opacity: 0; } }
@keyframes status-spin { to { transform: translate(-50%, -520px) rotate(32deg); opacity: 0; } }

@media (max-width: 900px) {
  .scoreboard { grid-template-columns: minmax(145px, 1fr) minmax(110px, .7fr) auto; }
  .classroom-art { width: 111%; margin-left: -5.5%; }
  .shop { grid-template-columns: 1fr 1fr; }
  .rate-readout { grid-column: 1 / -1; grid-row: 1; grid-template-columns: 1fr auto 1fr auto; min-height: 52px; }
  .rate-readout i { transform: none; }
  .upgrade-card { grid-row: 2; }
}

@media (min-width: 901px) and (max-height: 1050px) {
  .game-shell { width: min(100%, 1240px, calc(184.5vh - 553.5px)); }
}

@media (max-width: 650px) {
  .game-shell { padding: max(8px, env(safe-area-inset-top)) 7px max(12px, env(safe-area-inset-bottom)); }
  .topbar { align-items: center; gap: 10px; padding-bottom: 8px; }
  .back-link { font-size: .5rem; }
  .topbar h1 { font-size: 2rem; }
  .scoreboard { flex: 1; grid-template-columns: 1fr .8fr 46px; border-width: 3px; }
  .scoreboard > div { padding: 6px 8px; }
  .scoreboard > div + div, .sound-button { border-left-width: 2px; }
  .scoreboard strong { font-size: clamp(1.05rem, 5vw, 1.35rem); }
  .scoreboard span { font-size: .44rem; }
  .sound-button { width: 46px; }
  .sound-button svg { width: 20px; }
  .sound-button span { display: none; }
  .classroom { border-width: 4px; border-radius: 11px; }
  .classroom-art { width: 143%; max-width: none; height: 432px; min-height: 0; margin-left: -21.5%; object-fit: cover; }
  .status-ribbon { top: 8px; min-width: 165px; padding: 6px 9px; border-width: 3px; }
  .status-dot { width: 14px; height: 14px; border-width: 3px; }
  .status-ribbon strong { font-size: .69rem; }
  .status-ribbon small { font-size: .49rem; }
  .hold-zone { right: 8px; bottom: 8px; left: 16%; min-height: 66px; border-width: 4px; }
  .hold-copy { padding: 8px 10px; }
  .hold-copy b { font-size: 1.2rem; }
  .hold-copy small { font-size: .46rem; }
  .cps-pill { min-width: 79px; padding: 5px 8px; border-left-width: 3px; }
  .cps-pill b { font-size: 1.25rem; }
  .caught-flash strong { font-size: clamp(2.8rem, 15vw, 5rem); text-shadow: 4px 5px 0 var(--ink); }
  .shop { grid-template-columns: 1fr; gap: 8px; margin-top: 9px; }
  .rate-readout { grid-column: 1; grid-row: 2; grid-template-columns: 1fr auto 1fr; padding: 6px; border-width: 4px; }
  .rate-readout small { grid-column: 1 / -1; }
  .upgrade-card { grid-row: auto; grid-template-columns: 68px 1fr; border-width: 4px; }
  .upgrade-card:first-child { grid-row: 1; }
  .upgrade-card:last-child { grid-row: 3; }
  .upgrade-icon { border-right-width: 3px; }
  .upgrade-icon svg { width: 55px; }
  .upgrade-copy { padding: 8px 9px 7px; }
  .upgrade-copy h2 { font-size: .84rem; }
  .upgrade-copy p { font-size: .58rem; }
  .upgrade-stats strong { font-size: 1.2rem; }
  .buy-button { min-height: 43px; border-top-width: 3px; padding: 6px 9px; }
  .footer-line { font-size: .45rem; }
  .footer-line span:nth-child(2) { display: none; }
  .intro-card, .win-card { border-width: 5px; }
  .intro-card h2 { font-size: clamp(2rem, 12vw, 3.4rem); }
  .intro-card h2 em { display: block; font-size: .82em; }
  .win-actions { grid-template-columns: 1fr; }
  .win-actions button { min-height: 48px; }
}

@media (max-width: 390px) {
  .topbar h1 { font-size: 1.65rem; }
  .scoreboard { grid-template-columns: 1fr .8fr 40px; }
  .scoreboard > div { padding-inline: 5px; }
  .scoreboard strong { font-size: .98rem; }
  .classroom-art { height: 402px; }
  .hold-zone { left: 6%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .001ms !important; }
  .classroom[data-teacher="warning"] .status-ribbon { outline: 6px solid #fff; }
  .classroom[data-teacher="watching"] .teacher-front { display: block; }
}
