:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
  --bg: #e6e5e1;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-solid: #ffffff;
  --line: rgba(45, 42, 38, 0.14);
  --text: #24201c;
  --muted: #69625b;
  --accent: #247d73;
  --warning: #a96817;
  --danger: #b94747;
  --shadow: 0 18px 48px rgba(72, 68, 61, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.74), rgba(228, 227, 223, 0.36) 44%, rgba(198, 196, 190, 0.68) 100%),
    var(--bg);
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

.model-loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.model-loading.is-hidden {
  visibility: hidden;
  opacity: 0;
}

.model-loading-card {
  width: min(340px, calc(100vw - 40px));
  padding: 18px 18px 16px;
  border: 1px solid rgba(36, 125, 115, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 46px rgba(72, 68, 61, 0.18);
  backdrop-filter: blur(18px);
}

.model-loading-title {
  font-size: 16px;
  font-weight: 800;
}

.model-loading-bar {
  height: 6px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(36, 125, 115, 0.14);
}

.model-loading-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #247d73, #f0aa39);
  transition: width 180ms ease;
}

.model-loading-meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.acupoint-label-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
}

.acupoint-label-layer.is-interacting {
  visibility: hidden;
}

.acupoint-label {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  color: rgba(12, 12, 12, 0.98);
  font-size: 14px;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
  text-shadow:
    -1.4px -1.4px 0 rgba(255, 255, 255, 0.96),
    1.4px -1.4px 0 rgba(255, 255, 255, 0.96),
    -1.4px 1.4px 0 rgba(255, 255, 255, 0.96),
    1.4px 1.4px 0 rgba(255, 255, 255, 0.96),
    0 0 3px rgba(255, 255, 255, 0.92);
  transform-origin: center center;
  user-select: none;
  will-change: transform;
}

.acupoint-label.selected {
  color: #000;
}

.acupoint-label[hidden] {
  display: none;
}

.topbar {
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(180px, auto) minmax(220px, 420px) minmax(180px, 260px) 42px;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}

.brand,
.search-box,
.topbar select,
.icon-button,
.legend,
.toggles,
.detail-panel {
  pointer-events: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  font-weight: 700;
  white-space: nowrap;
  backdrop-filter: blur(16px);
}

.brand-mark {
  width: 14px;
  height: 14px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(36, 125, 115, 0.14);
}

.search-box input,
.topbar select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  box-shadow: var(--shadow);
  outline: none;
  backdrop-filter: blur(16px);
}

.search-box input {
  padding: 0 14px;
}

.topbar select {
  padding: 0 12px;
}

.search-box input:focus,
.topbar select:focus,
.icon-button:focus-visible {
  border-color: rgba(36, 125, 115, 0.78);
  box-shadow: 0 0 0 3px rgba(36, 125, 115, 0.14), var(--shadow);
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.icon-button:hover {
  border-color: rgba(36, 125, 115, 0.42);
  color: var(--accent);
}

.legend {
  position: absolute;
  left: 18px;
  top: 76px;
  z-index: 4;
  display: grid;
  width: min(276px, calc(100vw - 36px));
  max-height: calc(100vh - 162px);
  gap: 7px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.legend-button {
  display: grid;
  grid-template-columns: 13px 44px 1fr auto;
  gap: 9px;
  align-items: center;
  width: 100%;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.legend-button:hover,
.legend-button.active {
  border-color: rgba(36, 125, 115, 0.2);
  background: rgba(36, 125, 115, 0.08);
}

.legend-swatch {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

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

.legend-name {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-count {
  color: var(--muted);
  font-size: 12px;
}

.toggles {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 36px);
  min-height: 44px;
  overflow-x: auto;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  white-space: nowrap;
  backdrop-filter: blur(16px);
}

.toggles label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.toggles input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.toggles .flow-toggle {
  position: relative;
  min-width: 76px;
  justify-content: center;
  padding: 7px 12px;
  border: 1px solid rgba(36, 125, 115, 0.28);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease;
}

.toggles .flow-toggle:hover {
  border-color: rgba(36, 125, 115, 0.52);
  background: rgba(36, 125, 115, 0.08);
}

.toggles .flow-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.toggles .flow-toggle:has(input:checked) {
  border-color: rgba(36, 125, 115, 0.72);
  background: rgba(36, 125, 115, 0.15);
  color: var(--text);
}

.review-toggle {
  min-width: 54px;
  min-height: 28px;
  border: 1px solid rgba(169, 104, 23, 0.26);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--warning);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.review-toggle:hover,
.review-toggle.active {
  border-color: rgba(169, 104, 23, 0.58);
  background: rgba(169, 104, 23, 0.13);
  color: #51300b;
}

.review-toggle.dragging {
  background: rgba(169, 104, 23, 0.2);
}

.range-control input {
  width: 110px;
  accent-color: var(--warning);
}

.detail-panel {
  position: absolute;
  top: 76px;
  right: 18px;
  z-index: 4;
  width: min(380px, calc(100vw - 36px));
  max-height: calc(100vh - 112px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.detail-header {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.detail-code {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(36, 125, 115, 0.08);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.detail-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.detail-title h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.detail-title span {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.detail-section {
  padding: 14px 18px 16px;
  border-bottom: 1px solid var(--line);
}

.detail-section:last-child {
  border-bottom: 0;
}

.detail-section h2 {
  margin: 0 0 8px;
  color: var(--warning);
  font-size: 13px;
}

.detail-section p {
  margin: 0;
  color: #342f2a;
  font-size: 13px;
  line-height: 1.65;
}

.source-note {
  color: var(--muted);
  font-size: 12px;
}

.review-panel {
  position: absolute;
  top: 76px;
  right: 416px;
  z-index: 4;
  width: min(330px, calc(100vw - 36px));
  max-height: calc(100vh - 112px);
  overflow: auto;
  border: 1px solid rgba(169, 104, 23, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.review-panel[hidden] {
  display: none;
}

.review-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.review-kicker {
  color: var(--warning);
  font-size: 12px;
  font-weight: 850;
}

.review-header h2 {
  margin: 4px 0 0;
  font-size: 19px;
  line-height: 1.2;
}

.review-count {
  display: inline-grid;
  min-width: 28px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: rgba(169, 104, 23, 0.12);
  color: var(--warning);
  font-size: 12px;
  font-weight: 850;
}

.review-empty,
.review-body {
  padding: 14px 16px;
}

.review-empty {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.review-status {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.review-status button,
.review-actions button,
.review-footer button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font-size: 12px;
  font-weight: 760;
  cursor: pointer;
}

.review-status button.active {
  border-color: rgba(36, 125, 115, 0.54);
  background: rgba(36, 125, 115, 0.12);
  color: var(--accent);
}

.review-coordinates {
  display: grid;
  gap: 7px;
  margin: 14px 0;
}

.review-coordinates div {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 8px;
  align-items: baseline;
}

.review-coordinates dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}

.review-coordinates dd {
  margin: 0;
  color: #342f2a;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
}

.review-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.review-note {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}

.review-note textarea {
  width: 100%;
  resize: vertical;
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  line-height: 1.5;
  outline: none;
}

.review-note textarea:focus {
  border-color: rgba(36, 125, 115, 0.58);
  box-shadow: 0 0 0 3px rgba(36, 125, 115, 0.12);
}

.review-footer {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
}

.review-footer button:last-child {
  color: var(--danger);
}

.hover-tip {
  position: fixed;
  z-index: 20;
  display: none;
  max-width: 220px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  font-size: 12px;
  pointer-events: none;
  box-shadow: var(--shadow);
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr 42px;
  }

  .brand,
  .search-box,
  .topbar select {
    grid-column: 1 / -1;
  }

  .icon-button {
    position: absolute;
    top: 0;
    right: 0;
  }

  .legend {
    display: none;
  }

  .detail-panel {
    top: auto;
    right: 12px;
    bottom: 76px;
    left: 12px;
    width: auto;
    max-height: 40vh;
  }

  .review-panel {
    top: 162px;
    right: 12px;
    left: 12px;
    width: auto;
    max-height: calc(100vh - 250px);
  }

  .toggles {
    right: 12px;
    left: 12px;
    justify-content: center;
    transform: none;
  }
}

@media (max-width: 560px) {
  .topbar {
    top: 10px;
    right: 10px;
    left: 10px;
  }

  .brand {
    font-size: 14px;
  }

  .toggles {
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  .detail-title h1 {
    font-size: 24px;
  }
}
