:root {
  --bg: #0f1115; --panel: #171a21; --line: #262b36; --text: #e8eaf0; --muted: #8b93a5;
  --accent: #3ddc84; --accent-2: #2ba866;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; letter-spacing: .2px; }
.brand span { color: var(--muted); font-weight: 400; }
.stats { display: flex; gap: 16px; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; padding: 16px; max-width: 1280px; margin: 0 auto; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

.stage { display: flex; flex-direction: column; gap: 10px; }
.viewport { position: relative; background: #000; border-radius: 14px; overflow: hidden; aspect-ratio: 4 / 3; border: 1px solid var(--line); }
.viewport video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; }
.viewport canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.hint { position: absolute; inset: auto 12px 12px 12px; background: rgba(0,0,0,.6); padding: 10px 12px; border-radius: 10px; font-size: 13px; color: #ddd; }
.hint.hidden { display: none; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
button, .file { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px; cursor: pointer; font: inherit; }
button:hover, .file:hover { border-color: #3a4150; }
button.primary { background: var(--accent); color: #062; border-color: var(--accent); font-weight: 600; }
button.primary:hover { background: var(--accent-2); }
.file input { display: none; }
.check { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); padding: 0 6px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.panel h2 { margin: 0; font-size: 18px; }
.muted { color: var(--muted); margin: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.grid button { padding: 6px; aspect-ratio: 1; display: grid; place-items: center; background: #fff; border-radius: 10px; border: 2px solid transparent; }
.grid button img { max-width: 100%; max-height: 100%; object-fit: contain; }
.grid button.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(61,220,132,.25); }
.buy { display: block; text-align: center; background: #fff; color: #111; text-decoration: none; padding: 10px; border-radius: 10px; font-weight: 600; }
.tune summary { cursor: pointer; color: var(--muted); }
.tune label { display: grid; grid-template-columns: 90px 1fr 44px; align-items: center; gap: 8px; font-size: 13px; margin-top: 8px; }
.tune input[type=range] { width: 100%; accent-color: var(--accent); }
.tune span { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

/* --- try-on v2 additions --- */
.viewport #aiVideo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 1; background: #000; }
.viewport #aiVideo.hidden { display: none; }
.sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
button.ai { border-color: #4b3fa3; background: #1d1a33; }
button.ai:hover { border-color: #7a6cf0; }
button:disabled { opacity: .5; cursor: progress; }
.note { font-size: 13px; color: #d7d9e0; background: rgba(75,63,163,.18); border: 1px solid #4b3fa3; border-radius: 10px; padding: 8px 12px; }
.note.hidden { display: none; }
