:root {
  color-scheme: dark;
  --ink: #f4f8fb;
  --muted: #c0d0dc;
  --panel: rgb(9 20 30 / 72%);
  --panel-strong: rgb(7 17 27 / 88%);
  --edge: rgb(214 235 248 / 29%);
  --accent: #84d7ca;
  --stage: #88a9c2;
}

* { box-sizing: border-box; }

html, body, .viewer-shell, #canvas-host { width: 100%; height: 100%; margin: 0; }

body {
  min-width: 320px;
  overflow: hidden;
  background: var(--stage);
  color: var(--ink);
  font-family: "Microsoft YaHei UI", "Noto Sans SC", sans-serif;
}

button { font: inherit; }

.viewer-shell {
  position: relative;
  isolation: isolate;
  background: radial-gradient(circle at 50% 15%, #c7e0ef 0%, #88a9c2 45%, #5f8198 100%);
}

#canvas-host { position: absolute; inset: 0; z-index: -1; }
#canvas-host canvas { display: block; width: 100%; height: 100%; outline: none; }

.topbar, .footer-bar, .instruction-card { position: absolute; z-index: 1; }
.topbar {
  top: 20px;
  left: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark, .loader-mark {
  width: 15px;
  height: 15px;
  display: inline-block;
  border: 2px solid var(--accent);
  transform: rotate(45deg);
  box-shadow: 0 0 24px rgb(112 227 213 / 55%);
}

.eyebrow, .card-label {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .15em;
}

h1 { margin: 2px 0 0; font-size: clamp(18px, 2vw, 24px); font-weight: 650; letter-spacing: .05em; }

.status {
  padding: 8px 11px;
  border: 1px solid var(--edge);
  border-radius: 3px;
  background: var(--panel);
  box-shadow: 0 8px 30px rgb(13 34 49 / 19%);
  color: var(--muted);
  font-size: 13px;
  backdrop-filter: blur(14px);
}

.status.is-ready { color: #d7fff4; border-color: rgb(132 215 202 / 55%); }
.status.is-error { border-color: #e48d8d; color: #ffe0e0; }

.instruction-card {
  left: 20px;
  bottom: 54px;
  width: min(322px, calc(100vw - 40px));
  padding: 16px;
  border: 1px solid var(--edge);
  border-radius: 4px;
  background: var(--panel);
  box-shadow: 0 14px 42px rgb(9 29 44 / 28%);
  backdrop-filter: blur(16px);
}

.instruction-card p:not(.card-label) { margin: 7px 0 14px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.instruction-actions { display: flex; gap: 8px; }
.instruction-actions button {
  border: 1px solid var(--edge);
  border-radius: 2px;
  background: rgb(14 34 48 / 88%);
  color: var(--ink);
  padding: 8px 12px;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease, border-color .18s ease;
}

.instruction-actions button:hover { background: #1d4c63; border-color: rgb(132 215 202 / 60%); }
.instruction-actions button:focus-visible { outline: 2px solid #9ae7df; outline-offset: 2px; }
.instruction-actions button:active { transform: translateY(1px); }

.footer-bar {
  left: 20px;
  right: 20px;
  bottom: 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #e5f0f5;
  font-size: 11px;
  letter-spacing: .08em;
  text-shadow: 0 1px 5px rgb(16 42 58 / 60%);
}

.loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgb(18 48 68 / 47%);
  backdrop-filter: blur(4px);
  transition: opacity .35s ease, visibility .35s ease;
}

.loader.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-panel {
  width: min(330px, calc(100vw - 48px));
  padding: 24px;
  border: 1px solid var(--edge);
  border-radius: 4px;
  background: var(--panel-strong);
  box-shadow: 0 18px 54px rgb(7 27 41 / 36%);
}

.loader-panel p { margin: 14px 0 10px; font-size: 14px; }
.progress-track { height: 3px; overflow: hidden; background: #35566a; }
.progress-track span { display: block; height: 100%; width: 8%; background: var(--accent); transition: width .2s ease; }

@media (max-width: 600px) {
  .topbar { top: 12px; left: 12px; right: 12px; align-items: flex-start; }
  .status { max-width: 132px; text-align: right; }
  .instruction-card { left: 12px; bottom: 48px; }
  .footer-bar { left: 12px; right: 12px; bottom: 12px; }
}
