:root {
  color-scheme: dark;
  --page: #211923;
  --panel: #30232f;
  --deep: #261c29;
  --line: #704e5c;
  --ink: #faead3;
  --muted: #d3b4a8;
  --gold: #f0c686;
  font-family: "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: radial-gradient(ellipse at 50% 0%, #49303e, var(--page) 67%); }
button, a, input { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid #ffe9b4; outline-offset: 3px; }

.lab { width: min(840px, calc(100% - 28px)); margin: 0 auto; padding: 24px 0 20px; }
.mast { display: flex; align-items: end; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.eyebrow { margin: 0 0 4px; color: var(--gold); font-size: .72rem; font-weight: 750; letter-spacing: .15em; }
h1 {
  margin: 0;
  font-family: "Songti TC", "Noto Serif TC", PMingLiU, Georgia, serif;
  font-size: clamp(1.94rem, 8vw, 3.1rem);
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: .035em;
  text-shadow: 2px 2px #1a131d;
}
.button {
  display: inline-grid;
  min-height: 40px;
  place-items: center;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #3b2938;
  color: var(--ink);
  font-size: .78rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.button:hover { background: #533746; }
.button.gold, .play { background: var(--gold); color: #32212c; border-color: var(--gold); }
.button.gold:hover, .play:hover { background: #ffe0a1; }

.studio {
  --preview-box: 128px;
  overflow: hidden;
  padding: 14px;
  border: 1px solid #805c60;
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 18px 36px #140b1766;
}
.roster { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.character {
  display: grid;
  min-height: 70px;
  place-content: center;
  justify-items: center;
  gap: 2px;
  padding: 5px 2px;
  border: 1px solid #73515d;
  border-radius: 8px;
  background: #2c212e;
  color: var(--muted);
  font-size: .69rem;
  white-space: nowrap;
}
.character img { width: auto; max-width: 100%; height: 43px; }
.character:hover { background: #493344; color: var(--ink); }
.character[aria-pressed="true"] {
  border-color: var(--crew-color);
  background: radial-gradient(ellipse at 50% 78%, color-mix(in srgb, var(--crew-color) 26%, #352532), #352532 88%);
  color: var(--ink);
}
.clip-heading { display: flex; justify-content: space-between; align-items: center; gap: 9px; margin: 14px 0 10px; }
.clip-heading h2 { margin: 0; font-size: 1.1rem; letter-spacing: .025em; }
.clip-heading p { margin: 3px 0 0; color: var(--muted); font-size: .72rem; line-height: 1.45; }
.segmented { display: flex; gap: 3px; align-items: center; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: var(--deep); }
.segmented button {
  min-height: 32px;
  padding: 4px 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: .71rem;
  font-weight: 700;
  white-space: nowrap;
}
.segmented button:hover { color: var(--ink); background: #47303e; }
.segmented button[aria-pressed="true"] { color: #32212c; background: var(--gold); }
.compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.screen { overflow: hidden; margin: 0; border: 1px solid #815c64; border-radius: 9px; }
.screen figcaption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px;
  padding: 7px 9px;
  border-bottom: 1px solid #755462;
  color: var(--muted);
  font-size: .66rem;
  white-space: nowrap;
}
.screen strong { color: var(--ink); font-size: .77rem; }
.reel-window {
  position: relative;
  height: 174px;
  overflow: hidden;
  background:
    linear-gradient(transparent 73%, #c9966e22 74%, transparent 75%),
    radial-gradient(ellipse at 50% 65%, #674955, #40313e 78%);
}
.reel-window svg { position: absolute; top: 50%; left: 50%; translate: -50% -50%; width: var(--preview-box); height: var(--preview-box); }
.reel-window svg[data-pose] { overflow: visible; }
.playback { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; margin: 9px 0; }
.playback .play { min-width: 62px; min-height: 38px; }
.playback input { width: 100%; accent-color: var(--gold); }
.playback output { color: var(--muted); font-size: .73rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.settings { display: flex; justify-content: space-between; align-items: center; gap: 5px; margin: 7px 0 8px; }
.settings[hidden] { display: none; }
.settings > span { color: var(--muted); font-size: .72rem; }
.frames { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.frame {
  display: grid;
  justify-items: center;
  padding: 0;
  overflow: hidden;
  border: 1px solid #72505d;
  border-radius: 8px;
  background: #372936;
  color: var(--muted);
}
.frame[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }
.frame:hover { border-color: #e4b384; }
.frame svg { display: block; width: min(100%, 100px, var(--preview-box)); height: auto; aspect-ratio: 1; }
.frame span { width: 100%; padding: 3px 1px 4px; background: var(--deep); font-size: .66rem; white-space: nowrap; }
.frame time { font-variant-numeric: tabular-nums; }
.exports { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-top: 11px; }
.exports p { margin: 0; color: var(--muted); font-size: .72rem; }
.export-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.export-actions [hidden] { display: none; }

@media (max-width: 550px) {
  .lab { width: calc(100% - 18px); padding-top: 13px; }
  .studio { padding: 8px; }
  .roster { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .character { min-height: 59px; }
  .character img { height: 35px; }
  .clip-heading { align-items: start; flex-wrap: wrap; margin-top: 10px; }
  .clip-heading h2 { font-size: 1rem; }
  .screen figcaption { padding-inline: 6px; font-size: .61rem; }
  .reel-window { height: 148px; }
  .frame span { font-size: .58rem; }
}
