:root {
  --bg: #0b0e16;
  --panel: rgba(20, 26, 44, 0.74);
  --panel-solid: #141a2c;
  --ink: #eef1ff;
  --ink-dim: #9aa3c7;
  --accent: #7ea0ff;
  --accent-2: #e0a6a0;
  --line: rgba(255, 255, 255, 0.12);
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --chip-bg: rgba(0, 0, 0, 0.25);
  --on-accent: #fff;
  --hover-accent: color-mix(in oklab, var(--accent) 18%, transparent);
}
/* ===== 3-way theme (Light/Dark/System) — base :root above = native DARK. Opposite (light) WCAG-aware auto-generated (contrast-solving ink/accent vs worst-case surface). ===== */
:root[data-theme="light"]{
  --bg: #f4f4f6;
  --panel: #f6f6f7;
  --panel-solid: #f6f6f7;
  --ink: #002bf4;
  --ink-dim: #5c6aa5;
  --accent: #205bff;
  --accent-2: #b7473c;
  --line: rgba(0,0,0,0.10);
  --chip-bg: #6c6c6c;
  --on-accent: #ffffff;
}












* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font-family: "Noto Sans KR", system-ui, -apple-system, "Apple SD Gothic Neo", sans-serif;
  -webkit-font-smoothing: antialiased; overflow: hidden; }

.app { position: fixed; inset: 0; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.hidden { display: none !important; }

/* overlays */
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 5; }
.loading { flex-direction: column; gap: 14px; color: var(--ink-dim); font-size: 14px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* topbar + language switcher */
.topbar { position: absolute; top: max(10px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); z-index: 8; }
.topbar [data-i18n-switcher] select,
.topbar select { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 10px; font-size: 12px; backdrop-filter: blur(8px); }

/* title card */
.title-card { text-align: center; padding: 36px 30px; max-width: 440px; }
.logo { font-family: "Orbitron", "Noto Sans KR", sans-serif; font-weight: 800; font-size: clamp(38px, 11vw, 70px);
  margin: 0 0 6px; letter-spacing: 1.5px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline { color: var(--ink-dim); margin: 0 0 26px; font-size: 15px; }
.hint { color: var(--ink-dim); margin: 18px 0 0; font-size: 12.5px; opacity: 0.85; }

.btn { font: inherit; font-weight: 700; border: none; border-radius: 999px; padding: 13px 26px; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.btn-primary { background: linear-gradient(120deg, var(--accent), var(--accent-2)); color: var(--on-accent); box-shadow: 0 8px 24px rgba(126, 160, 255, 0.4); }
.btn-primary:hover { transform: translateY(-2px); }
.btn-primary:active { transform: translateY(0); }

/* controls (HUD) */
.controls { position: absolute; left: 50%; transform: translateX(-50%);
  bottom: max(16px, env(safe-area-inset-bottom)); z-index: 8; display: flex; gap: 10px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 7px 10px; backdrop-filter: blur(10px); box-shadow: var(--shadow); }
.ctl-group { display: flex; align-items: center; gap: 8px; }
.ctl-group + .ctl-group { border-left: 1px solid var(--line); padding-left: 10px; }
.ctl-label { font-size: 11px; color: var(--ink-dim); padding: 0 2px; }

/* mode segmented control */
.segmented { display: inline-flex; gap: 2px; align-items: center; background: var(--chip-bg); border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.seg { font: inherit; font-weight: 600; font-size: 12px; color: var(--ink-dim); background: transparent; border: none;
  border-radius: 999px; height: 30px; padding: 0 12px; cursor: pointer; transition: background .12s, color .12s; }
.seg:hover { color: var(--ink); }
.seg.is-on { background: var(--accent); color: var(--on-accent); }

/* color chips */
.chips { display: inline-flex; gap: 8px; align-items: center; }
.chip { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0;
  box-shadow: inset 0 1px 2px rgba(255,255,255,.25); transition: transform .12s, border-color .12s; }
.chip:hover { transform: translateY(-1px); }
.chip.is-on { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(126,160,255,.4), inset 0 1px 2px rgba(255,255,255,.25); }

.icon-btn { line-height: 1; color: var(--ink); background: var(--chip-bg); border: 1px solid var(--line);
  border-radius: 999px; height: 34px; padding: 0 12px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-weight: 600; font-size: 12px; }
.icon-btn:hover { background: var(--hover-accent); }
.icon-btn.is-on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* V3 — AR camera preview button: distinct accent so it reads as a mode toggle */
#arBtn.icon-btn.is-on { background: linear-gradient(120deg, var(--accent), var(--accent-2)); color: var(--on-accent); border-color: transparent;
  box-shadow: 0 0 0 2px rgba(126,160,255,.35); }

/* AR note panel */
.arnote { position: absolute; right: max(14px, env(safe-area-inset-right)); top: 54px; z-index: 9; width: min(290px, calc(100vw - 28px));
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; backdrop-filter: blur(12px); box-shadow: var(--shadow); }
.arnote-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; gap: 8px; }
.arnote-head strong { font-family: "Orbitron", "Noto Sans KR", sans-serif; font-size: 15px; color: var(--ink); line-height: 1.25; }
.arnote-close { background: none; border: none; color: var(--ink-dim); font-size: 16px; cursor: pointer; line-height: 1; padding: 2px 6px; border-radius: 8px; flex-shrink: 0; }
.arnote-close:hover { background: rgba(255, 255, 255, 0.08); color: var(--ink); }
.arnote-body { margin: 0; font-size: 13px; line-height: 1.55; color: var(--ink-dim); }
.arnote-hint { margin: 8px 0 0; font-size: 12px; line-height: 1.5; color: var(--accent); opacity: 0.9; }

.foot { position: absolute; left: 50%; transform: translateX(-50%); bottom: max(70px, calc(env(safe-area-inset-bottom) + 64px));
  z-index: 4; margin: 0; font-size: 11px; color: var(--ink-dim); opacity: 0.7; text-align: center; pointer-events: none; white-space: nowrap; }

/* toast */
.toast { position: absolute; left: 50%; transform: translate(-50%, -10px); bottom: max(74px, calc(env(safe-area-inset-bottom) + 60px));
  z-index: 12; background: var(--panel-solid); color: var(--ink); border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 16px; font-size: 12.5px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 540px) {
  .foot { display: none; }
  .ctl-label { display: none; }
  /* Reserve a right gutter for the fixed bottom-right .pmp-fab so the centered
     bottom HUD never overlaps it on mobile (Cross-cutting FAB/mobile collision). */
  .controls { max-width: calc(100vw - 60px); padding-right: 14px; }
}
@media (prefers-reduced-motion: reduce) { .spinner, .btn-primary { animation: none; transition: none; } }
