/* ==========================================================================
   STUDIO 2D — only studio.html uses this file (like css/admin.css).
   Mobile-first; tokens come from css/style.css.
   ========================================================================== */

.studio-page {
  height: 100vh;
  height: 100svh;
  height: 100dvh;   /* the address bar can hide (a full-screen sheet scrolled): no gap under the nav */
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--paper-cream);
}

.studio-page.st-lock { overflow: hidden; }

/* Things to press are not text to select: a click must not leave a text
   caret in a button (a browser in caret-browsing mode, F7, blinks one
   wherever the selection lands). Words worth copying stay selectable. */
.studio-page button, .studio-page [role="button"], .studio-page summary { -webkit-user-select: none; user-select: none; }

/* ---------- TOP BAR ---------- */
.st-top {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  padding-top: max(var(--space-2), env(safe-area-inset-top));
  background: var(--paper-white);
  border-bottom: 1px solid var(--paper-cream-warm);
  position: relative;
  z-index: 10;
}

.st-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--ink-dark);
  margin-right: auto;
}

.st-brand span { white-space: nowrap; }

/* A phone has no room for the name beside the three controls: with it the
   list link sat on the name and the language switch ran off the screen.
   The logo stands for it there; the name is still read out. */
@media (max-width: 479px) {
  .st-brand { position: relative; }
  .st-brand::after { content: ''; position: absolute; inset: -7px -4px; }   /* a finger-sized target around the logo */
  .st-brand span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}
/* the smallest phones (320px) */
@media (max-width: 359px) {
  .st-top { gap: var(--space-2); padding-left: var(--space-3); padding-right: var(--space-3); }
}

.st-list-link {
  font-size: var(--text-sm);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.st-long { display: none; }

/* "Hiệu ứng": on / off for walking + motion */
.st-motion {
  min-height: 36px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--sage-light); background: var(--paper-white); color: var(--ink-dark);
  font: inherit; font-size: var(--text-sm); white-space: nowrap;
}
.st-motion[aria-pressed="false"] { color: var(--ink-soft); text-decoration: line-through; }

/* ---------- STAGE ---------- */
.st {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.st-stage {
  position: relative;
  flex: 1;
  min-height: 320px;
  overflow: hidden;
  background: #efe3cf;
  touch-action: pan-y;        /* sideways drags are ours: swipe to walk */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;   /* a long press is not "save image" (Android: studio.js contextmenu) */
  /* Chrome on Android flashes the whole tappable stage blue otherwise */
  -webkit-tap-highlight-color: transparent;
}

/* The hand shows only over what a click opens (a lit piece, a tap box, a
   tag); elsewhere a click walks. */
.st-world {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
  cursor: default;
}

.st-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.st-bgx { position: absolute; top: 0; height: 100%; pointer-events: none; }

/* ---------- HOTSPOTS ----------
   A tap on a place (its box, its picture) walks there; its tag opens it
   (studio.js tap). So the box itself never looks like a button: under the
   mouse only its tag lights up. The rim is for the keyboard. */
.st-hot {
  position: absolute;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  cursor: default;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.st-hot:focus-visible {
  background: rgba(251, 246, 238, 0.18);
  box-shadow: 0 0 0 3px rgba(135, 150, 90, 0.75), 0 0 24px rgba(251, 246, 238, 0.6);
  outline: none;
}

.st-hot-label {
  position: absolute;
  z-index: 6;        /* its box lies under the pieces; the name stays on top */
  left: 50%;
  top: 0;
  transform: translate(-50%, -60%);
  white-space: nowrap;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--paper-white);
  border: 1.5px solid var(--kraft);
  color: var(--ink-dark);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.78rem;
  box-shadow: 0 2px 6px rgba(61, 74, 46, 0.18);
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
/* The label is what opens a spot; give it a finger-sized target. */
.st-hot-label::after {
  content: '';
  position: absolute;
  inset: -10px -6px;
}

.st-hot:hover .st-hot-label,
.st-hot:focus-visible .st-hot-label,
.st-hot-label:hover,
.st-hot-label.is-hover {
  background: var(--sage-deep);
  border-color: var(--sage-deep);
  color: var(--paper-white);
}

/* The place the character stands at (studio.js markHere): its tag lights up,
   with an arrow. */
.st-hot-label.is-here {
  background: var(--sage-deep);
  border-color: var(--sage-deep);
  color: var(--paper-white);
  padding-right: 24px;
}
.st-hot-label.is-here::before {
  content: '\203A';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-55%);
  font-size: 1.15em;
  line-height: 1;
}
/* a tap on a place's picture walks there: its tag nods (that is what opens it) */
.st-hot-label.is-nudge { animation: st-nudge 0.5s ease-in-out; }
@keyframes st-nudge { 50% { transform: translate(-50%, -60%) scale(1.14); } }

/* Where a tap landed (studio.js ring): a small ring that fades. Every tap
   that walks shows one, even a tap that doesn't move the character. */
.st-tap {
  position: absolute;
  z-index: 7;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border-radius: 50%;
  border: 2px solid var(--paper-white);
  box-shadow: 0 0 0 1.5px rgba(61, 74, 46, 0.45);
  pointer-events: none;
  animation: st-tap 0.45s ease-out forwards;
}
@keyframes st-tap { from { transform: scale(0.35); opacity: 1; } to { transform: scale(1.15); opacity: 0; } }

/* ---------- UDON + PLAYER ---------- */
/* Udon is a button: tap and Udon hops into the basket, then back out. */
.st-udon {
  position: absolute;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transform-origin: 50% 100%;
  animation: st-udon 6s ease-in-out infinite;
}
.st-udon img {
  position: absolute; left: 50%; bottom: 0;
  height: 100%; width: auto; max-width: none;
  transform: translateX(-50%);
  pointer-events: none;
}
.st-udon img[hidden] { display: none; }
/* asleep: the lying pose is wide and low */
.st-udon img[data-pose="ud-ngu"] { height: 62%; }
.st-udon.is-asleep { animation: none; }
.st-udon:focus-visible { outline: 3px solid var(--sage-deep); outline-offset: 4px; border-radius: 12px; }
.st-udon-ghost { position: absolute; z-index: 6; height: auto; max-width: none; pointer-events: none; }
.st-udon { cursor: grab; touch-action: none; }
.st-udon-ghost.is-dragging { z-index: 20; filter: drop-shadow(0 10px 12px rgba(61, 74, 46, 0.3)); cursor: grabbing; }
/* something held over the cart / basket: say "let go here" */
.st-stage.is-drop-ok .st-udon-ghost.is-dragging { filter: drop-shadow(0 0 10px rgba(135, 150, 90, 0.9)); }
/* Udon peeking out of the basket widget */
.st-udon-peek { position: absolute; left: 18%; bottom: 30%; width: 64%; height: auto; max-width: none; z-index: 25; pointer-events: none; }
.st-stage * { -webkit-tap-highlight-color: transparent; }

/* Owner's layout pieces (js/studio-layout.js): behind the character unless
   'front'. Plain ones never take a tap themselves; the tap boxes under them do.
   The stack inside .st-world, back to front (keep every number in step):
   tap boxes (no z-index: under every piece, so a tap finds a piece first) ·
   1 pieces behind the character, IN THE OWNER'S ORDER whatever their kind
   (a bag hung on a screen that is a "Khu vực" stays on it), memo pins ·
   4 the character · 5 pieces in front · 6 Udon and every name tag (tap box,
   zone, product) · 7 speech. */
.st-item { position: absolute; z-index: 1; pointer-events: none; object-fit: contain; max-width: none; }
.st-item.is-front { z-index: 5; }
.st-player { z-index: 4; }
.st-udon { z-index: 6; }
.st-wait .st-world { opacity: 0; }
.st-world { transition: opacity 0.25s ease; }

/* First load (html.st-boot, js/studio.js): the published layout is not in
   yet, so there is no scene to show. Udon says the door is opening instead
   of an empty wall, shown only when the wait is long enough to notice; the
   nav, "?" and the basket wait too, as none of them does anything yet. */
.st-loading { display: none; }
.st-boot .st-loading {
  position: absolute; inset: 0; z-index: 8; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-3); padding: var(--space-6); text-align: center; pointer-events: none;
  font-family: var(--font-display); font-weight: 700; color: var(--ink-soft);
  opacity: 0; animation: st-loading-in 0.4s ease-out 0.6s forwards;
}
.st-loading img { width: 72px; height: auto; }
.st-loading p { margin: 0; }
@keyframes st-loading-in { to { opacity: 1; } }
.st-boot .st-nav, .st-boot .st-help-b, .st-boot .gb-widget { visibility: hidden; }
@media (prefers-reduced-motion: reduce) {
  .st-boot .st-loading { animation: none; opacity: 1; }
}

/* Real product photos standing on the empty cabinet's shelves, in a thin
   wooden frame, like prints propped up for sale. */
.st-shelf-item {
  position: absolute;
  display: block;
  aspect-ratio: 1;
  transform: translateX(-50%);
  padding: 0;   /* % padding would be relative to the whole strip */
  background: #FBF6EE;
  border: 3px solid #B08452;
  border-radius: 3px;
  box-shadow: 2px 3px 4px rgba(61, 74, 46, 0.28);
  pointer-events: none;
}
.st-shelf-item img {
  display: block; box-sizing: border-box; width: 100%; height: 100%;
  object-fit: cover; border: 3px solid #FBF6EE;
}
/* products customers can pick up: tap for the card, drag to the basket */
.st-shelf-prod { pointer-events: auto; touch-action: none; z-index: 1; }
/* pieces the owner gave a "Loại" (studio.js thing()) */
.st-thing { pointer-events: auto; }
.st-thing[data-kind="story"] { touch-action: none; }
/* Lit by its own outline, never by its box: an uploaded picture can sit in a
   sheet much wider than itself. .is-over = the mouse is on the picture
   (studio.js over()); a piece reached with the keyboard gets a firmer rim. */
.st-thing.is-over[data-kind="story"], .st-shelf-prod.is-over {
  filter: brightness(1.06) drop-shadow(0 0 6px rgba(251, 246, 238, 0.9));
}
.st-thing.is-over { cursor: pointer; }
.st-thing.is-over[data-kind="story"], .st-shelf-prod.is-over { cursor: grab; }
.st-thing:focus-visible {
  outline: none;
  filter: brightness(1.06) drop-shadow(0 0 2px var(--sage-deep)) drop-shadow(0 0 7px rgba(251, 246, 238, 0.95));
}
.st-thing.is-lifted { opacity: 0.25; }
.st-board { position: absolute; z-index: 1; pointer-events: none; container-type: size; }   /* right after its picture */
.st-board.is-front { z-index: 5; }
/* inset (not padding): % of the board itself, not of the whole wall */
.st-board-in {
  position: absolute; inset: 12% 13%; display: flex; flex-direction: column; justify-content: center; align-items: center;
  gap: 2cqh; text-align: center; color: var(--ink-dark); overflow: hidden;
}
.st-board span { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.st-board-h { font-family: var(--font-hand); font-size: min(12cqh, 13cqw); color: var(--kraft); line-height: 1.1; }
.st-board-t { font-family: var(--font-display); font-weight: 800; font-size: min(11cqh, 12cqw); line-height: 1.15;
  display: -webkit-box !important; -webkit-line-clamp: 3; -webkit-box-orient: vertical; white-space: normal; }
.st-board-d { font-size: min(8.5cqh, 9cqw); font-weight: 600; }
.st-talk {
  position: absolute; z-index: 7; transform: translate(-50%, calc(-100% - 10px));
  max-width: 240px; padding: 8px 12px; border-radius: 14px;
  background: var(--paper-white); border: 1.5px solid var(--kraft); color: var(--ink-dark);
  font-size: 0.85rem; line-height: 1.4; pointer-events: none; box-shadow: 0 4px 12px rgba(61, 74, 46, 0.15);
  animation: st-pop 0.2s ease-out;
}
.st-talk[hidden] { display: none; }
.st-talk::after {
  content: ''; position: absolute; left: 50%; top: 100%; transform: translateX(-50%);
  border: 7px solid transparent; border-top-color: var(--kraft);
}
@keyframes st-pop { from { opacity: 0; transform: translate(-50%, calc(-100% - 2px)); } }
.st-story-udon { display: flex; align-items: center; gap: 10px; margin: 0 0 var(--space-3); font-family: var(--font-hand); font-size: 1.25rem; color: var(--sage-deep); }
.st-story h2 { margin: var(--space-3) 0 var(--space-2); font-family: var(--font-display); }
.st-story p { margin: 0 0 var(--space-3); line-height: 1.7; }
.st-story-img { display: block; width: 100%; max-height: 46vh; object-fit: cover; border-radius: var(--radius-md); }
/* a product's name while the mouse is over it (studio.js nameTag) */
.st-prod-label { pointer-events: none; }
.st-prod-label[hidden] { display: none; }
/* touch: a thing tapped once is named (studio.js pickTap); the tag opens it */
.st-pick-label[hidden] { display: none; }
.st-thing.is-picked, .st-shelf-prod.is-picked {
  filter: brightness(1.06) drop-shadow(0 0 6px rgba(251, 246, 238, 0.9));
}
.st-shelf-prod.is-lifted { opacity: 0.25; }
/* a cut-out product stands on the shelf as itself, no frame */
.st-shelf-item.is-cut { aspect-ratio: auto; background: none; border: 0; box-shadow: none; }
.st-shelf-item.is-cut img { width: auto; height: 100%; object-fit: contain; border: 0; filter: drop-shadow(1px 3px 2px rgba(61, 74, 46, 0.3)); }
.st-grid.st-grid--one { grid-template-columns: minmax(0, 260px); justify-content: center; }
.st-prod-tip { font-size: var(--text-sm); }

/* Paper notes on the memo board: a hint that people have written. */
.st-pins { position: absolute; z-index: 1; pointer-events: none; }   /* same layer as the pieces, after them: on the board picture */
.st-pins.is-front { z-index: 5; }   /* the board is set in front of the character */
.st-pin {
  position: absolute;
  width: 20%;
  max-width: 34%;
  aspect-ratio: 1;
  background: #FBF6EE;
  box-shadow: 0 2px 4px rgba(61, 74, 46, 0.18);
  background-image: repeating-linear-gradient(transparent 0 22%, rgba(61, 74, 46, 0.14) 22% 25%);
}
.st-pin::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 6%;
  width: 12%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--kraft);
  transform: translateX(-50%);
}
.st-pin-0 { left: 4%; top: 6%; transform: rotate(-5deg); }
.st-pin-1 { left: 26%; top: 18%; transform: rotate(4deg); background-color: #F3E3D3; }
.st-pin-2 { left: 50%; top: 4%; transform: rotate(-2deg); }
.st-pin-3 { left: 76%; top: 20%; transform: rotate(6deg); background-color: #E8EBD9; }
.st-pin-4 { left: 38%; top: 48%; transform: rotate(3deg); background-color: #F3E3D3; }

@keyframes st-udon {
  0%, 86%, 100% { transform: translateY(0); }
  90% { transform: translateY(-6%); }
  94% { transform: translateY(0); }
}

.st-player {
  position: absolute;
  width: 0;
  transform-origin: 0 100%;
  pointer-events: none;
}

.st-bob {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 100%;
}

.st-fr {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 100%;
}
.st-fr > img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; }

/* Accessories worn by the character (js/wear.js), placed in % of the
   frame; height = share of the character's height. A piece sewn from one's
   own design is its drawing (an svg in a box of its shape). */
.st-fr > .st-acc, .fit-fr > .st-acc { inset: auto; width: auto; }
.st-acc-d { position: absolute; display: block; pointer-events: none; }
.st-acc-d > svg { display: block; width: 100%; height: 100%; }

.st-player.is-moving .st-bob { animation: st-bob 0.34s ease-in-out infinite; }

@keyframes st-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2.5%); }
}

/* ---------- UDON'S BUBBLE ---------- */
.st-bubble {
  position: absolute;
  left: var(--space-3);
  right: var(--space-3);
  top: var(--space-3);
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--paper-white);
  border: 1.5px solid var(--kraft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-paper);
  z-index: 5;
  cursor: pointer;
  animation: st-pop 0.25s ease-out;
}

.st-bubble[hidden] { display: none; }
/* a story is in hand: the bubble is where to drop it (studio.js storyDrop) */
.st-bubble.is-drop { border-style: dashed; border-color: var(--sage-deep); box-shadow: 0 0 0 4px rgba(135, 150, 90, 0.22), var(--shadow-paper); }
.st-stage.is-drop-ok .st-bubble.is-drop { background: #EEF1E2; }
.st-bubble img { flex: none; border-radius: 50%; background: var(--paper-cream); object-fit: cover; object-position: 50% 15%; }
.st-bubble p { margin: 0; font-size: 1rem; color: var(--ink-dark); line-height: 1.45; }

/* ---------- GUIDE (studio.js GUIDE) ----------
   A tip is a dashed paper card over the middle of the scene, not part of
   the painting (NN/g: a tip must not look like the interface); taps go
   through it, except on its own two buttons. */
.st-tip {
  position: absolute;
  left: 50%;
  top: 30%;
  transform: translate(-50%, -50%);
  width: min(320px, calc(100% - 2 * var(--space-4)));
  display: grid;
  justify-items: center;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4) 0;
  background: rgba(251, 247, 240, 0.95);
  border: 1.5px dashed var(--kraft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-paper);
  text-align: center;
  z-index: 6;
  pointer-events: none;
  animation: st-tip-in 0.3s ease-out;
}
.st-tip[hidden] { display: none; }
.st-tip p { margin: 0; padding: 0 var(--space-5); font-family: var(--font-display); font-weight: 700; font-size: 1rem; line-height: 1.4; color: var(--ink-dark); }
.st-tip button { pointer-events: auto; }
.st-tip-skip {
  min-height: 40px; padding: 0 var(--space-3); border: 0; background: none; cursor: pointer;
  font: inherit; font-size: var(--text-xs); color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px;
}
.st-tip-x {
  position: absolute; top: 2px; right: 2px; width: 40px; height: 40px;
  border: 0; background: none; cursor: pointer; font-size: 22px; line-height: 1; color: var(--ink-soft);
}
.st-tip .st-swipe { display: none; }
.st-tip.is-swipe .st-swipe { display: inline-flex; }
@keyframes st-tip-in { from { opacity: 0; transform: translate(-50%, -44%); } to { opacity: 1; transform: translate(-50%, -50%); } }
/* swipe: a fingertip going left and right between two arrows */
.st-swipe { position: relative; align-items: center; justify-content: space-between; width: 116px; height: 30px; }
.st-swipe-chev { font-family: var(--font-display); font-weight: 800; font-size: 24px; line-height: 1; color: var(--kraft); }
.st-swipe-dot {
  position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px;
  border-radius: 50%; background: var(--sage-deep); box-shadow: 0 0 0 6px rgba(135, 150, 90, 0.25);
  animation: st-swipe 1.7s ease-in-out infinite alternate;
}
@keyframes st-swipe { from { transform: translateX(-32px); } to { transform: translateX(32px); } }
.st-calm .st-swipe-dot, .st-calm .st-tip { animation: none; }
/* the nearest place out of view on each side; tap to walk there */
.st-edge {
  position: absolute;
  top: 58%;
  max-width: 44%;
  min-height: 40px;
  padding: 0 var(--space-3);
  border: 1px solid var(--sage-light);
  border-radius: 999px;
  background: rgba(251, 247, 240, 0.9);
  box-shadow: 0 2px 8px rgba(61, 74, 46, 0.18);
  font-family: var(--font-display); font-weight: 700; font-size: 13px; color: var(--ink-dark);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; z-index: 4;
  -webkit-tap-highlight-color: transparent;
}
.st-edge.is-l { left: var(--space-2); }
.st-edge.is-r { right: var(--space-2); }
.st-edge[hidden] { display: none; }
.st-edge.is-dodged { visibility: hidden; }   /* every height would cover a place's own tag */
.st-hot-label.is-offview { visibility: hidden; }   /* its place has an edge tag instead */
.st-edge:active { background: var(--paper-cream); }
/* "?": a round paper button, the basket's twin in the other corner */
.st-help-b {
  position: fixed;
  left: var(--space-4);
  bottom: calc(72px + env(safe-area-inset-bottom));
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 2px solid var(--kraft);
  background: rgba(251, 246, 238, 0.94);
  box-shadow: 0 6px 18px rgba(61, 74, 46, 0.22);
  font-family: var(--font-display); font-weight: 800; font-size: 22px; color: var(--ink-dark);
  cursor: pointer; z-index: 40;
  -webkit-tap-highlight-color: transparent;
}
.st-help-b:active { background: var(--paper-cream); }
.st-lock .st-help-b, .zt-open .st-help-b { display: none; }
/* the "?" sheet */
.st-help-how { list-style: none; margin: var(--space-3) 0 0; padding: 0; display: grid; gap: var(--space-3); }
.st-help-how li { display: grid; grid-template-columns: 116px 1fr; align-items: center; gap: var(--space-3); font-size: var(--text-sm); color: var(--ink-body); }
.st-help-how .st-swipe { display: inline-flex; }
.st-help-ico { display: inline-flex; justify-content: center; }
.st-help-tag { padding: 2px 10px; border-radius: 999px; background: var(--paper-white); border: 1.5px solid var(--kraft); font-family: var(--font-display); font-weight: 700; font-size: var(--text-xs); color: var(--ink-dark); }
.st-edge-demo { padding: 2px 12px; border-radius: 999px; background: var(--paper-white); border: 1px solid var(--sage-light); font-family: var(--font-display); font-weight: 800; color: var(--ink-dark); }
.st-help-h { margin: var(--space-5) 0 var(--space-2); font-size: var(--text-base); }
.st-help-places { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-1); }
.st-help-go {
  min-height: 40px; padding: 0 var(--space-4); border: 1.5px solid var(--sage-light); border-radius: 999px;
  background: var(--paper-white); color: var(--ink-dark); cursor: pointer;
  font-family: var(--font-display); font-weight: 700; font-size: var(--text-xs);
}
.st-help-go:hover, .st-help-go:active { border-color: var(--sage-deep); background: var(--paper-cream); }
.st-help-places li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-1) 0; border-bottom: 1px solid var(--paper-cream-warm); }
.st-help-places span { font-weight: 600; color: var(--ink-dark); }
.st-help-again { margin: var(--space-3) 0 72px; text-align: center; }   /* room to scroll past the basket button */
.st-help-again .st-link { display: inline-block; margin: 0 var(--space-2); }

@keyframes st-pop {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- BOTTOM NAV ---------- */
.st-nav {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding: var(--space-2) var(--space-3);
  padding-bottom: max(var(--space-2), env(safe-area-inset-bottom));
  background: var(--paper-white);
  border-top: 1px solid var(--paper-cream-warm);
  scrollbar-width: none;
}

.st-nav::-webkit-scrollbar { display: none; }
/* street: "Vào studio" (+ the street's own places); inside: everything but it */
.st-nav .st-go-in { display: none; }
.st-nav button.is-off { display: none; }
.st-is-out .st-nav button { display: none; }
.st-is-out .st-nav .st-go-in {
  display: inline-flex; align-items: center;
  background: var(--sage-deep); border-color: var(--sage-deep); color: var(--paper-white);
}
/* street: the owner's places out there ("Chơi đàn tranh"), js streetNav */
.st-is-out .st-nav .st-go-out { display: inline-flex; align-items: center; }

.st-nav button {
  flex: none;
  min-height: 44px;
  padding: 0 var(--space-4);
  border: 1.5px solid var(--sage-light);
  border-radius: 999px;
  background: var(--paper-cream);
  color: var(--ink-dark);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-sm);
  cursor: pointer;
}

.st-nav button:hover,
.st-nav button:focus-visible {
  border-color: var(--sage-deep);
  background: var(--sage-deep);
  color: var(--paper-white);
  outline: none;
}

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

/* ---------- SHEET (pop-up) ---------- */
.st-modal {
  position: fixed;
  inset: 0;
  z-index: 800;              /* under the basket widget (900) so items fly into it */
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(61, 74, 46, 0.35);
}

.st-modal[hidden] { display: none; }
/* No pull-to-refresh / swipe-to-navigate from the studio: horizontal drags
   walk, vertical drags inside a sheet scroll it or pull it closed. */
.studio-page { overscroll-behavior: none; }
html:has(.studio-page) { overscroll-behavior: none; }   /* own rule: a Safari without :has drops only this one */
.st-sheet { overscroll-behavior: contain; touch-action: pan-y; }
/* grab handle: a bottom sheet you can pull down */
.st-grab { position: sticky; top: calc(-1 * var(--space-6)); z-index: 2; height: 28px; margin: calc(-1 * var(--space-6)) calc(-1 * var(--space-4)) 0; display: flex; justify-content: center; align-items: center; cursor: grab; touch-action: none; }
.st-grab span { width: 44px; height: 5px; border-radius: 999px; background: rgba(61, 74, 46, 0.28); }

.st-sheet {
  position: relative;
  width: 100%;
  max-height: 86vh;
  max-height: 86svh;
  overflow-y: auto;
  padding: var(--space-6) var(--space-4) var(--space-8);
  padding-bottom: max(var(--space-8), calc(env(safe-area-inset-bottom) + 96px));
  background: var(--paper-white) url("../images/studio/ui/giay-nen.webp") center / cover;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-paper);
  animation: st-up 0.25s ease-out;
}

@keyframes st-up {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.st-close {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}

.st-close:hover { background: var(--paper-cream); color: var(--ink-dark); }
/* over what a sheet draws at its top (the sorting game's header sat over it
   and took its taps, 24/10) */
.st-close { z-index: 5; }
/* moved down with a sheet scrolled down (studio.js): over the text, so on paper */
.st-close.is-pinned { background: var(--paper-white); box-shadow: 0 1px 4px rgba(61, 74, 46, 0.25); }

.st-sheet h2 {
  margin: 0 var(--space-10) var(--space-2) 0;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--ink-dark);
}

.st-lead { margin: 0 0 var(--space-5); color: var(--ink-body); }

.st-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.st-prod {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.st-prod img,
.st-grid--photos img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-md);
  background: var(--paper-cream);
}

.st-prod b {
  font-family: var(--font-display);
  color: var(--ink-dark);
  font-size: var(--text-sm);
  line-height: 1.3;
}

.st-price { color: var(--kraft); font-weight: 600; font-size: var(--text-sm); }

.st-prod .st-btn { margin-top: auto; }

.st-prod.is-locked img { filter: grayscale(0.85) opacity(0.55); }

.st-lock-tag {
  align-self: flex-start;
  padding: 1px 8px;
  border: 1px dashed var(--kraft);
  border-radius: 999px;
  font-size: var(--text-xs);
  color: var(--ink-soft);
}

.st-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 var(--space-4);
  border: 0;
  border-radius: 999px;
  background: var(--sage-deep);
  color: var(--paper-white);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-sm);
  cursor: pointer;
}

.st-btn:hover { background: var(--ink-dark); color: var(--paper-white); }
.st-btn:disabled { background: var(--sage-light); cursor: default; }
.st-btn.is-added { background: var(--kraft); }

.st-foot {
  margin: var(--space-6) 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
}

.st-foot a:not(.st-btn) { min-height: 44px; display: inline-flex; align-items: center; }

/* The detail sheet (studio.js pdSheet): real photos, choices, notes. Chips,
   price, consignor tag and notes are the product page's (css/style.css .pg-*).
   Phone: name and price, the photo, then what to pick. Wide: the photo on
   the left, the rest beside it. */
.st-pd { display: grid; gap: var(--space-4); }
.st-pd-head .pg-consign { margin-bottom: var(--space-2); }
.st-pd-head h2 { margin-bottom: var(--space-1); }
.st-pd-media {
  position: relative;
  border-radius: var(--radius-md);
  background: var(--paper-cream);
  overflow: hidden;
}
.st-pd-img {
  display: block;
  width: 100%;
  height: min(38vh, 360px);
  height: min(38svh, 360px);
  object-fit: contain;   /* posters, jars, square crops: all of it shows */
}
.st-pd-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(251, 246, 238, 0.88);
  color: var(--ink-dark);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.st-pd-nav.is-prev { left: var(--space-2); }
.st-pd-nav.is-next { right: var(--space-2); }
.st-pd-nav:focus-visible { outline: 2px solid var(--sage-deep); outline-offset: 2px; }
.st-pd-count {
  position: absolute;
  right: var(--space-2);
  bottom: var(--space-2);
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(61, 74, 46, 0.6);
  color: var(--paper-white);
  font-size: var(--text-xs);
}
.st-pd-buy .pg-opts-label { margin-top: 0; }
.st-pd-add { width: 100%; margin-top: var(--space-5); }
.st-pd-buy .st-prod-tip { margin: 0; color: var(--ink-soft); }
.st-pd-buy .st-design-from { padding-left: 0; }
@media (min-width: 768px) {
  .st-pd {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "media head" "media buy";
    grid-template-rows: auto 1fr;
    column-gap: var(--space-6);
    row-gap: var(--space-3);
  }
  .st-pd-head { grid-area: head; }
  .st-pd-buy { grid-area: buy; }
  .st-pd-media { grid-area: media; align-self: start; position: sticky; top: 0; }
  .st-pd-img { height: auto; aspect-ratio: 4 / 5; max-height: 62vh; }
}

.st-chars {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3);
}

.st-char {
  width: 100%;
  aspect-ratio: 3 / 5;
  padding: var(--space-2) var(--space-1) 0;
  border-radius: var(--radius-md);
  background: var(--paper-cream);
  border: 2px solid transparent;
  cursor: pointer;
}
.st-char img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: bottom; }
.st-char:hover { border-color: var(--sage-light); }
.st-char.is-picked { border-color: var(--sage-deep); background: var(--paper-white); }

.st-fitting {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-5);
}

.st-fitting img { height: 180px; width: auto; }

.st-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-3);
}

.st-links a {
  display: flex;
  align-items: center;
  min-height: 56px;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--sage-light);
  border-radius: var(--radius-md);
  background: var(--paper-cream);
  color: var(--ink-dark);
  font-weight: 500;
}

.st-links a:hover { border-color: var(--sage-deep); }

.st-preview {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 44vh;
  max-height: 44svh;
  margin: 0 auto;
  border-radius: var(--radius-md);
}

/* ---------- DESKTOP ---------- */
@media (min-width: 768px) {
  .st-top { padding-left: var(--space-6); padding-right: var(--space-6); }
  .st-long { display: inline; }
  .st-short { display: none; }

  .st-nav {
    justify-content: center;
    padding-left: var(--space-6);
  }

  .st-hot-label { font-size: 0.9rem; }

  .st-modal { align-items: center; padding: var(--space-6); }
  .st-grab { display: none; }

  .st-sheet {
    max-width: 760px;
    max-height: 86vh;
    padding: var(--space-8);
    border-radius: var(--radius-lg);
  }

  .st-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- ĐÀN TRANH (studio.js zitherSheet) ----------
   Full screen, so the 16 or 19 strings get as much height as the screen has
   (rows of 30–56px; a finger between two strings plucks neither). A wooden
   board, the note names on its head, the bridges (nhạn) on a slant. */
.zt-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-4); padding-right: 48px; }
.zt-head h2 { margin: 0; }
.zt-kind { display: inline-flex; border: 1.5px solid var(--sage-light); border-radius: 999px; overflow: hidden; }
.zt-kind-b {
  min-height: 36px; padding: 0 14px; border: 0; background: transparent;
  font-family: var(--font-display); font-weight: 700; font-size: var(--text-xs); color: var(--ink-dark); cursor: pointer;
}
.zt-kind-b[aria-pressed="true"] { background: var(--sage-deep); color: var(--paper-white); }
.zt-kind-b:focus-visible { outline: 2px solid var(--sage-deep); outline-offset: -2px; }
.zt-wrap .st-lead { margin: var(--space-2) 0 var(--space-3); font-size: var(--text-sm); }
.zt { margin: 0 0 var(--space-3); }
/* the strings take what the screen has left after the title and the buttons */
.zt-body {
  height: clamp(calc(16 * 30px + 16px), calc(100vh - 260px), calc(16 * 56px + 16px));
  height: clamp(calc(16 * 30px + 16px), calc(100svh - 260px), calc(16 * 56px + 16px));
  display: grid;
  grid-template-rows: repeat(16, 1fr);
  padding: 8px 0;
  border-radius: 14px 40px 40px 14px;
  background:
    linear-gradient(90deg, rgba(61, 74, 46, 0.18), transparent 8%, transparent 92%, rgba(61, 74, 46, 0.22)),
    linear-gradient(180deg, #b07a48, #8f5d33 55%, #7d4f2a);
  box-shadow: inset 0 2px 0 rgba(255, 240, 215, 0.35), inset 0 -3px 0 rgba(40, 25, 10, 0.25), 0 4px 10px rgba(61, 74, 46, 0.25);
  touch-action: none;   /* a sweep plays, it doesn't scroll */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;   /* a long press: no copy / look-up menu */
  cursor: pointer;
}
/* no tinted box over a string or a button when tapped (Chrome on a phone paints one, light blue) */
.zt-wrap, .zt-wrap * { -webkit-tap-highlight-color: transparent; }
.zt-str {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: inherit;
}
.zt-str:focus-visible { outline: 2px solid var(--paper-white); outline-offset: -2px; border-radius: 6px; }
.zt-line {
  position: absolute;
  left: 4%;
  right: 3%;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  background: linear-gradient(180deg, #fbf3e2, #cbbfa6);
  box-shadow: 0 1px 1px rgba(40, 25, 10, 0.45);
  pointer-events: none;
}
.zt-body[data-n="19"] { grid-template-rows: repeat(19, 1fr); height: clamp(calc(19 * 30px + 16px), calc(100vh - 260px), calc(19 * 52px + 16px)); }
.zt-body[data-n="19"] { grid-template-rows: repeat(19, 1fr); height: clamp(calc(19 * 30px + 16px), calc(100svh - 260px), calc(19 * 52px + 16px)); }
.zt-str:nth-child(n + 10) .zt-line { height: 1.5px; }   /* the high strings are thinner */
.zt-body.has-names .zt-line { left: 60px; }   /* past the longest name, Xang / Phan */
.zt-name {
  display: none;
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 36px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(251, 246, 238, 0.9);
  color: var(--ink-dark);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  pointer-events: none;
}
.zt-body.has-names .zt-name { display: block; }
/* the pressed note, left of the bridge (Bắc: Fa on the Mi strings, Si on the La strings): a tap there plays it */
.zt-press {
  display: none;
  position: absolute;
  top: 50%;
  left: var(--b, 50%);
  transform: translate(calc(-100% - 12px), -50%);
  min-width: 30px;
  padding: 0 5px;
  border: 1px dashed rgba(251, 246, 238, 0.85);
  border-radius: 999px;
  background: rgba(125, 79, 42, 0.55);
  color: #fbf6ee;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  pointer-events: none;
}
.zt-body.has-names .zt-press { display: block; }
.zt-str.is-pressed .zt-press { background: var(--kraft); border-style: solid; }
/* a computer's keys, once one has played */
.zt-key {
  display: none;
  position: absolute;
  right: 18px;   /* clear of the board's round corners */
  top: 50%;
  transform: translateY(-115%);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 10px;
  color: rgba(251, 246, 238, 0.75);
  pointer-events: none;
}
.zt-body.has-keys .zt-key { display: block; }
.zt-str.is-do .zt-name { background: var(--sage-deep); color: var(--paper-white); }   /* Đô: find your place */
.zt-name.is-bent { background: var(--kraft); color: var(--paper-white); }   /* nhấn: Mi held is Fa, La held is Si */
.zt-nhan {
  position: absolute;
  top: 50%;
  left: var(--b, 50%);
  width: 16px;
  height: 14px;
  margin: -11px 0 0 -8px;
  background: #e9d6b5;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  filter: drop-shadow(0 1px 0 rgba(40, 25, 10, 0.4));
  pointer-events: none;
}
.zt-str.is-on .zt-line { animation: zt-shake 0.42s ease-out; background: #fffaf0; }
@keyframes zt-shake {
  0% { transform: translateY(0); }
  15% { transform: translateY(-2px); }
  30% { transform: translateY(1.6px); }
  45% { transform: translateY(-1.1px); }
  60% { transform: translateY(0.7px); }
  80% { transform: translateY(-0.3px); }
  100% { transform: translateY(0); }
}
.st-calm .zt-str.is-on .zt-line { animation: none; }
/* the basket button is hidden while the zither is open: it sat on the high strings */
.zt-open .gb-widget { display: none; }
.zt-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); }
.zt-set { gap: var(--space-2); margin-bottom: var(--space-2); }
.zt-sel {
  min-height: 40px;
  padding: 0 30px 0 14px;
  border: 1.5px solid var(--sage-light);
  border-radius: 999px;
  -webkit-appearance: none;
  appearance: none;
  background-color: var(--paper-white);
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-dark) 50%), linear-gradient(135deg, var(--ink-dark) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  color: var(--ink-dark);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-xs);
  cursor: pointer;
}
.zt-tone { display: inline-flex; align-items: center; border: 1.5px solid var(--sage-light); border-radius: 999px; background: var(--paper-white); }
.zt-tone button {
  width: 40px; height: 40px; border: 0; border-radius: 999px; background: transparent;
  font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--ink-dark); cursor: pointer;
}
.zt-tone button:focus-visible, .zt-sel:focus-visible { outline: 2px solid var(--sage-deep); outline-offset: 1px; }
.zt-tone-v { min-width: 64px; text-align: center; font-family: var(--font-display); font-size: var(--text-xs); font-weight: 700; color: var(--ink-dark); }
.zt-tone-v b { color: var(--sage-deep); }
.zt-tone button:active, .zt-kind-b:active { background: var(--sage-light); }
.zt-sel:active { background-color: var(--paper-cream); }
.zt-vib { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; font-size: var(--text-sm); color: var(--ink-dark); cursor: pointer; }
.zt-vib input { width: 18px; height: 18px; accent-color: var(--sage-deep); }
.zt-note { margin: var(--space-1) 0 0; font-size: var(--text-xs); color: var(--ink-soft); }
.zt-about { margin-top: var(--space-1); font-size: var(--text-sm); color: var(--ink-body); }
.zt-about summary { padding: 8px 0; cursor: pointer; color: var(--ink-dark); font-weight: 600; }   /* list-item: keeps the ▸ that says it opens */
.zt-about p { margin: 0 0 var(--space-2); line-height: 1.6; }
@media (hover: none) { .zt-keys-p { display: none; } }   /* the computer keys: not on a phone */
@media (min-width: 768px) {
  .zt-body { height: clamp(calc(16 * 30px + 16px), calc(min(96vh, 940px) - 280px), calc(16 * 52px + 16px)); }
  .zt-body[data-n="19"] { height: clamp(calc(19 * 30px + 16px), calc(min(96vh, 940px) - 280px), calc(19 * 48px + 16px)); }
}

/* ---------- REDUCED MOTION ----------
   .st-calm: the device asks for less motion and the visitor didn't turn the
   "Hiệu ứng" button on, or they turned it off (js/studio.js syncMotion). */
.st-calm .st-udon,
.st-calm .st-player.is-moving .st-bob,
.st-calm .st-bubble,
.st-calm .st-sheet,
.st-calm .st-talk,
.st-calm .st-hot-label.is-nudge { animation: none; }
.st-calm .st-tap { animation: st-tap-calm 0.5s linear forwards; }   /* a still dot that fades */
@keyframes st-tap-calm { from { opacity: 1; } to { opacity: 0; } }

/* The site-wide "View in English" pill: above the bottom nav, between the "?"
   button (48px, same corner) and the basket. It used to sit right on top of
   "?" (15/11/2026); on a phone it keeps only its button, which says it all. */
.studio-page .lang-hint {
  left: calc(var(--space-4) + 48px + var(--space-2));
  transform: none;
  bottom: calc(72px + env(safe-area-inset-bottom));
  max-width: calc(100vw - 2 * var(--space-4) - 72px - 48px - var(--space-2));
}
@media (max-width: 480px) { .studio-page .lang-hint span { display: none; } }

/* Basket sits above the bottom nav, smaller, so it never covers a chip. */
.studio-page .gb-widget {
  width: 64px;
  height: 64px;
  bottom: calc(72px + env(safe-area-inset-bottom));
}
/* Painted wooden cart (images/studio/ui/gio-hang.webp = props/xe) instead
   of the line-drawn basket: the same picture twice, the front copy cut below
   the cloth rim, so items in the basket still sit inside it. */
.studio-page .gb-layer svg { display: none; }
.studio-page .gb-layer {
  background: url("../images/studio/ui/gio-hang.webp") center bottom / contain no-repeat;
}
.studio-page .gb-layer-front { clip-path: inset(36% 0 0 0); }
.studio-page .gb-pile { left: 26%; right: 4%; }
/* A round paper button, so the cart reads as a control floating over the
   painting, not a piece of furniture standing in the scene. */
.studio-page .gb-widget {
  border-radius: 50%;
  background: rgba(251, 246, 238, 0.94);
  border: 2px solid var(--kraft);
  box-shadow: 0 6px 18px rgba(61, 74, 46, 0.28), 0 0 0 5px rgba(251, 246, 238, 0.45);
  filter: none;
}
.studio-page .gb-widget .gb-basket-art { position: absolute; inset: 14% 13% 16% 15%; width: auto; height: auto; }
.studio-page .gb-widget .gb-badge { top: -4px; right: -4px; }
/* A sheet is open: the nav is covered anyway, so back to the corner. */
.studio-page.st-lock .gb-widget { bottom: max(0.75rem, env(safe-area-inset-bottom)); }

/* ---------- BÀN THIẾT KẾ (designer) ---------- */
.pt { display: grid; gap: var(--space-4); }
.pt-side { display: grid; gap: var(--space-4); }

.pt-tabs { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.pt-tab,
.pt-tool {
  min-height: 44px;
  padding: 0 var(--space-4);
  border: 1.5px solid var(--sage-light);
  border-radius: 999px;
  background: var(--paper-cream);
  color: var(--ink-dark);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-sm);
  cursor: pointer;
}

.pt-tab.is-on { background: var(--sage-deep); border-color: var(--sage-deep); color: var(--paper-white); }
.pt-tool:hover { border-color: var(--sage-deep); }
.pt-tool:disabled { opacity: 0.45; cursor: default; }
.pt-tool.is-added { background: var(--kraft); border-color: var(--kraft); color: var(--paper-white); }

.pt-view { display: grid; gap: var(--space-1); justify-items: center; }
.pt-board { width: 100%; max-width: min(300px, 38vh); }
.pt-board svg { display: block; width: 100%; height: auto; }

.pt-sec { display: grid; gap: var(--space-2); }

.pt-label {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.pt-small { margin: 0; font-size: var(--text-xs); color: var(--ink-soft); line-height: 1.5; }

.pt-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.pt-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 var(--space-3) 0 var(--space-2);
  border: 1.5px solid var(--sage-light);
  border-radius: 999px;
  background: var(--paper-white);
  color: var(--ink-dark);
  font-size: var(--text-sm);
  cursor: pointer;
}
.pt-chip svg { flex: none; display: block; }
.pt-chip.is-on { border-color: var(--sage-deep); box-shadow: 0 0 0 2px var(--sage-deep) inset; background: #F3F1E4; }
.pt-layouts .pt-chip { padding-left: 4px; border-radius: 12px; }
.pt-layouts .pt-chip svg { width: 40px; height: 40px; }

.pt-other,
.pt-notefield { display: grid; gap: var(--space-1); font-size: var(--text-sm); }
.pt-other input,
.pt-notefield textarea {
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  border: 1.5px solid var(--sage-light);
  border-radius: 8px;
  background: var(--paper-white);
  font: inherit;
}
.pt-notefield textarea { resize: vertical; }
.pt-other input:focus,
.pt-notefield textarea:focus { outline: none; border-color: var(--sage-deep); }

.pt-draw { display: grid; gap: var(--space-2); justify-items: start; }
.pt-inks { display: flex; gap: var(--space-2); }
.pt-ink {
  width: 44px;
  height: 44px;
  padding: 8px;
  border: 2px solid transparent;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}
.pt-ink span { display: block; width: 100%; height: 100%; border-radius: 50%; }
.pt-ink.is-on { border-color: var(--sage-deep); }
.pt-ink[data-eraser="true"] span { box-shadow: inset 0 0 0 2px var(--sage-light); background-image: linear-gradient(135deg, transparent 45%, var(--sage-light) 45% 55%, transparent 55%); }
.pt-sizes { display: flex; gap: var(--space-2); }
.pt-size { width: 44px; height: 44px; display: grid; place-items: center; border: 2px solid transparent; border-radius: 50%; background: none; cursor: pointer; }
.pt-size span { display: block; border-radius: 50%; background: var(--ink-dark); }
.pt-size.is-on { border-color: var(--sage-deep); }

/* top row: the pieces + "surprise me" */
.pt-top { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
/* eight pieces: one row that scrolls sideways, not three rows of chips */
.pt-top { flex-wrap: nowrap; min-width: 0; }
.pt, .pt-top, .pt-side, .pt-left { min-width: 0; }
.st-sheet { overflow-x: hidden; }
.pt-top .pt-tabs { flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px;
  -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
.pt-top .pt-tabs::-webkit-scrollbar { display: none; }
.pt-top .pt-tab { flex: none; }
.st-shop-h { margin: 0 0 var(--space-1); font-size: var(--text-lg); }
.pt-random { white-space: nowrap; }
/* optional extras, folded */
.pt-extra { border-top: 1px dashed var(--sage-light); padding-top: var(--space-3); display: grid; gap: var(--space-4); }
.pt-extra > summary { cursor: pointer; font-weight: 600; font-size: var(--text-sm); color: var(--ink-dark); list-style: none; padding: var(--space-2) 0; }
.pt-extra > summary::-webkit-details-marker { display: none; }
.pt-extra > summary::before { content: '+'; display: inline-block; width: 1.4em; font-weight: 800; color: var(--sage-deep); }
.pt-extra[open] > summary::before { content: '−'; }
.gv-see { margin-left: 4px; padding: 0; border: 0; background: none; color: var(--sage-deep); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.st-shop-tabs { display: flex; gap: var(--space-2); overflow-x: auto; padding: 0 2.5rem var(--space-2) 0; margin-bottom: var(--space-3); scrollbar-width: none; }
.st-shop-tabs::-webkit-scrollbar { display: none; }
.st-shop-tab { flex: none; }
.st-design-from { min-height: 40px; font-size: var(--text-xs); align-self: center; }

.pt-tools,
.pt-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }

.pt-price { font-weight: 600; color: var(--kraft); margin-right: auto; }

.pt-photo { display: grid; gap: var(--space-2); justify-items: start; }
.pt-upload { display: inline-flex; align-items: center; cursor: pointer; }
.pt-photo-prev { margin: 0; display: grid; grid-template-columns: 96px 1fr; gap: var(--space-2) var(--space-3); align-items: center; }
.pt-photo-prev[hidden] { display: none; }
.pt-photo-prev img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; border: 3px solid var(--paper-white); box-shadow: 0 2px 8px rgba(61, 74, 46, 0.18); grid-row: span 2; }
.pt-photo-prev img[hidden] { display: none; }
.pt-photo-prev figcaption { font-size: var(--text-xs); color: var(--ink-soft); }
.pt-photo-prev .pt-tool { justify-self: start; min-height: 36px; }
.pt-note { margin: 0; font-size: var(--text-xs); color: var(--ink-soft); line-height: 1.5; }

@media (min-width: 768px) {
  .pt { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }
  .pt-tabs, .pt-top { grid-column: 1 / -1; }
  /* preview + real pieces stay in view, together, while the choices scroll
     past (the preview alone used to slide over the real-pieces row) */
  /* .pt-left: see below, after its phone rule */
}

/* An open sheet owns the screen: the language pill waits behind it. */
.studio-page.st-lock .lang-hint { display: none; }


/* TỦ SƯU TẦM */
.st-prod.is-owned img { filter: none; }
.st-lock-tag.is-have { border-style: solid; border-color: var(--sage-deep); color: var(--sage-deep); }

.tu { display: grid; gap: var(--space-3); }
.tu-h {
  margin: var(--space-4) 0 0;
  font-family: var(--font-display);
  font-size: var(--text-base);
  color: var(--ink-dark);
}
.tu-set p { margin: 0 0 var(--space-2); display: flex; justify-content: space-between; }
.tu-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--paper-cream);
  border: 1px solid var(--sage-light);
  overflow: hidden;
}
.tu-bar span { display: block; height: 100%; background: var(--sage-deep); }

.tu-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}
.tu-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  font-size: var(--text-sm);
}
.tu-item svg,
.tu-item img,
.tu-noimg {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-md, 10px);
  background: var(--paper-cream);
}
.tu-row { display: flex; gap: var(--space-2); }
.tu-row .pt-tool { flex: 1; }
.tu-small { margin: 0; font-size: var(--text-xs); color: var(--ink-soft); line-height: 1.5; }
.tu-empty { margin: 0; color: var(--ink-soft); font-size: var(--text-sm); }
.tu-empty .pt-tool { margin-top: var(--space-2); }

.tu-claim {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px dashed var(--kraft);
  border-radius: var(--radius-md, 10px);
}
.tu-claim summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
}
.tu-form { display: grid; gap: var(--space-3); margin-top: var(--space-3); }
.tu-form label { display: grid; gap: var(--space-1); font-size: var(--text-sm); }
.tu-form input {
  min-height: 44px;
  padding: 0 var(--space-3);
  border: 1.5px solid var(--sage-light);
  border-radius: 8px;
  background: var(--paper-white);
  font: inherit;
}
.tu-form input:focus { outline: none; border-color: var(--sage-deep); }
.tu-msg { margin: 0; font-size: var(--text-sm); min-height: 1.4em; }

@media (min-width: 768px) {
  .tu-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tu-form { grid-template-columns: 1fr 1fr auto; align-items: end; }
  .tu-msg { grid-column: 1 / -1; }
}

/* Real pieces + ready-made suggestions under the designer */
.pt-more { display: grid; gap: var(--space-3); grid-column: 1 / -1; }

/* UDON GIÁO VIÊN: Udon beside a little easel with a real sewn piece on it */
.gv {
  display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 5fr); align-items: end;
  gap: 0 var(--space-2); max-width: 340px; width: 100%; justify-self: center;
}
.gv-udon { position: relative; aspect-ratio: 375 / 500; }
.gv-udon img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: bottom; }
.gv-udon img[hidden] { display: none; }
.gv-board {
  position: relative; display: block; aspect-ratio: 610 / 700; padding: 0; border: 0; cursor: pointer;
  background: url("../images/studio/ui/udgv-bang.webp") center / 100% 100% no-repeat;
}
/* the paper of the board: 8% in from the sides, 11% from the top, 25% from the bottom */
.gv-photo { position: absolute; left: 9%; right: 9%; top: 12%; bottom: 26%; overflow: hidden; border-radius: 2px; }
.gv-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gv-board:focus-visible { outline: 3px solid var(--sage-deep); outline-offset: 2px; }
.gv-say {
  grid-column: 1 / -1; margin: var(--space-2) 0 0; padding: var(--space-2) var(--space-3);
  background: rgba(251, 246, 238, 0.92); border: 1.5px solid var(--sage-light); border-radius: 14px;
  font-size: var(--text-sm); line-height: 1.45; color: var(--ink-dark); min-height: 3em;
}
.gv-say:empty { visibility: hidden; }
@media (max-width: 767px) {
  /* phone: Udon + board side by side, small, above the preview */
  .gv { max-width: 300px; }
}
/* phone: one column — preview, choices, then the real pieces */
.pt-left { display: contents; }
.pt-left .pt-more { order: 3; }
@media (min-width: 768px) {
  /* preview + real pieces stay in view, together, while the choices scroll
     past (the preview alone used to slide over the real-pieces row) */
  .pt-left { display: grid; gap: var(--space-4); align-content: start; position: sticky; top: 0; }
  .pt-left .pt-more { grid-column: auto; order: 0; }
  .pt-left .pt-view { position: static; }
}
.pt-more h3 {
  margin: var(--space-2) 0 0;
  font-family: var(--font-display);
  font-size: var(--text-base);
  color: var(--ink-dark);
}
.pt-real {
  list-style: none;
  margin: 0;
  padding: 0 0 var(--space-1);
  display: flex;
  gap: var(--space-3);
  overflow-x: auto;
  scrollbar-width: thin;
}
.pt-real li { flex: none; width: 112px; font-size: var(--text-xs); color: var(--ink-soft); }
.pt-real img {
  display: block;
  width: 112px;
  height: 112px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: var(--space-1);
}
.pt-real li.is-this img { box-shadow: 0 0 0 2px var(--sage-deep); }

@media (min-width: 768px) {
  .studio-page .gb-widget { width: 80px; height: 80px; bottom: 84px; }
}

/* BẢNG LỜI NHẮN */
.mb { display: grid; gap: var(--space-4); }
.mb-form { display: grid; gap: var(--space-2); }
.mb-form label { display: grid; gap: var(--space-1); font-size: var(--text-sm); }
.mb-form textarea,
.mb-form input {
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  border: 1.5px solid var(--sage-light);
  border-radius: 8px;
  background: var(--paper-white);
  font: inherit;
}
.mb-form textarea { resize: vertical; }
.mb-form textarea:focus,
.mb-form input:focus { outline: none; border-color: var(--sage-deep); }
.mb-count { justify-self: end; margin-top: calc(-1 * var(--space-1)); font-size: var(--text-xs); color: var(--ink-soft); }
.mb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.mb-form .st-btn { justify-self: start; }
.mb-msg { margin: 0; min-height: 1.4em; font-size: var(--text-sm); }
.mb-note { margin: 0; font-size: var(--text-xs); line-height: 1.5; color: var(--ink-soft); }

.mb-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}
.mb-note {
  padding: var(--space-5) var(--space-4);
  background: url("../images/studio/ui/giay-ngang.webp") center / 100% 100% no-repeat;
  filter: drop-shadow(0 2px 3px rgba(61, 74, 46, 0.16));
  font-size: var(--text-sm);
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.mb-note:nth-child(3n+1) { transform: rotate(-1deg); }
.mb-note:nth-child(3n+2) { transform: rotate(0.8deg); }
.mb-note p { margin: 0 0 var(--space-2); white-space: pre-line; }
.mb-who { font-family: var(--font-hand, 'Dancing Script', cursive); font-size: 1.05rem; color: var(--kraft); }
.mb-empty { grid-column: 1 / -1; color: var(--ink-soft); font-size: var(--text-sm); }

@media (min-width: 768px) {
  .mb-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* GÓC THỬ ĐỒ: the character picked at the door wears the piece you tap,
   standing in the middle of the polaroid (khung-polaroid = khung-hoa-2
   cropped so the photo is centred) */
.fit { display: grid; gap: var(--space-4); }
.fit-model {
  position: relative;
  margin: 0 auto;
  width: min(100%, 340px);
  aspect-ratio: 560 / 800;
  background: url("../images/studio/ui/khung-polaroid.webp") center / 100% 100% no-repeat;
}
/* photo window of the polaroid: x 16–86%, y 16–70% */
.fit-fr {
  position: absolute;
  left: 51%;
  bottom: 31%;
  height: 52%;
  transform: translateX(-50%);
}
.fit-fr > img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; }
.fit-fr[hidden], .fit-mac[hidden] { display: none; }
/* a piece with a drawing of its own being worn (the scrunchie's close-up) */
.fit-mac {
  position: absolute;
  left: 51%;
  bottom: 31%;
  height: 52%;
  width: auto;
  max-width: 68%;
  object-fit: contain;
  object-position: bottom;
  transform: translateX(-50%);
}
/* its "Mẫu" under the picture */
.fit-opts { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin: var(--space-2) auto 0; max-width: 360px; }
.fit-opts[hidden] { display: none; }
.fit-opts-h { flex-basis: 100%; text-align: center; font-size: var(--text-xs); font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.06em; }
.fit-opts .pt-chip { min-height: 40px; font-size: var(--text-xs); }
.fit-opts .pt-chip.is-out { opacity: 0.55; }
.fit-opts .pt-chip:disabled { opacity: 0.4; cursor: default; border-style: dashed; }
.fit-cap {
  position: absolute;
  left: 22%; right: 20%;
  top: 74%;
  text-align: center;
  font-family: var(--font-hand);
  font-size: clamp(1.1rem, 4.6vw, 1.45rem);
  line-height: 1.1;
  color: var(--ink-dark);
}
.fit-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3);
}
/* one card per piece: picture, name, button — all cards the same height */
.fit-item {
  display: flex; flex-direction: column; align-items: stretch; gap: var(--space-2);
  padding: var(--space-2) var(--space-2) var(--space-3);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  background: rgba(251, 246, 238, 0.85);
}
.fit-item.is-on { border-color: var(--sage-deep); background: var(--paper-white); }
.fit-pick {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: var(--space-1);
  padding: 0; border: 0; background: none;
  cursor: pointer;
  font: inherit; font-size: var(--text-sm); font-weight: 700; color: var(--ink-dark); text-align: center;
}
.fit-pick img { height: 96px; width: 100%; object-fit: contain; }
.fit-pick b { min-height: 2.6em; display: flex; align-items: center; }
.fit-item .st-btn, .fit-item .st-lock-tag { align-self: center; }
.fit-pick { position: relative; }
.fit-worn {
  position: absolute; top: 0; left: 0;
  padding: 2px 8px; border-radius: 999px;
  background: var(--sage-deep); color: var(--paper-white);
  font-style: normal; font-size: var(--text-xs); font-weight: 700;
}
.fit-wear { margin: var(--space-3) 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); }
.fit-wear [hidden] { display: none; }
.fit-add { background: var(--paper-white); color: var(--ink-dark); box-shadow: inset 0 0 0 1.5px var(--sage-deep); }
.fit-add:disabled { background: var(--paper-white); color: var(--ink-soft); box-shadow: inset 0 0 0 1.5px var(--sage-light); }
.fit-svg { display: block; height: 96px; width: 100%; }
.fit-svg > svg { display: block; width: 100%; height: 100%; }
.fit-list-h { grid-column: 1 / -1; margin-top: var(--space-2); font: 700 var(--text-sm) var(--font-display); color: var(--ink-dark); }
.fit-note { margin: var(--space-2) auto 0; max-width: 340px; font-size: var(--text-xs); color: var(--ink-soft); text-align: center; }
.st-link {
  min-height: 44px; padding: 0 var(--space-2);
  border: 0; background: none; cursor: pointer;
  font: inherit; font-size: var(--text-sm); color: var(--ink-dark);
  text-decoration: underline; text-underline-offset: 3px;
}
a.st-link { display: inline-block; line-height: 44px; }   /* a link written as text, same 44px to tap */
.st-btn-sm { min-height: 40px; padding: 0 var(--space-3); font-size: var(--text-xs); }
@media (min-width: 768px) {
  .fit { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); align-items: start; }
  .fit-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ======================================================================
   BÀN THIẾT KẾ — chơi (đợt 1): toàn màn hình, tâm trạng, rổ vải,
   chạm / kéo vải vào từng ô, "May xong", thẻ chia sẻ
   ====================================================================== */
.st-modal.is-full { padding: 0; align-items: stretch; }
.st-sheet.is-full {
  /* the design table: the paper washed light, so fabric colours read true */
  background-image: linear-gradient(rgba(251, 247, 240, 0.8), rgba(251, 247, 240, 0.8)), url("../images/studio/ui/giay-nen.webp");
  max-height: none; height: 100vh; max-width: none; border-radius: 0;
  max-height: none; height: 100svh; max-width: none; border-radius: 0;
  /* the screen as it is now: scrolling the table hides the address bar,
     and a fixed small height left the dark backdrop showing under it */
  height: 100dvh;
  padding-bottom: calc(env(safe-area-inset-bottom) + var(--space-6));
}
@media (min-width: 768px) {
  .st-modal.is-full { padding: var(--space-4); align-items: center; }
  .st-sheet.is-full { height: min(940px, 96vh); max-width: 1080px; border-radius: var(--radius-lg); }
}

.pt-sec-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; }
.pt-sec-acts { display: flex; gap: var(--space-2); }
.pt-tool.pt-mini { min-height: 36px; padding: 4px 12px; font-size: var(--text-xs); }

/* the piece: big, every patch tappable */
.pt-view { gap: var(--space-2); }
.st-sheet.is-full .pt-board { max-width: min(420px, 46vh); }
.st-sheet.is-full .pt-board { max-width: min(420px, 46svh); }
/* only the patches take taps: shading, seams and hardware drawn on top let them through */
.pt-board svg * { pointer-events: none; }
.pt-board svg [data-i] { pointer-events: auto; cursor: pointer; }
.pt-board [data-i]:hover { filter: brightness(1.06); }
/* the patch picked (a tap with no scrap in hand; tapped again it lets go):
   what "Xoay vải" turns */
.pt-board [data-i].is-sel { stroke: var(--sage-deep); stroke-width: 3; stroke-dasharray: none; stroke-opacity: 1; stroke-linejoin: round; }
.pt-hint { text-align: center; min-height: 3em; max-width: 34ch; }
/* turn the fabric of the patch last touched: on the piece's corner */
.pt-turn {
  position: absolute; right: 0; bottom: 0; z-index: 6; min-height: 44px; padding: 0 var(--space-3);
  border: 1.5px solid var(--sage-light); border-radius: 22px; background: var(--paper-white);
  box-shadow: 0 2px 6px rgba(61, 74, 46, 0.25); font: inherit; font-size: var(--text-sm); color: var(--ink-dark); cursor: pointer;
}
.pt-turn[hidden] { display: none; }
@keyframes pt-pop { 0% { transform: scale(0.8); } 60% { transform: scale(1.06); } 100% { transform: none; } }
.pt-board .pt-pop, .pt-board.is-shuffle [data-i] { transform-box: fill-box; transform-origin: center; animation: pt-pop 0.38s ease-out; }
@keyframes pt-puff { 0% { transform: none; } 40% { transform: scale(1.05); } 70% { transform: scale(0.985); } 100% { transform: none; } }
.pt-board.is-puff svg { animation: pt-puff 0.6s ease-out; }
@keyframes pt-sew { to { stroke-dashoffset: 0; } }
.pt-thread {
  stroke: #B5654A !important; stroke-width: 2.6 !important; stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1; animation: pt-sew 0.7s ease-in-out forwards;
}

/* moods: one sideways row */
.pt-moods { display: flex; gap: var(--space-2); overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; }
.pt-moods::-webkit-scrollbar { display: none; }
.pt-mood {
  flex: none; display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; padding: 4px 14px 4px 8px;
  border: 1.5px solid var(--sage-light); border-radius: 999px; background: var(--paper-white);
  font: 600 var(--text-sm) var(--font-body); color: var(--ink-dark); cursor: pointer; white-space: nowrap;
}
.pt-mood.is-on { border-color: var(--sage-deep); box-shadow: 0 0 0 2px var(--sage-deep) inset; background: #F3F1E4; }
.pt-mood img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none; border: 1.5px solid var(--sage-light); }
/* "Tâm trạng ngẫu nhiên": four of the palette's fabrics in the circle */
.pt-mood-mix {
  width: 34px; height: 34px; border-radius: 50%; overflow: hidden; flex: none; border: 1.5px solid var(--sage-light);
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; background: var(--paper-cream);
}
.pt-mood-mix i { background: center / cover no-repeat; }

/* the basket: scraps stand behind its front wall (images/studio/vai/ro-truoc)
   and stick out over the rim */
.pt-basket { position: relative; padding-top: 18px; overflow-x: clip; }
.pt-scraps { position: relative; display: flex; justify-content: center; flex-wrap: nowrap; padding-inline: 6%; }
.pt-ro { position: relative; z-index: 2; display: block; width: 100%; height: auto; margin-top: -3.5%; pointer-events: none; }
.pt-scrap {
  position: relative; flex: 1 1 0; min-width: 0; max-width: 96px; aspect-ratio: 1; padding: 0; margin: 0 -2.6%;
  border: 0; background: none; cursor: grab;
  transform: translateY(var(--dy, 0)) rotate(var(--r, 0deg)); transition: transform 0.18s ease, filter 0.18s ease;
  filter: drop-shadow(0 2px 2px rgba(61, 74, 46, 0.25)); touch-action: none; -webkit-tap-highlight-color: transparent;
}
.pt-sf, .pt-ss { position: absolute; inset: 0; width: 100%; height: 100%; }
.pt-sf {
  /* big enough that a print reads as a print, not as texture */
  background-size: 115% auto; background-position: center; background-repeat: repeat;
  filter: saturate(1.15) contrast(1.06);
  -webkit-mask-size: contain; mask-size: contain; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
}
.pt-ss { object-fit: contain; mix-blend-mode: multiply; opacity: 0.6; pointer-events: none; }
.pt-scrap.is-held {
  transform: translateY(calc(var(--dy, 0) - 22px)) rotate(var(--r, 0deg)) scale(1.12);
  filter: drop-shadow(0 10px 8px rgba(61, 74, 46, 0.35));
  z-index: 3;
}
.pt-scrap:focus-visible { outline: 3px solid var(--sage-deep); outline-offset: 2px; border-radius: 8px; }
.pt-ghost {
  position: fixed; z-index: 1000; width: 84px; margin: 0; pointer-events: none;
  transform: translate(-50%, -60%) rotate(-8deg) scale(1.1); filter: drop-shadow(0 12px 10px rgba(61, 74, 46, 0.35));
}
@keyframes pt-rummage { 0%, 100% { transform: none; } 25% { transform: translateX(-6px) rotate(-2deg); } 75% { transform: translateX(6px) rotate(2deg); } }
.pt-scraps.is-rummage { animation: pt-rummage 0.35s ease-in-out; }

/* actions stay at hand while the page scrolls */
.st-sheet.is-full .pt-actions {
  position: sticky; bottom: calc(-1 * var(--space-6)); z-index: 3;
  margin: 0 calc(-1 * var(--space-4)); padding: var(--space-3) var(--space-4);
  background: var(--paper-white); border-top: 1px solid var(--sage-light);
  box-shadow: 0 -6px 14px rgba(61, 74, 46, 0.08);
}
.pt-sew { min-height: 48px; padding-inline: var(--space-6); }
/* Phone, upright: one column in a fixed order, and nothing moves while it
   scrolls (Anna: "khi scroll thì bố cục bị thay đổi nhìn hơi amateur" —
   the docked basket used to jump between the bottom and its place, over
   the piece). The piece, what to do now, then the basket right under it,
   so both are on the first screen; the rest below. The action bar is the
   last thing in the column, so it never leaves the bottom edge. */
@media (max-width: 767px) and (orientation: portrait) {
  .st-sheet.is-full:has(.pt) .st-lead { display: none; }   /* the hint under the piece says what to do */
  .st-sheet.is-full:has(.pt) .st-sheet-body > h2 { margin-bottom: var(--space-1); }
  .st-sheet.is-full .pt { gap: var(--space-3); }
  .st-sheet.is-full .pt-view, .st-sheet.is-full .pt-side { display: contents; }
  .st-sheet.is-full .pt-top { order: 0; }
  .st-sheet.is-full .pt-shared { order: 1; }
  .st-sheet.is-full .pt-stage { order: 2; }
  .st-sheet.is-full .pt-drawbar { order: 3; }
  .st-sheet.is-full .pt-hint { order: 4; margin: 0 auto; min-height: 0; }
  .st-sheet.is-full .pt-done { order: 5; }
  .st-sheet.is-full .pt-sec-basket { order: 6; }
  .st-sheet.is-full .pt-onpiece { order: 7; }
  .st-sheet.is-full .gv-row { order: 8; }
  .st-sheet.is-full .pt-sec-moods { order: 9; }
  .st-sheet.is-full .pt-shapes { order: 10; }
  .st-sheet.is-full .pt-sec-layout { order: 11; }
  .st-sheet.is-full .pt-opts { order: 12; }
  .st-sheet.is-full .pt-letter { order: 13; }
  .st-sheet.is-full .pt-actions { order: 99; }
  /* the basket kept low: one swipeable row of colour chips, a smaller basket */
  .st-sheet.is-full .pt-sec-basket { gap: 2px; }
  .st-sheet.is-full .pt-sec-basket .pt-vtones {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 2px calc(-1 * var(--space-4)) 0; padding: 0 var(--space-4);
  }
  .st-sheet.is-full .pt-sec-basket .pt-vtones::-webkit-scrollbar { display: none; }
  .st-sheet.is-full .pt-sec-basket .pt-vtone { flex: none; }
  .st-sheet.is-full .pt-sec-basket .pt-basket { width: min(100%, 290px); margin: 0 auto; padding-top: 10px; }
  /* the piece as big as the first screen allows: title, products, the
     piece, the hint, the basket and the bar (about 470px besides the piece) */
  .st-sheet.is-full .pt-stage { max-width: max(220px, min(420px, calc(100svh - 470px))); }
  /* the bar: the price and how it adds up, then the two buttons side by
     side; the floating cart keeps the corner */
  .st-sheet.is-full:has(.pt) { padding-bottom: 0; }   /* the bar ends the sheet: scrolled to the end, it stays put */
  .st-sheet.is-full .pt-actions {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    bottom: 0; gap: 0 var(--space-2);
    padding: var(--space-2) 84px calc(var(--space-3) + env(safe-area-inset-bottom)) var(--space-4);
  }
  .st-sheet.is-full .pt-actions .pt-price { grid-column: 1 / -1; grid-row: 1; margin: 0; line-height: 1.3; }
  .st-sheet.is-full .pt-actions .pt-price-lines { grid-column: 1 / -1; grid-row: 2; margin: 0; line-height: 1.35; }
  .st-sheet.is-full .pt-actions .pt-add,
  .st-sheet.is-full .pt-actions .pt-sew { grid-row: 3; margin-top: var(--space-2); min-height: 48px; padding-inline: var(--space-2); }
  .st-sheet.is-full .pt-actions .pt-add { grid-column: 1; }
  .st-sheet.is-full .pt-actions .pt-sew { grid-column: 2; }
}

/* after "May xong" */
.pt-done {
  display: grid; gap: var(--space-2); justify-items: center; text-align: center;
  padding: var(--space-4); border: 1.5px dashed var(--kraft); border-radius: var(--radius-lg); background: rgba(251, 246, 238, 0.85);
}
.pt-done[hidden] { display: none; }
.pt-done-name { margin: 0; font-family: var(--font-hand); font-size: clamp(34px, 9vw, 48px); line-height: 1.1; color: var(--ink-dark); }
.pt-done-sub { margin: 0; font-size: var(--text-sm); color: var(--ink-soft); }
.pt-done-card { position: relative; width: 150px; aspect-ratio: 9 / 16; border-radius: 10px; overflow: hidden; box-shadow: 0 8px 22px rgba(61, 74, 46, 0.25); background: var(--paper-cream); }
.pt-done-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pt-done-card img:not([src]) { visibility: hidden; }
.pt-card-wait { position: absolute; inset: 0; display: none; place-items: center; padding: var(--space-2); }
.pt-done-card.is-wait .pt-card-wait { display: grid; }
.pt-done-card.is-wait img { opacity: 0.3; }
.pt-byfield { display: grid; gap: var(--space-1); justify-items: center; width: 100%; max-width: 260px; }
.pt-byfield input {
  width: 100%; min-height: 44px; padding: 8px 12px; text-align: center;
  border: 1.5px solid var(--sage-light); border-radius: 10px; background: var(--paper-white); font: inherit; color: var(--ink-dark);
}
.pt-byfield input:focus { outline: none; border-color: var(--sage-deep); }
.pt-done-acts { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: center; }

/* a design opened from someone's link */
.pt-shared {
  display: grid; gap: var(--space-2); justify-items: center; text-align: center;
  padding: var(--space-3); border-radius: var(--radius-md); background: #F3F1E4; border: 1.5px solid var(--sage-light);
}
.pt-shared[hidden] { display: none; }
.pt-shared-h { margin: 0; font-family: var(--font-hand); font-size: 28px; color: var(--ink-dark); }

.st-calm .pt-board .pt-pop, .st-calm .pt-board.is-shuffle [data-i], .st-calm .pt-board.is-puff svg, .st-calm .pt-scraps.is-rummage { animation: none; }
.st-calm .pt-scrap { transition: none; }

/* Udon sews next to the piece, then cheers */
.pt-view { position: relative; }
.pt-sewer { position: absolute; left: -2%; bottom: 2.4em; width: 34%; max-width: 160px; pointer-events: none; z-index: 2; }
.pt-sewer[hidden] { display: none; }
@keyframes pt-sewer-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pt-hop { 0%, 100% { transform: none; } 35% { transform: translateY(-22px) rotate(-4deg); } 65% { transform: translateY(-6px); } }
.pt-sewer.is-sewing { animation: pt-sewer-in 0.3s ease-out; }
.pt-sewer.is-cheer { animation: pt-hop 0.7s ease-out 2; }
.pt-needle { pointer-events: none; }
.st-calm .pt-sewer { animation: none !important; }

/* own colour: the browser's picker + a few starting points */
/* "Màu riêng": a drawer over the foot of the screen, so opening it leaves
   the piece and the basket where they are */
.pt-own {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; margin: 0 auto; width: min(560px, 100%);
  display: grid; gap: var(--space-2); max-height: 74vh; max-height: 74svh; overflow-y: auto; overscroll-behavior: contain;
  padding: var(--space-3) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom));
  background: var(--paper-white); border-top: 1.5px dashed var(--kraft); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 -10px 28px rgba(61, 74, 46, 0.22); animation: st-up 0.25s ease-out;
}
.pt-own[hidden] { display: none; }
.pt-own-top { display: flex; align-items: center; justify-content: space-between; }
.pt-own-top .pt-label { margin: 0; }
.pt-own-x { width: 44px; height: 44px; margin: -6px -10px -6px 0; border: 0; background: none; font-size: 28px; line-height: 1; color: var(--ink-soft); cursor: pointer; }
.pt-own-steps { margin: 0; padding-left: 1.3em; display: grid; gap: 2px; font-size: var(--text-sm); color: var(--ink-dark); }
/* after the dye: what next, over the basket */
.pt-basket-tip { margin: 0; padding: var(--space-1) var(--space-2); border-radius: 8px; background: rgba(135, 150, 90, 0.16); color: var(--ink-dark); text-align: center; }
.pt-basket-tip[hidden] { display: none; }
/* "?" by the product tabs: how the table works */
.pt-help {
  flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--sage-deep); background: var(--paper-white);
  font: 800 18px/1 var(--font-display); color: var(--sage-deep); cursor: pointer;
}
/* the welcome: three steps, each with a little picture */
.pt-intro { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: var(--space-4); background: rgba(61, 74, 46, 0.4); }
.pt-intro[hidden] { display: none; }
.pt-in-card {
  position: relative; width: min(460px, 100%); max-height: calc(100svh - 2 * var(--space-4)); overflow-y: auto; overscroll-behavior: contain;
  display: grid; gap: var(--space-2); padding: var(--space-5) var(--space-4) var(--space-4);
  background: var(--paper-white) url("../images/studio/ui/giay-nen.webp") center / cover; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-paper); animation: st-up 0.25s ease-out;
}
.pt-in-x { position: absolute; top: var(--space-2); right: var(--space-3); margin: 0; }
.pt-in-udon { width: 64px; justify-self: center; margin-bottom: -4px; }
.pt-in-h { margin: 0; text-align: center; font-size: var(--text-xl); }
.pt-in-p { margin: 0; text-align: center; color: var(--ink-soft); font-size: var(--text-sm); }
.pt-in-steps { list-style: none; margin: var(--space-1) 0 0; padding: 0; display: grid; gap: var(--space-2); }
.pt-in-step { display: grid; grid-template-columns: 76px 1fr; gap: var(--space-3); align-items: center; padding: var(--space-2); border: 1.5px dashed var(--kraft); border-radius: var(--radius-md); background: rgba(251, 246, 238, 0.85); }
.pt-in-txt { display: grid; gap: 2px; font-size: var(--text-sm); line-height: 1.45; }
.pt-in-txt b { font-family: var(--font-display); font-size: var(--text-base); color: var(--ink-dark); }
.pt-ill { position: relative; display: block; width: 76px; height: 76px; }
.pt-ill img { position: absolute; display: block; }
.pt-ill-1 img { width: 54px; left: 11px; bottom: 0; }
.pt-ill-tabs { position: absolute; top: 2px; left: 4px; right: 4px; display: flex; gap: 3px; }
.pt-ill-tabs i { flex: 1; height: 10px; border-radius: 5px; border: 1.5px solid var(--sage-light); background: var(--paper-cream); }
.pt-ill-tabs i:nth-child(2) { background: var(--sage-deep); border-color: var(--sage-deep); }
.pt-ill-2 img:first-child { width: 42px; left: 17px; top: 0; }
.pt-ill-2 .pt-ill-ro { width: 76px; left: 0; bottom: 0; }
.pt-ill-scrap {
  position: absolute; left: 28px; bottom: 10px; width: 22px; height: 22px;
  background: url("../images/studio/vai/vai-hong-1.webp") center / 44px;
  -webkit-mask: url("../images/studio/vai/dang-4.webp") center / contain no-repeat; mask: url("../images/studio/vai/dang-4.webp") center / contain no-repeat;
  animation: pt-ill-lift 2.6s ease-in-out infinite;
}
@keyframes pt-ill-lift { 0%, 20% { transform: translateY(0); opacity: 1; } 65% { transform: translateY(-34px) rotate(-8deg); opacity: 1; } 85%, 100% { transform: translateY(-34px) rotate(-8deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pt-ill-scrap { animation: none; transform: translateY(-20px); } }
.pt-ill-3 img { width: 76px; left: 0; top: 0; }
.pt-in-more summary { cursor: pointer; font-weight: 600; font-size: var(--text-sm); color: var(--sage-deep); min-height: 44px; display: flex; align-items: center; }
.pt-hb { margin: 0; display: grid; gap: 4px; font-size: var(--text-sm); line-height: 1.45; }
.pt-hb dt { font-weight: 700; color: var(--ink-dark); margin-top: 4px; }
.pt-hb dd { margin: 0; color: var(--ink-soft); }
.pt-in-go { justify-self: center; min-width: 200px; }
.pt-own-h { margin: 0; font-weight: 600; font-size: var(--text-sm); color: var(--ink-dark); }
.pt-own-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.pt-own-row input[type="color"] { width: 52px; height: 44px; padding: 2px; border: 1.5px solid var(--sage-light); border-radius: 10px; background: var(--paper-white); cursor: pointer; }
.pt-own-dot { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--paper-white); box-shadow: 0 0 0 1.5px var(--sage-light); cursor: pointer; padding: 0; }
.pt-own-go { justify-self: start; }
/* round / square coaster */
.pt-shapes { align-items: center; }
.pt-shapes[hidden] { display: none; }
.pt-shapes .pt-label { margin-right: var(--space-1); }
.pt-shape-ic { width: 20px; height: 20px; border: 2px solid var(--kraft); background: var(--paper-cream); flex: none; }
.pt-shape-lotcoc { border-radius: 50%; }
.pt-shape-lotcocv { border-radius: 4px; }
/* bag shapes: a small drawing of each */
.pt-shape-pic { display: block; width: 38px; height: 38px; flex: none; }
.pt-shape-pic svg { width: 38px; height: 38px; }

/* size + bag options */
.pt-opts { display: grid; gap: var(--space-2); }
.pt-own-size { display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-2); }
.pt-own-size[hidden] { display: none; }
.pt-own-size label { display: grid; gap: 2px; font-size: var(--text-xs); color: var(--ink-soft); }
.pt-own-size input { width: 88px; min-height: 44px; padding: 0 var(--space-2); border: 1.5px solid var(--sage-light); border-radius: 10px; font: inherit; font-size: var(--text-base); background: var(--paper-white); }
.pt-own-size > span { padding-bottom: 12px; color: var(--ink-soft); }
.pt-own-size .pt-small { flex: 1 1 100%; }
.pt-bagopts[hidden] { display: none; }
.pt-pockets { display: inline-flex; align-items: center; gap: var(--space-1); min-height: 44px; font-size: var(--text-sm); }
.pt-pockets > span { margin-right: var(--space-1); }
.pt-pockets .pt-mini { min-width: 44px; justify-content: center; font-size: var(--text-base); }
.pt-chip-fixed { cursor: default; border-style: dashed; color: var(--ink-soft); }
.pt-ties-h { flex: 1 1 100%; margin-top: var(--space-1); }
/* the strap's stitch: a small picture of each, the thread colours */
/* the stitch as on the machine's pattern dial (GemPatch.stitchIcon), in the chip's ink */
.pt-stitch-ico { width: 40px; height: 15px; flex: none; }
.pt-threads { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.pt-thread-dot { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--paper-white); box-shadow: 0 0 0 1.5px var(--sage-light); cursor: pointer; padding: 0; }
.pt-thread-dot.is-on { box-shadow: 0 0 0 3px var(--sage-deep); }
/* what the price is made of, under the buttons */
.pt-price-lines { flex: 1 1 100%; }
.pt-price-lines:empty { display: none; }
.pt-own-mats { margin-bottom: var(--space-1); }

/* what is in the basket rides in the character's cart: above the rim,
   the lower part hidden as if inside */
.st-cargo { position: absolute; left: 61%; width: 35%; height: 20%; overflow: hidden; display: flex; align-items: flex-end; justify-content: center; pointer-events: none; }
.st-cargo-item { position: relative; flex: 0 0 58%; aspect-ratio: 1; margin: 0 -12%; transform: translateY(38%); }
.st-cargo-item svg, .st-cargo-item img { width: 100%; height: 100%; display: block; object-fit: contain; }
.st-cargo-item img.is-photo { object-fit: cover; border-radius: 4px; }
.st-cargo-0 { transform: translateY(46%) rotate(-10deg); }
.st-cargo-1 { transform: translateY(40%) rotate(6deg); z-index: 1; }
.st-cargo-2 { transform: translateY(48%) rotate(-3deg); }
/* the design's name: tap to rename */
input.pt-done-name {
  width: 100%; max-width: 22ch; text-align: center; padding: 2px 8px; border: 0; border-bottom: 1.5px dashed var(--kraft);
  background: transparent; outline: none; border-radius: 0;
}
input.pt-done-name:focus { border-bottom-style: solid; border-bottom-color: var(--sage-deep); }
.pt-title-hint { margin-top: -4px; }

/* ======================================================================
   BÀN THIẾT KẾ — xếp lại (10/2026): Udon + ảnh món thật quanh món, vẽ
   thẳng lên món, tờ nhắn giấy kraft
   ====================================================================== */
/* z-index 1: the piece is one layer with its "Xoay vải" button inside, so
   the sticky action bar (3) passes over both (the button sat on the basket) */
.pt-stage { position: relative; z-index: 1; width: 100%; max-width: min(420px, 46vh); margin: 4px auto 0; }
.pt-stage { position: relative; z-index: 1; width: 100%; max-width: min(420px, 46svh); margin: 4px auto 0; }
.pt-stage .pt-board, .st-sheet.is-full .pt-stage .pt-board { max-width: none; width: 100%; }
.pt-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; touch-action: none; cursor: crosshair; }
.pt-canvas[hidden] { display: none; }

/* Udon, his line and the real piece: one row under the piece (nothing on it) */
.gv-row { display: flex; align-items: flex-end; gap: var(--space-2); width: 100%; max-width: min(460px, 100%); margin-top: 6px; }
.gv-row .gv-udon { flex: none; width: 64px; aspect-ratio: 375 / 500; pointer-events: none; }
.pt-stage.is-sewing ~ .gv-row .gv-udon { visibility: hidden; }
/* phone: a short row, so the fabric basket still shows above the "May xong" bar */
@media (max-width: 767px) {
  .gv-row { margin-top: 0; }
  .gv-row .gv-udon { width: 46px; }
  .gv-row .gv-polaroid { width: 54px; padding: 4px 4px 0; }
  .gv-row .gv-cap { font-size: 11px; padding: 1px 0 2px; }
  .pt-view .gv-row .gv-say { font-size: 13px; line-height: 1.35; padding: 6px 10px; margin-bottom: 4px; }
}
.pt-stage .pt-sewer { left: -8%; bottom: -5%; width: 33%; }

/* the real piece: a small polaroid at the end of the row; tapped, it comes
   up big over the piece until the next tap */
.gv-polaroid {
  flex: none; width: 72px; margin-left: auto; padding: 5px 5px 0; border: 0; cursor: zoom-in; align-self: center;
  background: #fffdf8; box-shadow: 0 3px 8px rgba(61, 74, 46, 0.25); transform: rotate(4deg);
}
.gv-polaroid .gv-photo { position: static; display: block; aspect-ratio: 1; overflow: hidden; }
/* "Đồ thật", or another piece's name: two lines at most */
.gv-cap {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  padding: 2px 0 4px; font-family: var(--font-hand); font-size: 13px; color: var(--ink-dark); text-align: center; line-height: 1.2;
}
.gv-polaroid::before {   /* the pin */
  content: ''; position: absolute; top: -5px; left: 50%; width: 11px; height: 11px; margin-left: -5px; border-radius: 50%;
  background: #B5654A; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.pt-view.is-zoom .gv-polaroid {
  position: absolute; top: 2%; left: 50%; width: min(74%, 340px); margin: 0; padding: 4% 4% 0; z-index: 6;
  transform: translateX(-50%) rotate(-2deg); cursor: zoom-out;
}
.pt-view.is-zoom .gv-cap { font-size: 18px; }
.gv-next {
  position: absolute; right: 2%; top: 42%; z-index: 7; width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: var(--paper-white); box-shadow: 0 2px 6px rgba(61, 74, 46, 0.3); font-size: 26px; line-height: 1; color: var(--ink-dark); cursor: pointer;
}
.gv-next[hidden] { display: none; }

/* Udon's line, a speech bubble beside him; an instruction takes its place when there is one */
.pt-view .gv-say {
  position: relative; flex: 1 1 auto; margin: 0 0 8px; max-width: 36ch; min-height: 0; padding: var(--space-2) var(--space-3);
  background: var(--paper-white); border: 1.5px solid var(--sage-light); border-radius: 14px;
  font-size: var(--text-sm); line-height: 1.45; color: var(--ink-dark); text-align: left;
}
.pt-view .gv-say::before {
  content: ''; position: absolute; left: -8px; bottom: 12px; width: 14px; height: 14px; background: var(--paper-white);
  border-left: 1.5px solid var(--sage-light); border-bottom: 1.5px solid var(--sage-light); transform: rotate(45deg);
}
.pt-view .gv-say:empty { display: none; }
.pt-hint:empty { display: none; }
.pt-hint:not(:empty) ~ .gv-row .gv-say { visibility: hidden; }
.pt-view .pt-hint { margin: 8px 0 0; }

/* pens under the piece while drawing on it */
.pt-drawbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin-top: 6px; }
.pt-drawbar[hidden] { display: none; }
.pt-drawbar .pt-draw-msg { flex-basis: 100%; text-align: center; margin: 0; }
.pt-drawbar .pt-draw-msg:empty { display: none; }

/* the note to Gem: kraft paper, pinned */
.pt-letter {
  position: relative; border-top: 0; margin-top: var(--space-4); padding: var(--space-5) var(--space-4) var(--space-4);
  background: #E8D6B8 url("../images/studio/ui/giay-nen.webp") center / cover; background-blend-mode: multiply;
  border-radius: 6px; box-shadow: 0 3px 10px rgba(61, 74, 46, 0.18); transform: rotate(-0.4deg);
}
.pt-letter::before {
  content: ''; position: absolute; top: -7px; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%;
  background: #B5654A; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.pt-letter > summary { display: grid; gap: 2px; padding: 0; }
.pt-letter > summary::before { display: none; }
.pt-letter-h { font-family: var(--font-hand); font-size: 30px; line-height: 1.1; color: var(--ink-dark); font-weight: 600; }
.pt-letter[open] > summary { margin-bottom: var(--space-2); }
.pt-letter .pt-label { color: #6E5A3C; }
/* fabrics as sewn-in labels */
.pt-tags .pt-chip { border-radius: 3px; border: 1.5px dashed var(--kraft); background: #FBF4E6; min-height: 40px; padding: 4px 12px; }
.pt-tags .pt-chip.is-on { border-style: solid; border-color: var(--sage-deep); box-shadow: none; background: #F1F0E0; }
.pt-letter .pt-other input { background: rgba(251, 246, 238, 0.7); }
/* the message: written on ruled paper */
.pt-letter .pt-notefield textarea {
  border: 0; border-radius: 0; padding: 0 4px; background: transparent; resize: vertical;
  font-family: var(--font-hand); font-size: 22px; line-height: 32px;
  background-image: repeating-linear-gradient(transparent 0 31px, rgba(138, 106, 68, 0.35) 31px 32px);
}
.pt-letter .pt-notefield textarea:focus { border: 0; }
/* the reference photo: an empty polaroid to fill */
.pt-polaroid-add {
  display: inline-block; width: 120px; padding: 8px 8px 24px; background: #fffdf8; cursor: pointer;
  box-shadow: 0 3px 8px rgba(61, 74, 46, 0.25); transform: rotate(-3deg);
}
.pt-polaroid-in {
  display: grid; place-items: center; aspect-ratio: 1; padding: 6px; text-align: center; border: 1.5px dashed var(--kraft);
  font-size: var(--text-xs); color: var(--ink-soft);
}
.pt-letter .pt-photo-prev img { border-radius: 0; border: 6px solid #fffdf8; border-bottom-width: 18px; transform: rotate(2deg); }
.pt-letter .pt-note { margin-top: var(--space-3); font-size: var(--text-xs); }

/* buy straight from the card, without scrolling back up */
.pt-done-buy { display: flex; align-items: center; justify-content: center; gap: var(--space-3); flex-wrap: wrap; }
.pt-done-buy .pt-price { margin: 0; }
/* "Ghép theo nét vẽ": cut lines have no colour or width */
.pt-drawbar.is-net .pt-inks, .pt-drawbar.is-net .pt-sizes { display: none; }

/* KHO VẢI — real fabrics in the basket: colour chips over it, the fabrics
   on the piece under it */
.pt-vtones { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 2px; }
.pt-vtones[hidden] { display: none; }
.pt-vtone {
  min-height: 36px; padding: 4px 12px; border: 1.5px solid var(--sage-light); border-radius: 999px;
  background: var(--paper-white); color: var(--ink-dark); font: inherit; font-size: var(--text-xs); cursor: pointer;
}
.pt-vtone span { color: var(--ink-soft); }
.pt-vtone.is-on { border-color: var(--sage-deep); background: var(--sage-deep); color: var(--paper-white); }
.pt-vtone.is-on span { color: inherit; opacity: 0.85; }
/* a photo, not a painting: no extra colour, a little more of the print */
.pt-scrap.is-real .pt-sf { filter: none; background-size: 135% auto; }
.pt-onpiece {
  margin: 8px auto 0; max-width: 46ch; padding: 8px 12px; text-align: left;
  border: 1.5px dashed var(--kraft); border-radius: 10px; background: #FBF4E6; color: var(--ink-dark);
}
.pt-onpiece[hidden] { display: none; }
.pt-onpiece b { font-weight: 600; }
.pt-onpiece span:last-child { color: var(--ink-soft); }

/* KHO VẢI for customers: every fabric in stock, pick up to 8 */
.kho { display: flex; flex-direction: column; gap: var(--space-3); }
.kho-back { align-self: flex-start; }
.kho .pt-vtones { margin: 0; }
.kho-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px;
}
@media (min-width: 640px) { .kho-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .kho-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.kho-f {
  position: relative; display: flex; flex-direction: column; width: 100%; padding: 0; text-align: left;
  border: 1.5px solid var(--sage-light); border-radius: 10px; overflow: hidden;
  background: var(--paper-white); color: var(--ink-dark); font: inherit; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.kho-f img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--paper-cream); }
.kho-t { display: flex; flex-direction: column; padding: 6px 8px 8px; min-height: 3.6em; }
.kho-t b { font-weight: 600; font-size: var(--text-xs); line-height: 1.3; }
.kho-t span { font-size: 11px; color: var(--ink-soft); }
.kho-f.is-on { border-color: var(--sage-deep); box-shadow: 0 0 0 2px var(--sage-deep); }
/* a tick in the corner of a picked fabric (a circle + a turned corner) */
.kho-f.is-on::before {
  content: ''; position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--sage-deep); box-shadow: 0 1px 3px rgba(61, 74, 46, 0.35);
}
.kho-f.is-on::after {
  content: ''; position: absolute; top: 10px; right: 14px; width: 6px; height: 11px;
  border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}
.kho-f:focus-visible { outline: 3px solid var(--sage-deep); outline-offset: 2px; }
/* Màu cơ bản: six groups, each a row of small tiles under its name;
   side by side on wider screens */
.kho-grid.is-basic { grid-template-columns: minmax(0, 1fr); gap: 12px 20px; }
@media (min-width: 640px) { .kho-grid.is-basic { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .kho-grid.is-basic { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kho-gp { grid-column: 1 / -1; font-size: var(--text-sm); color: var(--ink-soft); }
.kho-grp { display: flex; flex-direction: column; gap: 6px; }
.kho-gh { font: 700 var(--text-sm) var(--font-display); color: var(--ink-dark); }
.kho-sws { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.kho-sw { display: block; width: 100%; aspect-ratio: 1; background: center / cover no-repeat; }
.kho-c .kho-t { min-height: 0; padding: 4px 5px 5px; }
.kho-c .kho-t b { font-size: 11px; }
.kho-c.is-on::before { top: 4px; right: 4px; }
.kho-c.is-on::after { top: 8px; right: 12px; }
.kho-bar {
  position: sticky; bottom: calc(-1 * var(--space-6)); z-index: 3;
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin: 0 calc(-1 * var(--space-4)); padding: var(--space-3) var(--space-4);
  background: var(--paper-white); border-top: 1px solid var(--sage-light); box-shadow: 0 -6px 14px rgba(61, 74, 46, 0.08);
}
.kho-picked { display: flex; gap: 3px; flex: 0 1 auto; min-width: 0; overflow: hidden; }
.kho-picked img, .kho-picked i { width: 28px; height: 28px; border-radius: 5px; object-fit: cover; flex: none; border: 1px solid var(--sage-light); }
.kho-picked i { background: center / cover no-repeat; }
.kho-n { flex: 1 1 auto; font-size: var(--text-sm); color: var(--ink-dark); min-width: 8ch; }
.kho-bar .st-btn { min-height: 44px; }
@media (max-width: 767px) {
  /* phone: "Ghép thử" first and wide; the floating basket keeps its corner */
  .kho-bar { padding-right: 84px; }
  .kho-bar .st-btn { order: -1; flex: 1 1 100%; }
}

/* ======================================================================
   PHONE ON ITS SIDE (Anna 14/10/2026: "bị cắt màn hình không kéo lên
   xuống được"). Sideways a phone is 250–340px tall: the top bar, a 320px
   scene and the bottom nav were cut off, and the page does not scroll.
   Now one bar: the brand and its controls, then the places (it scrolls
   sideways); the scene takes the rest of the height (studio.js scales the
   painting to it) and the round buttons sit in its corners.
   ====================================================================== */
@media (orientation: landscape) and (max-height: 520px) {
  .studio-page {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }
  .st { display: contents; }
  .st-top {
    grid-row: 1; grid-column: 1;
    gap: var(--space-2);
    padding: 4px var(--space-2) 4px max(var(--space-3), env(safe-area-inset-left));
  }
  /* the logo stands for the name, as on an upright phone */
  .st-brand { position: relative; }
  .st-brand::after { content: ''; position: absolute; inset: -4px; }
  .st-brand span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .st-brand img { width: 30px; height: 30px; }
  .st-long { display: none; }
  .st-short { display: inline; }
  .st-list-link { min-height: 36px; }
  .st-motion { min-height: 32px; padding: 0 10px; }
  .st-nav {
    grid-row: 1; grid-column: 2;
    align-items: center;
    justify-content: flex-start;   /* centred, a row wider than the bar would lose its first places */
    padding: 4px max(var(--space-3), env(safe-area-inset-right)) 4px var(--space-2);
    border-top: 0;
    border-bottom: 1px solid var(--paper-cream-warm);
  }
  .st-nav button { min-height: 36px; padding: 0 var(--space-3); }
  .st-stage { grid-row: 2; grid-column: 1 / -1; min-height: 0; }
  .st-help-b {
    left: max(var(--space-2), env(safe-area-inset-left));
    bottom: max(var(--space-2), env(safe-area-inset-bottom));
    width: 40px; height: 40px; font-size: 18px;
  }
  .studio-page .gb-widget,
  .studio-page.st-lock .gb-widget {
    width: 56px; height: 56px;
    right: max(var(--space-2), env(safe-area-inset-right));
    bottom: max(var(--space-2), env(safe-area-inset-bottom));
  }
  .studio-page .lang-hint { bottom: max(var(--space-2), env(safe-area-inset-bottom)); left: 60px; }
  .st-tip { top: 50%; }

  /* sheets: a bottom sheet with all of the height, read by scrolling */
  .st-modal { padding: 0 var(--space-4); align-items: flex-end; }
  .st-sheet {
    max-width: 760px;
    max-height: calc(100svh - var(--space-2));
    padding: var(--space-6) var(--space-4) calc(env(safe-area-inset-bottom) + 72px);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
  .st-grab { display: flex; }
  .st-modal.is-full { padding: 0; align-items: stretch; }
  .st-sheet.is-full { height: 100svh; height: 100dvh; max-width: none; border-radius: 0; }

  /* the design table: the piece on the left, as tall as the screen allows,
     staying in view while the basket and the choices scroll on the right */
  .st-sheet.is-full:has(.pt) .st-lead { display: none; }
  .st-sheet.is-full:has(.pt) .st-sheet-body > h2 { font-size: var(--text-lg); margin-bottom: var(--space-1); }
  .pt { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }
  .pt-tabs, .pt-top { grid-column: 1 / -1; }
  .pt-left { display: grid; gap: var(--space-2); align-content: start; position: sticky; top: 0; }
  .st-sheet.is-full .pt-stage,
  .st-sheet.is-full .pt-board { max-width: min(420px, calc(100dvh - 64px)); }
  /* the bar in one low row (the cart in its corner); how the price adds up shows upright or on a computer */
  .st-sheet.is-full .pt-actions { padding: 6px 72px 6px var(--space-4); flex-wrap: nowrap; }
  .st-sheet.is-full .pt-price-lines { display: none; }
  .st-sheet.is-full .pt-sew, .st-sheet.is-full .pt-add { min-height: 44px; }
}

/* =========================================================================
   PHÂN LOẠI RÁC (js/phanloai.js): Tagom's posters, one bottle, ten things.
   Tags: Tagom's colours (yellow posters = nylon, pink = plastic), sage = Gem.
   ========================================================================= */
.pl { position: relative; padding-bottom: var(--space-4); }
.pl-acts { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-3) 0; }
.pl-acts .st-btn, .pl-acts .pt-tool { text-decoration: none; }
.pl-back { margin-bottom: var(--space-2); }
.pl-lead { margin-bottom: var(--space-2); }
.pl-posters { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
.pl-poster {
  display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; padding: 6px;
  border: 1.5px solid var(--sage-light); border-radius: 10px; background: var(--paper-white); cursor: pointer;
  font: inherit; font-size: var(--text-sm); color: var(--ink-dark);
}
.pl-poster img { width: 100%; aspect-ratio: 296 / 420; object-fit: cover; border-radius: 6px; }
.pl-big { margin: 0; text-align: center; }
/* the poster whole on screen, its button below it in view (a desktop screen is short for it) */
.pl-big img { display: block; margin: 0 auto; width: auto; max-width: 100%; max-height: 68vh; height: auto; border-radius: 10px; box-shadow: 0 2px 10px rgba(61, 74, 46, 0.18); }

/* the stage: the thing (or the table), Udon in the corner */
.pl-stage { position: relative; min-height: 210px; display: flex; align-items: center; justify-content: center; gap: var(--space-3); }
.pl-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; max-width: 120px;
  border: 1.5px solid transparent; border-radius: 12px; background: transparent; cursor: grab; touch-action: none;
  font: inherit; font-size: var(--text-sm); color: var(--ink-dark); -webkit-tap-highlight-color: transparent;
}
.pl-item img { height: 90px; width: auto; max-width: 110px; object-fit: contain; pointer-events: none; }
.pl-item.is-sel { border-color: var(--sage-light); background: rgba(255, 255, 255, 0.55); }
.pl-item.is-big { max-width: 220px; }
.pl-item.is-big img { height: 150px; max-width: 200px; }
/* the plastic number (hard-to-tell boxes, cups, trays): at the picture's foot, as under the real thing */
.pl-pic { position: relative; display: inline-block; }
.pl-code { position: absolute; right: -10px; bottom: -6px; width: 30px; height: auto; padding: 2px; color: var(--ink-dark);
  background: rgba(251, 246, 238, 0.92); border-radius: 8px; box-shadow: 0 1px 4px rgba(61, 74, 46, 0.2); }
.pl-code text { fill: currentColor; font-family: var(--font-display); }
.pl-item.is-big .pl-code { width: 48px; }
/* nylon: Tagom sorts it by feel, so the card says how it feels */
.pl-feel { display: block; max-width: 200px; color: var(--ink-soft); font-size: var(--text-xs); line-height: 1.35; font-style: italic; }
.pl-item.is-lifted { opacity: 0.35; }
.pl-item.is-in { animation: pl-in 0.45s ease-in forwards; }
@keyframes pl-in { to { transform: translateY(60px) scale(0.3); opacity: 0; } }
.pl-item.is-no img { filter: grayscale(0.6); }
/* a mouse drag doesn't select the words round it (the addresses at the end stay selectable) */
.pl-stage, .pl-bins { -webkit-user-select: none; user-select: none; }
/* over the sheet (800) and the basket (900): it follows the finger, it must be seen */
.pl-ghost { position: fixed; z-index: 1000; pointer-events: none; filter: drop-shadow(0 6px 10px rgba(61, 74, 46, 0.3)); }

.pl-count { text-align: center; margin: 0; }
.pl-say { min-height: 2.6em; margin: var(--space-2) 0; text-align: center; font-size: var(--text-sm); }
.pl-say.is-ok { color: var(--sage-deep); }
.pl-say.is-no { color: #9A4A36; }

/* the bags: Tagom's colours on the tag */
.pl-bins { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pl-bin {
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 44px; padding: 4px 2px 6px;
  border: 1.5px solid var(--sage-light); border-radius: 12px; background: var(--paper-white); cursor: pointer;
  font: inherit; font-size: 12px; line-height: 1.2; color: var(--ink-dark); -webkit-tap-highlight-color: transparent;
}
.pl-bin img { width: 58px; height: 58px; object-fit: contain; pointer-events: none; }
.pl-bin span { padding: 2px 6px; border-radius: 6px; text-align: center; }
.pl-y span { background: #F6DE7A; }
.pl-p span { background: #F1BDB6; }
.pl-g span { background: #E2DDD2; }   /* general waste: not one of Tagom's */
.pl-bin.is-over { border-color: var(--sage-deep); box-shadow: 0 0 0 3px rgba(135, 150, 90, 0.35); }
.pl-bin.is-take { animation: pl-take 0.4s ease-out; }
@keyframes pl-take { 30% { transform: scale(1.08); } 60% { transform: scale(0.97); } }

/* Udon: sits in the corner, hops when right; the first mistake, runs in
   and tugs the hem of a trouser leg that comes in from the left */
.pl-udon { position: absolute; right: 0; bottom: 0; width: 76px; pointer-events: none; }
.pl-udon img { width: 100%; height: auto; }
.pl-udon .pl-ud-hop, .pl-udon.is-hop .pl-ud-sit { display: none; }
.pl-udon.is-hop .pl-ud-hop { display: block; animation: pl-hop 0.6s ease-out; }
@keyframes pl-hop { 40% { transform: translateY(-14px); } }
.pl-tug { position: fixed; left: 0; bottom: 0; width: min(92vw, 460px); z-index: 98; pointer-events: none; }
.pl-tug[hidden] { display: none; }
.pl-tug img { display: none; width: 100%; height: auto; }
.pl-tug .pl-run { position: absolute; bottom: 4px; right: 0; width: 46%; }
.pl-tug.is-run { height: 160px; animation: pl-runin 0.7s linear; }
.pl-tug.is-run.f1 .pl-run-1, .pl-tug.is-run.f2 .pl-run-2 { display: block; }
.pl-tug.is-keo.f1 .pl-keo-1, .pl-tug.is-keo.f2 .pl-keo-2 { display: block; }
.pl-tug.is-out { opacity: 0; transition: opacity 0.3s; }
@keyframes pl-runin { from { transform: translateX(60%); } to { transform: translateX(0); } }

.pl-end-udon { width: 110px; margin: 0 auto; }
.pl-end-udon img { width: 100%; height: auto; }
.pl-miss { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.pl-miss li { display: flex; gap: var(--space-2); align-items: center; font-size: var(--text-sm); }
.pl-miss img { width: 52px; height: 52px; object-fit: contain; flex: none; }
.pl-place { margin-top: var(--space-3); padding: var(--space-3); border: 1.5px solid var(--sage-light); border-radius: 12px; background: var(--paper-white); }
.pl-place h3 { margin: 0 0 var(--space-1); }
.pl-place p { margin: 0 0 var(--space-2); }

@media (min-width: 768px) {
  .pl-posters { grid-template-columns: repeat(6, 1fr); }
  .pl-bins { grid-template-columns: repeat(7, 1fr); }
  .pl-stage { min-height: 250px; }
  .pl-udon { width: 96px; }
}
@media (prefers-reduced-motion: reduce) {
  .pl-item.is-in, .pl-bin.is-take, .pl-udon.is-hop .pl-ud-hop, .pl-tug.is-run { animation: none; }
}

/* Phân loại rác: how to play (a card the first time each level opens, "?"
   brings it back), Udon's line over the tug */
.pl-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); padding-right: 44px; }   /* clear of the sheet's × */
.pl-head h2 { margin: 0; }
.pl-help { flex: none; min-width: 44px; min-height: 44px; padding: 0; border-radius: 50%; font-weight: 700; }
.pl-music { flex: none; min-height: 44px; white-space: nowrap; }
.pl-music[aria-pressed="false"] { color: var(--ink-soft); }
.pl-guide { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: var(--space-4); background: rgba(61, 74, 46, 0.4); }
.pl-guide[hidden] { display: none; }
.pl-g-card {
  position: relative; width: min(460px, 100%); max-height: calc(100svh - 2 * var(--space-4)); overflow-y: auto; overscroll-behavior: contain;
  display: grid; gap: var(--space-2); padding: var(--space-5) var(--space-4) var(--space-4);
  background: var(--paper-white) url("../images/studio/ui/giay-nen.webp") center / cover; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-paper); animation: st-up 0.25s ease-out;
}
.pl-g-x { position: absolute; top: var(--space-2); right: var(--space-3); margin: 0; }
.pl-g-h { margin: 0; padding: 0 36px; text-align: center; font-size: var(--text-lg); }
.pl-g-p { margin: 0; text-align: center; color: var(--ink-soft); font-size: var(--text-sm); }
.pl-g-steps { list-style: none; margin: var(--space-1) 0 0; padding: 0; display: grid; gap: var(--space-2); }
.pl-g-step { display: grid; grid-template-columns: 76px 1fr; gap: var(--space-3); align-items: center; padding: var(--space-2); border: 1.5px dashed var(--kraft); border-radius: var(--radius-md); background: rgba(251, 246, 238, 0.85); }
.pl-g-txt { display: grid; gap: 2px; font-size: var(--text-sm); line-height: 1.45; }
.pl-g-txt b { font-family: var(--font-display); font-size: var(--text-base); color: var(--ink-dark); }
.pl-g-go { justify-self: center; min-width: 200px; }
.pl-gi { position: relative; display: block; width: 76px; height: 76px; }
.pl-gi img { position: absolute; display: block; object-fit: contain; }
.pl-gi .pl-gi-a { height: 72px; width: auto; left: 8px; top: 2px; }
.pl-gi .pl-gi-b { width: 30px; right: 2px; top: 0; }
.pl-gi .pl-gi-c { width: 44px; right: 0; bottom: 4px; }
.pl-gi .pl-gi-d { width: 64px; height: 64px; left: 6px; top: 6px; }
.pl-gi .pl-gi-code { position: absolute; right: 0; bottom: 0; }
.pl-gi .pl-gi-code .pl-code { position: static; width: 30px; }
.pl-gi .pl-gi-0 { width: 40px; height: 52px; left: 0; top: 0; }
.pl-gi .pl-gi-1 { width: 40px; height: 52px; right: 0; top: 4px; }
.pl-gi .pl-gi-2 { width: 40px; height: 44px; left: 18px; bottom: 0; }
.pl-tug-say {
  position: absolute; right: 4%; bottom: calc(100% + 6px); max-width: 78%; margin: 0; padding: 6px 12px;
  background: var(--paper-white); border: 1.5px solid var(--kraft); border-radius: 14px;
  font-family: var(--font-display); font-weight: 700; font-size: var(--text-sm); color: var(--ink-dark); line-height: 1.35;
  box-shadow: 0 2px 8px rgba(61, 74, 46, 0.18);
}
.pl-tug-say::after {
  content: ""; position: absolute; left: 28%; top: 100%; width: 12px; height: 12px; margin-top: -6px;
  background: var(--paper-white); border-right: 1.5px solid var(--kraft); border-bottom: 1.5px solid var(--kraft); transform: rotate(45deg);
}

/* Phân loại rác: nylon, felt. A tap squeezes it, the grips on its edges pull
   it; the sound words come up like a comic's (hard: SỘT SOẠT!, soft: ~ ~ ~) */
.pl-stretch { display: inline-block; transition: transform 0.45s cubic-bezier(0.3, 1.6, 0.45, 1); }
.pl-stretch.is-squeeze { animation: pl-squeeze 0.32s ease-out; }
.pl-stretch.is-shake { animation: pl-shake 0.36s linear; }
@keyframes pl-squeeze { 40% { transform: scale(0.9, 0.84); } }
@keyframes pl-shake { 20%, 60% { translate: -4px 0; } 40%, 80% { translate: 4px 0; } }
.pl-grip { position: absolute; top: 50%; width: 26px; height: 52px; margin-top: -26px; cursor: ew-resize; touch-action: none; }
.pl-grip.is-l { left: -20px; }
.pl-grip.is-r { right: -20px; }
.pl-grip::before {
  content: ""; position: absolute; left: 8px; top: 6px; width: 10px; height: 40px; border-radius: 5px;
  background: repeating-linear-gradient(0deg, var(--kraft) 0 6px, #C9AE82 6px 8px); box-shadow: 0 1px 3px rgba(61, 74, 46, 0.3);
}
.pl-sfx {
  position: absolute; left: 50%; top: 8%; z-index: 3; pointer-events: none; white-space: nowrap;
  transform: translateX(-50%) rotate(-8deg); animation: pl-pop 1s ease-out forwards;
}
.pl-sfx b {
  position: relative; display: inline-block; font-family: var(--font-display); font-weight: 800; font-size: 32px; letter-spacing: 0.02em;
  color: #F6DE7A; -webkit-text-stroke: 2px var(--ink-dark); paint-order: stroke fill; text-shadow: 3px 3px 0 var(--ink-dark);
}
/* the burst behind the big word: short lines all round */
.pl-sfx.is-bop::before, .pl-sfx.is-khong::before {
  content: ""; position: absolute; inset: -34px -30px; opacity: 0.45;
  background: repeating-conic-gradient(var(--ink-dark) 0 2deg, transparent 2deg 16deg);
  -webkit-mask: radial-gradient(closest-side, transparent 62%, #000 64%, #000 92%, transparent 94%);
  mask: radial-gradient(closest-side, transparent 62%, #000 64%, #000 92%, transparent 94%);
}
.pl-sfx-echo {
  position: absolute; font-family: var(--font-display); font-weight: 800; font-style: normal; font-size: 16px;
  color: var(--paper-white); -webkit-text-stroke: 1.5px var(--ink-dark); paint-order: stroke fill;
}
.pl-sfx-echo.is-a { left: -22px; top: 34px; transform: rotate(-16deg); }
.pl-sfx-echo.is-b { right: -18px; top: -14px; transform: rotate(12deg); }
.pl-sfx.is-mem b { font-weight: 700; font-size: 30px; letter-spacing: 0.2em; color: var(--ink-soft); -webkit-text-stroke: 0; text-shadow: 0 0 6px var(--paper-white), 0 0 2px var(--paper-white); }
.pl-sfx.is-mem { animation-name: pl-float; }
.pl-sfx.is-dan b { color: var(--sage-light); transform: scaleX(1.25); }
.pl-sfx.is-khong b { color: #F1BDB6; font-size: 26px; }
@keyframes pl-pop { 0% { opacity: 0; scale: 0.5; } 18% { opacity: 1; scale: 1.12; } 30% { scale: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes pl-float { 0% { opacity: 0; translate: 0 8px; } 25% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; translate: 0 -10px; } }
@media (prefers-reduced-motion: reduce) {
  .pl-stretch, .pl-stretch.is-squeeze, .pl-stretch.is-shake { animation: none; transition: none; }
  .pl-sfx { animation: none; }
}

/* Phân loại rác: five levels, each opened by the one before; the clock of
   levels 3–5 (red and ticking in the last ten seconds); the party table of
   levels 4–5 with its tools */
.pl-levels { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: grid; gap: 6px; }
.pl-lv {
  display: grid; grid-template-columns: 36px 1fr; align-items: center; column-gap: var(--space-2); width: 100%; min-height: 52px;
  padding: 6px var(--space-3) 6px 8px; border: 1.5px solid var(--sage-light); border-radius: 12px; background: var(--paper-white);
  cursor: pointer; font: inherit; color: var(--ink-dark); text-align: left;
}
.pl-lv-n { grid-row: 1 / 3; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--sage-deep); color: var(--paper-white); font-family: var(--font-display); font-size: var(--text-base); }
.pl-lv-t { font-family: var(--font-display); font-weight: 700; line-height: 1.3; }
.pl-lv-s { display: flex; align-items: center; gap: 4px; color: var(--ink-soft); font-size: var(--text-xs); }
.pl-lv.is-locked { cursor: default; background: transparent; border-style: dashed; color: var(--ink-soft); }
.pl-lv.is-locked .pl-lv-n { background: var(--sage-light); }
.pl-lock { width: 12px; height: 12px; flex: none; }
.pl-stars { display: inline-flex; gap: 2px; }
.pl-stars svg { width: 16px; height: 16px; fill: none; stroke: var(--kraft); stroke-width: 1.5; stroke-linejoin: round; }
.pl-stars svg.is-on { fill: #F6DE7A; }
.pl-end-stars { text-align: center; }
.pl-end-stars svg { width: 40px; height: 40px; }
.pl-end-p { text-align: center; }
.pl-best { text-align: center; font-family: var(--font-display); font-weight: 700; color: var(--sage-deep); }

/* the clock: a bar and the seconds; Udon sits at its end */
.pl-hud { position: relative; min-height: 56px; padding-right: 64px; display: grid; gap: 2px; align-content: center; }
.pl-hud .pl-udon { width: 56px; }
.pl-hud .pl-count { text-align: left; }
.pl-count.is-tight { color: #9A4A36; font-weight: 700; }
.pl-clock { position: relative; display: flex; align-items: baseline; gap: 6px; }
.pl-clock-bar { flex: 1; align-self: center; height: 12px; border-radius: 6px; background: rgba(195, 195, 165, 0.45); overflow: hidden; }
.pl-clock-bar i { display: block; height: 100%; background: var(--sage-deep); transform-origin: left center; transition: transform 0.1s linear, background-color 0.3s; }
.pl-clock-s { min-width: 2ch; font-family: var(--font-display); font-size: var(--text-xl); line-height: 1; text-align: right; font-variant-numeric: tabular-nums; }
.pl-clock-u { color: var(--ink-soft); font-size: var(--text-xs); }
.pl-clock.is-low .pl-clock-bar i { background: #C8644A; }
.pl-clock.is-low .pl-clock-s { color: #9A4A36; animation: pl-beat 1s ease-out infinite; }
@keyframes pl-beat { 0% { scale: 1.25; } 30% { scale: 1; } }
.pl-minus { position: absolute; right: 0; bottom: 100%; font-family: var(--font-display); font-weight: 800; color: #9A4A36; white-space: nowrap; pointer-events: none; animation: pl-rise 1s ease-out forwards; }
@keyframes pl-rise { from { opacity: 1; translate: 0 6px; } to { opacity: 0; translate: 0 -16px; } }
.pl-bin.is-right { border-color: var(--sage-deep); background: #EEF1E2; box-shadow: 0 0 0 3px rgba(135, 150, 90, 0.5); }

/* 3, 2, 1, go */
.pl-ready { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; pointer-events: none; }
.pl-ready[hidden] { display: none; }
.pl-ready b {
  font-family: var(--font-display); font-weight: 800; font-size: 76px; line-height: 1; color: var(--sage-deep);
  -webkit-text-stroke: 3px var(--paper-white); paint-order: stroke fill; text-shadow: 0 3px 0 rgba(61, 74, 46, 0.25);
  animation: pl-count 0.7s ease-out;
}
.pl-ready b.is-go { font-size: 48px; color: var(--kraft); }
@keyframes pl-count { 0% { opacity: 0; scale: 1.6; } 25% { opacity: 1; scale: 1; } 85% { opacity: 1; } 100% { opacity: 0.2; } }

/* the party table */
.pl-stage-ban { display: block; min-height: 0; }
.pl-table {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-flow: dense; gap: 6px; align-content: start; min-height: 240px; padding: 8px;
  border-radius: 14px; background: #EAD8BD; box-shadow: inset 0 0 0 1.5px rgba(184, 153, 104, 0.55), inset 0 6px 14px rgba(184, 153, 104, 0.25);
}
.pl-table.is-over { animation: pl-shake 0.36s linear 2; box-shadow: inset 0 0 0 2px #C8644A; }
.pl-thing {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; padding: 4px 2px 6px;
  border: 1.5px solid transparent; border-radius: 10px; background: rgba(251, 246, 238, 0.75); cursor: grab; touch-action: none;
  font: inherit; font-size: 11px; line-height: 1.25; color: var(--ink-dark); -webkit-tap-highlight-color: transparent;
}
.pl-thing .pl-pic { display: flex; align-items: center; justify-content: center; height: 60px; }
.pl-thing img { display: block; height: 56px; width: auto; max-width: 72px; object-fit: contain; pointer-events: none; }
.pl-thing.is-sel { border-color: var(--sage-deep); background: var(--paper-white); box-shadow: 0 0 0 2px rgba(135, 150, 90, 0.35); }
.pl-thing.is-lifted { opacity: 0.35; }
.pl-thing.is-new { animation: pl-land 0.45s cubic-bezier(0.3, 1.5, 0.5, 1); }
.pl-thing.is-in { animation: pl-in 0.3s ease-in forwards; }
.pl-thing.is-shake { animation: pl-shake 0.36s linear; }
@keyframes pl-land { from { transform: translateY(-40px); opacity: 0; } }
.pl-tn { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 100%; text-align: center; }
.pl-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; }
.pl-chips i { padding: 1px 5px; border-radius: 6px; background: #F1BDB6; font-style: normal; font-size: 10px; white-space: nowrap; }
/* a bottle on the table: two rows tall, so its cap and label are big enough
   to tap; the cap cut from the picture with it (water: its top 14%, cooking oil: 12%) */
.pl-table .pl-thing.is-bottle { grid-row: span 2; justify-content: center; }
.pl-table .pl-thing.is-bottle .pl-pic { height: 132px; }
.pl-table .pl-thing.is-bottle img { height: 126px; max-width: 72px; }
.pl-pic.is-squash { animation: pl-squash 0.24s ease-in forwards; transform-origin: center bottom; }
@keyframes pl-squash { to { transform: scale(1.25, 0.35); } }
.pl-chai { position: relative; display: inline-block; }
/* the open snack bag: crumbs over its picture until it is cleaned */
.pl-dirty { position: relative; display: inline-block; }
.pl-dirty .pl-crumbs { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pl-crumbs polygon { stroke: var(--ink-dark); stroke-width: 1.6; stroke-linejoin: round; }
/* food left on a party thing (about half come dirty): smears and crumbs on the picture only */
.pl-dirty .pl-smear { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pl-smear mask { mask-type: alpha; }
.pl-smear ellipse.is-a { fill: #9C6230; opacity: 0.5; }
.pl-smear ellipse.is-b { fill: #C58B4A; opacity: 0.55; }
.pl-smear polygon { fill: #D9A85B; stroke: var(--ink-dark); stroke-width: 2; stroke-linejoin: round; }
.pl-chai .pl-chai-cap { position: absolute; left: 50%; top: 0; transform: translateX(-50%); clip-path: inset(0 0 86% 0); }
.pl-chai.is-nocap .pl-chai-img { clip-path: inset(14% 0 0 0); }
.pl-chai.is-dau .pl-chai-cap { clip-path: inset(0 0 88% 0); }
.pl-chai.is-dau.is-nocap .pl-chai-img { clip-path: inset(12% 0 0 0); }

/* the tools: each drawn as before → after */
.pl-tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: var(--space-2); -webkit-user-select: none; user-select: none; }
.pl-tool {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; padding: 4px 2px;
  border: 1.5px solid var(--kraft); border-radius: 10px; background: var(--paper-white); cursor: pointer;
  font: inherit; font-size: 11px; line-height: 1.15; color: var(--ink-dark); text-align: center; -webkit-tap-highlight-color: transparent;
}
.pl-tool svg { width: 64px; height: 32px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.pl-tool:active { transform: scale(0.96); }
.pl-tool.is-over { border-color: var(--sage-deep); box-shadow: 0 0 0 3px rgba(135, 150, 90, 0.35); }
.pl[data-pl-view="ban"] .pl-bin img, .pl[data-pl-view="tiec"] .pl-bin img { width: 42px; height: 42px; }
.pl[data-pl-view="ban"] .pl-say, .pl[data-pl-view="tiec"] .pl-say { min-height: 2.4em; margin: 6px 0; }
.pl-sfx.is-xi b { color: var(--paper-white); font-size: 26px; letter-spacing: 0.08em; -webkit-text-stroke: 1.5px var(--ink-soft); text-shadow: none; }
.pl-sfx.is-xi { animation-name: pl-float; }

/* The tools, the line that answers and the bags, kept together (.pl-dock).
   On a phone (11/2026) they stay at the bottom of the sheet while the table
   scrolls above them: on a real phone's screen (390 x 664) every bag of
   levels 1 and 4 sat under the fold, with the clock running and nothing
   scrolling by itself. A level starts scrolled so that its clock is at the
   top (settle() in js/phanloai.js). The floating basket would sit on the last
   bag, so it steps out while the game is open (html.pl-open). */
.pl-open .gb-widget { display: none; }
/* a phone upright, or held sideways (short and wide: the bags in one row) */
@media (max-width: 767px), (max-height: 520px) {
  .pl-dock {
    position: sticky; bottom: 0; z-index: 6;
    margin: var(--space-2) calc(-1 * var(--space-4)) calc(-1 * var(--space-4));
    padding: 6px var(--space-4) calc(env(safe-area-inset-bottom) + 6px);
    background: #FBF7F0; box-shadow: 0 -8px 12px -10px rgba(61, 74, 46, 0.4);
  }
  /* the sheet's own bottom padding would show the table under the bags */
  .st-sheet.is-full:has(.pl-dock) { padding-bottom: 0; }
  .pl-dock .pl-tools { margin-top: 0; }
  .pl-dock .pl-tool { flex-direction: row; gap: 5px; min-height: 44px; padding: 2px 6px; white-space: nowrap; }
  .pl-dock .pl-tool svg { width: 36px; height: 18px; flex: none; }
  .pl-dock .pl-say { min-height: 2.5em; margin: 4px 0; line-height: 1.25; }
  .pl-dock .pl-bins { gap: 4px; }
  .pl-dock .pl-bin { padding: 2px 2px 4px; font-size: 11px; }
  .pl-dock .pl-bin img,
  .pl[data-pl-view="ban"] .pl-dock .pl-bin img, .pl[data-pl-view="tiec"] .pl-dock .pl-bin img { width: 32px; height: 32px; }
  .pl-dock .pl-bin span { padding: 1px 4px; }
}
/* held sideways there is little height: one line for the answer (it grows when it needs two) */
@media (max-height: 520px) {
  .pl-dock .pl-say { min-height: 1.4em; margin: 2px 0; }
}

/* how to play: a number for a step, a tag, two tools */
.pl-gi .pl-gi-num { position: absolute; inset: 8px; display: grid; place-items: center; border: 2px solid var(--sage-deep); border-radius: 50%;
  font-family: var(--font-display); font-size: 24px; color: var(--sage-deep); }
.pl-gi .pl-gi-num.is-red { border-color: #C8644A; color: #9A4A36; }
.pl-gi .pl-gi-chip { position: absolute; right: 0; bottom: 2px; padding: 1px 5px; border-radius: 6px; background: #F1BDB6; font-style: normal; font-size: 10px; white-space: nowrap; }
.pl-gi-tools { display: flex; align-items: center; justify-content: center; gap: 4px; }
.pl-gi-tools { flex-direction: column; }
.pl-gi-tools svg { width: 44px; height: 22px; fill: none; stroke: var(--ink-dark); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

@media (min-width: 768px) {
  .pl-levels { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .pl-table { grid-template-columns: repeat(6, minmax(0, 1fr)); min-height: 260px; }
  .pl-thing img { height: 68px; max-width: 90px; }
  .pl-thing .pl-pic { height: 72px; }
  .pl-thing { font-size: 12px; }
  .pl-table .pl-thing.is-bottle .pl-pic { height: 156px; }
  .pl-table .pl-thing.is-bottle img { height: 150px; max-width: 90px; }
  .pl-tools { max-width: 480px; margin-left: auto; margin-right: auto; }
  .pl-tool svg { width: 80px; height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .pl-clock.is-low .pl-clock-s, .pl-ready b, .pl-thing.is-new, .pl-thing.is-in, .pl-thing.is-shake, .pl-table.is-over, .pl-minus, .pl-pic.is-squash { animation: none; }
}

/* Phân loại rác 24/10: level 1 on the table (big, a thing or three at a
   time, no clock); level 5's bars (each thing's time) and its bin filling
   up beside Udon; the overflowing bin at the end; いらすとや's credit */
.pl-hud.is-intro { min-height: 48px; }
.pl[data-pl-view="chai"] .pl-table { display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: 8px; min-height: 196px; }
.pl[data-pl-view="chai"] .pl-thing { width: 104px; font-size: 12px; }
.pl[data-pl-view="chai"] .pl-thing .pl-pic { height: 118px; }
.pl[data-pl-view="chai"] .pl-thing img { height: 112px; max-width: 100px; }
.pl[data-pl-view="chai"] .pl-thing.is-bottle .pl-pic { height: 200px; }
.pl[data-pl-view="chai"] .pl-thing.is-bottle img { height: 192px; max-width: 100px; }
.pl-life { position: absolute; left: 8px; right: 8px; bottom: 3px; height: 4px; border-radius: 2px; background: rgba(195, 195, 165, 0.55); overflow: hidden; }
.pl-life i { display: block; height: 100%; background: var(--sage-deep); transform-origin: left center; transition: transform 0.1s linear; }
.pl-thing { padding-bottom: 10px; }
.pl-thing.is-late { border-color: #C8644A; }
.pl-thing.is-late .pl-life i { background: #C8644A; }
.pl-thing.is-gone { animation: pl-gone 0.35s ease-in forwards; }
@keyframes pl-gone { to { transform: translateY(24px) scale(0.5); opacity: 0; filter: grayscale(1); } }
.pl-hud.is-bin { padding-right: 104px; }
.pl-meter { position: absolute; right: 62px; bottom: 4px; width: 36px; height: 42px; color: var(--ink-dark); }
.pl-meter-fill { fill: var(--kraft); }
.pl-meter.is-high .pl-meter-fill { fill: #C8644A; }
.pl-end-thung { width: min(280px, 72vw); margin: 0 auto; }
.pl-end-thung img { display: block; width: 100%; height: auto; }
.pl-table-udon { width: 120px; height: auto; animation: pl-hop 0.6s ease-out 2; }
.pl-g img { filter: drop-shadow(0 1px 2px rgba(61, 74, 46, 0.35)); }   /* the white bag on a white tile */
.pl-credit { margin: var(--space-4) 0 0; color: var(--ink-soft); font-size: var(--text-xs); }
.pl-credit a { color: inherit; }
@media (min-width: 768px) {
  .pl[data-pl-view="chai"] .pl-thing { width: 132px; font-size: 13px; }
  .pl[data-pl-view="chai"] .pl-thing .pl-pic { height: 150px; }
  .pl[data-pl-view="chai"] .pl-thing img { height: 144px; max-width: 128px; }
  .pl[data-pl-view="chai"] .pl-thing.is-bottle .pl-pic { height: 240px; }
  .pl[data-pl-view="chai"] .pl-thing.is-bottle img { height: 232px; max-width: 128px; }
}
@media (prefers-reduced-motion: reduce) {
  .pl-thing.is-gone { animation: none; opacity: 0; }
  .pl-table-udon { animation: none; }
}

/* ======================================================================
   BẤT NGỜ NGOÀI PHỐ: RÁC RƠI (js/racroi.js)
   ====================================================================== */
.rr-item {
  position: absolute;
  z-index: 5;
  transform: translateX(-50%);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  animation: rr-fall 0.9s cubic-bezier(0.45, 0, 0.75, 1) both;
}
.rr-item::before {   /* a tap target of at least 44px round the drawing */
  content: '';
  position: absolute;
  inset: 50% auto auto 50%;
  width: max(44px, 130%);
  height: max(44px, 130%);
  transform: translate(-50%, -50%);
}
.rr-item img { display: block; height: 100%; width: auto; max-width: none; pointer-events: none;
  filter: drop-shadow(0 3px 2px rgba(61, 74, 46, 0.25)); }
.rr-item:focus-visible { outline: 3px solid var(--sage-deep); outline-offset: 4px; border-radius: 8px; }
.rr-item.is-calm { animation: rr-show 0.3s ease both; }
.rr-item.is-up { animation: rr-up 0.45s ease-in forwards; pointer-events: none; }
@keyframes rr-fall {
  0% { transform: translateX(-50%) translateY(var(--rr-from)) rotate(var(--rr-turn)); }
  78% { transform: translateX(-50%) translateY(0) rotate(0deg); }
  88% { transform: translateX(-50%) translateY(-10%) rotate(0deg); }
  100% { transform: translateX(-50%) translateY(0) rotate(0deg); }
}
@keyframes rr-show { from { opacity: 0; } to { opacity: 1; } }
@keyframes rr-up {
  to { transform: translateX(-50%) translateY(-120%) scale(0.6); opacity: 0; }
}

.rr-bar {
  position: absolute;
  z-index: 12;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100% - 32px);
  padding: 8px 10px 8px 16px;
  border-radius: 999px;
  background: var(--paper-white, #FBF6EE);
  border: 2px solid var(--sage-deep);
  box-shadow: 0 6px 18px rgba(61, 74, 46, 0.18);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-dark);
  animation: rr-show 0.3s ease both;
  pointer-events: none;
}
.rr-bar.is-late { border-color: var(--kraft); }
@media (max-width: 520px) {
  .rr-bar { top: 8px; gap: 8px; padding: 6px 8px 6px 12px; font-size: var(--text-xs); }
}
.rr-bar.is-out { opacity: 0; transition: opacity 0.4s; }
.rr-clock { position: relative; flex: none; width: 36px; height: 36px; }
.rr-clock svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.rr-ring-bg { fill: none; stroke: var(--sage-light); stroke-width: 4; }
.rr-ring { fill: none; stroke: var(--sage-deep); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 94.25;
  transition: stroke-dashoffset 0.25s linear; }
.rr-bar.is-late .rr-clock, .rr-bar.is-done .rr-clock { display: none; }
.rr-clock b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; }

.rr-udon {
  position: absolute;
  z-index: 5;
  transform: translateX(-50%);
  pointer-events: none;
}
.rr-udon img { display: none; height: 100%; width: auto; max-width: none; }
.rr-udon.is-flip img { transform: scaleX(-1); }
.rr-udon.is-run.f1 .rr-u-run1, .rr-udon.is-run.f2 .rr-u-run2,
.rr-udon.is-sit .rr-u-sit, .rr-udon.is-hop .rr-u-hop { display: block; }
.rr-udon.is-hop .rr-u-hop { animation: pl-hop 0.6s ease-out; }
.rr-udon.is-out { opacity: 0; transition: opacity 0.4s; }

.rr-tug {
  position: absolute;
  z-index: 40;
  left: 8px;
  bottom: 8px;
  width: min(68vw, 340px);
  pointer-events: none;
  animation: rr-show 0.25s ease both;
}
.rr-tug img { display: none; width: 100%; height: auto; }
.rr-tug.f1 .rr-keo1, .rr-tug.f2 .rr-keo2 { display: block; }
.rr-tug.is-out { opacity: 0; transition: opacity 0.3s; }
.rr-tug-say {
  position: relative;
  margin: 0 0 6px 8px;
  max-width: 300px;
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--paper-white, #FBF6EE);
  border: 2px solid var(--ink-dark);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink-dark);
}

.rr-card {
  position: absolute;
  z-index: 16;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  width: min(calc(100% - 32px), 420px);
  max-height: calc(100% - 120px);
  overflow: auto;
  padding: 16px 18px 14px;
  border-radius: 18px;
  background: var(--paper-white, #FBF6EE);
  border: 2px solid var(--sage-deep);
  box-shadow: 0 10px 28px rgba(61, 74, 46, 0.22);
  animation: rr-show 0.3s ease both;
}
.rr-cat { margin: 0 0 4px; font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--sage-deep); }
.rr-text { margin: 0 0 8px; font-size: var(--text-base); line-height: 1.5; color: var(--ink-dark); }
.rr-src { margin: 0 0 8px; font-size: var(--text-xs); color: var(--ink-soft); }
.rr-src a { color: var(--ink-dark); text-decoration: underline; }
.rr-count { margin: 0 0 10px; font-size: var(--text-xs); color: var(--ink-soft); }
.rr-card-badge { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px dashed var(--sage-light); }
.rr-close { min-height: 44px; }

/* "?" sheet: the switch for the street surprises */
.st-bn { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  margin-top: var(--space-4); padding: var(--space-3); border-radius: 14px; background: var(--paper-cream); }
.st-bn-p { margin: 2px 0 0; font-size: var(--text-xs); color: var(--ink-soft); }
.st-bn-sw { flex: none; min-width: 92px; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 2px solid var(--sage-deep);
  background: var(--paper-white, #FBF6EE); color: var(--ink-dark); font-weight: 700; cursor: pointer; }
.st-bn-sw[aria-checked="true"] { background: var(--sage-deep); color: #fff; }

/* Tủ sưu tầm: badges and the notebook */
.tu-rac { margin-top: var(--space-4); }
.rr-badges { list-style: none; display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 var(--space-3); padding: 0; }
.rr-badges li { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); }
.rr-list { margin: var(--space-2) 0 0; padding-left: 1.4em; display: grid; gap: var(--space-3); }
.rr-list .rr-text { font-size: var(--text-sm); margin-bottom: 4px; }

@media (prefers-reduced-motion: reduce) {
  .rr-item, .rr-item.is-up, .rr-bar, .rr-card, .rr-tug, .rr-udon.is-hop .rr-u-hop { animation: none; }
}
