/* DEV-290 六维位姿遥测 · Claymorphism（偏蓝紫糖果色系） */

:root {
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ink: #4c4765;
  --ink-strong: #3f3a5c;
  --head: #6d28d9;
  --muted: #6e6990;
  --shadow-card:
    12px 12px 24px rgba(76, 60, 130, 0.10),
    inset 6px 6px 12px rgba(255, 255, 255, 0.6),
    inset -4px -4px 8px rgba(76, 60, 130, 0.06);
  --shadow-btn:
    8px 8px 16px rgba(109, 40, 217, 0.18),
    inset 4px 4px 8px rgba(255, 255, 255, 0.4),
    inset -2px -2px 4px rgba(76, 60, 130, 0.15);
  --shadow-press:
    2px 2px 4px rgba(76, 60, 130, 0.06),
    inset 8px 8px 16px rgba(76, 60, 130, 0.18),
    inset -4px -4px 8px rgba(255, 255, 255, 0.5);
  --shadow-inset:
    inset 4px 4px 8px rgba(76, 60, 130, 0.10),
    inset -4px -4px 8px rgba(255, 255, 255, 0.9);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "Nunito", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(135deg, #e0e7ff 0%, #ede9fe 45%, #fce7f3 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

h1, h2, h3 { color: var(--head); margin: 0; }

code, .mono, .tile-value, .age-value, dd {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 64px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 16px;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffffff 0%, #eef1ff 100%);
  box-shadow: var(--shadow-card);
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-blob {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: linear-gradient(180deg, #c4b5fd, #a78bfa);
  box-shadow: var(--shadow-btn);
}

.brand-blob svg { width: 24px; height: 24px; }

.brand-text h1 { font-size: 20px; font-weight: 900; letter-spacing: 0.02em; }
.brand-text p { margin: 2px 0 0; font-size: 12px; color: var(--muted); font-weight: 600; }

.topbar-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.conn-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-strong);
  background: linear-gradient(180deg, #f1f2fb, #e4e6f5);
  box-shadow: var(--shadow-inset);
}

.conn-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #a5b4fc;
  transition: background 0.3s var(--spring);
}

.conn-chip.live .conn-dot { background: #34d399; animation: pulse 1.6s var(--spring) infinite; }
.conn-chip.bad .conn-dot { background: #fb7185; }
.conn-chip.mock .conn-dot { background: #a78bfa; }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.35); }
}

/* ---------- 粘土按钮 ---------- */

.clay-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  cursor: pointer;
  padding: 10px 20px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  color: #ffffff;
  background: linear-gradient(180deg, #c4b5fd, #a78bfa);
  box-shadow: var(--shadow-btn);
  transition: all 0.3s var(--spring);
}

.clay-btn svg { width: 16px; height: 16px; }

.clay-btn:hover { transform: translateY(-4px); }

.clay-btn:active {
  transform: scaleX(1.05) scaleY(0.9);
  box-shadow: var(--shadow-press);
}

.clay-btn.ghost {
  color: var(--head);
  background: linear-gradient(180deg, #f5f3ff, #e9e5fb);
}

.clay-btn[aria-pressed="true"] {
  color: #ffffff;
  background: linear-gradient(180deg, #a78bfa, #8b5cf6);
  box-shadow: var(--shadow-press);
}

.clay-btn:focus-visible, .tool-chip:focus-visible, .clay-input:focus-visible {
  outline: none;
  box-shadow: var(--shadow-btn), 0 0 0 4px rgba(167, 139, 250, 0.35);
}

/* ---------- 卡片 ---------- */

.card {
  border-radius: 32px;
  background: linear-gradient(135deg, #ffffff 0%, #eef1ff 100%);
  box-shadow: var(--shadow-card);
  padding: 24px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.card-head h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 900;
}

.card-head h2 svg { width: 20px; height: 20px; }

.chips { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-strong);
  background: linear-gradient(180deg, #f1f2fb, #e4e6f5);
  box-shadow: var(--shadow-inset);
}

.chip svg { width: 14px; height: 14px; }
.chip.mini { font-size: 11px; padding: 4px 12px; color: var(--muted); }

.tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  background: linear-gradient(180deg, #f5f3ff, #e9e5fb);
  box-shadow: var(--shadow-btn);
  transition: all 0.3s var(--spring);
}

.tool-chip svg { width: 14px; height: 14px; }
.tool-chip:hover { transform: translateY(-3px); }
.tool-chip:active { transform: scaleX(1.05) scaleY(0.9); box-shadow: var(--shadow-press); }

.tool-chip.on {
  color: #ffffff;
  background: linear-gradient(180deg, #a78bfa, #8b5cf6);
}

/* ---------- 状态横幅 ---------- */

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.hero-left { display: flex; flex-direction: column; gap: 12px; min-width: 260px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  padding: 12px 26px;
  border-radius: 999px;
  font-size: 20px;
  font-weight: 900;
  box-shadow: var(--shadow-btn);
  transition: all 0.3s var(--spring);
}

.status-pill svg { width: 22px; height: 22px; }

.status-desc { margin: 0; font-size: 14px; font-weight: 600; color: var(--muted); max-width: 460px; }

.st-valid    { color: #047857; background: linear-gradient(180deg, #a7f3d0, #6ee7b7); }
.st-no-target{ color: #a16207; background: linear-gradient(180deg, #fef08a, #fde047); }
.st-invalid  { color: #b45309; background: linear-gradient(180deg, #fcd9a8, #fdba74); }
.st-stale    { color: #6d28d9; background: linear-gradient(180deg, #ddd6fe, #c4b5fd); }
.st-error    { color: #be123c; background: linear-gradient(180deg, #fecdd3, #fda4af); }
.st-offline  { color: #b91c1c; background: linear-gradient(180deg, #fecaca, #fca5a5); }
.st-no-data  { color: #475569; background: linear-gradient(180deg, #e2e8f0, #cbd5e1); }
.st-unknown  { color: #4338ca; background: linear-gradient(180deg, #e0e7ff, #c7d2fe); }

.hero-right {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}

.age-block { display: flex; flex-direction: column; gap: 4px; }

.age-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.age-label svg { width: 14px; height: 14px; }

.age-value {
  font-size: 40px;
  font-weight: 700;
  color: var(--head);
  line-height: 1.1;
}

.live-block { display: flex; align-items: center; gap: 10px; }

.live-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #a5b4fc;
  box-shadow: var(--shadow-inset);
}

.live-dot.on { background: #34d399; animation: pulse 1.6s var(--spring) infinite; }
.live-dot.bad { background: #fb7185; }

.live-text { font-size: 13px; font-weight: 800; color: var(--ink-strong); }

/* ---------- 主网格 ---------- */

.grid-main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 1024px) {
  .grid-main { grid-template-columns: 3fr 2fr; }
}

.side-col { display: flex; flex-direction: column; gap: 24px; }

/* ---------- 3D 视图 ---------- */

.view3d-card { display: flex; flex-direction: column; }

.view3d-wrap {
  position: relative;
  border-radius: 28px;
  overflow: hidden;
  min-height: 420px;
  background: linear-gradient(160deg, #eef0ff 0%, #f6f0ff 55%, #fdeef7 100%);
  box-shadow: var(--shadow-inset);
}

.view3d-wrap canvas { display: block; width: 100%; height: 100%; }

.view3d-hint {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
  color: var(--muted);
  pointer-events: none;
  text-align: center;
  padding: 24px;
}

.view3d-hint[hidden] { display: none; }

.legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 14px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.legend-item { display: inline-flex; align-items: center; gap: 6px; }

.sw {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  box-shadow: inset 2px 2px 3px rgba(255, 255, 255, 0.5), inset -1px -1px 2px rgba(76, 60, 130, 0.2);
}

.sw-x { background: #fb7185; }
.sw-y { background: #34d399; }
.sw-z { background: #60a5fa; }

.legend-note { margin-left: auto; font-weight: 600; }

/* ---------- 位姿数值 ---------- */

.tile-group-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  margin: 10px 0 8px;
}

.tile-group-label svg { width: 14px; height: 14px; }

.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.tile {
  border-radius: 24px;
  padding: 14px 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: linear-gradient(180deg, #f1f2fb, #e6e8f7);
  box-shadow: var(--shadow-inset);
  transition: all 0.3s var(--spring);
}

.tile-label { font-size: 12px; font-weight: 900; color: var(--muted); }

.tile-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink-strong);
  transition: color 0.3s var(--spring);
}

.tile-unit { font-size: 10px; font-weight: 800; color: var(--muted); }

.tile-x .tile-value { color: #e11d48; }
.tile-y .tile-value { color: #059669; }
.tile-z .tile-value { color: #2563eb; }
.tile-roll .tile-value { color: #b45309; }
.tile-pitch .tile-value { color: #7c3aed; }
.tile-yaw .tile-value { color: #be185d; }

.tiles.dimmed .tile-value { color: #a8a4c4; }

.pose-note {
  margin: 14px 0 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.6;
}

/* ---------- 时间卡片 ---------- */

.time-rows { margin: 0; display: flex; flex-direction: column; gap: 10px; }

.time-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, #f5f6fd, #e9ebf9);
  box-shadow: var(--shadow-inset);
}

.time-row dt { font-size: 12px; font-weight: 800; color: var(--muted); }

.time-row dd {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-strong);
  text-align: right;
  word-break: break-all;
}

/* ---------- 历史趋势 ---------- */

.spark-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 720px) { .spark-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .spark-grid { grid-template-columns: repeat(3, 1fr); } }

.spark {
  border-radius: 24px;
  padding: 14px;
  background: linear-gradient(180deg, #f5f6fd, #e9ebf9);
  box-shadow: var(--shadow-inset);
}

.spark-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.spark-name { font-size: 13px; font-weight: 900; display: inline-flex; align-items: center; gap: 6px; }
.spark-name::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  box-shadow: inset 2px 2px 3px rgba(255, 255, 255, 0.5);
}

.dot-x { color: #e11d48; } .dot-x::before { background: #fb7185; }
.dot-y { color: #059669; } .dot-y::before { background: #34d399; }
.dot-z { color: #2563eb; } .dot-z::before { background: #60a5fa; }
.dot-roll { color: #b45309; } .dot-roll::before { background: #fbbf24; }
.dot-pitch { color: #7c3aed; } .dot-pitch::before { background: #a78bfa; }
.dot-yaw { color: #be185d; } .dot-yaw::before { background: #f472b6; }

.spark-range { font-size: 10px; font-weight: 700; color: var(--muted); font-family: "JetBrains Mono", ui-monospace, monospace; }

.spark canvas { display: block; width: 100%; height: 56px; }

/* ---------- 弹窗 ---------- */

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(76, 60, 130, 0.25);
}

.modal-mask[hidden] { display: none; }

.modal { width: 100%; max-width: 440px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }

.field span { font-size: 12px; font-weight: 800; color: var(--muted); }

.clay-input {
  border: 0;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-strong);
  padding: 12px 18px;
  border-radius: 20px;
  background: linear-gradient(180deg, #eef0fa, #e2e5f4);
  box-shadow: var(--shadow-inset);
  transition: all 0.3s var(--spring);
}

.clay-input:focus { outline: none; box-shadow: var(--shadow-inset), 0 0 0 4px rgba(167, 139, 250, 0.35); }

.form-note {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.7;
}

.form-note code {
  font-size: 11px;
  color: var(--head);
  background: linear-gradient(180deg, #f1f2fb, #e4e6f5);
  border-radius: 8px;
  padding: 1px 6px;
  box-shadow: var(--shadow-inset);
}

.form-hint { min-height: 18px; margin: 0 0 12px; font-size: 12px; font-weight: 700; color: #be123c; }
.form-hint.ok { color: #047857; }

.form-actions { display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }

/* ---------- 页脚 ---------- */

footer p {
  margin: 0;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

main { display: flex; flex-direction: column; gap: 24px; }

/* ---------- 动效降级 ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}

/* Camera preview follows the existing clay cards and purple palette. */
.tag-reading { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 16px; border-radius:20px; background:linear-gradient(180deg,#f1f2fb,#e6e8f7); box-shadow:var(--shadow-inset); margin-bottom:14px; }
.tag-reading span { display:inline-flex; align-items:center; gap:8px; font-size:13px; font-weight:800; color:var(--muted); }
.tag-reading svg { width:16px; height:16px; }
.tag-reading strong { font-size:24px; color:#7c3aed; font-family:'JetBrains Mono',monospace; }
.camera-card { margin-top:24px; }
.camera-frame { position:relative; width:100%; aspect-ratio:16/9; border-radius:24px; overflow:hidden; background:linear-gradient(145deg,#e9e7f6,#dde5f5); box-shadow:var(--shadow-inset); }
.camera-frame img { display:block; width:100%; height:100%; object-fit:contain; }
.camera-frame p { position:absolute; inset:0; display:grid; place-items:center; margin:0; padding:20px; color:var(--muted); font-weight:800; text-align:center; }
.camera-frame p[data-mode="badge"] { inset:auto 12px 12px 12px; display:block; width:fit-content; max-width:calc(100% - 24px); box-sizing:border-box; border-radius:12px; padding:8px 12px; background:rgba(30,24,48,.88); color:#fff; font-size:13px; text-align:left; pointer-events:none; }
.camera-frame img[hidden], .camera-frame p[hidden] { display:none; }
.camera-card .card-head { flex-wrap:wrap; gap:10px; }
