@font-face {
  font-family: 'Mochiy Pop P One';
  src: url('world-ui.woff2?v=8b2f702925f4') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
:root {
  color-scheme: dark;
  --world-type: 'Mochiy Pop P One', 'Hiragino Maru Gothic ProN', Meiryo, sans-serif;
  --ink: #fff6ee;
  --muted: #d1c0c8;
  --deep: #211c24;
  --panel: #302731;
  --control: #443642;
  --hover: #54414f;
  --edge: #735f6c;
  --rule: #503f4c;
  --accent: #e6badb;
  --selected: #513b4e;
  --gold: #ffda93;
  font:
    15px/1.45 'Hiragino Maru Gothic ProN',
    'M PLUS Rounded 1c',
    ui-rounded,
    Meiryo,
    'Yu Gothic UI',
    system-ui,
    sans-serif;
  background: var(--deep);
  color: var(--ink);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
select,
input {
  font: inherit;
}
button,
select {
  cursor: pointer;
  color: var(--ink);
  background: var(--control);
  border: 1px solid var(--edge);
  border-radius: 11px;
  min-height: 34px;
  padding: 5px 10px;
  font-weight: 600;
}
@media (hover: hover) {
  button:enabled:hover, select:enabled:hover {
    border-color: #bfa2b2;
    background: var(--hover);
  }
}
button:enabled:active { filter: brightness(.88); }
@media (prefers-reduced-motion: no-preference) {
  button { transition: background-color 110ms, border-color 110ms, color 110ms; }
}
button:disabled {
  opacity: 0.48;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
summary:focus-visible,
canvas:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}
button[aria-pressed='true'] {
  color: #fff1fb;
  border-color: var(--accent);
  background: var(--selected);
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1, h2, h3, #cast-name, .cast-caption, .action, #adjust, .world-link, .preset-caption strong {
  font-family: var(--world-type);
  font-weight: 400;
  font-synthesis: none;
}
h1 {
  font-size: clamp(17px, 2vw, 24px);
  letter-spacing: 0.025em;
}
h2 {
  font-size: 19px;
}
h3 {
  font-size: 14px;
}
button,
canvas,
input[type='range'] {
  touch-action: manipulation;
}
[hidden] {
  display: none !important;
}
main {
  height: 100vh;
  height: 100dvh;
  display: grid;
  --dock-height: min(50dvh, 432px);
  --dock-open: min(58dvh, 540px);
  --dock-tall: min(80dvh, 760px);
  grid-template-rows: minmax(0, 1fr) var(--dock-height);
}
#stage {
  position: relative;
  isolation: isolate;
  min-height: 0;
  overflow: hidden;
  min-width: 0;
  background: var(--deep);
}
#game {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
}
#game, #grip {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
#load {
  padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
           8px max(12px, env(safe-area-inset-left));
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
  background: var(--deep);
}
#welcome:not([src]) { visibility: hidden; }
#welcome {
  width: min(84%, 50vh, 480px);
  aspect-ratio: 2 / 1;
  height: auto;
  border-radius: 8px;
}
.gallery-link, #load a {
  color: var(--accent);
  text-underline-offset: .22em;
}
.gallery-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  font-size: .85rem;
}
#load h2 {
  font-size: 15px;
}
progress {
  width: min(46%, 260px);
  height: 6px;
  accent-color: var(--accent);
}
#load-note {
  max-width: 85%;
  text-align: center;
  color: var(--muted);
}
#enable-audio {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  min-height: 44px;
  padding-inline: 14px;
  font-family: var(--world-type);
  font-size: 12px;
  font-weight: 400;
}
#show-dock {
  position: absolute;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
}
.expanded main {
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
}
.expanded #dock {
  display: none;
}
#dock {
  position: relative;
  z-index: 1;
  align-self: end;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: var(--dock-height);
  padding: 0 max(12px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: var(--panel);
  border-top: 1px solid var(--edge);
  border-radius: 19px 19px 0 0;
  color: var(--ink);
}
#dock.settings-open { height: var(--dock-open); }
#dock.sheet-tall { height: var(--dock-tall); }
.primary-controls, .quick-presets, .sheet {
  width: min(100%, 740px);
  margin-inline: auto;
}
.primary-controls {
  container-type: inline-size;
  flex: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}
.cast-group, .view-group { min-width: 0; }
.legend {
  display: grid;
  grid-template-columns: minmax(0, max-content) minmax(max-content, 1fr) auto;
  align-items: center;
  column-gap: 6px;
  margin-bottom: 4px;
  color: var(--muted);
}
.cast-info { min-width: 0; max-width: 43cqw; line-height: 1.35; }
#cast-name { display: block; color: var(--ink); font-size: 14px; }
#cast-name[data-pair] { font-size: 12px; word-break: keep-all; overflow-wrap: anywhere; }
#playing { display: block; font-size: 10px; }
.world-link {
  justify-self: center;
  position: relative;
  isolation: isolate;
  display: inline-flex;
  gap: 2px;
  align-items: center;
  min-height: 44px;
  padding-inline: 6px 9px;
  color: #493328;
  font-size: 11px;
  text-decoration: none;
  white-space: nowrap;
}
.world-link::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 5px 0;
  background: #efcba8;
  border: 1px solid #f4d9ba;
  border-radius: 9px;
}
.world-link img { width: 57px; height: auto; }
.world-link:lang(en) { flex-direction: row-reverse; }
.world-link:focus-visible { outline: 2px solid #ffda9c; outline-offset: 1px; border-radius: 9px; }
@media (hover: hover) { .world-link:hover::before { background: #ffe1be; } }
.world-link:active::before { background: #e2b995; }
#cast {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  container-type: inline-size;
}
#cast button {
  display: grid;
  grid-template-rows: auto 1fr;
  align-self: stretch;
  min-width: 0;
  min-height: 48px;
  padding: 0;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: #3f323e;
  overflow: hidden;
}
#cast .portrait-frame {
  display: block;
  width: 100%;
  aspect-ratio: 1.42;
  overflow: hidden;
}
#cast img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cast-caption {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 23px;
  padding: 3px 0;
  color: #f7e8ee;
  font-size: clamp(9px, 3.25cqw, 12px);
  line-height: 1.2;
  white-space: nowrap;
}
#cast button[aria-pressed='true'] { border-color: var(--gold); background: #ffdda8; }
#cast button[aria-pressed='true'] .cast-caption { color: #3c2925; }
@media (hover: hover) {
  #cast button[aria-pressed='false']:hover { border-color: #cbafba; background: var(--hover); }
}
.views, .row, .dialog-actions, .utilities {
  display: flex;
  align-items: center;
  gap: 7px;
}
.views { gap: 6px; }
.camera-options {
  display: grid;
  grid-template-columns: 1.45fr 1fr 1fr;
  flex: 1;
  min-width: 0;
  padding: 2px;
  border: 1px solid var(--edge);
  border-radius: 9px;
  background: var(--deep);
}
.camera-options button {
  min-width: 0;
  min-height: 38px;
  padding: 3px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.15;
}
.camera-options button[aria-pressed='true'] {
  background: #ebc8e2;
  color: #382735;
}
#move {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 4px 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}
#move::before {
  content: '';
  width: 18px;
  height: 10px;
  box-sizing: border-box;
  border: 1px solid #ac95a4;
  border-radius: 10px;
  background: radial-gradient(circle at 4px 50%, currentColor 2.5px, transparent 3px);
}
#move[aria-pressed='true'] { border-color: #b18da6; color: #ebc8e2; }
#move[aria-pressed='true']::before {
  border-color: var(--accent);
  background: radial-gradient(circle at 12px 50%, #442d40 2.5px, transparent 3px) var(--accent);
}
#adjust {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  align-self: stretch;
  min-height: 44px;
  min-width: 78px;
  border-radius: 14px;
  font-size: 14px;
}
#adjust::after {
  content: '';
  width: 7px;
  height: 7px;
  margin-top: -3px;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
#adjust[aria-expanded='true'] { background: var(--selected); border-color: #c699ba; color: #fff1fb; }
#adjust[aria-expanded='true']::after { transform: rotate(225deg); margin-top: 3px; }
#game.moving { cursor: move; }
.action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding-inline: 12px;
  border-radius: 14px;
  box-shadow: inset 0 1px 0 #fff3df70, inset 0 -2px 0 #69332022;
  border-color: #ffcfb4;
  background: #ffc3a8;
  color: #43281f;
  font-size: clamp(16px, 1.45vw, 21px);
}
.action::before {
  content: '';
  width: 10px;
  height: 11px;
  background: currentColor;
  clip-path: polygon(5% 0, 100% 50%, 5% 100%);
}
.action[data-state='stop'] { box-shadow: none; background: #503539; border-color: #c79688; color: #ffdbca; }
.action[data-state='stop']::before { clip-path: none; width: 9px; height: 9px; border-radius: 2px; }
.action[data-state='returning'] { box-shadow: none; border-color: var(--edge); color: var(--muted); background: var(--control); opacity: 1; }
.action[data-state='returning']::before { display: none; }
@media (hover: hover) {
  .action:enabled:hover { background: #ffd2b9; border-color: var(--gold); }
  .action[data-state='stop']:enabled:hover { background: #62414a; border-color: #ffd1b8; }
}
#grip {
  flex: none;
  display: grid;
  place-items: center;
  width: 100%;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  touch-action: none;
  cursor: ns-resize;
}
#grip span { width: 36px; height: 4px; border-radius: 2px; background: #aa929e; }
#dock:not(.settings-open) .sheet, .settings-open .quick-presets { display: none; }
.sheet, .quick-presets {
  min-height: 0;
  margin-top: 8px;
  border-top: 1px solid var(--rule);
}
.sheet { flex: 1; }
.sheet-window, #panel { height: 100%; }
#panel, #quick-list {
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-color: #866c7c var(--panel);
  scrollbar-width: thin;
}
#panel { padding: 8px 2px 6px; }
.motion-title { margin: 12px 0 6px; }
@media (prefers-reduced-motion: reduce) {
  #dock { transition: none; }
}
.utilities {
  flex-wrap: wrap;
  margin-top: 10px;
}
.utilities button { font-size: 12px; }
#notice { grid-column: 1 / -1; }
#controls {
  display: grid;
  border-block: 1px solid var(--edge);
}
.tune {
  display: grid;
  grid-template-columns: minmax(70px, 1fr) minmax(120px, 1.7fr);
  align-items: center;
  column-gap: 10px;
  padding-inline: 2px;
  min-height: 44px;
}
.tune + .tune { border-top: 1px solid var(--rule); }
.tune label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0 5px;
  line-height: 1.25;
  font-size: 12px;
  font-weight: 650;
}
.tune output {
  color: var(--accent);
  font-size: 13px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.rail {
  display: flex;
  align-items: center;
  gap: 5px;
}
.rail input {
  min-width: 0;
  flex: 1;
  accent-color: var(--accent);
  width: 100%;
  height: 28px;
  margin: 0;
  cursor: pointer;
}
.rail button {
  font-size: 15px;
  min-width: 36px;
  min-height: 38px;
  padding: 0;
}
.footer-actions {
  margin: 9px 0;
}
.footer-actions button {
  font-size: 12px;
  flex: 1;
}
.preferences h3 {
  margin: 10px 0 5px;
}
.chips {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.chips button,
#edit-second {
  font-size: 12px;
}
.preferences select {
  flex: 1;
  min-width: 0;
}
.presets {
  border-top: 1px solid var(--edge);
  padding-top: 12px;
  margin-top: 14px;
}
.preset-heading, .preset-search, .history-heading, .code-actions, .pager {
  display: flex;
  align-items: center;
  gap: 6px;
}
.preset-heading, .history-heading { justify-content: space-between; }
.preset-heading h3 { font-size: 15px; }
#sort {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: var(--deep);
}
#sort button {
  min-height: 32px;
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
#sort button[aria-pressed='true'] { color: #ffeef9; background: var(--selected); }
.preset-search { margin-block: 7px 5px; }
#preset-query { flex: 1; min-width: 0; font-size: 13px; }
#refresh { flex: none; width: 38px; min-height: 36px; padding: 0; font-size: 18px; }
#preset-tools { margin-top: 10px; border-top: 1px solid var(--edge); }
#preset-tools summary { padding: 11px 2px; font-size: 13px; cursor: pointer; color: var(--muted); }
.code-actions { margin-bottom: 10px; }
.code-actions button, .history-heading select, .pager button { font-size: 12px; }
.history-heading { flex-wrap: wrap; }
.history-heading small, .pager span { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.history-choice {
  display: grid;
  gap: 3px;
  width: 100%;
  min-height: 44px;
  text-align: start;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  overflow-wrap: anywhere;
}
.history-choice small, .empty, #notice { color: var(--muted); font-size: 12px; }
.empty { padding: 12px 0; }
#notice { padding-top: 8px; color: var(--accent); }
#notice:empty { display: none; }
.pager { justify-content: center; margin-top: 6px; }
.pager button { min-height: 36px; }
#preset-query,
dialog input {
  width: 100%;
  background: var(--deep);
  color: var(--ink);
  border: 1px solid var(--edge);
  padding: 8px;
  border-radius: 5px;
}
dialog {
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 10px;
  max-width: min(430px, 94vw);
  padding: 22px;
  box-shadow: 0 14px 60px #0009;
}
dialog::backdrop {
  background: #171119ba;
}
dialog h2 {
  margin-bottom: 12px;
}
dialog p {
  margin: 8px 0;
  color: #e2d5da;
}
.dialog-actions {
  justify-content: flex-end;
  margin-top: 18px;
}
dialog label {
  display: block;
}
dialog input {
  margin: 8px 0;
}
#dialog-body textarea {
  width: 100%;
  min-height: 7em;
  resize: vertical;
  padding: 0.5rem;
  background: var(--deep);
  color: var(--ink);
  border: 1px solid var(--edge);
}

.cast-group { grid-column: 1 / -1; container-type: inline-size; }
.view-group { margin: 0 0 8px; container-type: inline-size; }
#editing-portrait { flex: none; object-fit: cover; border-radius: 5px; }
#language {
  min-width: 59px;
  border-radius: 18px;
  min-height: 32px;
  padding: 3px 8px;
  color: #ebdce3;
  background: transparent;
  font-size: 12px;
}
.lighting {
  display: grid;
  grid-template-columns: auto auto minmax(40px, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  margin-top: 9px;
}
.room-look { display: flex; align-items: center; gap: 8px; }
.room-look select { flex: 1; min-width: 0; }
.room-look label, .lighting label { margin-inline-end: 4px; font-weight: 700; }
.lighting span { font-size: 12px; color: var(--muted); }
.lighting input { width: 100%; margin: 0; accent-color: var(--accent); }
#restore:disabled { cursor: default; }

#view-hint { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
@container (max-width: 295px) {
  #editing-portrait { width: 29px; }
  .views { gap: 4px; }
  .camera-options button, #move { font-size: 12px; }
  #move { padding-inline: 4px; }
}

.quick-presets { display: flex; flex: 1; flex-direction: column; container-type: inline-size; }
.quick-heading { flex: none; display: flex; align-items: center; justify-content: space-between; min-height: 44px; gap: 8px; }
.quick-heading h2 { display: flex; align-items: center; gap: 6px; font-size: 15px; line-height: 1.4; }
.preset-star {
  display: inline-block;
  flex: none;
  width: 17px;
  height: 17px;
  background-color: var(--gold);
  -webkit-mask: url('preset-star.svg') center / contain no-repeat;
  mask: url('preset-star.svg') center / contain no-repeat;
}
#quick-pages {
  display: flex;
  align-items: center;
  border-radius: 8px;
}
#quick-pages button, #quick-pages select {
  height: 36px;
  border-radius: inherit;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}
#quick-pages button { width: 38px; padding: 0; }
#quick-pages select { min-width: 44px; padding: 0 1px; font: 500 12px/1.3 system-ui, sans-serif; font-variant-numeric: tabular-nums; }
#quick-pages option { background: var(--panel); color: var(--ink); }
@media (hover: hover) {
  #quick-pages button:enabled:hover, #quick-pages select:hover { background: var(--hover); color: var(--ink); }
}
#quick-pages button:disabled { opacity: .32; cursor: default; }
#quick-pages button::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
}
#quick-prev::before { transform: rotate(135deg); }
#quick-next::before { transform: rotate(-45deg); }
#first-hint {
  flex: none;
  margin: 0 0 6px;
  color: #e7c9bb;
  font-size: 12px;
  line-height: 1.45;
}
#quick-list.measuring { overflow-y: hidden; }
#quick-list { flex: 1; min-height: 0; border-top: 1px solid var(--rule); }
/* The whole row is the touch target. The title keeps the space beside the score. */
.preset-choice {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 6px 8px;
  text-align: start;
  border: 0;
  border-radius: 9px;
  background: transparent;
}
.preset-row + .preset-row::before {
  content: '';
  position: absolute;
  inset: 0 8px auto;
  height: 1px;
  background: var(--rule);
}
.preset-row:has([aria-pressed='true'])::before,
.preset-row:has([aria-pressed='true']) + .preset-row::before { background: transparent; }
@media (hover: hover) {
  .preset-choice[aria-pressed='false']:hover { background: #423540; }
}
.preset-choice[aria-pressed='true'], .preset-choice[aria-pressed='true']:enabled:hover { color: #fff5e9; background: #674c51; }
.preset-choice:focus-visible { outline-offset: -2px; }
.preset-caption { display: grid; min-width: 0; gap: 3px; overflow-wrap: anywhere; }
.preset-row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 42px; align-items: center; border-radius: 9px; }
.preset-row:has([aria-pressed='true']) { background: #674c51; }
.row-share { display: grid; place-items: center; min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--muted); }
.row-share svg, #share-current svg, #share-copy svg { flex: none; }
#share-current, #share-copy { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.clipboard-source { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
#copy-notice {
  position: absolute;
  z-index: 8;
  bottom: calc(100% + 8px);
  inset-inline-end: max(10px, env(safe-area-inset-right));
  width: max-content;
  max-width: min(29em, calc(100vw - 24px));
  padding: 9px 14px;
  border: 1px solid #9b7e8e;
  border-radius: 12px;
  background: #392d38;
  box-shadow: 0 2px 10px #24182836;
  color: #fff3ec;
  font-size: 13px;
  line-height: 1.55;
  pointer-events: none;
  text-wrap: pretty;
}
#copy-notice:empty { opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  #copy-notice:not(:empty) { animation: copy-appear 130ms ease-out; }
  @keyframes copy-appear { from { opacity: 0; transform: translateY(3px); } }
}
.row-share:focus-visible { outline-offset: -3px; }
.creation-actions { display: flex; gap: 8px; margin: 14px 0 18px; }
.creation-actions button { flex: 1; min-height: 42px; font-size: 13px; }
#link-warning { color: var(--gold); font-size: 13px; margin-bottom: 8px; }
#share-dialog { width: min(380px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); border: 1px solid var(--edge); border-radius: 19px; padding: 20px; }
#share-dialog header, .share-preview, .share-actions { display: flex; align-items: center; gap: 12px; }
#share-dialog header { justify-content: space-between; }
#share-dialog h2 { font-size: 18px; margin: 0; }
#share-close { color: var(--muted); background: transparent; border: 0; font-size: 22px; width: 40px; height: 40px; padding: 0; }
.share-preview { padding-block: 14px; margin-bottom: 12px; border-bottom: 1px solid var(--rule); }
.share-preview img { flex: none; width: 58px; height: 48px; object-fit: cover; border-radius: 10px; }
.share-preview strong, .share-preview small { display: block; overflow-wrap: anywhere; }
.share-preview strong { font: 400 16px/1.55 var(--world-type); }
.share-preview small, #share-dialog p { color: var(--muted); font-size: 13px; }
#post-controls { border: 0; margin: 0; padding: 0; }
#post-controls label { font-size: 13px; }
#share-dialog input { min-height: 42px; border-radius: 8px; }
.share-actions { gap: 8px; justify-content: flex-end; margin-top: 14px; }
.share-actions button { min-height: 44px; }
.share-primary { color: #35232e; background: #f1c8df; border-color: #f1c8df; }
.share-primary:enabled:hover { color: #35232e; background: #ffdbeb; }
#share-feedback:not(:empty) { margin: 12px 0 0; color: #ffe0bc; }
#share-feedback:empty { margin: 0; }
.preset-caption strong { font-size: 14px; line-height: 1.45; }
.preset-caption small { color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.35; }
.preset-choice[aria-pressed='true'] small { color: #f0deda; }
.preset-rating {
  display: grid;
  grid-template-columns: auto minmax(3ch, auto);
  align-items: center;
  gap: 4px;
  color: #f4e6d2;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: end;
}
.preset-rating .preset-star { position: relative; top: -1px; }
@media (forced-colors: active) {
  .preset-star { forced-color-adjust: none; background: ButtonText; }
  .preset-choice[aria-pressed='true'] { border: 2px solid Highlight; }
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (min-width: 550px) and (min-aspect-ratio: 6/5) {
  #copy-notice {
    inset-inline-end: calc(100% + 12px);
    bottom: max(14px, env(safe-area-inset-bottom));
    max-width: min(29em, calc(100vw - 100% - 24px));
  }
  main { grid-template: minmax(0, 1fr) / minmax(0, 1fr) clamp(300px, 30vw, 400px); }
  #dock, #dock.settings-open, #dock.sheet-tall {
    align-self: stretch;
    height: auto;
    min-height: 0;
    padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) 16px;
    border: 0;
    border-left: 1px solid var(--edge);
    border-radius: 0;
  }
  #grip { display: none; }
  .primary-controls { gap: 12px 8px; }
  #cast-name { font-size: 17px; }
  .cast-group .legend { margin-bottom: 8px; }
  .quick-presets, .sheet { margin-top: 16px; }
  .quick-heading { min-height: 52px; }
  #quick-list .preset-choice { min-height: 56px; padding-block: 8px; }
  .action { font-size: clamp(15px, 1.4vw, 20px); }
}
/* A narrow side panel leaves too little room for an unbroken mascot name.
   Stack the wordmark and caption within the same 44px tap target. */
@container (max-width: 315px) {
  #cast-name { font-size: 13px; }
  .world-link, .world-link:lang(en) {
    flex-direction: column;
    justify-content: center;
    gap: 0;
    padding: 2px 7px;
    font-size: 10px;
    line-height: 1.15;
  }
  .world-link:lang(en) { flex-direction: column-reverse; }
  .world-link img { width: 52px; }
  .world-link::before { inset-block: 1px; }
}
@container (max-width: 310px) {
  .quick-heading { gap: 4px; }
  .quick-heading h2 { font-size: 13px; gap: 4px; }
}
@container (max-width: 280px) {
  .action { font-size: 14px; gap: 6px; padding-inline: 6px; }
  #adjust { min-width: 66px; gap: 5px; padding-inline: 6px; }
  #quick-pages button { width: 32px; }
}
@media (pointer: coarse) {
  #quick-pages button { width: 42px; }
  #quick-pages button, #quick-pages select, .rail button, .chips button { min-height: 42px; }
  .quick-heading { min-height: 50px; }
}
/* Keep the usable rail width outside the phone notch. Let the author and
   rating share the second line when the landscape viewport is short. */
@media (min-width: 550px) and (min-aspect-ratio: 6/5) and (max-height: 430px) {
  main { grid-template-columns: minmax(0, 1fr) calc(clamp(300px, 30vw, 400px) + max(0px, env(safe-area-inset-right) - 16px)); }
  #dock, #dock.settings-open, #dock.sheet-tall { padding-top: max(8px, env(safe-area-inset-top)); }
  #load { gap: 8px; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
  #welcome { width: min(80%, 64vh, 320px); }
  .primary-controls { row-gap: 6px; }
  .quick-presets, .sheet { margin-top: 7px; }
  .quick-heading { min-height: 44px; }
  #quick-list .preset-choice { min-height: 48px; padding-block: 4px; align-content: center; gap: 2px 6px; }
  #quick-list .preset-caption { display: contents; }
  #quick-list .preset-caption strong { grid-area: 1 / 1 / 2 / -1; overflow-wrap: anywhere; }
  #quick-list .preset-caption small { grid-area: 2 / 1; overflow-wrap: anywhere; }
  #quick-list .preset-rating { grid-area: 2 / 2; }
}
@media (max-height: 560px) and (max-aspect-ratio: 6/5) {
  main { --dock-height: min(234px, 57dvh); --dock-open: 65dvh; }
}
@media (prefers-reduced-motion: no-preference) {
  #dock:not(.dragging-sheet) { transition: height 160ms ease-out; }
}

/* WebGL 2 is available on iOS versions that predate dynamic viewport units. */
@supports not (height: 100dvh) {
  main { --dock-height: min(50vh, 432px); --dock-open: min(58vh, 540px); --dock-tall: min(80vh, 760px); }
  #share-dialog { max-height: calc(100vh - 24px); }
  @media (max-height: 560px) and (max-aspect-ratio: 6/5) {
    main { --dock-height: min(234px, 57vh); --dock-open: 65vh; }
  }
}
