/* Slam Book: bubblegum yearbook. Ink outlines, sticker items on notebook paper. */
@font-face {
  font-family: "Nunito Sans";
  src: url("/site/brand/NunitoSans-Black.woff2") format("woff2");
  font-weight: 900;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("/site/brand/DMSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("/site/brand/DMSans-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
:root {
  --ink: #2b1d2e;
  --pink: #ff4f9a;
  --blush: #ff9ec7;
  --lilac: #b388ff;
  --grape: #6c3fc7;
  --sun: #ffd23f;
  --teal: #2ec4b6;
  --mint: #9be8c8;
  --paper: #fff8ec;
  --bg: #ffe3f0;
  --line: rgba(43, 29, 46, 0.1);
  --sticker: drop-shadow(1.5px 0 0 #fff) drop-shadow(-1.5px 0 0 #fff)
    drop-shadow(0 1.5px 0 #fff) drop-shadow(0 -1.5px 0 #fff)
    drop-shadow(0 3px 2px rgba(43, 29, 46, 0.3));
  --display: "Nunito Sans", "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "DM Sans", system-ui, sans-serif;
  --cell: 48px;
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  font: 400 15px/1.4 var(--body);
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 210, 63, 0.35), transparent 32%),
    radial-gradient(circle at 90% 90%, rgba(179, 136, 255, 0.35), transparent 40%),
    linear-gradient(160deg, #ffd6e8, #f3e3ff 60%, #ffe9d6);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  -webkit-touch-callout: none;
}
/* Painted art is <img>: a long press must never open the browser's image menu
   or start a native image drag (Android Chrome, iOS Safari). */
img {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}
#app img {
  pointer-events: none;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
svg {
  display: block;
}
/* The current room, faint behind everything: you're playing inside the school. */
#room-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.28;
  pointer-events: none;
}
#room-bg svg {
  width: 100%;
  height: 100%;
}
#room-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 214, 232, 0.55), rgba(243, 227, 255, 0.35) 50%, rgba(255, 233, 214, 0.6));
}
#app {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right))
    max(6px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  gap: 6px;
  max-width: 1400px;
  margin: 0 auto;
}

/* ---------- HUD ---------- */
.hud {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}
.room-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 3px 0 var(--ink);
  min-width: 0;
}
.room-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}
.room-thumb {
  width: 46px;
  height: 30px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--ink);
  background: var(--paper);
}
.room-thumb svg {
  width: 100%;
  height: 100%;
}
.room-meta {
  display: grid;
  gap: 3px;
  text-align: left;
  font: 900 12px/1 var(--display);
  white-space: nowrap;
}
.bar {
  display: block;
  height: 7px;
  border-radius: 99px;
  background: rgba(43, 29, 46, 0.12);
  overflow: hidden;
  min-width: 56px;
}
.bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--pink);
  border-radius: inherit;
  transition: width 400ms ease;
}
.badge {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--pink);
  color: #fff;
  border: 2px solid var(--ink);
  font: 900 13px/18px var(--display);
  text-align: center;
  animation: bob 1.2s ease-in-out infinite;
}
.room-btn.nudge {
  animation: nudge 1.1s ease-in-out infinite;
}
@keyframes nudge {
  50% {
    transform: scale(1.06);
    box-shadow: 0 3px 0 var(--ink), 0 0 0 6px rgba(255, 79, 154, 0.35);
  }
}
@keyframes bob {
  50% {
    transform: translateY(-3px);
  }
}
.stats {
  display: flex;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}
.stat {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px 3px 3px;
  border-radius: 99px;
  background: #fff;
  border: 2px solid var(--ink);
  font: 900 14px/1 var(--display);
  flex: none;
  position: relative;
}
button.stat {
  box-shadow: 0 2px 0 var(--ink);
}
.stat .glyph {
  width: 22px;
  height: 22px;
  flex: none;
}
.stat small {
  position: absolute;
  bottom: -13px;
  left: 50%;
  transform: translateX(-50%);
  font: 700 10px/1 var(--body);
  color: var(--grape);
  white-space: nowrap;
}
.stat.level .bar {
  min-width: 26px;
  width: 26px;
  height: 5px;
}
.stat.level .bar i {
  background: var(--sun);
}
.glyph {
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  vertical-align: -0.25em;
}
.glyph svg {
  width: 100%;
  height: 100%;
}
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 2.5px solid var(--ink);
  background: #fff;
  box-shadow: 0 3px 0 var(--ink);
  display: grid;
  place-items: center;
  padding: 0;
}
.icon-btn svg {
  width: 22px;
  stroke: var(--ink);
  stroke-width: 2.6;
  stroke-linecap: round;
  fill: none;
}

/* ---------- play area ---------- */
.play {
  display: grid;
  min-height: 0;
}
.table {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}
/* Explicit rows: the goal bar is sometimes hidden, and the rest must not shift up. */
/* Every row around the board has a fixed height, so selecting, serving or a
   new order never resizes or moves the board. */
:root {
  --orders-h: 82px;
  --strip-h: 62px;
  --info-h: 92px;
}
.table > .strip {
  height: var(--strip-h);
}
.strip > * {
  height: 100%;
}
.table > .orders {
  grid-row: 1;
  height: var(--orders-h);
}
.table > .orders > .order {
  height: 100%;
}
.table > .strip {
  grid-row: 2;
}
.table > .board-wrap {
  grid-row: 3;
}
.table > .info {
  grid-row: 4;
  height: var(--info-h);
  overflow: hidden;
}
.table {
  gap: 6px;
  min-height: 0;
}
.room {
  display: none;
  min-height: 0;
  overflow: auto;
}
body.view-room .room {
  display: block;
}
body.view-room .table {
  display: none;
}

/* ---------- goal bar, backpack and event ---------- */
.strip {
  display: flex;
  gap: 6px;
  min-width: 0;
}
.strip > .goal {
  flex: 1;
  min-width: 0;
}
#bag-btn {
  margin-left: auto;
}
.side-btn {
  position: relative;
  flex: none;
  width: 58px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 1px;
  padding: 3px 2px 5px;
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 3px 0 var(--ink);
}
.side-btn[hidden] {
  display: none;
}
.side-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}
.side-icon {
  width: 32px;
  height: 32px;
  filter: var(--sticker);
}
.side-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.side-btn small {
  font: 900 11px/1 var(--display);
  white-space: nowrap;
}
.side-btn.full small {
  color: var(--pink);
}
.side-btn.event {
  background: #fff4c7;
}
.side-bar {
  width: 40px;
  height: 5px;
  border-radius: 99px;
  background: rgba(43, 29, 46, 0.14);
  overflow: hidden;
}
.side-bar i {
  display: block;
  height: 100%;
  background: var(--pink);
  transition: width 400ms ease;
}
.side-btn.drop-ok {
  box-shadow:
    0 3px 0 var(--ink),
    0 0 0 4px var(--pink);
  transform: scale(1.08);
}
.side-btn.drop-no {
  opacity: 0.55;
}
.acts {
  display: flex;
  gap: 4px;
  align-items: center;
}
.btn.icon-only {
  padding: 2px 6px;
}
.btn.icon-only img {
  width: 26px;
  height: 26px;
  display: block;
  filter: var(--sticker);
}
/* Backpack and event dialogs */
.slots {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin: 10px 0;
}
.slot {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 2px dashed rgba(43, 29, 46, 0.25);
  background: rgba(43, 29, 46, 0.04);
  padding: 4px;
}
.slot.full {
  border: 2.5px solid var(--ink);
  background: #fff;
  box-shadow: 0 2px 0 var(--ink);
  cursor: pointer;
}
.slot.full img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: var(--sticker);
}
.slot.buy {
  border: 2.5px solid var(--ink);
  background: #fff4c7;
  font: 900 20px/1 var(--display);
  cursor: pointer;
}
.slot.buy small {
  display: flex;
  align-items: center;
  font-size: 11px;
}
.slot.buy .glyph,
.milestones .glyph,
.ev-points .glyph {
  width: 16px;
  height: 16px;
}
.slot.locked {
  opacity: 0.35;
  border-style: solid;
}
.ev-points {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}
.ev-points .bar {
  flex: 1;
  height: 10px;
  border-radius: 99px;
  background: rgba(43, 29, 46, 0.12);
  overflow: hidden;
}
.ev-points .bar i {
  display: block;
  height: 100%;
  background: var(--pink);
}
.milestones {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: grid;
  gap: 4px;
  text-align: left;
}
.milestones li {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 10px;
  background: #fff4c7;
  font-size: 13px;
}
.milestones li b {
  font: 900 14px/1 var(--display);
  color: var(--pink);
}
.milestones li span {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 6px;
}
.milestones li.todo {
  background: rgba(43, 29, 46, 0.05);
}
.milestones li.got {
  background: #d9f5ee;
}
.milestones li i {
  font-style: normal;
  font-weight: 900;
  color: var(--teal);
}
.goal {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "label tea" "name tea" "bar bar";
  align-items: center;
  gap: 1px 10px;
  padding: 6px 12px 8px;
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 3px 0 var(--ink);
  text-align: left;
}
.goal[hidden] {
  display: none;
}
.goal:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}
.g-label {
  grid-area: label;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font: 900 10px/1.2 var(--display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pink);
}
.g-name {
  grid-area: name;
  font: 900 15px/1.2 var(--display);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.g-tea {
  grid-area: tea;
  display: flex;
  align-items: center;
  gap: 3px;
  font: 900 15px/1 var(--display);
}
.g-tea .glyph {
  width: 22px;
  height: 22px;
}
.g-sub {
  grid-area: bar;
  font-size: 12px;
  color: rgba(43, 29, 46, 0.72);
}
.g-bar {
  grid-area: bar;
  height: 8px;
  margin-top: 4px;
  border-radius: 99px;
  background: rgba(43, 29, 46, 0.12);
  overflow: hidden;
}
.g-bar i {
  display: block;
  height: 100%;
  background: var(--pink);
  border-radius: inherit;
  transition: width 400ms ease;
}
.goal.ready {
  background: #fff4c7;
  animation: nudge 1.1s ease-in-out infinite;
}
.goal.ready .g-bar i {
  background: var(--teal);
}
/* Wide screens show the room itself beside the board. */
@media (min-width: 900px) and (min-aspect-ratio: 1/1) and (min-height: 900px) {
  .goal {
    display: none;
  }
}

/* ---------- orders ---------- */
.orders {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  min-height: 70px;
}
.order {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: end;
  gap: 2px 4px;
  padding: 4px 6px 5px 2px;
  background: #fff;
  border: 2.5px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 3px 0 var(--ink);
  min-width: 0;
  overflow: hidden;
  cursor: pointer;
}
.order.arriving {
  animation: drop-in 380ms cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
@keyframes drop-in {
  from {
    transform: translateY(-18px) scale(0.85);
    opacity: 0;
  }
}
.order.ready {
  background: #fff4c7;
  box-shadow:
    0 3px 0 var(--ink),
    0 0 0 3px var(--sun);
  animation: ready 1.2s ease-in-out infinite;
}
.order.drop-ok {
  box-shadow:
    0 3px 0 var(--ink),
    0 0 0 4px var(--pink);
  transform: scale(1.04);
}
.order.drop-no {
  opacity: 0.6;
}
@keyframes ready {
  50% {
    transform: translateY(-3px);
  }
}
.order-leaving {
  position: fixed;
  z-index: 60;
  margin: 0;
  pointer-events: none;
  animation: none;
}
.order .who {
  grid-row: span 2;
  align-self: end;
  width: 44px;
  height: 56px;
  margin: -2px 0 -6px;
  border-radius: 0;
  background: none;
  border: 0;
}
.order .who svg {
  width: 100%;
  height: 100%;
}
.wants {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  min-width: 0;
  padding: 3px;
  border-radius: 12px;
  background: var(--paper);
  border: 2px solid rgba(43, 29, 46, 0.18);
  align-self: start;
  justify-self: start;
}
.wants::before {
  content: "";
  position: absolute;
  left: -7px;
  bottom: 6px;
  border: 6px solid transparent;
  border-right-color: rgba(43, 29, 46, 0.18);
  border-left: 0;
}
.want {
  position: relative;
  width: 30px;
  height: 30px;
  flex: none;
}
.want svg {
  width: 100%;
  height: 100%;
  filter: var(--sticker);
}
.want.got::after {
  content: "";
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--teal)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 6.2l2 2 4-4.4' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / 100% no-repeat;
}
/* Two-item orders: the items sit side by side (the bubble may overlap the
   face) so the Done button always has a row inside the fixed-height card. */
.order.pair .wants {
  flex-wrap: nowrap;
  justify-self: end;
  z-index: 1;
}
.order.pair .want {
  width: 28px;
  height: 28px;
}
.reward {
  font: 900 12px/1 var(--display);
  display: flex;
  align-items: center;
  gap: 2px;
  color: var(--grape);
}
.reward .glyph {
  width: 16px;
  height: 16px;
}
/* At least as wide as its column; when "Done!" needs more, it grows left over
   the face instead of past the card's edge. */
.serve {
  justify-self: end;
  width: max-content;
  min-width: 100%;
  position: relative;
  z-index: 1;
  white-space: nowrap;
  text-align: center;
  padding: 3px 6px;
  border-radius: 99px;
  border: 2px solid var(--ink);
  background: var(--teal);
  color: #fff;
  font: 900 13px/1.2 var(--display);
  box-shadow: 0 2px 0 var(--ink);
  text-shadow: 0 1px 0 rgba(43, 29, 46, 0.4);
}

/* ---------- board ---------- */
.board-wrap {
  display: grid;
  place-items: center;
  min-height: 0;
  min-width: 0;
}
.board {
  display: grid;
  grid-template-columns: repeat(7, var(--cell));
  grid-auto-rows: var(--cell);
  padding: 6px;
  border-radius: 18px;
  border: 3px solid var(--ink);
  background:
    linear-gradient(90deg, transparent 22px, rgba(255, 79, 154, 0.35) 22px 24px, transparent 24px) 0 0 / 100% 100% no-repeat,
    var(--paper);
  box-shadow: 0 5px 0 var(--ink), 0 14px 30px -14px rgba(108, 63, 199, 0.5);
  touch-action: none;
}
.cell {
  position: relative;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(var(--line), var(--line)) bottom / 100% 1px no-repeat;
}
.cell:nth-child(odd) {
  background-color: rgba(179, 136, 255, 0.07);
}
.piece {
  width: 92%;
  height: 92%;
  filter: var(--sticker);
  transition: opacity 120ms;
}
.piece svg {
  width: 100%;
  height: 100%;
}
.cell.gen .piece {
  width: 100%;
  height: 100%;
  animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe {
  50% {
    transform: scale(1.05);
  }
}
.cell.soot .piece {
  filter: grayscale(0.85) brightness(0.55) contrast(1.1) var(--sticker);
}
.soot-fx {
  position: absolute;
  inset: 2%;
  pointer-events: none;
}
.soot-fx svg,
.max svg {
  width: 100%;
  height: 100%;
}
.max {
  position: absolute;
  top: -3px;
  left: 50%;
  width: 20px;
  height: 20px;
  transform: translateX(-50%) rotate(-8deg);
  filter: drop-shadow(0 1px 0 #fff);
  pointer-events: none;
}
.cell.box .piece {
  width: 88%;
  height: 88%;
}
.cell:focus-visible {
  outline: 3px solid var(--grape);
  outline-offset: -3px;
}
.cell.selected {
  background-color: rgba(255, 210, 63, 0.4);
  box-shadow: inset 0 0 0 2.5px var(--sun);
}
.cell.ready .check {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--teal)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 6.2l2 2 4-4.4' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / 100% no-repeat;
}
.cell.lifted .piece {
  opacity: 0.25;
}
.cell.target {
  box-shadow: inset 0 0 0 2.5px rgba(43, 29, 46, 0.25);
}
.cell.merge {
  background-color: rgba(46, 196, 182, 0.3);
  box-shadow: inset 0 0 0 3px var(--teal);
}
.cell.hint .piece {
  animation: hint 0.9s ease-in-out infinite;
}
@keyframes hint {
  50% {
    transform: scale(1.14) rotate(-4deg);
  }
}
.ghost,
.fly {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  filter: var(--sticker);
}
.ghost {
  transform: translate(-50%, -60%);
}
.ghost svg,
.fly svg {
  width: 100%;
  height: 100%;
}
.burst-fx {
  position: fixed;
  z-index: 45;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: burst 600ms cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}
.burst-fx svg {
  width: 100%;
  height: 100%;
}
@keyframes burst {
  from {
    transform: translate(-50%, -50%) scale(0.3) rotate(-20deg);
    opacity: 1;
  }
  60% {
    opacity: 1;
  }
  to {
    transform: translate(-50%, -50%) scale(1.1) rotate(10deg);
    opacity: 0;
  }
}
.fly-glyph {
  position: fixed;
  z-index: 75;
  width: 26px;
  height: 26px;
  pointer-events: none;
  filter: var(--sticker);
}
.fly-glyph svg {
  width: 100%;
  height: 100%;
}
.ring {
  position: fixed;
  z-index: 40;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  border: 3px solid var(--sun);
  pointer-events: none;
  animation: ring 480ms ease-out forwards;
}
@keyframes ring {
  to {
    transform: scale(7);
    opacity: 0;
    border-width: 1px;
  }
}
.hand {
  position: fixed;
  z-index: 60;
  width: 42px;
  height: 42px;
  margin: -6px 0 0 -12px;
  pointer-events: none;
  display: none;
  filter: drop-shadow(0 3px 2px rgba(43, 29, 46, 0.35));
}
.hand.on {
  display: block;
}

/* ---------- info bar ---------- */
.info {
  min-height: 60px;
  padding: 6px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.85);
  border: 2.5px solid var(--ink);
  display: grid;
  gap: 4px;
  align-content: center;
}
.tip {
  margin: 0;
  font-size: 14px;
  text-align: center;
}
.sel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.sel-icon {
  width: 36px;
  height: 36px;
  filter: var(--sticker);
}
.sel-icon svg {
  width: 100%;
  height: 100%;
}
.sel-text {
  display: grid;
  min-width: 0;
}
.sel-text b {
  font: 900 15px/1.2 var(--display);
}
.sel-text small {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 12px;
  color: rgba(43, 29, 46, 0.72);
}
.chain {
  display: flex;
  gap: 3px;
  justify-content: center;
}
.chain span {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font: 900 12px/1 var(--display);
  color: rgba(43, 29, 46, 0.4);
  background: rgba(43, 29, 46, 0.05);
}
.chain span svg {
  width: 100%;
  height: 100%;
}
.chain span.me {
  background: rgba(255, 210, 63, 0.55);
  box-shadow: inset 0 0 0 2px var(--ink);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 18px;
  border-radius: 14px;
  border: 2.5px solid var(--ink);
  background: #fff;
  box-shadow: 0 3px 0 var(--ink);
  font: 900 15px/1.1 var(--display);
}
.btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}
.btn.primary {
  background: var(--pink);
  color: #fff;
  text-shadow: 0 1px 0 rgba(43, 29, 46, 0.35);
}
.btn.danger {
  background: #ff4d4d;
  color: #fff;
}
.btn.disabled {
  background: #eee6f0;
  color: rgba(43, 29, 46, 0.55);
}
.btn.plain {
  background: transparent;
  box-shadow: none;
}
.btn.small {
  padding: 5px 10px;
  font-size: 13px;
  border-radius: 10px;
}
.btn .glyph {
  width: 18px;
  height: 18px;
}

/* ---------- room ---------- */
.room-card {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 5px 0 var(--ink);
}
.eyebrow {
  margin: 0;
  font: 900 11px/1.2 var(--display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pink);
}
.room-card h2 {
  margin: 2px 0 8px;
  font: 900 22px/1.1 var(--display);
}
.scene {
  border-radius: 14px;
  overflow: hidden;
  border: 2.5px solid var(--ink);
  aspect-ratio: 400 / 260;
  background: var(--paper);
}
.scene svg {
  width: 100%;
  height: 100%;
}
.progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 6px;
  font: 900 13px/1 var(--display);
}
.progress .bar {
  flex: 1;
  height: 10px;
}
.tasks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.tasks li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px 7px 12px;
  border-radius: 12px;
  border: 2px solid rgba(43, 29, 46, 0.15);
  font-weight: 700;
}
.tasks li.next {
  border: 2.5px solid var(--ink);
  background: #fff4c7;
}
.tasks li.done {
  color: rgba(43, 29, 46, 0.45);
  text-decoration: line-through;
}
.tasks li.later {
  color: rgba(43, 29, 46, 0.55);
}
.t-done {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--teal);
  color: #fff;
  font-weight: 900;
  text-decoration: none;
}
.t-cost {
  font: 900 13px/1 var(--display);
  display: flex;
  align-items: center;
  gap: 2px;
}
.t-cost .glyph {
  width: 18px;
  height: 18px;
}
.to-board {
  width: 100%;
  margin-top: 10px;
}

/* ---------- wide screens: room beside the board ---------- */
@media (min-width: 900px) and (min-aspect-ratio: 1/1) and (min-height: 900px) {
  .play {
    grid-template-columns: minmax(300px, 1fr) minmax(0, 1.25fr);
    gap: 16px;
  }
  .room,
  body.view-room .room {
    display: block;
  }
  .table,
  body.view-room .table {
    display: grid;
  }
  .to-board {
    display: none;
  }
  .room-card {
    margin: 0;
  }
  .orders {
    max-width: 640px;
    width: 100%;
    justify-self: center;
  }
  .info,
  .strip {
    max-width: 640px;
    width: 100%;
    justify-self: center;
  }
}

/* ---------- short landscape (phones on their side): board beside orders ---------- */
/* Landscape screens under 900px tall (phones on their side, tablets, laptops):
   the board takes the full height on the right, orders and info beside it,
   and the room opens from its button. Taller wide screens show the room too. */
@media (orientation: landscape) and (max-height: 899px) {
  #app {
    gap: 4px;
    padding-top: max(4px, env(safe-area-inset-top));
  }
  .play {
    grid-template-columns: minmax(0, 1fr);
  }
  .room,
  body.view-room .table {
    display: none;
  }
  body.view-room .room {
    display: block;
  }
  .table,
  body:not(.view-room) .table {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: minmax(0, 1fr) auto auto;
    column-gap: 10px;
  }
  .to-board {
    display: flex;
  }
  /* Three orders side by side, as on portrait phones: all three stay in view
     (stacked, the third scrolled out of sight), and full-height cards keep
     Done! and the Tea reward inside them. */
  .table > .orders {
    height: auto;
    grid-column: 1;
    grid-row: 1;
    grid-auto-rows: max-content;
    align-content: start;
    max-width: none;
    overflow: auto;
  }
  .table > .orders > .order {
    height: auto;
    min-height: 76px;
  }
  .table > .board-wrap {
    grid-column: 2;
    grid-row: 1 / span 3;
  }
  .table > .info {
    grid-column: 1;
    grid-row: 3;
    max-width: none;
  }
  .table > .strip {
    grid-column: 1;
    grid-row: 2;
  }
  .room-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0 12px;
    max-width: none;
  }
  .room-card > .eyebrow,
  .room-card > h2 {
    grid-column: 1 / -1;
  }
  .room-card .scene {
    grid-row: 3 / span 3;
  }
}

/* ---------- toast & floating rewards ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(max(6px, env(safe-area-inset-bottom)) + 76px);
  transform: translate(-50%, 20px);
  opacity: 0;
  z-index: 80;
  max-width: min(92vw, 460px);
  padding: 8px 14px;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
  transition:
    opacity 180ms,
    transform 180ms;
}
.toast.on {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast.has-action.on {
  pointer-events: auto;
}
.toast button {
  margin-left: 8px;
  padding: 3px 12px;
  border-radius: 99px;
  border: 2px solid #fff;
  background: var(--pink);
  color: #fff;
  font: 900 13px/1.2 var(--display);
}
.float {
  position: fixed;
  z-index: 70;
  transform: translate(-50%, 0);
  white-space: nowrap;
  font: 900 15px/1 var(--display);
  color: var(--ink);
  text-shadow: 0 0 3px #fff, 0 0 6px #fff;
  pointer-events: none;
  animation: float 1.2s ease-out forwards;
}
@keyframes float {
  to {
    transform: translate(-50%, -44px);
    opacity: 0;
  }
}
.spark {
  position: fixed;
  z-index: 130;
  width: 14px;
  height: 14px;
  pointer-events: none;
  background: var(--sun);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  animation: spark 1s ease-out both;
}
@keyframes spark {
  from {
    transform: scale(0) rotate(0);
  }
  40% {
    transform: scale(1.4) rotate(45deg);
  }
  to {
    transform: scale(0) rotate(90deg);
    opacity: 0;
  }
}

/* ---------- modals ---------- */
.layer > * {
  z-index: 100;
}
.modal-back {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(43, 29, 46, 0.45);
  animation: fade 160ms ease-out;
}
.modal-back.out {
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.modal {
  width: min(420px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 18px;
  border-radius: 22px;
  border: 3px solid var(--ink);
  background: #fff;
  box-shadow: 0 6px 0 var(--ink);
  animation: pop-in 260ms cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
.modal.wide {
  width: min(560px, 100%);
}
@keyframes pop-in {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
}
.modal h2 {
  margin: 0 0 6px;
  font: 900 24px/1.1 var(--display);
}
.modal p {
  margin: 0 0 10px;
}
.modal.center {
  text-align: center;
}
.modal .actions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.burst {
  width: 84px;
  height: 84px;
  margin: 0 auto 6px;
  filter: var(--sticker);
  animation: wobble 1.6s ease-in-out infinite;
}
@keyframes wobble {
  25% {
    transform: rotate(-8deg) scale(1.05);
  }
  75% {
    transform: rotate(8deg) scale(1.05);
  }
}
.gains {
  font: 900 18px/1.2 var(--display);
}
.gains .glyph {
  width: 24px;
  height: 24px;
}
.room-done {
  border-radius: 14px;
  overflow: hidden;
  border: 2.5px solid var(--ink);
  margin-bottom: 12px;
}
.room-done svg {
  width: 100%;
  height: auto;
  aspect-ratio: 400 / 260;
}
.page-paper {
  padding: 18px 16px;
  margin: 0 0 10px;
  border-radius: 6px;
  background:
    repeating-linear-gradient(transparent 0 26px, rgba(255, 79, 154, 0.25) 26px 27px),
    #ffe3f0;
  border: 2.5px solid var(--ink);
  transform: rotate(-1.5deg);
}
.secret {
  font: 700 18px/1.5 var(--body);
  font-style: italic;
}
.field {
  display: grid;
  gap: 4px;
  margin: 8px 0;
  font-weight: 700;
  font-size: 13px;
}
.field input,
.field textarea {
  font: 400 16px/1.3 var(--body);
  padding: 10px 12px;
  border-radius: 12px;
  border: 2.5px solid var(--ink);
  background: var(--paper);
  -webkit-user-select: text;
  user-select: text;
  resize: vertical;
}
.field input:focus,
.field textarea:focus {
  outline: 3px solid var(--blush);
  outline-offset: 1px;
}
.error {
  color: #d62f6d;
  font-weight: 700;
}
.acct {
  font-size: 14px;
  color: rgba(43, 29, 46, 0.75);
}
.thumbs {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.thumb {
  font-size: 28px;
  width: 64px;
  height: 56px;
  border-radius: 14px;
  border: 2.5px solid var(--ink);
  background: #fff;
}
.thumb.on {
  background: var(--sun);
}
.small {
  font-size: 13px;
  color: rgba(43, 29, 46, 0.7);
}
.streak {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 4px 0 8px;
}
.streak span {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: #eee6f0;
}
.streak span.on {
  background: var(--pink);
}
.album {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
  counter-reset: page;
}
.album li {
  counter-increment: page;
  padding: 10px 12px 10px 38px;
  position: relative;
  border-radius: 6px;
  border: 2px solid var(--ink);
  background:
    repeating-linear-gradient(transparent 0 22px, rgba(255, 79, 154, 0.22) 22px 23px),
    #ffe3f0;
  font-style: italic;
}
.album li::before {
  content: counter(page);
  position: absolute;
  left: 10px;
  top: 9px;
  font: 900 14px/1 var(--display);
  font-style: normal;
  color: var(--pink);
}
.album li.missing {
  background: #f3eef5;
  color: rgba(43, 29, 46, 0.45);
  border-style: dashed;
}
.school {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.school li {
  display: grid;
  gap: 2px;
}
.school .room-art {
  aspect-ratio: 400 / 260;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  overflow: hidden;
  background: var(--paper);
  display: grid;
  place-items: center;
}
.school .room-art svg {
  width: 100%;
  height: 100%;
}
.school .locked .room-art {
  background: repeating-linear-gradient(-45deg, #eee6f0 0 10px, #f7f2f8 10px 20px);
  border-style: dashed;
  font: 900 28px/1 var(--display);
  color: rgba(43, 29, 46, 0.3);
}
.school b {
  font: 900 14px/1.2 var(--display);
}
.school small {
  font-size: 12px;
  color: rgba(43, 29, 46, 0.65);
}
.school .fixed small {
  color: var(--teal);
  font-weight: 700;
}
.howto {
  padding-left: 20px;
  display: grid;
  gap: 8px;
}

/* ---------- story scenes ---------- */
.talk {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  align-items: end;
  background: linear-gradient(transparent 30%, rgba(43, 29, 46, 0.55));
  cursor: pointer;
  animation: fade 200ms ease-out;
  padding: 0 max(12px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left));
}
.talk.out {
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms;
}
.skip {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  padding: 6px 14px;
  border-radius: 99px;
  border: 2px solid var(--ink);
  background: #fff;
  font: 900 13px/1.2 var(--display);
}
.stage-row {
  width: min(680px, 100%);
  margin: 0 auto;
}
.speaker {
  display: grid;
  align-items: end;
  grid-template-columns: minmax(140px, min(44%, 230px)) minmax(0, 1fr);
}
.speaker.right {
  grid-template-columns: minmax(0, 1fr) minmax(140px, min(44%, 230px));
}
.speaker.right .portrait {
  order: 2;
}
@keyframes slide {
  from {
    transform: translateY(16px);
    opacity: 0;
  }
}
.portrait svg {
  width: 100%;
  max-height: 42dvh;
  filter: drop-shadow(0 4px 0 rgba(43, 29, 46, 0.25));
}
.bubble {
  position: relative;
  margin-bottom: 14px;
  padding: 18px 16px 12px;
  border-radius: 18px;
  border: 3px solid var(--ink);
  background: #fff;
  box-shadow: 0 5px 0 var(--ink);
  font-size: 17px;
}
.bubble p {
  margin: 0;
}
.name {
  position: absolute;
  top: -14px;
  left: 12px;
  padding: 3px 10px;
  border-radius: 99px;
  border: 2.5px solid var(--ink);
  background: var(--c);
  color: var(--ink);
  font: 900 13px/1.2 var(--display);
}
.name {
  background: color-mix(in srgb, var(--c) 45%, #fff);
}
.tap {
  display: block;
  margin-top: 6px;
  text-align: right;
  font: 700 11px/1 var(--body);
  color: rgba(43, 29, 46, 0.45);
}
.caption {
  margin-bottom: 18vh;
  padding: 18px;
  border-radius: 16px;
  background: var(--ink);
  color: #fff;
  text-align: center;
  font: 700 18px/1.45 var(--body);
  animation: slide 240ms ease-out;
}
.caption p {
  margin: 0;
}
.caption .tap {
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
}

/* ---------- tall phones: roomier orders ---------- */
@media (min-height: 700px) and (max-width: 899px) {
  :root {
    --orders-h: 96px;
  }
  .order {
    padding: 8px;
    border-radius: 16px;
  }
  .order .who {
    width: 52px;
    height: 66px;
  }
  .want {
    width: 36px;
    height: 36px;
  }
}

/* ---------- story backdrops & the renovation reveal ---------- */
.talk .backdrop {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}
.talk.has-backdrop {
  background: #2b1d2e;
}
.talk.has-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(transparent 45%, rgba(43, 29, 46, 0.6));
  pointer-events: none;
}
.scene-art {
  position: absolute;
  inset: 0;
  animation: scene-in 700ms ease-out both;
}
.scene-art.leaving {
  animation: scene-out 500ms ease-in forwards;
}
.scene-art svg {
  width: 100%;
  height: 100%;
}
@keyframes scene-in {
  from {
    opacity: 0;
    transform: scale(1.06);
  }
}
@keyframes scene-out {
  to {
    opacity: 0;
  }
}
.reveal {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 56px 12px min(36dvh, 290px);
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 210, 63, 0.35), transparent 60%),
    linear-gradient(160deg, #ffd6e8, #f3e3ff 60%, #ffe9d6);
}
.reveal-rays {
  position: absolute;
  left: 50%;
  top: 40%;
  width: 180vmax;
  height: 180vmax;
  margin: -90vmax 0 0 -90vmax;
  background: repeating-conic-gradient(rgba(255, 255, 255, 0.45) 0 9deg, transparent 9deg 18deg);
  opacity: 0;
  transition: opacity 600ms;
  animation: rays 24s linear infinite;
}
.reveal.done .reveal-rays {
  opacity: 1;
}
@keyframes rays {
  to {
    transform: rotate(1turn);
  }
}
.reveal-room {
  position: relative;
  flex-shrink: 0;
  width: min(100%, 880px, calc((100dvh - 330px) * 400 / 260));
  min-width: min(100%, 320px);
  border: 4px solid var(--ink);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 8px 0 var(--ink);
  background: var(--paper);
  animation: pop-in 420ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.reveal-title {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px 8px 8px;
  border: 3px solid var(--ink);
  border-radius: 99px;
  background: #fff;
  box-shadow: 0 4px 0 var(--ink);
  font: 900 18px/1.1 var(--display);
  opacity: 0;
  transform: scale(0.6);
}
.reveal.done .reveal-title {
  animation: title-pop 420ms 250ms cubic-bezier(0.2, 0.9, 0.3, 1.4) forwards;
}
@keyframes title-pop {
  to {
    opacity: 1;
    transform: scale(1) rotate(-2deg);
  }
}
.reveal-title .tick {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  background: var(--teal);
  color: #fff;
  font-size: 16px;
}
.reveal-room svg {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 400 / 260;
}
.talk.revealing .stage-row,
.talk.revealing .skip {
  opacity: 0;
}
.talk.revealing {
  pointer-events: none;
}
.talk .stage-row {
  transition: opacity 200ms;
}
.speaker.enter .portrait {
  animation: enter-left 360ms cubic-bezier(0.2, 0.9, 0.3, 1.25) both;
}
.speaker.right.enter .portrait {
  animation-name: enter-right;
}
@keyframes enter-left {
  from {
    transform: translateX(-40px) scale(0.9);
    opacity: 0;
  }
}
@keyframes enter-right {
  from {
    transform: translateX(40px) scale(0.9);
    opacity: 0;
  }
}
.portrait.react {
  animation: react 320ms ease-out;
  transform-origin: 50% 100%;
}
@keyframes react {
  40% {
    transform: scale(1.06, 0.95) translateY(4px);
  }
}
.speaker:not(.enter) .bubble,
.speaker .bubble {
  animation: bubble-in 200ms ease-out;
}
@keyframes bubble-in {
  from {
    transform: scale(0.96);
    opacity: 0.4;
  }
}

/* ---------- first-time item banner ---------- */
.discover {
  position: fixed;
  left: 50%;
  top: calc(max(8px, env(safe-area-inset-top)) + 52px);
  z-index: 85;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 5px 0 var(--ink);
  transform: translateX(-50%);
  animation: discover-in 420ms cubic-bezier(0.2, 0.9, 0.3, 1.4);
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 24px);
}
.discover.top {
  background: #fff4c7;
}
.discover.out {
  opacity: 0;
  transform: translate(-50%, -12px);
  transition: all 300ms ease-in;
}
@keyframes discover-in {
  from {
    opacity: 0;
    transform: translate(-50%, -20px) scale(0.8);
  }
}
.d-icon {
  width: 46px;
  height: 46px;
  filter: var(--sticker);
  animation: wobble 1.2s ease-in-out infinite;
}
.d-icon svg {
  width: 100%;
  height: 100%;
}
.d-text {
  display: grid;
  line-height: 1.1;
  white-space: nowrap;
}
.d-text small {
  font: 900 11px/1.2 var(--display);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pink);
}
.d-text b {
  font: 900 17px/1.2 var(--display);
}
.d-bonus {
  font: 900 15px/1 var(--display);
  display: flex;
  align-items: center;
  gap: 2px;
}
.d-bonus .glyph {
  width: 20px;
  height: 20px;
}

/* ---------- narrow phones: the room thumbnail without its name ---------- */
@media (max-width: 460px) {
  .room-meta {
    display: none;
  }
  .room-btn {
    padding: 4px;
  }
}

/* ---------- phones: a compact top bar (five counters must fit) ---------- */
@media (max-width: 460px) {
  .stats {
    gap: 3px;
  }
  .stat {
    gap: 1px;
    padding-right: 5px;
    font-size: 12px;
    border-width: 1.5px;
  }
  .stat.level .bar {
    display: none;
  }
  .stat .glyph {
    width: 19px;
    height: 19px;
  }
}

/* ---------- small phones ---------- */
@media (max-width: 380px) {
  .hud {
    gap: 5px;
  }
  .stats {
    gap: 3px;
  }
  .stat {
    gap: 1px;
    padding-right: 5px;
    font-size: 12px;
    border-width: 1.5px;
  }
  .stat.level .bar {
    display: none;
  }
  .room-btn {
    padding: 3px;
  }
  .room-thumb {
    width: 38px;
    height: 26px;
  }
  .icon-btn {
    width: 36px;
    height: 36px;
  }
  .stat .glyph {
    width: 19px;
    height: 19px;
  }
  .room-meta {
    display: none;
  }
  .want {
    width: 26px;
    height: 26px;
  }
  .order .who {
    width: 36px;
    height: 46px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
/* With a backdrop, captions sit low so the scene stays visible. */
.talk.has-backdrop .caption {
  margin-bottom: 4px;
  background: rgba(43, 29, 46, 0.88);
  font-size: 16px;
  padding: 14px 16px;
}
@media (min-width: 700px) {
  .bubble {
    font-size: 19px;
  }
  .name {
    font-size: 14px;
  }
}
@media (orientation: landscape) and (max-height: 560px) {
  .reveal {
    padding: 10px 12px 128px;
    gap: 6px;
  }
  .reveal-room {
    width: calc((100dvh - 186px) * 400 / 260);
    min-width: 0;
    border-width: 3px;
    border-radius: 14px;
    box-shadow: 0 5px 0 var(--ink);
  }
  .reveal-title {
    font-size: 14px;
    padding: 3px 12px 3px 3px;
  }
  .reveal-title .tick {
    width: 22px;
    height: 22px;
    font-size: 12px;
  }
  .talk .bubble {
    font-size: 15px;
    padding: 14px 14px 8px;
    margin-bottom: 6px;
  }
  .portrait svg {
    max-height: 30dvh;
  }
}

/* ---------- painted art (assets/**.webp) ---------- */
img.art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}
img.room-img,
svg.room-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-user-drag: none;
}
#room-bg .room-img {
  position: absolute;
  inset: 0;
}
.reveal-room {
  aspect-ratio: 3 / 2;
}
.reveal-room .room-img {
  position: absolute;
  inset: 0;
}
.reveal-after {
  position: absolute;
  inset: 0;
  opacity: 0;
}
.scene,
.room-done,
.school .room-art {
  aspect-ratio: 3 / 2;
}
.room-done {
  position: relative;
}
.scene-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* On tall screens only a slice shows: keep the school sign in it. */
.scene-art img.s-school {
  object-position: 72% 50%;
}
img.face {
  display: block;
  width: 100%;
  height: auto;
  -webkit-user-drag: none;
  user-select: none;
}
.portrait img.face {
  max-height: 44dvh;
  object-fit: contain;
  object-position: 50% 100%;
  filter: drop-shadow(0 4px 0 rgba(43, 29, 46, 0.2));
}
.order .who img.face {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 4%;
}
/* Sources carry a small lightning badge so players learn "tap me". */
/* Source level (2+): a small number badge in the bottom corner. */
.cell.gen[data-lv]::after {
  content: attr(data-lv);
  position: absolute;
  left: 2px;
  bottom: 2px;
  z-index: 1;
  min-width: 30%;
  padding: 0 3px;
  border-radius: 99px;
  border: 2px solid var(--ink);
  background: var(--teal);
  color: #fff;
  font: 900 11px/1.35 var(--display);
  text-align: center;
  pointer-events: none;
}
.cell.gen::before {
  content: "";
  position: absolute;
  top: 1px;
  right: 1px;
  z-index: 1;
  width: 34%;
  height: 34%;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--sun)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M13.5 2 5 13.5h6L9.8 22 19 9.8h-6.2z' fill='%23fff' stroke='%232b1d2e' stroke-width='1.6' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / 72% no-repeat;
  pointer-events: none;
}

/* ---------- room peek: the room's painting in the board-first landscape layout ---------- */
.peek {
  display: none;
  position: relative;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 2.5px solid var(--ink);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
}
.peek-art,
.peek-art .room-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.peek-label {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: grid;
  gap: 1px;
  padding: 6px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid var(--ink);
  text-align: left;
}
.peek-label b {
  font: 900 15px/1.2 var(--display);
}
.peek-label small {
  font-size: 12px;
  color: rgba(43, 29, 46, 0.72);
}
.peek.ready {
  box-shadow:
    0 3px 0 var(--ink),
    0 0 0 3px var(--sun);
}
.peek:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}
/* Landscape screens with room to spare (tablets, laptops, desktop windows):
   orders on top, the room's painting filling the middle, goal and info below. */
@media (orientation: landscape) and (max-height: 899px) and (min-height: 480px) {
  .table,
  body:not(.view-room) .table {
    grid-template-rows: auto minmax(0, 1fr) auto auto;
  }
  .table > .orders {
    grid-row: 1;
  }
  .table > .peek {
    display: block;
    grid-column: 1;
    grid-row: 2;
  }
  .table > .strip {
    grid-row: 3;
  }
  .table > .info {
    grid-row: 4;
  }
  .table > .board-wrap {
    grid-row: 1 / span 4;
  }
}

/* ---------- bubbles, the Vending Machine, gems ---------- */
.cell.bubbled .piece {
  opacity: 0.85;
  transform: scale(0.8);
}
.bubble-fx {
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.95);
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.9) 0 8%, transparent 9%),
    radial-gradient(circle at 50% 50%, rgba(179, 136, 255, 0.05) 55%, rgba(92, 200, 255, 0.35) 72%, rgba(255, 79, 154, 0.35) 100%);
  box-shadow: 0 0 0 1.5px rgba(43, 29, 46, 0.35);
  pointer-events: none;
  animation: bubble-bob 2.4s ease-in-out infinite;
}
@keyframes bubble-bob {
  50% {
    transform: translateY(-3%) scale(1.03);
  }
}
.cell.vend[data-lv]::after {
  background: var(--pink);
}
.cell.vend[data-lv="0"]::after {
  background: rgba(43, 29, 46, 0.45);
}
.cell.vend::before {
  display: none;
}
@media (prefers-reduced-motion: reduce) {
  .bubble-fx {
    animation: none;
  }
}
