/* Zazzoyance — Apple-website look: system type, white/grey planes, one blue accent, square corners. */
:root {
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-ink: #ffffff;
  --link: #0066cc;
  --good: #34c759;
  --danger: #e30000;
  --nav-bg: rgba(251, 251, 253, .8);
  --scrim: rgba(0, 0, 0, .4);
  --tabbar-h: 60px;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Inter", Helvetica, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-alt: #161617;
    --surface: #1d1d1f;
    --surface-2: #2c2c2e;
    --ink: #f5f5f7;
    --muted: #a1a1a6;
    --line: #424245;
    --accent: #0071e3;
    --accent-hover: #0077ed;
    --link: #2997ff;
    --danger: #ff453a;
    --nav-bg: rgba(22, 22, 23, .8);
    --scrim: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; border-radius: 0; }
html, body { margin: 0; }
body {
  background: var(--bg-alt);
  color: var(--ink);
  font: 17px/1.47 var(--sans);
  letter-spacing: -.022em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
[hidden] { display: none !important; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  height: calc(48px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.brand { font-size: 21px; font-weight: 600; letter-spacing: -.02em; }
.ai-pill {
  border: 0; background: none; padding: 6px 0; font-size: 12px; color: var(--muted);
  cursor: pointer; display: flex; align-items: center; gap: 6px; letter-spacing: -.01em;
}
.ai-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.ai-pill.on::before { background: var(--good); }

main { max-width: 680px; margin: 0 auto; padding: 0 16px calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom)); }
.view { display: flex; flex-direction: column; gap: 16px; padding-top: 20px; }

.eyebrow { font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: -.016em; margin: 0; }
.headline { font-size: 40px; line-height: 1.1; font-weight: 600; letter-spacing: -.028em; margin: 0; }
.h { font-size: 28px; line-height: 1.14; font-weight: 600; letter-spacing: -.02em; margin: 16px 0 0; }
.small { font-size: 14px; letter-spacing: -.016em; }
.muted { color: var(--muted); }
.center { text-align: center; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.card { background: var(--surface); padding: 22px 20px; }

.btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 11px 20px; font-size: 17px; font-weight: 400; cursor: pointer; min-height: 44px;
  transition: background-color .2s, border-color .2s, color .2s;
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--link); }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.link { background: none; border: 0; color: var(--link); cursor: pointer; padding: 8px 0; font-size: 17px; }
.link::after { content: " ›"; }
.icon-btn { background: none; border: 0; width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer; color: var(--muted); flex: none; }
.icon-btn.send { background: var(--accent); color: var(--accent-ink); }

.seg { display: inline-flex; border: 1px solid var(--line); background: var(--surface); }
.seg button { border: 0; background: none; padding: 8px 18px; cursor: pointer; font-size: 15px; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--ink); color: var(--bg); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--line); background: var(--surface); padding: 8px 14px;
  cursor: pointer; white-space: nowrap; font-size: 15px; letter-spacing: -.016em;
}
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* Weather */
.weather { display: grid; grid-template-columns: auto 1fr; gap: 2px 18px; align-items: center; }
.weather .temp { font-size: 64px; line-height: 1; font-weight: 600; letter-spacing: -.04em; grid-row: span 2; }
.weather .place { font-size: 21px; font-weight: 600; letter-spacing: -.02em; }
.weather .facts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 12px; font-size: 14px; color: var(--muted); }
.weather .advice { grid-column: 1 / -1; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 17px; }

/* Suggestions */
.outfit { display: flex; flex-direction: column; gap: 12px; }
.outfit h3 { font-size: 24px; line-height: 1.17; font-weight: 600; letter-spacing: -.02em; margin: 0; }
.outfit-pieces { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 2px; }
.piece { display: flex; flex-direction: column; gap: 6px; cursor: pointer; background: none; border: 0; padding: 0 0 6px; text-align: left; }
.piece img { width: 100%; aspect-ratio: 3/4; object-fit: cover; background: var(--surface-2); display: block; }
.piece span { font-size: 12px; line-height: 1.33; color: var(--muted); letter-spacing: -.01em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.why { font-size: 17px; }
.tip { font-size: 14px; color: var(--muted); border-left: 2px solid var(--ink); padding-left: 12px; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); background: var(--surface); }
.empty strong { display: block; color: var(--ink); font-size: 28px; font-weight: 600; letter-spacing: -.02em; margin-bottom: 8px; }

/* Closet grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 2px; margin: 0 -16px; }
.grid > .empty { margin: 0 16px; }
.tile { position: relative; border: 0; padding: 0; background: var(--surface); overflow: hidden; cursor: pointer; aspect-ratio: 3/4; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .label {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 8px 7px;
  font-size: 12px; line-height: 1.25; color: #fff; text-align: left; letter-spacing: -.01em;
  background: linear-gradient(transparent, rgba(0,0,0,.6));
}
.tile .fav { position: absolute; top: 6px; right: 8px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.fab {
  position: fixed; right: max(16px, calc(50% - 324px)); bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border: 0; background: var(--accent); color: #fff;
  font-size: 30px; font-weight: 300; line-height: 1; cursor: pointer; z-index: 4;
}

/* Tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; justify-content: space-around;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.tabbar button {
  flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 10px; letter-spacing: 0; color: var(--muted); cursor: pointer;
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: square; stroke-linejoin: miter; }
.tabbar button.on { color: var(--accent); }

/* Sheets */
dialog.sheet {
  border: 0; padding: 24px 20px calc(16px + env(safe-area-inset-bottom)); margin: auto auto 0; width: 100%; max-width: 680px;
  max-height: 90dvh; overflow-y: auto; background: var(--bg-alt); color: var(--ink);
}
dialog.sheet.tall { height: 90dvh; }
dialog.sheet::backdrop { background: var(--scrim); backdrop-filter: blur(4px); }
dialog.sheet h3 { font-size: 28px; font-weight: 600; letter-spacing: -.02em; line-height: 1.14; margin: 0 0 16px; }
.add-option { display: flex; flex-direction: column; gap: 14px; background: var(--surface); padding: 20px; margin-bottom: 2px; }
.add-option strong { font-size: 21px; font-weight: 600; letter-spacing: -.02em; }
.add-option p { margin: 4px 0 0; }
.add-option + .btn { margin-top: 12px; }
.sticky-actions { position: sticky; bottom: calc(-16px - env(safe-area-inset-bottom)); background: var(--bg-alt); padding: 14px 0 6px; justify-content: flex-end; border-top: 1px solid var(--line); margin-top: 16px; }

.form { display: flex; flex-direction: column; gap: 16px; }
.form label, .field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); letter-spacing: -.016em; }
input:not([type=checkbox]):not([type=range]), select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); padding: 12px 14px; font-size: 17px; color: var(--ink);
  appearance: none; -webkit-appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
textarea { resize: vertical; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.check { flex-direction: row !important; align-items: center; gap: 10px !important; color: var(--ink) !important; font-size: 17px !important; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.review-item { display: grid; grid-template-columns: 88px 1fr; gap: 14px; padding: 14px; background: var(--surface); margin-bottom: 2px; }
.review-item img { width: 88px; height: 118px; object-fit: cover; background: var(--surface-2); }
.review-item .fields { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.review-item.off { opacity: .4; }
.review-look { font-size: 14px; color: var(--muted); margin: 6px 0 10px; }

.editor-photo { width: 100%; max-height: 44dvh; object-fit: contain; background: var(--surface); display: block; }
.range-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.stat { font-size: 14px; color: var(--muted); }

/* Chat */
.chat-view { min-height: calc(100dvh - 48px - var(--tabbar-h) - 32px - env(safe-area-inset-bottom)); }
.chat-log { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.msg { max-width: 86%; padding: 10px 14px; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; }
.msg.assistant { align-self: flex-start; background: var(--surface); }
.msg img.attached { max-width: 180px; display: block; margin-bottom: 8px; }
.msg.typing { color: var(--muted); }
.inline-piece {
  display: inline-flex; vertical-align: middle; cursor: pointer; background: none;
  border: 1px solid var(--line); padding: 0; margin: 0 2px;
}
.inline-piece img { width: 28px; height: 28px; object-fit: cover; display: block; }
.msg-pieces { display: flex; gap: 2px; margin-top: 10px; overflow-x: auto; }
.msg-pieces img { width: 64px; height: 86px; object-fit: cover; flex: none; cursor: pointer; }
.composer {
  position: sticky; bottom: calc(var(--tabbar-h) + 10px + env(safe-area-inset-bottom));
  display: flex; align-items: flex-end; gap: 4px; background: var(--surface); border: 1px solid var(--line); padding: 4px;
}
.composer:focus-within { border-color: var(--accent); }
.composer-main { flex: 1; min-width: 0; }
.composer textarea { border: 0 !important; outline: none !important; background: transparent; padding: 10px 4px; max-height: 140px; resize: none; }
#attachPreview { position: relative; padding: 6px 4px 0; }
#attachPreview img { height: 64px; display: block; }
#attachPreview button { position: absolute; top: 0; left: 52px; width: 24px; height: 24px; border: 0; background: var(--ink); color: var(--bg); cursor: pointer; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 88px + env(safe-area-inset-bottom));
  background: var(--ink); color: var(--bg); padding: 12px 18px; z-index: 50; font-size: 15px;
  max-width: calc(100% - 32px);
}
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
.place-result { display: block; width: 100%; text-align: left; margin-top: -1px; }
.footnote { font-size: 12px; color: var(--muted); text-align: center; letter-spacing: -.01em; }
