:root {
  --bg: #0c0f17;
  --panel: rgba(20, 25, 40, 0.78);
  --panel-solid: #141928;
  --ink: #eef1fb;
  --ink-dim: #9aa3c2;
  --accent: #7e9472;      /* sage — ties to the chair palette */
  --accent-2: #c08a4a;    /* oak */
  --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);          /* dark chip wells / inset backgrounds */
  --on-accent: #fff;                         /* text/icon sitting on accent fills */
}
/* ===== 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: #f5f6f7;
  --panel-solid: #f5f6f7;
  --ink: #2948b0;
  --ink-dim: #5e6c9b;
  --accent: #5f7156;
  --accent-2: #8e6331;
  --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-2); 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: "Space Grotesk", "Noto Sans KR", sans-serif; font-weight: 700; font-size: clamp(38px, 11vw, 68px);
  margin: 0 0 6px; letter-spacing: 0.5px;
  background: linear-gradient(120deg, var(--accent-2), var(--accent)); -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: 12px 22px; cursor: pointer;
  transition: transform .15s, box-shadow .15s, background .15s; }
.btn-primary { background: linear-gradient(120deg, var(--accent-2), var(--accent)); color: var(--on-accent); box-shadow: 0 8px 24px rgba(192, 138, 74, 0.35); }
.btn-primary:hover { transform: translateY(-2px); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost { background: var(--panel); color: var(--ink); border: 1px solid var(--line); backdrop-filter: blur(10px); }
.btn-ghost:hover { background: color-mix(in oklab, var(--ink) 10%, transparent); }

/* configurator panel (HUD) */
.config { position: absolute; left: 50%; transform: translateX(-50%);
  bottom: max(16px, env(safe-area-inset-bottom)); z-index: 8; width: min(680px, calc(100vw - 24px));
  display: flex; flex-direction: column; gap: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  backdrop-filter: blur(12px); box-shadow: var(--shadow); }
.cfg-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cfg-row + .cfg-row { padding-top: 12px; border-top: 1px solid var(--line); }
.cfg-row.cfg-bottom { padding-top: 12px; border-top: 1px solid var(--line); justify-content: space-between; }
.cfg-bottom > * { display: flex; align-items: center; gap: 8px; }
.cfg-label { font-size: 11px; color: var(--ink-dim); text-transform: none; letter-spacing: 0.2px; min-width: 34px; }
.price { font-family: "Space Grotesk", "Noto Sans KR", sans-serif; font-size: 22px; font-weight: 700; color: var(--ink); }
.price-unit { font-family: "Noto Sans KR", system-ui, sans-serif; font-size: 13px; font-weight: 600; margin-left: 3px; color: var(--ink-dim); }
.cfg-actions { display: flex; align-items: center; gap: 8px; }

/* color chips */
.chips { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.chip { --chip: #ccc; position: relative; width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid var(--line); background: var(--chip); cursor: pointer; padding: 0;
  box-shadow: inset 0 1px 2px rgba(255,255,255,.25), 0 2px 6px rgba(0,0,0,.3);
  transition: transform .15s, border-color .15s; }
.chip:hover { transform: translateY(-2px); }
.chip.is-on { border-color: var(--ink); transform: scale(1.06); }
.chip.is-on::after { content: "✓"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: rgba(0,0,0,0.65); font-size: 16px; font-weight: 800; text-shadow: 0 1px 2px rgba(255,255,255,.5); }

/* segment (part selector) */
.seg { display: inline-flex; flex-wrap: wrap; background: var(--chip-bg); border-radius: 999px; padding: 3px; }
.seg-btn { font: inherit; font-size: 12px; font-weight: 600; color: var(--ink-dim); background: transparent; border: none;
  border-radius: 999px; padding: 6px 11px; cursor: pointer; transition: background .15s, color .15s; }
.seg-btn.is-on { background: var(--accent-2); color: var(--on-accent); }

/* icon button */
.icon-btn { font-size: 15px; line-height: 1; color: var(--ink); background: var(--chip-bg); border: 1px solid var(--line);
  border-radius: 999px; width: 34px; height: 34px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: color-mix(in oklab, var(--accent-2) 22%, transparent); }

/* foot note */
.foot { position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 220px);
  z-index: 4; margin: 0; font-size: 11px; color: var(--ink-dim); opacity: 0.65; text-align: center; pointer-events: none;
  max-width: calc(100vw - 32px); }
@media (min-height: 760px) { .foot { bottom: calc(env(safe-area-inset-bottom) + 210px); } }

/* modal */
.modal-wrap { background: rgba(6, 8, 14, 0.62); }
.modal { width: min(380px, calc(100vw - 32px)); background: var(--panel-solid); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 22px 18px; box-shadow: var(--shadow); text-align: center; }
.modal h2 { font-family: "Space Grotesk", "Noto Sans KR", sans-serif; margin: 0 0 14px; font-size: 20px; }
.tut-list { list-style: none; margin: 0 0 18px; padding: 0; text-align: left; display: grid; gap: 8px; }
.tut-list li { font-size: 13.5px; color: var(--ink); padding-left: 18px; position: relative; }
.tut-list li::before { content: "•"; position: absolute; left: 4px; color: var(--accent-2); }
.modal-actions { display: flex; justify-content: center; gap: 10px; }

/* toast */
.toast { position: fixed; left: 50%; transform: translate(-50%, 16px); top: max(16px, env(safe-area-inset-top));
  z-index: 30; background: var(--panel-solid); color: var(--ink); border: 1px solid var(--line);
  border-radius: 999px; padding: 9px 16px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* V3 — embed code panel (collapsible) */
.cfg-embed { margin-top: 4px; padding: 12px 12px 14px; background: var(--chip-bg); border: 1px solid var(--line);
  border-radius: 10px; display: flex; flex-direction: column; gap: 8px; }
.cfg-embed-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cfg-embed-head strong { font-size: 12px; color: var(--ink); font-weight: 700; letter-spacing: 0.2px; }
.embed-close { font: inherit; font-size: 18px; line-height: 1; color: var(--ink-dim); background: transparent; border: none;
  cursor: pointer; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s; }
.embed-close:hover { background: color-mix(in oklab, var(--ink) 10%, transparent); color: var(--ink); }
.cfg-embed-hint { margin: 0; font-size: 11px; color: var(--ink-dim); line-height: 1.4; }
.cfg-embed-code { display: block; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 11px;
  line-height: 1.5; color: var(--ink); background: var(--chip-bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 10px; white-space: pre-wrap; word-break: break-all; max-height: 92px; overflow: auto;
  user-select: all; }
.cfg-embed-actions { display: flex; justify-content: flex-end; }
.cfg-embed-actions .btn { padding: 8px 16px; font-size: 12px; }

@media (max-width: 540px) {
  /* Reserve a right gutter so the fixed bottom-right Sponsors FAB never overlaps
     the centered config HUD. Shrink + nudge the HUD, leaving the FAB band clear. */
  .config { width: calc(100vw - 56px); transform: translateX(calc(-50% - 28px)); }
  .cfg-embed { padding: 10px; }
  .cfg-embed-code { font-size: 10.5px; }
}
@media (prefers-reduced-motion: reduce) { .embed-close, .cfg-embed { transition: none; } }

@media (max-width: 540px) {
  .config { padding: 12px; gap: 10px; }
  .price { font-size: 19px; }
  .chip { width: 34px; height: 34px; }
}
@media (prefers-reduced-motion: reduce) { .spinner, .btn-primary, .chip, .toast { animation: none; transition: none; } }
