:root {
  --bg: #0b0d10;
  --panel: #14171c;
  --panel-2: #1b1f26;
  --line: #262b33;
  --text: #e8eaed;
  --muted: #8a919c;
  --accent: #7fd7c4;
  --accent-ink: #06211b;
  --error: #ff7a5c;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "SF Pro Text", "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100dvh;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--error); }

button {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 18px;
  cursor: pointer;
  min-height: 44px;
}
button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
button.primary:disabled { opacity: 0.4; cursor: default; }
button.ghost { background: transparent; }
button.big { padding: 14px 28px; font-size: 18px; }

input, select {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  width: 100%;
  min-height: 44px;
}

/* Gate */
.gate {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  padding: 24px;
}
.gate-card { width: 100%; max-width: 360px; text-align: center; }
.gate-card h1 { font-weight: 300; letter-spacing: 0.12em; font-size: 28px; margin-bottom: 8px; }
.gate-card form { display: flex; gap: 8px; margin-top: 20px; }

/* Layout */
.app { max-width: 900px; margin: 0 auto; padding: 0 16px 80px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 0 14px;
  flex-wrap: wrap;
}
.brand { font-weight: 300; letter-spacing: 0.12em; font-size: 20px; }
.brand .tag { font-size: 11px; color: var(--muted); letter-spacing: 0.05em; vertical-align: super; }
.tabs { display: flex; gap: 6px; }
.tab { background: transparent; border-color: transparent; color: var(--muted); }
.tab.active { background: var(--panel-2); border-color: var(--line); color: var(--text); }
.count { color: var(--accent); font-size: 13px; }

.view { padding-top: 8px; }

/* Capture */
.capture-stage {
  position: relative;
  background: #000;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  /* Always a vertical mirror — full-body use case; JS matches the aspect to the feed */
  aspect-ratio: 3 / 4;
  max-height: 70vh;
  width: min(100%, calc(70vh * 0.75));
  margin-inline: auto;
}
.capture-stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
.capture-stage video.mirrored { transform: scaleX(-1); }
.cam-flip {
  position: absolute; right: 12px; bottom: 12px; z-index: 2;
  width: 46px; height: 46px; min-height: 46px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(20, 23, 28, 0.7);
  backdrop-filter: blur(6px);
}
.cam-fit { bottom: 66px; }
.capture-stage video.contain { object-fit: contain; }
.zoom-slider {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  width: 55%; z-index: 2;
  min-height: 0; padding: 0; border: 0; background: none;
  accent-color: var(--accent);
}
.user-chip { font-size: 12.5px; color: var(--muted); max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.fit-body { display: flex; flex-direction: column; gap: 10px; }
.fit-verdict {
  display: inline-block; align-self: flex-start;
  padding: 6px 14px; border-radius: 999px;
  font-size: 14px; font-weight: 600; letter-spacing: 0.04em;
}
.fit-verdict.good { background: var(--accent); color: var(--accent-ink); }
.fit-verdict.warn { background: #f0b25c; color: #2a1c04; }
.fit-verdict.bad { background: var(--error); color: #2a0d05; }
.fit-verdict.neutral { background: var(--panel-2); border: 1px solid var(--line); }
.fit-pairing { border-top: 1px solid var(--line); padding-top: 10px; }

.gesture-overlay {
  position: absolute; inset: 0; z-index: 3;
  display: flex; align-items: center; justify-content: center;
  font-size: 96px; font-weight: 200; color: var(--accent);
  background: rgba(0, 0, 0, 0.35);
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}
.gesture-overlay.small { font-size: 28px; font-weight: 400; }
.gesture-hint {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%);
  z-index: 2; font-size: 14px; color: var(--text);
  background: rgba(20, 23, 28, 0.7); backdrop-filter: blur(6px);
  padding: 6px 14px; border-radius: 999px; white-space: nowrap;
  pointer-events: none;
}
.cam-off {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; gap: 12px;
  align-items: center; justify-content: center;
  color: var(--muted);
}
.capture-actions { display: flex; align-items: center; gap: 18px; margin-top: 16px; flex-wrap: wrap; }
.upload-alt { color: var(--muted); font-size: 14px; }
.upload-alt input[type="file"] { width: auto; min-height: 0; border: 0; background: none; padding: 0; font-size: 13px; }

.review { margin-top: 28px; border-top: 1px solid var(--line); padding-top: 20px; }
.review h2 { font-weight: 400; margin-bottom: 4px; }
.review-grid { display: grid; grid-template-columns: 240px 1fr; gap: 20px; margin-top: 16px; }
.review-item { padding-bottom: 18px; border-bottom: 1px dashed var(--line); }
.vis-warn { color: #f0b25c; font-size: 14px; }
.review-item:last-of-type { border-bottom: 0; }
.review-grid img { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); }
.tag-form { display: flex; flex-direction: column; gap: 12px; }
.tag-form label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.tag-form input[type="range"] { padding: 0; min-height: 32px; accent-color: var(--accent); }
.range-val { color: var(--accent); }
.review-buttons { display: flex; gap: 10px; margin-top: 6px; }

/* Closet */
.closet-tools { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.match-result { margin-top: 0; border-top: 0; padding-top: 4px; margin-bottom: 20px; }
.g-card.selectable { cursor: pointer; }
.g-card.selected { outline: 3px solid var(--accent); outline-offset: -3px; }
.closet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.g-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.g-card img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; background: #000; }
.g-card .g-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.g-card .g-title { font-size: 15px; text-transform: capitalize; }
.g-card .g-meta { font-size: 12.5px; color: var(--muted); }
.g-card .g-actions { display: flex; gap: 8px; margin-top: 8px; }
.g-card .g-actions button { flex: 1; min-height: 36px; padding: 6px 8px; font-size: 13px; }
.empty { text-align: center; padding: 60px 0; }

/* Stylist */
.chat-log { display: flex; flex-direction: column; gap: 14px; min-height: 40vh; }
.msg { max-width: 85%; padding: 12px 16px; border-radius: var(--radius); }
.msg.user { align-self: flex-end; background: var(--panel-2); border: 1px solid var(--line); }
.msg.assistant { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); }
.msg.thinking { color: var(--muted); font-style: italic; }

.outfit-card { margin-top: 10px; }
.outfit-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.outfit-row img {
  width: 92px; height: 122px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line); background: #000;
}
.outfit-label { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-top: 10px; }
.wore-btn { margin-top: 10px; }

.chat-form { position: sticky; bottom: 0; padding: 14px 0 18px; background: linear-gradient(transparent, var(--bg) 30%); }
.chat-row { display: flex; gap: 8px; }
.weather-toggle { font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.weather-toggle input { width: auto; min-height: 0; accent-color: var(--accent); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line);
  padding: 10px 18px; border-radius: 999px; z-index: 60;
  max-width: 90vw;
}

@media (max-width: 640px) {
  .review-grid { grid-template-columns: 1fr; }
  .review-grid img { max-width: 260px; }
  .topbar { justify-content: center; }
  .capture-actions { flex-direction: column; align-items: stretch; text-align: center; }
  .capture-actions .big { width: 100%; }
  .closet-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .msg { max-width: 95%; }
}
