:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
  color: #19243b;
  background: #f5f6fa;
  --ink: #19243b;
  --muted: #52617b;
  --line: #dbe1ed;
  --primary: #3455cc;
  --primary-strong: #2946ad;
  --tint: #edf1ff;
  --ease: cubic-bezier(.2,.8,.2,1);
  --fast: 120ms;
  --state: 180ms;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
a { color: var(--primary-strong); text-underline-offset: .22em; }
button, input, select, textarea { font: inherit; }
.top {
  position: sticky; top: 0; z-index: 2; background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--line);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) and
          ((mask-image: linear-gradient(black, transparent)) or (-webkit-mask-image: linear-gradient(black, transparent))) {
  .top {
    background: transparent;
    border-bottom-color: transparent;
  }
  /* The lighter layer carries the blur past the tint, then fades into the page. */
  .top::before, .top::after {
    position: absolute;
    inset: 0 0 -24px;
    pointer-events: none;
    content: "";
    -webkit-backdrop-filter: var(--glass-filter);
    backdrop-filter: var(--glass-filter);
    -webkit-mask-image: var(--glass-mask);
    mask-image: var(--glass-mask);
  }
  .top::before {
    z-index: -2;
    --glass-filter: blur(4px);
    --glass-mask: linear-gradient(to bottom, #000 calc(100% - 27px), rgb(0 0 0 / .5) calc(100% - 15px), transparent);
  }
  .top::after {
    z-index: -1;
    --glass-filter: blur(12px) saturate(1.12);
    --glass-mask: linear-gradient(to bottom, #000 calc(100% - 42px), rgb(0 0 0 / .6) calc(100% - 30px),
                                  rgb(0 0 0 / .16) calc(100% - 19px), transparent calc(100% - 12px));
    background: linear-gradient(to bottom, rgb(255 255 255 / .93), rgb(247 250 255 / .82));
  }
  @media (prefers-reduced-transparency: no-preference) {
    .top .workspace-tabs { background: rgb(233 238 249 / .66); }
  }
}
@media (prefers-reduced-transparency: reduce) {
  .top { background: #fff; border-bottom-color: var(--line); }
  .top::before, .top::after { display: none; }
}
.top-inner {
  width: min(87rem,100%); min-height: 64px; margin-inline: auto;
  display: flex; align-items: center; gap: .5rem clamp(1rem,3vw,2rem);
  padding: calc(.4rem + env(safe-area-inset-top)) max(1rem,env(safe-area-inset-right)) .4rem max(1rem,env(safe-area-inset-left));
}
.brand { display: inline-flex; flex: none; align-items: center; gap: .625rem; min-height: 44px; color: var(--ink); font-size: 1rem; font-weight: 700; line-height: 1.25; white-space: nowrap; text-decoration: none; }
.brand-mark { display: grid; flex: none; place-items: center; width: 2rem; height: 2rem; border-radius: 8px; background: linear-gradient(137deg,#1a68df,#5545c2); }
.brand-mark::after { content: ""; width: 14px; height: 14px; border-radius: 2px; background: repeating-linear-gradient(90deg,white 0 2px,transparent 2px 6px); }
nav { display: flex; align-items: center; gap: .25rem; }
nav a { display: inline-flex; align-items: center; min-height: 44px; padding: .5rem .7rem; border-radius: 8px; color: #364563; white-space: nowrap; text-decoration: none; font-size: .875rem; line-height: 1.35; }
nav a:hover, nav [aria-current=page] { color: var(--primary-strong); background: var(--tint); }
nav [aria-current=page] { font-weight: 650; }
.local-mode { margin: 0 0 0 auto; padding: .32rem .55rem; border: 1px solid var(--line); border-radius: 999px; font-size: .78rem; color: var(--muted); white-space: nowrap; }
main { width: min(87rem,100%); margin: 0 auto; padding: clamp(1.15rem,3.2vw,2.5rem) max(1rem,env(safe-area-inset-right)) max(2rem,env(safe-area-inset-bottom)) max(1rem,env(safe-area-inset-left)); }
.page-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .65rem 1.1rem; margin-bottom: clamp(1rem,2.3vw,1.5rem); }
h1 { font-size: clamp(1.7rem,3.5vw,2.25rem); font-weight: 700; line-height: 1.25; margin: 0; text-wrap: balance; }
h2, h3 { margin: 0; line-height: 1.4; }
h2 { font-size: 1rem; font-weight: 700; }
h3 { font-size: .93rem; }
p { line-height: 1.55; }
.intro { margin: .4rem 0 0; color: var(--muted); font-size: .93rem; }
.back { font-size: .88rem; padding: .45rem 0; }
.layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(18.5rem,22rem); gap: 1rem; align-items: start; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: 0 2px 6px #1d31560b; }
.panel-header { min-height: 60px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem; padding: .7rem 1rem; }
.panel-heading { min-width: 0; }
.file-name { margin: .12rem 0 0; font-size: .78rem; color: var(--muted); overflow-wrap: anywhere; }
.inspector .panel-header { border-bottom: 1px solid var(--line); }
.inspector-body { padding: 1rem; }
.viewer {
  position: relative; isolation: isolate; display: grid; place-items: center; min-height: clamp(15rem,40vw,32rem);
  margin-inline: .65rem; overflow: hidden; border-radius: 10px; background: #121d2e; color: #eef3ff; text-align: center;
}
.viewer:has(canvas:not([hidden]),video:not([hidden])) { min-height: 0; }
.placeholder { margin: 1rem; }
.placeholder p { margin: .8rem 0 .25rem; font-weight: 650; }
.placeholder small { color: #aabbd7; font-size: .83rem; }
.view-mark { position: relative; display: block; width: 3rem; height: 2.5rem; margin-inline: auto; border-radius: 9px; border: 1px solid #8196b9; background: #1e2d45; }
.view-mark::after { content: ""; position: absolute; inset: 0; margin: auto; width: .85rem; height: .85rem; border: 2px solid #c6d6f2; border-radius: 50%; }
.viewer[data-state=busy]::after {
  content: ""; position: absolute; bottom: 0; left: 0; width: 40%; height: 3px; background: #8fa9ff;
  animation: processing 1.35s ease-in-out infinite alternate; pointer-events: none;
}
@keyframes processing { from { transform: translateX(-25%); } to { transform: translateX(175%); } }
#image-stage[data-state=ready] > canvas:not([hidden]) { animation: appear var(--state) var(--ease) both; }
canvas, video { display: block; width: 100%; height: auto; max-height: 70vh; min-height: 0; object-fit: contain; }
canvas.detour-marking { cursor: crosshair; }
.stage-footer { padding: .65rem 1rem; display: flex; flex-wrap: wrap; gap: .5rem .7rem; align-items: center; min-height: 48px; }
.stage-footer p { margin: 0; overflow-wrap: anywhere; }
.stage-footer .note { flex-basis: 100%; }
.stage-footer #frames-panel { flex-basis: 100%; }
.status-line { color: var(--muted); font-size: .84rem; }
.action-link { font-size: .85rem; font-weight: 650; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
.actions > label:not(.file) { min-width: 8rem; }
.actions:not(:has(> :not([hidden]))) { display: none; }
button, .file, a.primary, a.secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px;
  border-radius: 8px; border: 1px solid #c5cfdf; background: #fff; color: #2d3e5c;
  padding: .55rem .875rem; font-size: .9rem; line-height: 1.3; text-align: center;
  font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background-color var(--fast), border-color var(--fast), color var(--fast);
}
button:not(:disabled):hover, .file:hover, a.secondary:hover { background: #f0f3fb; border-color: #a7b6d5; }
a.primary, button.primary, .file.primary { color: white; background: var(--primary); border-color: transparent; }
a.primary:hover, button.primary:not(:disabled):hover, .file.primary:hover { background: var(--primary-strong); border-color: transparent; }
button:disabled { opacity: .52; cursor: default; }
:focus-visible, .file:focus-within { outline: 2px solid var(--primary); outline-offset: 3px; }
.file { position: relative; }
.file input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.file:has(input:disabled) { opacity: .52; }
.note { margin: .4rem 0 0; color: var(--muted); font-size: .82rem; }
.note:empty, .results:empty, .route-feedback:empty, .task-panel #save-status:empty { margin: 0; }
.finding, .route-feedback:not(:empty) { margin: 0 0 .85rem; padding: .7rem .75rem; background: #eef2f9; color: #344567; border-radius: 8px; font-size: .88rem; overflow-wrap: anywhere; }
.finding[data-tone=warning], .route-feedback[data-tone=warning] { background: #fff2e4; color: #814009; }
.route-feedback[data-tone=success] { background: #e8f7ef; color: #14593c; }
.demo-cases { margin-bottom: 1rem; }
.demo-cases .inspector-body { padding-top: 0; }
.demo-cases canvas { width: min(100%, 800px); max-height: 68vh; border-radius: 10px; }
#live-detour-recapture:not([hidden]), body[data-page=live] #detour-recapture:not([hidden]) { margin-bottom: .7rem; }
.results { padding-left: 1.2rem; font-size: .88rem; line-height: 1.6; max-height: 16rem; overflow: auto; }
.panel-divider { border-top: 1px solid var(--line); padding-top: .9rem; margin-top: .9rem; }
.panel-divider .actions { margin-top: .55rem; }
.assistant-form { margin-top: .85rem; }
.assistant-form > label { margin-bottom: .35rem; }
label:not(.file) { display: grid; gap: .32rem; font-size: .86rem; }
label.choice { display: flex; align-items: center; gap: .5rem; min-height: 42px; }
input[type=checkbox] { flex: none; width: 1rem; height: 1rem; margin: 0; accent-color: var(--primary); }
input:not([type=checkbox]), select, textarea { width: 100%; min-width: 0; min-height: 44px; padding: .48rem .62rem; border: 1px solid #a4b1c7; border-radius: 8px; color: var(--ink); background: #fff; font-size: 16px; line-height: 1.4; }
input[type=file]::file-selector-button { font: inherit; font-size: .875rem; color: var(--ink); border: 0; border-radius: 4px; background: var(--tint); padding: .34rem .55rem; margin-inline-end: .55rem; cursor: pointer; }
textarea { resize: vertical; }
.status-select { position: relative; width: min(12rem, 100%); }
.status-select summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  min-height: 44px;
  padding: .55rem .875rem;
  border: 1px solid #c5cfdf;
  border-radius: 8px;
  background: #fff;
  color: #2d3e5c;
  font-size: .9rem;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
  transition: background-color var(--fast), border-color var(--fast);
}
.status-select summary::-webkit-details-marker { display: none; }
.status-select summary:hover { background: #f7f9fc; }
.status-select[open] summary { border-color: #a7b6d5; background: #f7f9fc; }
.status-select summary::after {
  flex: none;
  margin-top: -.2rem;
  width: .45rem;
  height: .45rem;
  border: solid var(--muted);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
  transition: transform var(--fast);
  content: "";
}
.status-select[open] summary::after { transform: translateY(.2rem) rotate(225deg); }
.status-select-options {
  --menu-enter-offset: translateY(-.4rem) scale(.86);
  --menu-enter-motion: .26s cubic-bezier(.22, .9, .34, 1.18);
  --menu-enter-fade: .16s;
  transform-origin: 50% 0;
  position: absolute;
  z-index: 1;
  top: calc(100% + .375rem);
  inset-inline: 0;
  display: grid;
  gap: .125rem;
  padding: .375rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 22px rgb(33 51 98 / 14%);
}
.status-select[open] > .status-select-options {
  animation: status-menu-pop var(--menu-enter-motion) backwards, status-menu-fade var(--menu-enter-fade) backwards;
}
@keyframes status-menu-pop {
  from { transform: var(--menu-enter-offset); }
  to { transform: translateY(0) scale(1); }
}
@keyframes status-menu-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.status-select-options button { justify-content: space-between; border-color: transparent; }
.status-select-options button[aria-pressed=true] {
  color: var(--primary-strong);
  border-color: #d5dff5;
  background: var(--tint);
}
.status-select-options button[aria-pressed=true]::after {
  width: .55rem;
  height: .3rem;
  border: solid currentColor;
  border-width: 0 0 1.5px 1.5px;
  transform: rotate(-45deg);
  content: "";
}
.status-select summary[aria-disabled=true] { opacity: .52; background: #fff; cursor: default; }
.result-target { display: grid; gap: .32rem; }
.result-target .status-select { width: 100%; }
.result-target .status-select-options {
  max-height: min(17rem, 50vh);
  overflow: auto;
  overscroll-behavior: contain;
}
.result-target .status-select-options button { text-align: left; }
.coordinates { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .6rem; }
progress { width: 100%; accent-color: var(--primary); height: .45rem; }
:is(.workspace-tabs, .switcher) {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(var(--tab-count, 2), minmax(0, 1fr));
  padding: .25rem;
  border-radius: 10px;
  background: #edf0f7;
}
:is(.workspace-tabs, .switcher)::before {
  box-sizing: border-box;
  position: absolute;
  z-index: -1;
  inset: .25rem auto .25rem .25rem;
  width: calc((100% - .5rem) / var(--tab-count, 2));
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  pointer-events: none;
  content: "";
  transform: translateX(calc(var(--selected-tab, 0) * 100%));
  transition: transform var(--state) var(--ease);
}
.switcher:has(> button:nth-child(2):is([aria-selected=true], [aria-pressed=true])) { --selected-tab: 1; }
:is(.workspace-tabs, .switcher) > button {
  min-width: 0;
  padding-inline: .125rem;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}
:is(.workspace-tabs, .switcher) > button:is([aria-selected=true], [aria-pressed=true]) {
  color: var(--primary-strong);
  background: transparent;
  border-color: transparent;
}
:is(.workspace-tabs, .switcher) > button:not(:disabled):hover { border-color: transparent; background: #3455cc0a; }
.detour-modes { margin-bottom: .75rem; }
.task-panel { padding-top: .9rem; }
@media (prefers-reduced-motion: no-preference) {
  .task-panel:not([hidden]), .animate-detour-mode > .detour-mode-panel:not([hidden]), .annotation:not([hidden]) {
    animation: workspace-enter var(--state) var(--ease) backwards;
  }
}
@keyframes workspace-enter {
  from { opacity: var(--enter-opacity, .8); transform: translateY(var(--enter-offset, 5px)); }
  to { opacity: 1; transform: translateY(0); }
}
.task-panel > label, .task-panel > .actions, .task-panel > .coordinates { margin-top: .65rem; }
.task-panel > :first-child { margin-top: 0; }
.form-actions { padding-top: .35rem; }
.checklist { padding: 0; margin: .6rem 0; list-style: none; font-size: .84rem; }
.checklist li { display: flex; gap: .7rem; justify-content: space-between; align-items: start; padding: .48rem 0; border-bottom: 1px solid var(--line); }
.checklist li span:last-child { color: var(--muted); text-align: right; }
.checklist li span[data-ready=true] { color: #176242; }
.detour-map { margin: .65rem 0; color: var(--muted); font-size: .84rem; }
.detour-map summary { min-height: 42px; padding-block: .65rem; cursor: pointer; font-weight: 630; color: #354b7d; }
.detour-map label { margin-bottom: .55rem; }
.detour-map input { max-width: 8rem; }
.annotation { border-top: 1px solid var(--line); background: #f6f8fe; padding: .65rem 1rem; border-radius: 0 0 16px 16px; }
.trace-tools button[aria-pressed=true], button[aria-pressed=true] { background: var(--tint); color: var(--primary-strong); border-color: #8ba0e0; }
#trace-hint { min-height: 1.25rem; margin: .4rem 0 0; }
#save-status { overflow-wrap: anywhere; font-size: .84rem; }
@keyframes appear { from { opacity: .55; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media(max-width: 760px) {
  .layout { grid-template-columns: minmax(0,1fr); }
  .viewer { min-height: clamp(13rem,52vw,25rem); }
}
@media(max-width: 520px) {
  .top-inner { column-gap: .6rem; flex-wrap: wrap; }
  .brand { font-size: .925rem; gap: .5rem; }
  .brand-mark { width: 1.75rem; height: 1.75rem; }
  .local-mode { display: none; }
  nav a { font-size: .875rem; padding-inline: .45rem; }
  main { padding-inline: max(.875rem,env(safe-area-inset-left)) max(.875rem,env(safe-area-inset-right)); }
  .panel-header, .inspector-body, .stage-footer, .annotation { padding-inline: .75rem; }
  .sources { flex: 1 0 100%; }
  .sources .file { flex: 1 1 auto; padding-inline: .5rem; }
}
@media(max-width: 360px) {
  .coordinates { grid-template-columns: minmax(0,1fr); }
}
@media(prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
