:root {
  color-scheme: light;
  --bg: #eef0f3;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --ink: #15171a;
  --muted: #68707d;
  --line: #d9dde4;
  --accent: #1668dc;
  --focus: #0f5bd8;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 286px minmax(520px, 1fr) 360px;
  height: 100vh;
  min-height: 720px;
}

.sidebar,
.details {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: auto;
  padding: 22px;
}

.details {
  border-left: 1px solid var(--line);
  border-right: 0;
}

.brand h1,
.details h2,
.topbar h2 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  font-size: 24px;
  line-height: 1.2;
}

.topbar h2 {
  font-size: 22px;
  line-height: 1.25;
}

.details h2 {
  font-size: 21px;
  line-height: 1.25;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.field {
  display: grid;
  gap: 7px;
}

.field span,
.panel-title {
  color: #39404b;
  font-size: 13px;
  font-weight: 700;
}

select,
input {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  height: 40px;
  outline: none;
  padding: 0 12px;
  width: 100%;
}

select:focus,
input:focus,
button:focus-visible,
.model-link:focus-visible {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(22, 104, 220, 0.15);
}

.summary-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.metric {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.metric span {
  display: block;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.metric small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 8px;
}

.panel {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  padding-top: 18px;
}

.legend-list {
  display: grid;
  gap: 8px;
}

.legend-item {
  align-items: center;
  display: grid;
  gap: 9px;
  grid-template-columns: 26px 1fr;
  min-height: 28px;
}

.legend-swatch {
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 4px;
  height: 18px;
  width: 26px;
}

.model-link {
  align-items: center;
  background: #111827;
  border: 1px solid #111827;
  border-radius: 8px;
  color: #fff;
  display: flex;
  height: 38px;
  justify-content: center;
  text-decoration: none;
}

.note,
.empty-copy {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  margin: 0;
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
}

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 76px;
  padding: 16px 20px;
}

.toolbar {
  display: flex;
  gap: 8px;
}

.toolbar button {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  height: 38px;
  min-width: 38px;
  padding: 0 12px;
}

.toolbar button:hover {
  border-color: #aeb6c4;
}

.map-viewport {
  background: #ffffff;
  cursor: grab;
  overflow: hidden;
  position: relative;
}

.map-viewport.is-dragging {
  cursor: grabbing;
}

.map-content {
  left: 0;
  position: absolute;
  top: 0;
  transform-origin: 0 0;
  user-select: none;
}

.map-content img {
  display: block;
  height: 100%;
  pointer-events: none;
  width: 100%;
}

.hit-layer,
.region-hit {
  left: 0;
  position: absolute;
  top: 0;
}

.hit-layer {
  height: 100%;
  width: 100%;
}

.region-hit {
  background: rgba(22, 104, 220, 0);
  border: 1px solid transparent;
  cursor: pointer;
  padding: 0;
}

.region-hit:hover {
  background: rgba(22, 104, 220, 0.14);
  border-color: rgba(255, 255, 255, 0.8);
}

.region-hit.is-selected {
  background: rgba(255, 255, 255, 0.18);
  border-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(22, 104, 220, 0.9);
}

.region-hit.is-filtered {
  display: none;
}

.map-hint {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  bottom: 16px;
  color: #20242a;
  font-size: 13px;
  left: 16px;
  padding: 8px 11px;
  position: absolute;
}

#cropCanvas {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  height: 260px;
  width: 100%;
}

.detail-rows {
  display: grid;
  gap: 10px;
}

.detail-row {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
}

.detail-row small {
  color: var(--muted);
  font-size: 12px;
}

.detail-row span {
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
}

.category-pill {
  align-items: center;
  display: inline-flex;
  gap: 8px;
}

.category-dot {
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 999px;
  display: inline-block;
  height: 12px;
  width: 12px;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 260px minmax(420px, 1fr);
  }

  .details {
    border-left: 0;
    border-top: 1px solid var(--line);
    grid-column: 1 / -1;
    max-height: 360px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
    height: auto;
    min-height: 100vh;
  }

  .sidebar,
  .details {
    border: 0;
  }

  .workspace {
    height: 70vh;
    min-height: 520px;
  }
}
