/* 冰卡 · 界面样式 */
:root {
  --bg: #040b13;
  --fg: #ecfbff;
  --dim: rgba(214, 242, 255, 0.62);
  --ice: #7de3ff;
  --ice2: #b8f1ff;
  --deep: #0b2a40;
  --panel: rgba(7, 24, 38, 0.78);
  --line: rgba(160, 230, 255, 0.20);
  --warn: #fcd34d;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

a { color: var(--ice); }

.hidden { display: none !important; }

/* ------------------------------------------------------------------ HUD */

#hud {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.panel {
  pointer-events: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 15px;
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.42);
  max-width: min(470px, 92vw);
}

.brand {
  font-weight: 800;
  letter-spacing: 2px;
  font-size: 15px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand small {
  font-weight: 400;
  letter-spacing: 0;
  color: var(--dim);
  font-size: 12px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ice);
  box-shadow: 0 0 12px var(--ice);
  animation: breathe 2.4s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { opacity: 0.55; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.1); }
}

.row {
  display: flex;
  gap: 10px;
  font-size: 13px;
  line-height: 1.75;
}

.row .k { color: var(--dim); min-width: 56px; flex: none; }
.row .v { color: var(--fg); }

.actions {
  pointer-events: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  pointer-events: auto;
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn:hover { background: rgba(255, 255, 255, 0.13); border-color: rgba(255, 255, 255, 0.32); }
.btn:active { transform: translateY(1px); }

.btn.primary {
  background: linear-gradient(120deg, #22d3ee, #a5f3fc);
  border-color: transparent;
  color: #04121c;
  font-weight: 700;
}

.btn.big { padding: 13px 34px; font-size: 16px; }
.btn.ghost { background: transparent; }

.error {
  position: fixed;
  right: 16px;
  top: 16px;
  z-index: 40;
  border-color: rgba(248, 113, 113, 0.5);
  background: rgba(60, 12, 20, 0.88);
  color: #fecaca;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  max-height: 42vh;
  overflow: auto;
}

/* -------------------------------------------------------------- 拍照闪光 */

#flash {
  position: fixed;
  inset: 0;
  z-index: 26;
  pointer-events: none;
  background: #f2feff;
  opacity: 0;
}

#flash.on { animation: flash 180ms ease-out; }

@keyframes flash {
  0% { opacity: 0; }
  18% { opacity: 0.82; }
  100% { opacity: 0; }
}

/* ---------------------------------------------------------- 第一步：快门 */

#shoot-ui {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

#shoot-ui .shoot-tip {
  font-size: 14px;
  color: #eafbff;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 18px;
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

#shoot-ui .shoot-sub { font-size: 12px; color: var(--dim); }

.shutter {
  pointer-events: auto;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.9);
  background: rgba(125, 227, 255, 0.18);
  padding: 6px;
  cursor: pointer;
  box-shadow: 0 0 0 6px rgba(125, 227, 255, 0.14), 0 10px 30px rgba(0, 0, 0, 0.45);
  transition: transform 0.1s;
}

.shutter span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: linear-gradient(160deg, #eafcff, #7de3ff);
}

.shutter:active { transform: scale(0.94); }

/* 拍照阶段把底部按钮让开，避免和快门叠在一起 */
body[data-phase="shoot"] #hud .actions {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

/* -------------------------------------------------------------- 开场遮罩 */

#overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(900px 520px at 78% 10%, rgba(34, 211, 238, 0.20), transparent 62%),
    radial-gradient(800px 520px at 10% 94%, rgba(56, 189, 248, 0.16), transparent 62%),
    rgba(4, 11, 19, 0.94);
}

.overlay-card {
  width: min(570px, 94vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 26px 26px 22px;
  backdrop-filter: blur(16px);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

.overlay-card h1 {
  margin: 0 0 8px;
  font-size: 32px;
  letter-spacing: 2px;
  background: linear-gradient(100deg, #ffffff, #7de3ff 55%, #b8f1ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead { margin: 0 0 16px; color: var(--dim); font-size: 15px; line-height: 1.75; }

.steps { margin: 0 0 14px; padding-left: 20px; font-size: 14.5px; line-height: 1.95; }
.steps b { color: var(--ice); }

.note { margin: 0 0 14px; font-size: 13.5px; line-height: 1.7; color: var(--warn); }
.note:empty { display: none; }

.tiny { margin: 12px 0 0; font-size: 12px; color: var(--dim); line-height: 1.7; }

/* -------------------------------------------------------- 预览页 / 标记页 */

.page-preview { background: #050d16; }
.page-preview #hud { justify-content: flex-start; }
.page-preview .actions { margin-top: auto; }

.page-marker {
  overflow: auto;
  display: block;
  background: #f2f6fb;
  color: #101828;
}

.marker-wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.marker-wrap h1 { font-size: 24px; margin: 0 0 6px; }
.marker-wrap p { color: #4b5563; font-size: 14.5px; line-height: 1.8; margin: 6px 0; }
.marker-wrap .hint { color: #6b7280; font-size: 13px; }

.marker-sheet {
  margin: 20px 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 26px;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.marker-sheet img { width: min(420px, 70vw); height: auto; display: block; }

.marker-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.marker-actions button, .marker-actions a {
  appearance: none;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #101828;
  border-radius: 999px;
  padding: 10px 20px;
  font: inherit;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}

.marker-actions button.primary {
  background: #101828;
  border-color: #101828;
  color: #fff;
  font-weight: 600;
}

/* --------------------------------------------------- A-Frame 场景铺满窗口 */

a-scene {
  position: fixed !important;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

a-scene .a-canvas {
  width: 100% !important;
  height: 100% !important;
}

#arjs-video,
video { object-fit: cover; }

/* AR 页：body 不能有不透明底色，否则会盖住 z-index:-2 的摄像头 <video>
   （A-Frame 场景用 background="transparent: true" 让画布透明，3D 才叠在画面上） */
body.page-ar { background: transparent; }

/* -------------------------------------------------------------- 打印样式 */

@media print {
  @page { margin: 12mm; }
  .no-print { display: none !important; }
  html, body.page-marker { background: #fff; }
  .marker-wrap { max-width: none; padding: 0; }
  .marker-sheet {
    border: 0;
    box-shadow: none;
    padding: 0;
    margin: 0;
  }
  .marker-sheet img { width: 150mm; }
}
