:root {
  color-scheme: light;
  font-family: "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #172033;
  background: #edf2f7;
  --ink: #172033;
  --muted: #68748a;
  --line: #d7dee9;
  --panel: rgba(255, 255, 255, 0.94);
  --accent: #176b87;
  --accent-soft: #e4f2f5;
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; }

body {
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 10% 0%, rgba(23, 107, 135, 0.12), transparent 34rem),
    linear-gradient(145deg, #f6f9fc 0%, #e8eef5 100%);
}

button, a { font: inherit; }

.app-shell {
  height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.topbar {
  min-height: 88px;
  padding: 18px clamp(18px, 3vw, 42px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgba(165, 176, 192, 0.55);
  background: rgba(249, 251, 253, 0.86);
  backdrop-filter: blur(16px);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 { margin: 0; font-size: clamp(20px, 2.2vw, 29px); letter-spacing: -0.02em; }

.access-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border: 1px solid #bfd4da;
  border-radius: 999px;
  background: #f5fbfc;
  color: #285d6b;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.access-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2aa772;
  box-shadow: 0 0 0 4px rgba(42, 167, 114, 0.12);
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(245px, 300px) 1fr;
  gap: 16px;
  padding: 16px;
  overflow: hidden;
}

.sidebar, .viewer-panel {
  min-height: 0;
  border: 1px solid rgba(174, 186, 202, 0.7);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 20px 52px rgba(58, 73, 94, 0.09);
  overflow: hidden;
}

.sidebar { display: flex; flex-direction: column; }
.sidebar-heading { padding: 20px 20px 13px; border-bottom: 1px solid var(--line); }
.sidebar-heading h2 { margin: 0 0 4px; font-size: 16px; }
.sidebar-heading p { margin: 0; color: var(--muted); font-size: 12px; }

.model-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.model-group {
  margin: 12px 10px 4px;
  color: #8792a3;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
}
.model-group:first-child { margin-top: 4px; }

.model-button {
  width: 100%;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  padding: 11px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: 150ms ease;
}

.model-button:hover { background: #f3f7fa; border-color: #dbe3eb; }
.model-button.active { background: var(--accent-soft); border-color: #b6d5dc; }

.model-code {
  min-height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #eef2f6;
  color: #4c5b70;
  font-size: 11px;
  font-weight: 800;
}

.model-button.active .model-code { background: #fff; color: var(--accent); }
.model-copy strong { display: block; margin-bottom: 3px; font-size: 13px; }
.model-copy span { display: block; color: var(--muted); font-size: 11px; line-height: 1.35; }

.notice {
  margin: 10px;
  padding: 13px;
  border-radius: 12px;
  background: #f7f5ed;
  color: #625a3f;
  font-size: 11px;
  line-height: 1.55;
}
.notice strong { font-size: 12px; }
.notice p { margin: 5px 0 0; }

.viewer-panel { display: grid; grid-template-rows: auto 1fr; }

.viewer-toolbar {
  min-height: 76px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}

.model-meta { min-width: 0; display: flex; align-items: center; gap: 11px; }
.stage-pill {
  flex: 0 0 auto;
  min-width: 34px;
  padding: 7px 9px;
  border-radius: 8px;
  background: #173c54;
  color: white;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
}
.model-meta h2 { margin: 0 0 3px; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-meta p { margin: 0; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.toolbar-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.toolbar-actions button, .toolbar-link {
  padding: 7px 10px;
  border: 1px solid #ccd5df;
  border-radius: 8px;
  background: white;
  color: #35445a;
  font-size: 11px;
  font-weight: 650;
  line-height: normal;
  text-decoration: none;
  cursor: pointer;
}
.toolbar-actions button:hover,
.toolbar-actions button[aria-pressed="true"],
.toolbar-link:hover { border-color: #7aaebd; background: #e9f4f7; color: #155d74; }

.canvas-wrap { position: relative; min-height: 0; overflow: hidden; background: #f3f6f9; }
#viewport { width: 100%; height: 100%; display: block; touch-action: none; outline: none; }

.loading-card {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 15px;
  border: 1px solid rgba(189, 200, 214, 0.8);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 30px rgba(62, 78, 101, 0.12);
  color: #536175;
  font-size: 12px;
  transition: opacity 180ms ease;
}
.loading-card.hidden { opacity: 0; pointer-events: none; }
.spinner { width: 16px; height: 16px; border: 2px solid #cad7df; border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.interaction-hint {
  position: absolute;
  left: 14px;
  bottom: 13px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(25, 36, 52, 0.76);
  color: white;
  font-size: 10px;
  letter-spacing: 0.02em;
  pointer-events: none;
}

@media (max-width: 840px) {
  body { overflow: auto; }
  .app-shell { height: auto; min-height: 100vh; overflow: visible; }
  .topbar { min-height: 72px; }
  .access-badge { display: none; }
  .workspace { grid-template-columns: 1fr; grid-template-rows: auto minmax(64vh, 1fr); overflow: visible; }
  .sidebar { max-height: 235px; }
  .model-list { display: flex; overflow-x: auto; overflow-y: hidden; }
  .model-group { display: none; }
  .model-button { min-width: 220px; }
  .notice { display: none; }
  .viewer-toolbar { align-items: flex-start; flex-direction: column; }
  .toolbar-actions { justify-content: flex-start; }
}
