:root {
  color-scheme: light;
  --motion-bg: #f3f6fa;
  --motion-surface: #ffffff;
  --motion-ink: #172033;
  --motion-muted: #5d687c;
  --motion-line: #d7deea;
  --motion-soft: #edf2f8;
  --motion-blue: #235fd2;
  --motion-blue-strong: #17479f;
  --motion-blue-soft: #e6efff;
  --motion-green: #087a62;
  --motion-red: #bd2c36;
  --motion-stage: #0c1220;
  --motion-stage-line: #283349;
  --motion-stage-muted: #9daac0;
  --motion-focus: #f0a500;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--motion-bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--motion-bg);
  color: var(--motion-ink);
  font-size: 16px;
  line-height: 1.55;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
input,
label {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--motion-focus);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.motion-page {
  width: min(100%, 1320px);
  margin: 0 auto;
  padding: 0 30px 56px;
}

.motion-topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--motion-line);
}

.motion-brand,
.motion-nav a {
  color: var(--motion-ink);
  text-decoration: none;
}

.motion-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -.01em;
}

.motion-logo-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--motion-ink);
  color: #fff;
  font-size: 13px;
}

.motion-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.motion-nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--motion-muted);
  font-size: 14px;
  font-weight: 700;
}

.motion-nav a:hover,
.motion-nav a[aria-current="page"] {
  background: var(--motion-soft);
  color: var(--motion-ink);
}

.motion-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  align-items: end;
  gap: 48px;
  padding: 62px 0 42px;
}

.motion-kicker {
  margin: 0 0 12px;
  color: var(--motion-blue-strong);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.motion-hero h1 {
  max-width: 760px;
  margin: 0;
  color: var(--motion-ink);
  font-size: clamp(38px, 5vw, 62px);
  line-height: 1.04;
  letter-spacing: -.045em;
}

.motion-hero__lead {
  max-width: 680px;
  margin: 20px 0 0;
  color: var(--motion-muted);
  font-size: 18px;
  line-height: 1.65;
}

.motion-trust {
  border-top: 2px solid var(--motion-ink);
  padding-top: 18px;
}

.motion-trust strong {
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
}

.motion-trust ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--motion-muted);
  font-size: 13px;
}

.motion-trust li {
  display: flex;
  gap: 9px;
}

.motion-trust li::before {
  content: "✓";
  color: var(--motion-green);
  font-weight: 900;
}

.motion-workspace {
  min-height: 680px;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--motion-line);
  background: var(--motion-surface);
  box-shadow: 0 16px 42px rgba(33, 48, 77, .09);
}

.motion-controls {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--motion-line);
  background: var(--motion-surface);
}

.motion-controls__header,
.motion-control-section,
.motion-controls__footer {
  padding: 22px;
}

.motion-controls__header {
  border-bottom: 1px solid var(--motion-line);
}

.motion-controls__header h2,
.motion-control-section h3 {
  margin: 0;
  color: var(--motion-ink);
  line-height: 1.3;
}

.motion-controls__header h2 {
  font-size: 18px;
}

.motion-controls__header p,
.motion-control-section > p {
  margin: 7px 0 0;
  color: var(--motion-muted);
  font-size: 13px;
}

.motion-control-section {
  border-bottom: 1px solid var(--motion-line);
}

.motion-control-section h3 {
  font-size: 14px;
}

.motion-control-section--grow {
  flex: 1 1 auto;
}

.motion-controls__footer {
  margin-top: auto;
  background: #f8fafc;
  color: var(--motion-muted);
  font-size: 12px;
}

.motion-status {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--motion-line);
  background: #f8fafc;
  color: var(--motion-muted);
  font-size: 13px;
}

.motion-status__dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 50%;
  background: #8591a5;
}

.motion-status[data-tone="working"] .motion-status__dot {
  background: var(--motion-blue);
  animation: motion-pulse 1s ease-in-out infinite alternate;
}

.motion-status[data-tone="success"] .motion-status__dot {
  background: var(--motion-green);
}

.motion-status[data-tone="error"] {
  border-color: #e6b7bb;
  background: #fff6f6;
  color: #87232b;
}

.motion-status[data-tone="error"] .motion-status__dot {
  background: var(--motion-red);
}

.motion-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 16px;
}

.motion-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--motion-line);
  border-radius: 8px;
  background: #fff;
  color: var(--motion-ink);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
}

.motion-button:hover:not(:disabled) {
  border-color: #9ca9bd;
  background: #f8fafc;
}

.motion-button--primary {
  border-color: var(--motion-blue);
  background: var(--motion-blue);
  color: #fff;
}

.motion-button--primary:hover:not(:disabled) {
  border-color: var(--motion-blue-strong);
  background: var(--motion-blue-strong);
}

.motion-button--danger {
  color: #9c2530;
}

.motion-button--full {
  width: 100%;
}

.motion-button:disabled {
  opacity: .55;
  cursor: wait;
}

.motion-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  margin-top: 16px;
  padding: 4px;
  border: 1px solid var(--motion-line);
  background: var(--motion-soft);
}

.motion-tabs button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--motion-muted);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.motion-tabs button[aria-selected="true"] {
  background: #fff;
  color: var(--motion-blue-strong);
  box-shadow: 0 1px 3px rgba(28, 42, 68, .13);
}

.motion-checklist {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.motion-checklist li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 9px;
  color: var(--motion-muted);
  font-size: 13px;
}

.motion-checklist span:first-child {
  color: var(--motion-green);
  font-weight: 900;
}

.motion-field {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.motion-field__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--motion-ink);
  font-size: 13px;
  font-weight: 750;
}

.motion-field__label output {
  color: var(--motion-blue-strong);
  font-variant-numeric: tabular-nums;
}

.motion-field input[type="range"] {
  width: 100%;
  min-height: 44px;
  accent-color: var(--motion-blue);
}

.motion-field__help {
  margin: 0;
  color: var(--motion-muted);
  font-size: 12px;
}

.motion-switch-list {
  display: grid;
  gap: 2px;
  margin-top: 12px;
}

.motion-switch {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--motion-ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.motion-switch input {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--motion-blue);
}

.motion-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: 14px;
  border: 1px solid var(--motion-line);
  background: var(--motion-line);
}

.motion-metric {
  min-width: 0;
  padding: 11px;
  background: #fff;
}

.motion-metric span {
  display: block;
  color: var(--motion-muted);
  font-size: 11px;
}

.motion-metric strong {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--motion-ink);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.motion-stage {
  position: relative;
  min-width: 0;
  min-height: 680px;
  overflow: hidden;
  background: var(--motion-stage);
  color: #eef4ff;
  isolation: isolate;
}

.motion-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: .42;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath d='M0 0H48M0 0V48' fill='none' stroke='%23283349' stroke-width='1'/%3E%3C/svg%3E");
  background-size: 48px 48px;
}
.motion-stage__topline {
  position: absolute;
  z-index: 8;
  top: 16px;
  right: 18px;
  left: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.motion-stage__badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 999px;
  background: rgba(12, 18, 32, .82);
  color: #d8e1f0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .03em;
}

.motion-stage__badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8995a8;
}

.motion-stage__badge[data-live="true"]::before {
  background: #45d6a7;
  box-shadow: 0 0 0 4px rgba(69, 214, 167, .13);
}

.motion-stage__coordinates {
  color: var(--motion-stage-muted);
  font: 700 11px ui-monospace, SFMono-Regular, Consolas, monospace;
}

.motion-stage-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 76px 34px 34px;
}

.motion-empty {
  width: min(100%, 520px);
  text-align: center;
}

.motion-empty__icon {
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  margin: 0 auto 22px;
  border: 1px solid #3b4860;
  border-radius: 18px;
  background: #151e30;
  color: #73a2ff;
}

.motion-empty h2,
.motion-empty h3 {
  margin: 0;
  color: #fff;
  line-height: 1.25;
}

.motion-empty h2 {
  font-size: 24px;
}

.motion-empty h3 {
  font-size: 20px;
}

.motion-empty p {
  margin: 11px auto 0;
  color: var(--motion-stage-muted);
  font-size: 14px;
}

.motion-loader {
  width: 44px;
  height: 44px;
  margin: 0 auto 20px;
  border: 4px solid #344158;
  border-top-color: #76a5ff;
  border-radius: 50%;
  animation: motion-spin .8s linear infinite;
}

.motion-progress {
  width: 100%;
  height: 7px;
  overflow: hidden;
  background: #253047;
}

.motion-progress > span {
  display: block;
  width: 0;
  height: 100%;
  background: #74a3ff;
  transition: width .18s ease;
}

.motion-calibration {
  position: absolute;
  inset: 0;
  z-index: 5;
  padding: 72px 30px 30px;
}

.motion-calibration__instructions {
  width: min(440px, calc(100% - 40px));
  margin: 0 auto;
  text-align: center;
}

.motion-calibration__instructions h3 {
  margin: 0;
  font-size: 19px;
}

.motion-calibration__instructions p {
  margin: 7px 0 14px;
  color: var(--motion-stage-muted);
  font-size: 13px;
}

.calibration-point {
  position: absolute;
  z-index: 7;
  left: var(--calibration-x, 50%);
  top: var(--calibration-y, 50%);
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  padding: 0;
  transform: translate(-50%, -50%);
  border: 2px solid #a7c1ff;
  border-radius: 50%;
  background: #17479f;
  color: white;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 0 0 10px rgba(64, 116, 222, .16);
}

.calibration-point:active {
  transform: translate(-50%, -50%) scale(.92);
}

.motion-live-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  padding: 74px 24px 24px;
}

.gaze-cursor {
  position: fixed;
  z-index: 2147483640;
  left: 0;
  top: 0;
  width: 24px;
  height: 24px;
  transform: translate(-100px, -100px);
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: rgba(35, 95, 210, .48);
  box-shadow: 0 0 0 7px rgba(35, 95, 210, .18);
  pointer-events: none;
  transition: opacity .15s ease;
}

.gaze-zone-grid {
  height: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.gaze-zone {
  min-width: 0;
  display: grid;
  place-items: center;
  border: 1px solid #344158;
  background: rgba(16, 24, 40, .72);
  color: #748198;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  transition: border-color .18s ease, background-color .18s ease, color .18s ease;
}

.gaze-zone.is-looking {
  border-color: #74a3ff;
  background: #182e59;
  color: #fff;
}

.gaze-challenge {
  position: absolute;
  inset: 0;
}

.gaze-target {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 76px;
  height: 76px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.gaze-target svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.gaze-target circle {
  fill: #14213b;
  stroke-width: 6;
}

.gaze-target circle:first-child {
  stroke: #35435d;
}

.gaze-target circle:last-child {
  stroke: #75a5ff;
  stroke-linecap: round;
  stroke-dasharray: 176;
  stroke-dashoffset: 176;
}

.gaze-target::after {
  content: "看這裡";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: white;
  font-size: 11px;
  font-weight: 850;
}

.motion-stage-message {
  position: absolute;
  z-index: 9;
  right: 24px;
  bottom: 24px;
  left: 24px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, .15);
  background: rgba(12, 18, 32, .88);
  color: #d6deeb;
  font-size: 12px;
  text-align: center;
  pointer-events: none;
}

.video-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 62px 18px 72px;
}

.video-surface {
  position: relative;
  width: 100%;
  max-height: 100%;
  overflow: hidden;
  background: #05070c;
}

.video-surface video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #05070c;
}

.video-surface canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.video-diagnostics {
  position: absolute;
  z-index: 8;
  right: 18px;
  bottom: 18px;
  left: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid #344158;
  background: rgba(12, 18, 32, .9);
}

.video-diagnostic {
  min-width: 0;
  padding: 9px 12px;
  border-right: 1px solid #344158;
}

.video-diagnostic:last-child {
  border-right: 0;
}

.video-diagnostic span,
.video-diagnostic strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-diagnostic span {
  color: var(--motion-stage-muted);
  font-size: 10px;
}

.video-diagnostic strong {
  margin-top: 1px;
  color: #fff;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.drop-zone {
  margin-top: 16px;
  padding: 22px 16px;
  border: 1px dashed #aab6c9;
  background: #f8fafc;
  text-align: center;
  transition: border-color .15s ease, background-color .15s ease;
}

.drop-zone[data-dragging="true"] {
  border-color: var(--motion-blue);
  background: var(--motion-blue-soft);
}

.drop-zone strong,
.drop-zone span {
  display: block;
}

.drop-zone strong {
  color: var(--motion-ink);
  font-size: 14px;
}

.drop-zone span {
  margin: 5px 0 12px;
  color: var(--motion-muted);
  font-size: 12px;
}

.motion-file-name {
  margin-top: 10px;
  overflow: hidden;
  color: var(--motion-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.motion-limit {
  margin-top: 14px;
  padding: 11px 0 0;
  border-top: 1px solid var(--motion-line);
  color: var(--motion-muted);
  font-size: 12px;
}

.motion-content {
  max-width: 980px;
  margin: 68px auto 0;
}

.motion-content h2 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.15;
  letter-spacing: -.03em;
}

.motion-content__lead {
  max-width: 720px;
  margin: 16px 0 0;
  color: var(--motion-muted);
  font-size: 17px;
}

.motion-content-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-top: 36px;
  border-top: 1px solid var(--motion-line);
  border-bottom: 1px solid var(--motion-line);
}

.motion-content-grid article {
  padding: 26px 24px;
  border-right: 1px solid var(--motion-line);
}

.motion-content-grid article:last-child {
  border-right: 0;
}

.motion-content-grid h3 {
  margin: 0;
  font-size: 16px;
}

.motion-content-grid p {
  margin: 9px 0 0;
  color: var(--motion-muted);
  font-size: 14px;
}

.motion-faq {
  margin-top: 44px;
}

.motion-faq h2 {
  font-size: 26px;
}

.motion-faq details {
  border-bottom: 1px solid var(--motion-line);
}

.motion-faq summary {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--motion-ink);
  font-weight: 800;
  cursor: pointer;
}

.motion-faq summary::after {
  content: "+";
  color: var(--motion-blue);
  font-size: 22px;
  font-weight: 500;
}

.motion-faq details[open] summary::after {
  content: "−";
}

.motion-faq details p {
  max-width: 760px;
  margin: -2px 0 20px;
  color: var(--motion-muted);
  font-size: 14px;
}

.motion-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 64px;
  padding-top: 22px;
  border-top: 1px solid var(--motion-line);
  color: var(--motion-muted);
  font-size: 12px;
}

.motion-footer a {
  color: var(--motion-ink);
  font-weight: 750;
}

#webgazerVideoContainer {
  z-index: 2147483630 !important;
  right: 18px !important;
  bottom: 18px !important;
  left: auto !important;
  top: auto !important;
  overflow: hidden !important;
  border: 2px solid #fff !important;
  border-radius: 10px !important;
  background: #0c1220 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3) !important;
}

@keyframes motion-spin {
  to { transform: rotate(360deg); }
}

@keyframes motion-pulse {
  to { opacity: .45; }
}

@media (max-width: 940px) {
  .motion-workspace {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .motion-content-grid {
    grid-template-columns: 1fr;
  }

  .motion-content-grid article {
    border-right: 0;
    border-bottom: 1px solid var(--motion-line);
  }

  .motion-content-grid article:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 760px) {
  .motion-page {
    padding: 0 16px 42px;
  }

  .motion-topbar {
    min-height: 60px;
  }

  .motion-nav a:not([aria-current="page"]) {
    display: none;
  }

  .motion-hero {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 42px 4px 32px;
  }

  .motion-hero h1 {
    font-size: clamp(36px, 12vw, 48px);
  }

  .motion-hero__lead {
    font-size: 16px;
  }

  .motion-workspace {
    min-height: 0;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .motion-controls {
    border-right: 0;
    border-bottom: 1px solid var(--motion-line);
  }

  .motion-controls__header,
  .motion-control-section,
  .motion-controls__footer {
    padding: 18px;
  }

  .motion-stage {
    min-height: min(640px, 74vh);
  }

  .motion-stage-state {
    padding: 70px 22px 28px;
  }

  .motion-calibration {
    padding-inline: 10px;
  }

  .calibration-point {
    width: 54px;
    height: 54px;
  }

  .gaze-zone-grid {
    gap: 7px;
  }

  .motion-stage-message {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }

  .video-stage {
    padding: 58px 8px 104px;
  }

  .video-diagnostics {
    right: 8px;
    bottom: 8px;
    left: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .video-diagnostic:nth-child(2) {
    border-right: 0;
  }

  .video-diagnostic:nth-child(-n+2) {
    border-bottom: 1px solid #344158;
  }

  .motion-content {
    margin-top: 50px;
  }

  .motion-content-grid article {
    padding-inline: 4px;
  }

  .motion-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  #webgazerVideoContainer {
    right: 10px !important;
    bottom: 10px !important;
    transform: scale(.72) !important;
    transform-origin: bottom right !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
