:root {
  color-scheme: light;
  font-family: "Instrument Sans", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  color: #142337;
  background: #f2f5f8;
  --ink: #142337;
  --muted: #526479;
  --blue: #115eaa;
  --line: #dce4ed;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }

.layout {
  width: min(100%, 1740px);
  margin-inline: auto;
  padding: 0 clamp(16px, 3.25vw, 56px) 28px;
}
.page-header {
  display: flex;
  gap: 10px 26px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.project { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; }
.project-mark {
  width: 19px;
  height: 17px;
  display: inline-block;
  background:
    linear-gradient(130deg, transparent 39%, #115eaa 40% 60%, transparent 61%) left top / 15px 13px no-repeat,
    linear-gradient(130deg, transparent 39%, #3a92d4 40% 60%, transparent 61%) right bottom / 15px 13px no-repeat;
}
.context { color: var(--muted); margin: 0; font-size: 12px; }
.context span { margin: 0 5px; color: #75889e; }
.heading { display: flex; align-items: baseline; gap: 12px 20px; justify-content: space-between; padding: 23px 0 17px; }
h1 { margin: 0; font-size: clamp(25px, 3vw, 40px); font-weight: 750; letter-spacing: -.04em; line-height: 1.16; }
.gesture-control { position: relative; z-index: 2; flex: none; }
.gesture-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 4px 11px 4px 8px;
  border: 1px solid #416788;
  border-radius: 10px;
  background: linear-gradient(115deg, #132943, #0b1e35 82%);
  color: #f2f8ff;
  box-shadow: 0 1px 0 #ffffff36 inset, 0 5px 13px #1c4a762e;
  transition: background .16s, border-color .16s, box-shadow .16s;
}
.gesture-toggle:enabled:hover { background: linear-gradient(115deg, #1a3b5b, #123456); border-color: #6697bc; }
.gesture-toggle[aria-pressed="true"] { border-color: #4d9bc2; background: linear-gradient(115deg, #19486b, #112e50); box-shadow: 0 1px 0 #ffffff4a inset, 0 4px 18px #14578742; }
.gesture-symbol { display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid #5d87ad7d; border-radius: 6px; background: #77bbff15; }
.gesture-symbol i { position: relative; width: 15px; height: 15px; border: 1px solid #9ed9ff; border-radius: 5px; transform: rotate(45deg); }
.gesture-symbol i::after { content: ""; position: absolute; width: 5px; height: 5px; top: 4px; left: 4px; border-radius: 2px; background: #cbecff; box-shadow: 0 0 8px #86c4ff; }
.gesture-name { font-size: 14px; letter-spacing: .05em; font-weight: 750; }
.gesture-state { display: flex; align-items: center; gap: 5px; padding-left: 9px; border-left: 1px solid #769ebe59; color: #c1d9ed; font-size: 11px; font-weight: 600; }
.gesture-state i { width: 6px; height: 6px; border-radius: 50%; background: #8ca7bd; }
.gesture-state:is([data-mode="idle"], [data-mode="ready"]) i { background: #84eac2; }
.gesture-state:is([data-mode="rotate"], [data-mode="zoom"], [data-mode="mouse"]) i { background: #a1e4ff; box-shadow: 0 0 8px #87dfff; }
.gesture-state:is([data-mode="loading"], [data-mode="requesting"], [data-mode="error"]) i { background: #ffd088; }
.gesture-message:not(.notice) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.gesture-message.notice { position: absolute; right: 0; top: calc(100% + 7px); width: min(285px, 80vw); padding: 10px 12px; border: 1px solid #cad9e6; border-radius: 8px; color: #263d55; background: #fff; box-shadow: 0 6px 20px #20364c24; font-size: 12px; }
.workspace { min-width: 0; }
.viewer { background: #fff; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.stage-frame { position: relative; isolation: isolate; }
#stage {
  height: clamp(360px, calc(100vh - 236px), 850px);
  height: clamp(360px, calc(100svh - 236px), 850px);
  position: relative;
  background: #c3cbd1;
}
#stage > canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#stage > canvas:active { cursor: grabbing; }
#stage > canvas:focus-visible { outline: 2px solid var(--blue); outline-offset: -4px; }
.canvas-error { margin: 0; padding: 82px 24px; }
.view-tools { position: absolute; top: 13px; left: 13px; display: flex; gap: 3px; padding: 3px; border-radius: 8px; background: #f9fcfff5; }
.view-tools button { min-height: 34px; border-color: transparent; background: transparent; }
.view-tools button[aria-pressed="true"] { background: #daeaf6; color: #164c76; }
.camera-readout, .verify-tag {
  position: absolute;
  padding: 6px 9px;
  border-radius: 5px;
  pointer-events: none;
  font-size: 11px;
  font-weight: 650;
}
.camera-readout { bottom: 13px; right: 13px; color: #294355; background: #f4f8fbef; font-variant-numeric: tabular-nums; }
.verify-tag { bottom: 14px; left: 14px; background: #17334b; color: white; }
.dataset { position: absolute; right: 14px; top: 14px; border-radius: 5px; padding: 6px 9px; color: #294355; background: #f4f8fbef; font: 600 11px/1.2 Consolas, monospace; pointer-events: none; }
.viewer-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 7px 18px; padding: 11px 13px; }
.player { display: grid; grid-template-columns: auto auto minmax(64px, 104px) auto; align-items: center; gap: 5px 7px; }
.player button { min-width: 52px; min-height: 32px; padding-inline: 6px; }
.player #phase { grid-column: 3 / -1; min-width: 0; min-height: 1.2em; }
#time { width: 100%; margin: 0; accent-color: var(--blue); }
#phase, #elapsed, .hint { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
#elapsed { white-space: nowrap; font-variant-numeric: tabular-nums; }
.touch-hint { display: none; }
button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 650;
  padding: 5px 10px;
  white-space: nowrap;
  cursor: pointer;
}
button:enabled:hover { background: #edf4fa; }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.field { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
.field p { margin: 0; color: var(--muted); font-size: 12px; }

@media (max-width: 590px) {
  .layout { padding-inline: 10px; }
  .heading { align-items: center; gap: 6px 12px; flex-wrap: wrap; }
  .gesture-state { padding-left: 5px; }
  .gesture-toggle { gap: 6px; min-height: 40px; padding-right: 7px; }
  .gesture-symbol { width: 25px; height: 25px; }
  .gesture-name { font-size: 13px; }
  .player { width: 100%; grid-template-columns: auto auto 1fr auto; }
  #stage { height: clamp(340px, 62svh, 630px); }
}
@media (pointer: coarse) {
  .mouse-hint { display: none; }
  .touch-hint { display: inline; }
}
body.capture { margin: 0; overflow: hidden; background: #c3cbd1; }
body.capture .page-header, body.capture .heading, body.capture .field, body.capture .dataset, body.capture .view-tools,
body.capture .verify-tag, body.capture .camera-readout, body.capture .viewer-footer { display: none; }
body.capture .layout, body.capture .workspace { display: block; width: 100%; padding: 0; }
body.capture .viewer { border: 0; border-radius: 0; }
body.capture #stage { width: 100vw; height: 100vh; }
