:root {
  --ink: #1c1712;
  --muted: #6f655b;
  --paper: #f3eee4;
  --card: #fffaf4;
  --line: #e3d7c6;
  --red: #c83b32;
  --red-deep: #8e241e;
  --gold: #8d6b38;
  --shadow: 0 12px 32px rgba(28, 23, 18, 0.08);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.45 "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}

button, input { font: inherit; color: inherit; }

button { cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.flag { display: none; }

.mast {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  height: 44px;
  min-height: 44px;
  max-height: 44px;
  padding: 0 12px;
  background: #171410;
  color: var(--paper);
  flex: none;
}

.brand { display: flex; gap: 10px; align-items: center; min-width: 0; }

.brand > div { min-width: 0; }

.brand {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  min-height: 0;
}

.mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--red);
  font-family: Georgia, "Iowan Old Style", serif;
  font-size: 12px;
  font-weight: 700;
  flex: none;
}

.studio-name {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #e7c27a;
}

.brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.wordmark {
  margin: 0;
  font-family: Georgia, Palatino, serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.presenter {
  margin: 2px 0 0;
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0.02em;
  color: #c8bfb2;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .presenter { display: none; }
}

.wordmark em { font-style: italic; font-weight: 500; }

.tagline {
  margin: 3px 0 0;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #c8bfb2;
}

.mast-nav { display: flex; gap: 6px; flex: none; }

@media (max-width: 860px) {
  .mast { gap: 8px; padding: 0 8px; }
  .wordmark { font-size: 14px; }
  .mast-nav { gap: 4px; }
  .nav-btn { font-size: 12px; padding: 4px 7px; }
}

.nav-btn {
  min-height: 32px;
  border: 1px solid rgba(243, 238, 228, 0.35);
  background: transparent;
  color: var(--paper);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 14px;
}

.nav-btn[aria-current="page"] {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--paper);
}

main { padding: 12px 12px 20px; }

.colophon {
  padding: 4px 14px 18px;
  color: var(--muted);
  font-size: 13px;
}

.colophon p { margin: 0; }

.lede, .note { color: var(--muted); font-size: 14px; }

.lede { margin: 0 0 12px; }

.cat-bar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }

.cat-list, .seg, .btn-row, .format-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cat-btn, .seg button, .btn, .textish, .file-btn, .format-row button {
  min-height: 44px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 14px;
}

.cat-btn[aria-pressed="true"],
.seg button[aria-selected="true"],
.format-row button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.stage-frame .format-row button {
  background: transparent;
  color: #efe6d8;
  border: 1px solid rgba(243, 238, 228, 0.55);
}

.stage-frame .format-row button[aria-pressed="true"] {
  background: #f3eee4;
  color: #1c1712;
  border-color: #f3eee4;
}

.search, .field input[type="number"], .field input[type="text"], .scene-name input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 8px 12px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.grid.bg-grid {
  grid-template-columns: repeat(2, minmax(0, 220px));
  justify-content: start;
}

.card {
  display: flex;
  flex-direction: column;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 14px;
  padding: 6px;
  box-shadow: var(--shadow);
}

.card.is-reference { border-color: var(--red); }
.card.is-missing {
  border-style: dashed;
  box-shadow: none;
  color: var(--muted);
}

.card-figure, .pose-frame, .summary-thumb {
  background: #efe6d8;
  border-radius: 10px;
  overflow: hidden;
}

.card-figure {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.card-figure img, .pose-frame img, .summary-thumb img, .detail-figure img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
}

.card-figure.bg-figure,
.card-figure.bg-portrait,
.card-figure.bg-landscape,
.card-figure.bg-file {
  aspect-ratio: 9 / 16;
  background: #1c1712;
}

.card-figure.bg-figure img,
.card-figure.bg-portrait img,
.card-figure.bg-landscape img,
.card-figure.bg-file img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.number-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  border: 2px solid var(--ink);
  font-size: 11px;
  font-weight: 800;
}

.card-body { padding: 6px 2px 2px; }

.card-body h3 { margin: 0; font-size: 13px; }

.card-body p, .missing-label { margin: 2px 0 0; color: var(--muted); font-size: 12px; }

.inventory { margin-top: 14px; color: var(--muted); font-size: 13px; }

.inventory summary { cursor: pointer; color: var(--ink); min-height: 44px; display: flex; align-items: center; }

.sheet {
  width: min(640px, 100%);
  max-height: min(92vh, 880px);
  margin: auto auto 0;
  border: 0;
  border-radius: 22px 22px 0 0;
  padding: 0;
  background: var(--card);
  color: var(--ink);
}

.sheet::backdrop { background: rgba(23, 20, 16, 0.48); }

.sheet-body { padding: 16px 16px 24px; overflow: auto; max-height: min(92vh, 880px); }

.admin-merchant-panel {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff7ef;
}

.admin-merchant-panel h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.admin-merchant-panel .field { display: block; margin: 10px 0; }

.admin-merchant-panel .check { display: flex; gap: 8px; align-items: flex-start; }

.admin-merchant-panel .error {
  color: var(--red-deep, #8e241e);
  font-size: 14px;
}

.admin-merchant-panel .btn-danger {
  background: #f4e4e1;
  border-color: #d9a39a;
  color: var(--red-deep, #8e241e);
}

.royalty-breakdown {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #faf6ef;
}

.royalty-breakdown h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.royalty-count { margin: 6px 0 10px; font-size: 14px; }

.royalty-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.royalty-table th,
.royalty-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.royalty-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #efe4d4;
  color: #6a4b22;
  font-size: 12px;
  font-weight: 600;
}

.royalty-selector { margin-top: 10px; }

.royalty-selector h4 {
  margin: 0 0 6px;
  font-size: 14px;
}

.royalty-selector-table .royalty-pick {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  cursor: pointer;
}

.royalty-selector-table .royalty-pick input { margin-top: 3px; }

.sheet-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }

.sheet.asset-sheet {
  width: min(440px, calc(100% - 16px));
  max-height: calc(100dvh - 16px);
  margin: auto;
  border-radius: 18px;
}

.sheet.asset-sheet .sheet-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-sizing: border-box;
  max-height: calc(100dvh - 16px);
  overflow: hidden;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
}

.sheet.asset-sheet .sheet-head { align-items: center; flex: 0 0 auto; }

.sheet.asset-sheet .sheet-head h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
}

.sheet.asset-sheet .sheet-head .btn { flex: 0 0 auto; min-height: 40px; }

.sheet.asset-sheet .detail-figure {
  aspect-ratio: auto;
  width: 100%;
  height: auto;
  margin: 0;
  flex: 0 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sheet.asset-sheet .detail-figure img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100dvh - 168px);
  object-fit: contain;
}

.sheet.asset-sheet.has-action .detail-figure img { max-height: calc(100dvh - 228px); }

.sheet.asset-sheet.has-poses .detail-figure img { max-height: calc(100dvh - 212px); }

.sheet.asset-sheet.has-action.has-poses .detail-figure img { max-height: calc(100dvh - 272px); }

.asset-byline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 28px;
}

.asset-creator { margin: 0; font-size: 15px; color: var(--ink); }

.access-badge {
  flex: 0 0 auto;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.access-badge.is-free { background: #e5f2e4; color: #1f6b32; }

.access-badge.is-premium { background: #f8e7c8; color: #8a5a12; }

.pose-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  flex: 0 0 auto;
  padding-bottom: 2px;
}

.pose-pill {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
}

.pose-pill.is-current,
.pose-pill[aria-pressed="true"] {
  border-color: var(--red);
  box-shadow: inset 0 0 0 1px var(--red);
}

.sheet.asset-sheet .btn-row { flex: 0 0 auto; }

.sheet.asset-sheet .btn-row .btn-primary {
  width: 100%;
  min-height: 48px;
  font-size: 17px;
}

.detail-figure {
  aspect-ratio: 1;
  border-radius: 16px;
  overflow: hidden;
  background: #efe6d8;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
}

.detail-figure.is-wide { aspect-ratio: 16 / 9; }

.detail-figure.is-wide img { object-fit: contain; background: #1c1712; }

.detail-figure.is-portrait {
  aspect-ratio: 9 / 16;
  width: min(100%, calc(68vh * 9 / 16));
  margin-inline: auto;
}

.detail-figure.is-landscape { aspect-ratio: 16 / 9; width: 100%; }

.detail-figure.is-portrait img,
.detail-figure.is-landscape img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.kicker {
  margin: 0;
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sheet h2, .dock h2, .subhead {
  margin: 0 0 8px;
  font-family: Georgia, Palatino, serif;
  font-size: 26px;
  font-weight: 600;
}

.meta { margin: 12px 0; }

.meta div {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.meta dt { color: var(--muted); }

.meta dd { margin: 0; }

.film, .pose-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.pose {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
}

.pose.is-reference, .pose[aria-current="true"] { border-color: var(--red); }

.pose-frame { aspect-ratio: 1; min-width: 0; max-width: 100%; }

.pose-label { font-size: 12px; color: var(--muted); }

.btn-primary {
  background: var(--red);
  border-color: var(--red-deep);
  color: white;
}

.plan { padding-left: 18px; color: var(--muted); }

body:has(.workspace) {
  /* 100vh is taller than the visible iPad screen, which pushed this bar above Safari. */
  min-height: 0;
  height: 100svh;
  max-height: 100svh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
}

body:has(.workspace) .mast {
  flex: 0 0 44px;
}

html.vv-pin body:has(.workspace) {
  position: fixed;
  top: var(--vv-top, 0px);
  left: 0;
  width: 100%;
  height: var(--vv-height, 100svh);
  max-height: var(--vv-height, 100svh);
}

body:has(.workspace) .colophon { display: none; }

body:has(.workspace) main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 55%) minmax(0, 45%);
  grid-template-rows: minmax(0, 1fr);
  flex: 1;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.stage-column,
.dock {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.stage-column {
  display: flex;
  flex-direction: column;
  background: #e7e0d4;
}

.stage-frame {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  background: transparent;
}

.stage-tools,
.stage-actions,
.zoom-field {
  background: #171410;
  color: #efe6d8;
  flex: none;
  max-width: 100%;
}

.stage-tools {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 8px 8px 0;
  border-radius: 18px 18px 0 0;
}

.stage-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 4px 8px 0;
}

.stage-actions .textish {
  background: transparent;
  color: #efe6d8;
  border-color: rgba(243, 238, 228, 0.55);
}

.stage-actions .textish[aria-pressed="true"] {
  background: #f3eee4;
  color: #1c1712;
  border-color: #f3eee4;
}

.layer-count {
  margin: 0 0 0 auto;
  color: #c8bfb2;
  font-size: 13px;
}

.save-picture {
  width: 100%;
  max-width: 100%;
  margin-top: 0;
  min-height: 48px;
  white-space: nowrap;
  flex: none;
  border-radius: 0 0 18px 18px;
}

.zoom-field {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 6px 8px;
  font-size: 13px;
}

.zoom-field input { flex: 1; min-height: 36px; }

#zoom-readout { min-width: 7.2em; text-align: right; }

.stage-fit {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.preview-open {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  min-height: 44px;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(23, 20, 16, 0.78);
  color: #f3eee4;
  font-size: 15px;
}

@media (pointer: coarse) {
  .preview-open { display: block; }
}

.tas-touch .preview-open { display: block; }

.preview-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  min-height: 44px;
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: #f3eee4;
  color: #1c1712;
  font-size: 16px;
}

.picture-hold {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  background: #0c0c0c;
  color: #f3eee4;
}

.picture-hold img {
  max-width: min(100%, 420px);
  max-height: calc(100dvh - 140px);
  width: auto;
  height: auto;
}

.picture-hold button {
  min-height: 44px;
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: #f3eee4;
  color: #1c1712;
}

.scene-preview {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0c0c0c;
}

.scene-preview .stage {
  flex: none;
  max-width: 100vw;
  max-height: 100dvh;
  cursor: default;
}

.scene-preview .layer.is-selected,
.scene-preview .handle { outline: none; }

.stage-save {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(100%, 28rem);
  margin: 0 auto;
  padding: 0 0 12px;
}

.stage-save .btn {
  width: 100%;
  min-height: 44px;
}

.stage-save .stage-export {
  display: flex;
  gap: 8px;
}

.stage-save .stage-export .btn {
  width: auto;
  flex: 1 1 0;
}

.btn-submit {
  background: #1c1712;
  border-color: #1c1712;
  color: #f3eee4;
}

.submit-sheet { width: min(520px, 100%); }

.submit-preview {
  width: min(180px, 42vw);
  aspect-ratio: 9 / 16;
  margin: 8px auto 12px;
  border-radius: 12px;
  overflow: hidden;
  background: #1c1712;
}

.submit-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.field textarea {
  width: 100%;
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

.submit-error { color: #8c2f2f; margin: 8px 0; }

.submit-success { margin: 12px 0; font-size: 18px; }

.stage-fit.is-zoomed {
  align-items: flex-start;
  justify-content: flex-start;
  overflow: auto;
}

.scene-name { flex: 1; min-width: 0; }

.scene-name input { color: var(--ink); }

.stage {
  --zoom: 1;
  position: relative;
  flex: 0 0 auto;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  background: #d9d2c6;
  touch-action: none;
  user-select: none;
}

.stage.is-background-edit { cursor: grab; }

.stage-bg {
  position: absolute;
  max-width: none;
  pointer-events: none;
}

.layers { position: absolute; inset: 0; }

.layer {
  position: absolute;
  width: auto;
  transform: translate(-50%, -50%);
  touch-action: none;
}

.layer img {
  height: 100%;
  width: auto;
  display: block;
  background: none;
  pointer-events: none;
}

.ground-shadow {
  position: absolute;
  left: 50%;
  bottom: 2%;
  width: 58%;
  height: 14%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(28, 23, 18, 0.4), rgba(28, 23, 18, 0) 70%);
  pointer-events: none;
}

.layer:not(.has-shadow) .ground-shadow { display: none; }

.layer.is-selected {
  outline: 3px solid #f3eee4;
  outline-offset: 4px;
}

.handle {
  display: none;
  position: absolute;
  right: -18px;
  bottom: -18px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: var(--red);
  touch-action: none;
  padding: 0;
}

.layer.is-selected .handle { display: block; }

.stage-hint {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 8%;
  margin: 0;
  text-align: center;
  color: #4e463d;
  pointer-events: none;
}

.dock {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: none;
  overflow: hidden;
  background: var(--card);
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}

.dock-tabs {
  display: flex;
  flex: none;
  flex-wrap: nowrap;
  overflow: hidden;
  background: #171410;
}

.dock-tabs button {
  flex: 1 1 0;
  min-height: 44px;
  min-width: 0;
  border: 0;
  background: transparent;
  color: #c8bfb2;
  padding: 8px 2px;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
}

.dock-tabs button[aria-selected="true"] {
  background: #f3eee4;
  color: #1c1712;
}

.dock-body {
  padding: 12px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  background: var(--card);
}

.library-tabs {
  display: flex;
  gap: 6px;
  margin: 0 0 10px;
}

.library-tabs button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 36px;
  padding: 6px 8px;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.library-tabs button[aria-selected="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.art-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: start;
}

.art-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.art-pick {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-align: center;
}

.art-card.is-selected .art-pick {
  border-color: var(--red);
  box-shadow: inset 0 0 0 2px var(--red);
}

.art-pick img {
  width: 100%;
  aspect-ratio: 1;
  height: auto;
  object-fit: contain;
  background: #efe6d8;
  border-radius: 8px;
  display: block;
}

.art-name,
.art-pose {
  display: block;
  overflow-wrap: anywhere;
}

.art-name { font-size: 14px; line-height: 1.25; }

.art-pose { font-size: 12px; line-height: 1.25; color: var(--muted); }

.art-add {
  width: 100%;
  min-height: 36px;
  margin: 0;
  padding: 6px 8px;
  font-size: 14px;
}

.dock .pose-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pose-preview {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 10px;
  align-items: center;
  margin: 8px 0;
}

.pose-preview img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  background: #efe6d8;
  border-radius: 12px;
}

.pose-preview figcaption { font-size: 14px; }

.pose[aria-pressed="true"] { border-color: var(--red); box-shadow: inset 0 0 0 2px var(--red); }

.add-scene { width: 100%; margin-bottom: 8px; }

.field { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; font-size: 14px; }

.field-label { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }

.field input[type="range"] { width: 100%; min-height: 44px; }

.bg-actions { display: flex; flex-direction: column; gap: 8px; }

.bg-actions .btn { width: 100%; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.stack, .scene-list {
  display: flex;
  gap: 8px;
  overflow-x: hidden;
  list-style: none;
  margin: 0 0 10px;
  padding: 0 0 4px;
}

.cast-btn, .stack button, .scene-list button {
  min-height: 44px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 6px;
}

.cast-btn {
  width: auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  text-align: center;
  white-space: normal;
}

.cast-btn img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  background: #efe6d8;
  border-radius: 8px;
  display: block;
}

.cast-btn span {
  display: block;
  font-size: 13px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.cast-btn[aria-current="true"], .stack button[aria-current="true"] { border-color: var(--red); }

.stack, .scene-list { flex-direction: column; overflow: visible; }

.stack button, .scene-list > li > button:first-child { width: 100%; text-align: left; }

.scene-list li { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.file-btn { display: inline-flex; align-items: center; }

.status {
  position: fixed;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  max-width: min(560px, calc(100% - 24px));
  margin: 0;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  z-index: 6;
}

@media (min-width: 720px) {
  .grid.bg-grid { grid-template-columns: repeat(3, minmax(0, 220px)); }
}

@media (min-width: 1100px) {
  .grid.bg-grid { grid-template-columns: repeat(4, minmax(0, 220px)); }
}

.dock .grid.bg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (min-width: 700px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .sheet { margin: auto; border-radius: 22px; }
  .tagline { letter-spacing: 0.16em; }
  .wordmark { font-size: 16px; }
}

@media (max-width: 767px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 58%) minmax(8rem, 42%);
  }

  .dock {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

#leave-dialog {
  width: min(440px, calc(100% - 32px));
  border: 0;
  border-radius: 16px;
  padding: 20px;
  background: var(--card);
  color: var(--ink);
}

#leave-dialog::backdrop { background: rgba(23, 20, 16, 0.48); }

#leave-dialog p { margin: 0 0 14px; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; }
}
