/* Studio styles: the cast and props drawers, the casting screen and the sleeping newcomer's marks (ST6; studio DESIGN
   §2.5, §2.6). Every class root carries the st- prefix. Palette v3 tokens only; reduced motion keeps the information
   without the movement. */

/* ── The drawers: core sheets (cls st-drawer). A bottom sheet on a phone held upright, a right-hand panel when sideways
   and on a tablet. */
.sheet.st-drawer { width: 100%; max-height: 70dvh; box-sizing: border-box; background: var(--paper); border-radius: 24px 24px 0 0;
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom)); animation: st-drawer-up var(--t-card) var(--spring) both; }
.sheet.st-drawer .sheet-body { padding: 0; }
@keyframes st-drawer-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes st-drawer-in { from { transform: translateX(100%); } to { transform: none; } }

.st-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; margin: 0 0 10px; }
.st-drawer-gap { width: 1px; height: 1px; }
.sheet .st-drawer-close { flex: none; }

.st-two-tile { appearance: none; border: 0; margin: 0; padding: 3px 4px 4px; width: 88px; height: 64px; box-sizing: border-box; border-radius: 18px;
  background: var(--card); color: var(--ink); box-shadow: var(--shadow), var(--press); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 1px; font: 700 15px/1 var(--font); cursor: pointer; touch-action: manipulation; transition: transform var(--t-micro) var(--spring); }
.st-two-tile img { width: 42px; height: 42px; object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
.st-two-tile span { max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-two-tile.is-on { box-shadow: 0 0 0 4px var(--signal), var(--shadow); }
.st-two-tile:active { transform: scale(.94); transition-duration: 80ms; }

.st-drawer-grid { display: grid; grid-template-columns: repeat(3, 96px); gap: 12px; justify-content: center; align-items: start; padding: 4px 0 8px; }

/* Tiles: 96 px; each answers at pointerdown with its press (the shell plays the tap). */
.st-tile { appearance: none; border: 0; margin: 0; padding: 0; width: 96px; min-height: 96px; position: relative; background: transparent; color: var(--ink);
  font: inherit; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px; cursor: pointer; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent; transition: transform var(--t-micro) var(--spring); }
.st-tile:active { transform: scale(.92); transition-duration: 80ms; }
.st-tile img { -webkit-user-drag: none; pointer-events: none; }
.st-tile:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 20px; }

/* "New …": the clay add picture over the camera (cast) or the toy box (props), on a card */
.st-tile-new .st-tile-stack, .st-tile-draft, .st-tile-card, .st-tile-wish .st-tile-bulb { width: 88px; height: 88px; margin-top: 4px; box-sizing: border-box; border-radius: 22px;
  background: var(--card); box-shadow: var(--shadow), var(--press); display: grid; place-items: center; position: relative; }
.st-tile-new .st-tile-stack > * { grid-area: 1 / 1; }
.st-tile-cam { width: 48px; height: 48px; object-fit: contain; transform: translate(-6px, 6px); }
.st-tile-props { width: 48px; height: 48px; display: grid; place-items: center; transform: translate(-6px, 6px); }
.st-tile-props .ico { width: 48px; height: 48px; }
.st-tile-add { width: 40px; height: 40px; object-fit: contain; transform: translate(18px, -18px); filter: drop-shadow(0 2px 2px rgba(93, 63, 26, .2)); }

/* the waiting draft: its cut-out with the forward badge */
.st-tile-draft { width: 88px; height: 88px; margin: 4px 4px 0; padding: 0; }
.st-tile-cut { width: 72px; height: 72px; object-fit: contain; }
.st-tile-badge { position: absolute; right: -6px; bottom: -6px; width: 32px; height: 32px; border-radius: 50%; background: var(--coral); color: #fff;
  display: grid; place-items: center; box-shadow: var(--shadow); }
.st-tile-badge svg { width: 20px; height: 20px; }

/* actors: the portrait circle, the on-set ring, the temperament, 9-10 the name */
.st-tile-por { width: 88px; height: 88px; margin-top: 4px; box-sizing: border-box; border-radius: 50%; border: 2px solid var(--card); background: var(--sand);
  box-shadow: var(--shadow); overflow: hidden; display: block; transition: box-shadow var(--t-micro); }
.st-tile-por img { width: 100%; height: 100%; object-fit: cover; display: block; }
.st-tile-actor.is-on .st-tile-por { box-shadow: 0 0 0 4px var(--coral), var(--shadow); }
.st-tile-actor.r3-glow .st-tile-por { box-shadow: var(--glow-ready), var(--shadow); }
.st-tile-actor.r3-glow.is-on .st-tile-por { box-shadow: 0 0 0 4px var(--coral), var(--glow-ready), var(--shadow); }
.st-tile-trait { position: absolute; right: 0; top: 62px; width: 30px; height: 30px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow);
  display: grid; place-items: center; color: var(--ink); }
.st-tile-trait svg { width: 22px; height: 22px; }
.st-tile-name { display: block; max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 700; line-height: 18px; }

/* things and the set's props: a white card, a 3 px coral ring while on this set */
.st-tile-card { background: #fff; }
.st-tile-card img { width: 80px; height: 80px; object-fit: contain; }
.st-tile-thing.is-on .st-tile-card { box-shadow: inset 0 0 0 3px var(--coral), var(--shadow); }

/* the wish lightbulb (6-8, the last tile) */
.st-tile-wish .st-tile-bulb { background: var(--butter); border-radius: 50%; }
.st-tile-wish .ico { width: 48px; height: 48px; }

/* landscape phones: a right-hand panel, 380 px; tablets: 460 px with four tiles a row */
@media (orientation: landscape) {
  .sheet.st-drawer { align-self: stretch; margin-left: auto; width: 380px; max-height: none; height: auto; border-radius: 24px 0 0 24px;
    padding: calc(10px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) 16px;
    animation-name: st-drawer-in; }
}
@media (min-width: 640px) and (min-height: 640px) {
  .sheet.st-drawer { align-self: stretch; margin-left: auto; width: 460px; max-height: none; height: auto; border-radius: 28px 0 0 28px;
    padding: calc(14px + env(safe-area-inset-top)) calc(20px + env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) 20px;
    animation-name: st-drawer-in; }
  .st-drawer-grid { grid-template-columns: repeat(4, 96px); }
}

/* ── The casting screen: the cut-out bobbing on its card, above the object cards */
.st-castview { min-height: 100dvh; background: var(--paper); }
.st-cast-card { position: fixed; z-index: 1; left: 50%; top: 34%; width: 260px; height: 260px; margin: -130px 0 0 -130px; box-sizing: border-box;
  border-radius: 28px; background: #fff; box-shadow: var(--shadow-lift); display: grid; place-items: center; animation: st-cast-bob 1.6s ease-in-out infinite; }
.st-cast-card img { width: 86%; height: 86%; object-fit: contain; -webkit-user-drag: none; }
.st-cast-card img:not([src]) { visibility: hidden; }
.st-cast-card.is-tada { animation: st-cast-tada 600ms var(--spring) both; }
/* while the object cards are up (a bottom sheet over the lower screen), the card rides above them, smaller */
@media (orientation: portrait) {
  .st-cast-card { transition: top var(--t-card) var(--spring), scale var(--t-card) var(--spring); }
  html.sheet-open .st-cast-card { top: calc(19% + 12px); scale: .6; }
}
@keyframes st-cast-bob { 0%, 100% { translate: 0 -6px; } 50% { translate: 0 6px; } }
@keyframes st-cast-tada { 0% { transform: scale(1); } 45% { transform: scale(1.08); } 100% { transform: scale(1); } }
@media (orientation: landscape) {
  .st-cast-card { left: 22.5%; top: calc(50% + 20px); width: 280px; height: 280px; margin: -140px 0 0 -140px; }
}
@media (min-width: 640px) and (min-height: 640px) and (orientation: portrait) {
  .st-cast-card { width: 280px; height: 280px; margin: -140px 0 0 -140px; }
}

/* ── The sleeping newcomer: a drawn zzz over it and, after 3 s, the wake hand (a 64 px button) beside it (casting.js
   places its centre beside the sleeper's projected box, never over its face) */
.st-cast-marks { position: fixed; inset: 0; z-index: 6; overflow: hidden; pointer-events: none; }
.st-cast-marks[hidden] { display: none; }
.st-cast-zzz { color: var(--card); }
.st-cast-wake { appearance: none; position: absolute; left: 0; top: 0; width: 0; height: 0; margin: 0; padding: 0; border: 0; background: none; overflow: visible;
  pointer-events: auto; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.st-cast-wake[hidden] { display: none; }
.st-cast-wake > b { position: absolute; left: -32px; top: -32px; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--card) 94%, transparent); color: var(--ink); box-shadow: var(--shadow), 0 0 0 3px color-mix(in srgb, var(--butter) 70%, transparent);
  animation: st-cast-tap .8s ease-in-out infinite; }
.st-cast-wake > b > svg { width: 40px; height: 40px; }
.st-cast-wake:focus-visible > b { outline: 3px solid var(--ink); outline-offset: 2px; }
@keyframes st-cast-tap { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-3px, 5px) scale(.9); } }

@media (prefers-reduced-motion: reduce) {
  .sheet.st-drawer, .st-cast-card, .st-cast-card.is-tada, .st-cast-wake > b { animation: none; transition: none; }
  .st-tile, .st-two-tile { transition: none; }
  .st-tile:active, .st-two-tile:active { transform: none; filter: brightness(.92); }
}
