:root {
  color-scheme: light;
  font-family: "DM Sans", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  color: #223931;
  background: #f7f6ef;
  --border: #d8ded1;
  --muted: #5b6b60;
  --tint: #e2eee5;
  --accent: #396859;
}
* { box-sizing: border-box; }
body, h1, h2, h3, p { margin: 0; }
.container { width: min(1180px, calc(100% - 56px)); margin: auto; }
.masthead { background: #203e34; color: #f5f4df; }
.brand-row { min-height: 52px; display: flex; align-items: center; justify-content: space-between; }
a { text-decoration: none; color: inherit; }
.brand, .back { display: inline-flex; align-items: center; gap: 10px; }
.brand { font-weight: 700; letter-spacing: .08em; }
.ball { position: relative; width: 22px; height: 22px; border: 2px solid #e6cd94; border-radius: 50%; background: linear-gradient(155deg, transparent 43%, #e6cd94 44% 54%, transparent 55%); }
.ball::after { content: ""; position: absolute; inset: 5px; border: 2px solid #e6cd94; border-radius: 50%; background: #203e34; }
.back { color: #dfe8d9; font-size: 13px; }
.back:hover { color: white; text-decoration: underline; text-underline-offset: 4px; }
main { padding: clamp(18px, 3.2vh, 34px) 0 24px; }
h1 { font-size: clamp(26px, 3vw, 40px); line-height: 1.2; letter-spacing: -.045em; }
#species { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; margin: 18px 0; }
button, input { font: inherit; }
button { color: inherit; background: none; cursor: pointer; }
button:disabled { opacity: .4; cursor: default; }
:is(button, a, input, canvas):focus-visible { outline: 3px solid #986819; outline-offset: 3px; }
.species { display: flex; align-items: center; gap: 10px; height: 64px; border: 1px solid var(--border); border-radius: 12px; padding: 7px 12px; text-align: left; background: #fffef8; }
.species:hover { border-color: #94a697; }
.species[aria-pressed="true"] { border-color: var(--accent); background: var(--tint); box-shadow: inset 0 0 0 1px var(--accent); }
.species img { width: 47px; height: 47px; object-fit: contain; }
.species span { display: grid; gap: 2px; }
.species small, #model-code, #clip-code, #duration, .clip-duration { font: 500 11px/1.3 "IBM Plex Mono", Consolas, ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.species small { color: var(--muted); letter-spacing: .065em; }
.species b { font-size: 15px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) clamp(266px, 28%, 345px); gap: 16px; align-items: stretch; }
.viewer, .catalog { border: 1px solid var(--border); background: #fffef9; border-radius: 19px; overflow: hidden; }
.viewer { box-shadow: 0 6px 19px #3449190a; }
#stage { position: relative; height: clamp(345px, 50vh, 530px); isolation: isolate; background: radial-gradient(ellipse at 48% 34%, #fffdf0 0%, var(--tint) 72%, color-mix(in srgb, var(--tint), var(--accent) 18%) 100%); }
#stage::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .33; background: radial-gradient(#52695660 .7px, transparent .8px) 0 0 / 12px 12px; mask-image: linear-gradient(135deg,#000,transparent 46%,transparent 72%,#000); }
.model-heading, .reset { position: absolute; z-index: 1; top: 18px; }
.model-heading { left: 21px; pointer-events: none; }
#model-code { display: block; color: var(--accent); letter-spacing: .09em; }
.model-heading h2 { margin-top: 3px; font-size: clamp(20px, 2.2vw, 29px); letter-spacing: -.04em; }
.reset, .transport-controls button { min-height: 35px; padding: 5px 12px; border: 1px solid #bfccbd; border-radius: 9px; background: #fffff6cf; font-size: 13px; font-weight: 600; }
.reset { right: 17px; }
.reset:hover, .transport-controls button:not(:disabled):hover { filter: brightness(.95); }
#canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#canvas:active { cursor: grabbing; }
#canvas:focus-visible { outline-offset: -4px; }
#status { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); border-radius: 8px; padding: 8px 15px; background: #fffff4e5; font-size: 14px; text-align: center; }
#status:empty { display: none; }
.transport { padding: 14px 20px 16px; border-top: 1px solid var(--border); }
.transport-heading, .transport-controls { display: flex; align-items: center; }
.transport-heading { justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.transport-heading > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 9px; }
#clip-name { font-size: 17px; }
#clip-code, #duration { color: var(--muted); }
#duration { white-space: nowrap; }
.transport-controls { gap: 8px; }
.transport-controls .play { color: #fffef2; border-color: #29523e; background: #2f5543; }
#timeline { min-width: 0; flex: 1; height: 28px; margin-left: 5px; accent-color: #416750; cursor: pointer; }
.catalog { display: flex; flex-direction: column; min-height: 0; contain: size; }
.catalog-heading { display: flex; align-items: baseline; justify-content: space-between; padding: 19px 18px 14px; border-bottom: 1px solid var(--border); }
.catalog-heading h2 { font-size: 20px; letter-spacing: -.04em; }
#clip-count { font-size: 12px; color: var(--muted); }
#clips { height: 0; min-height: 0; flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #b6c4b5 transparent; padding: 0 14px 14px; }
.group h3 { margin: 14px 4px 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.clip { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; min-height: 37px; border: 1px solid transparent; border-radius: 8px; text-align: left; font-size: 14px; }
.clip:hover { background: #eff1e7; }
.clip[aria-pressed="true"] { color: #264739; background: var(--tint); border-color: color-mix(in srgb, var(--accent), transparent 66%); font-weight: 700; }
.clip-marker { flex: 0 0 11px; width: 11px; height: 11px; display: grid; place-items: center; }
.clip-marker::before { content: ""; width: 5px; height: 5px; border: 1px solid #9baa9f; border-radius: 50%; }
.clip[aria-pressed="true"] .clip-marker::before { width: 0; height: 0; border: 4px solid transparent; border-left: 7px solid var(--accent); border-right: 0; border-radius: 0; }
.clip-duration { margin-left: auto; color: var(--muted); }
.hint { margin: 11px 2px 0; color: var(--muted); line-height: 1.7; font-size: 12px; }
@media (max-width: 820px) {
  .container { width: calc(100% - 32px); }
  .species { gap: 6px; padding: 5px 8px; }
  .species img { width: 34px; height: 37px; }
  .workspace { grid-template-columns: minmax(0, 1fr) 226px; gap: 10px; }
}
@media (max-width: 640px) {
  .container { width: calc(100% - 24px); }
  .brand-row { min-height: 45px; }
  #species { gap: 4px; margin: 14px 0 10px; }
  .species { height: auto; padding: 4px 1px 6px; flex-direction: column; gap: 2px; border-radius: 9px; text-align: center; }
  .species img { width: 34px; height: 32px; }
  .species b { font-size: 12px; white-space: nowrap; }
  .species small { display: none; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  #stage { height: clamp(275px, 43svh, 420px); }
  .catalog { max-height: 42svh; contain: none; }
  #clips { height: auto; }
  .catalog-heading { padding: 11px 14px; }
  .catalog-heading h2 { font-size: 16px; }
  .group h3 { margin-top: 9px; }
  .transport { padding: 11px 12px; }
  .model-heading { top: 13px; left: 15px; }
  .reset { top: 12px; right: 12px; min-height: 32px; }
}
