/* css/style.css — botu3d (SPEC-493) minimal aesthetic · sans-serif · dark default + soft light · zero external fonts
   (base adapted from botu css; gallery section dropped, avatar stage + controls added) */

/* ── theme tokens ─────────────────────────────── */
:root {
  --bg: #161719;
  --panel: #1d1e21;
  --panel2: #131416;
  --ink: #c8cace;
  --bright: #e8e9ec;
  --muted: #85888e;
  --accent: #ff6a1a;
  --accent2: #7fa6e8;
  --accent-ink: #14161a;
  --line: #2a2c30;
  --err-bg: #2a1c1e;
  --err-ink: #e08585;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  --radius: 12px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}
:root[data-theme="light"] {
  --bg: #fafaf8;
  --panel: #fdfdfc;
  --panel2: #f4f4f1;
  --ink: #3a3d42;
  --bright: #23262a;
  --muted: #6f747b;
  --accent: #d4530c;
  --accent2: #3d6db5;
  --accent-ink: #fbfbfa;
  --line: #e4e4df;
  --err-bg: #fbf0ef;
  --err-ink: #b04a44;
  --shadow: 0 1px 3px rgba(30, 32, 36, 0.05);
}

/* ── base ─────────────────────────────────────── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.7;
  letter-spacing: 0.01em;
}
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }
main { max-width: 860px; margin: 0 auto; padding: 8px 24px 56px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
a { color: var(--accent2); }

/* ── topbar ───────────────────────────────────── */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 860px; margin: 0 auto; padding: 22px 24px;
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  color: var(--bright); font-weight: 600; font-size: 1.05rem; letter-spacing: 0.02em;
}
.brand .mark { width: 22px; height: 22px; display: block; color: var(--accent); }
.topbtns { display: flex; gap: 8px; align-items: center; }
.pill {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 4px 14px; cursor: pointer;
  font: inherit; font-size: 0.82rem; transition: color 0.15s, border-color 0.15s;
}
.pill:hover { border-color: var(--accent); color: var(--accent); }
.pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── hero ─────────────────────────────────────── */
.hero { margin: 40px 0 8px; text-align: center; }
.hero .tagline {
  font-size: 1.5rem; line-height: 1.4; color: var(--bright);
  font-weight: 600; margin: 0 0 6px; letter-spacing: 0.01em;
}
.hero .sub { color: var(--muted); font-size: 0.9rem; margin: 0; }

/* ── dropzone ─────────────────────────────────── */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px; margin: 20px auto; text-align: center;
  box-shadow: var(--shadow);
}
.dropzone {
  max-width: 620px; padding: 52px 28px; cursor: pointer;
  border: 1px dashed var(--line); box-shadow: none; background: transparent;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, transparent);
}
.dropzone:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dz-mark { width: 56px; height: 56px; margin: 0 auto 18px; display: block; opacity: 0.85; color: var(--accent); }
.dz-title { color: var(--bright); font-weight: 600; font-size: 1.02rem; margin: 0 0 6px; }
.dz-hint { color: var(--muted); font-size: 0.85rem; margin: 0; }

/* ── error / quota status lines ───────────────── */
.errbox {
  background: var(--err-bg); color: var(--err-ink);
  border: 1px solid var(--err-ink); border-radius: var(--radius);
  padding: 12px 18px; margin: 14px auto; max-width: 620px;
  font-size: 0.92rem; word-break: break-word; text-align: left;
}
.quota { max-width: 620px; margin: 12px auto; text-align: center; color: var(--accent); font-size: 0.9rem; }
.quota.out { color: var(--accent2); }

/* ── work area ────────────────────────────────── */
.work { max-width: 720px; padding: 32px 28px; }
.pair { display: flex; align-items: center; justify-content: center; gap: 20px; flex-wrap: nowrap; }
.slot { margin: 0; flex: 0 1 auto; min-width: 0; }
.slotbox {
  display: flex; align-items: center; justify-content: center;
  min-width: 0; min-height: 160px;
}
.slotbox img {
  max-width: min(240px, 38vw); width: 100%; height: auto; display: block;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel2);
}
.slotbox .ph { width: 96px; height: 96px; color: var(--muted); opacity: 0.55; }
/* the avatar stage: square host for mountAvatar's CSS-3D scene */
.stage {
  width: min(300px, 62vw); aspect-ratio: 1 / 1; position: relative;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel2);
  overflow: hidden;
}
.stage > .ph { position: absolute; inset: 0; margin: auto; }
/* once the live scene is mounted, the placeholder must not show (JS also removes it physically) */
.stage:has([data-avatar-scene]) > .ph { display: none !important; }
.slot figcaption { color: var(--muted); font-size: 0.8rem; margin-top: 10px; }
.arrow { color: var(--muted); font-size: 1.2rem; }
.meta { color: var(--muted); font-size: 0.82rem; margin: 14px 0 0; font-variant-numeric: tabular-nums; }
.hint { color: var(--muted); font-size: 0.9rem; margin: 8px 0 0; }

/* ── loading ──────────────────────────────────── */
.loading { margin-top: 18px; }
.loadline { margin: 0; color: var(--bright); font-size: 1.05rem; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 10px; }
.spin { display: inline-block; width: 15px; height: 15px; flex: none; }
.spin::after {
  content: ""; display: block; width: 100%; height: 100%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hintmsg { color: var(--muted); font-size: 0.85rem; margin: 4px 0 0; min-height: 1.4em; }

/* ── avatar controls (mood / colors / depth) ──── */
.controls { margin-top: 20px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.moodrow { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.pill.mood.active { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.ctrlrow { display: flex; gap: 18px; justify-content: center; align-items: center; flex-wrap: wrap; width: 100%; }
.ctrl { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.85rem; }
.ctrl.grow { flex: 1 1 12em; max-width: 18em; justify-content: flex-start; }
.ctrl input[type="color"] {
  inline-size: 2.4em; block-size: 1.7em; padding: 0; cursor: pointer;
  border: 1px solid var(--line); border-radius: 6px; background: transparent;
}
.ctrl input[type="range"] { flex: 1 1 auto; min-width: 6em; accent-color: var(--accent); cursor: pointer; }
.ctrl output { color: var(--bright); font-variant-numeric: tabular-nums; font-size: 0.85rem; min-width: 1.6em; text-align: right; }

/* ── buttons ──────────────────────────────────── */
/* restore UA [hidden] semantics — author styles like .btn set display and would override [hidden]{display:none} */
[hidden] { display: none !important; }
.btnrow { display: flex; gap: 10px; justify-content: center; margin-top: 24px; flex-wrap: wrap; align-items: center; }
.btnrow .btn { flex: 1 1 8em; max-width: 12em; min-width: 0; text-align: center; padding-left: 10px; padding-right: 10px; }
.btn {
  display: inline-block; border-radius: 8px; padding: 9px 22px;
  font: inherit; font-size: 0.93rem; cursor: pointer; text-decoration: none;
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { color: var(--accent-ink); filter: brightness(1.06); }
.btn:disabled { opacity: 0.45; pointer-events: none; }

/* ── footer ───────────────────────────────────── */
footer {
  border-top: 1px solid var(--line); margin: 72px auto 0; padding: 30px 24px 40px;
  max-width: 860px; color: var(--muted); font-size: 0.85rem;
}
footer .foot-seo { margin: 0; line-height: 1.8; }
footer .copy { margin: 0; font-size: 0.78rem; }

/* ── responsive ───────────────────────────────── */
@media (max-width: 560px) {
  /* topbar/mood pill touch targets ≥44px (iOS HIG), mobile only */
  .pill { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 4px 16px; }
  body { font-size: 14.5px; }
  .hero .tagline { font-size: 1.25rem; }
  .work { padding: 22px 16px; }
  .dropzone { padding: 40px 18px; }
  .ctrlrow { gap: 10px; }
}

/* ── reduced motion ───────────────────────────── */
/* spinner switches to a non-vestibular opacity pulse; the ring color stays and still signals loading;
   the avatar renderer itself honors prefers-reduced-motion internally (dist/dom/reduced.js) */
@media (prefers-reduced-motion: reduce) {
  .spin::after { animation: spin-fade 1.4s ease-in-out infinite; }
}
@keyframes spin-fade { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
