:root {
  --cream: #F3EDE2;
  --cream-deep: #E9E1D2;
  --tile: #FBF8F2;
  --ink: #1F2328;
  --ink-soft: #5B5F66;
  --line: #D9CFBE;
  --tan: #8E6239;
  --tan-deep: #74502E;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--cream);
  color: var(--ink);
  font: 15px/1.5 "IBM Plex Sans", system-ui, sans-serif;
  padding-bottom: calc(150px + env(safe-area-inset-bottom));
  max-width: 720px;
  margin: 0 auto;
}
button { font: inherit; color: inherit; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(18px + env(safe-area-inset-top)) 16px 10px;
}
.brand h1 {
  font: 600 34px/1 "Cormorant Garamond", Georgia, serif;
  letter-spacing: .02em; margin: 0;
}
.brand p { margin: 2px 0 0; color: var(--ink-soft); font-size: 13px; }
.season { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.season button {
  border: 0; background: transparent; padding: 7px 13px; font-size: 13px; font-weight: 500; cursor: pointer;
}
.season button.on { background: var(--ink); color: var(--cream); }

.filters {
  display: flex; gap: 6px; overflow-x: auto; padding: 6px 16px 10px;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.filters button, .chips button {
  flex: none; border: 1px solid var(--line); background: var(--tile);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.filters button.on, .chips button.on { background: var(--ink); border-color: var(--ink); color: var(--cream); }
.filters button .n { color: var(--ink-soft); margin-left: 4px; }
.filters button.on .n { color: var(--cream-deep); }

.hint { margin: 0 16px 10px; color: var(--ink-soft); font-size: 13px; min-height: 1em; }

.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px; padding: 0 16px;
}
.tile {
  position: relative; aspect-ratio: 4 / 5; background: var(--tile);
  border: 1px solid transparent; border-radius: 10px; padding: 10px;
  display: flex; flex-direction: column; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.tile img { flex: 1; min-height: 0; width: 100%; object-fit: contain; filter: drop-shadow(0 6px 8px rgba(70,50,30,.16)); }
.tile .label {
  font-size: 12px; color: var(--ink-soft); text-align: center; margin-top: 6px;
  border: 0; background: none; padding: 2px 4px; cursor: pointer; border-radius: 6px;
}
.tile .label:hover { background: var(--cream-deep); }
.tile.sel { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.tile.sel::after {
  content: "✓"; position: absolute; top: 8px; right: 8px; width: 22px; height: 22px;
  border-radius: 50%; background: var(--ink); color: var(--cream);
  display: grid; place-items: center; font-size: 12px;
}
.tile .del {
  position: absolute; top: 6px; left: 6px; width: 26px; height: 26px; border-radius: 50%;
  border: 0; background: rgba(31,35,40,.08); color: var(--ink-soft); cursor: pointer; font-size: 14px; line-height: 1;
  opacity: 0; transition: opacity .15s;
}
.tile .rot {
  position: absolute; bottom: 30px; right: 6px; width: 26px; height: 26px; border-radius: 50%;
  border: 0; background: rgba(31,35,40,.08); color: var(--ink-soft); cursor: pointer; font-size: 14px; line-height: 1;
  opacity: 0; transition: opacity .15s;
}
.tile:hover .del, .tile.sel .del, .tile:hover .rot, .tile.sel .rot { opacity: 1; }
@media (hover: none) { .tile .rot, .tile .del { opacity: .8; } }
.rotate { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.rotate .side { flex: 1; margin: 0; font-size: 13px; color: var(--tan-deep); font-weight: 500; }
.rotate .btn { min-height: 38px; width: 46px; font-size: 18px; }
.rotate .btn:first-of-type { margin-left: auto; }

.empty { margin: 30px 16px; padding: 28px 22px; border: 1px dashed var(--line); border-radius: 12px; text-align: center; }
.empty h2 { font: 600 26px/1.1 "Cormorant Garamond", Georgia, serif; margin: 0 0 8px; }
.empty p { margin: 0 auto; color: var(--ink-soft); max-width: 34em; }

.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  background: linear-gradient(to top, var(--cream) 75%, rgba(243,237,226,0));
  padding: 18px 16px calc(14px + env(safe-area-inset-bottom));
  max-width: 720px; margin: 0 auto;
}
.dock-main { display: flex; gap: 8px; }
.dock-main > * { flex: 1; }
.dock-look {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
  background: var(--ink); color: var(--cream); border-radius: 12px; padding: 8px 8px 8px 14px;
}
.dock-look[hidden] { display: none; }
.dock-look.warn { background: #7A2E22; }
.dock-look span { flex: 1; font-size: 13px; }
.dock-look .ghost { background: transparent; border: 0; color: var(--cream-deep); padding: 8px; cursor: pointer; }
.dock-look .primary { background: var(--tan); color: #fff; border: 0; border-radius: 8px; padding: 9px 14px; font-weight: 600; cursor: pointer; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  min-height: 46px; padding: 0 12px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--tile); font-weight: 500; font-size: 14px;
}
.btn.primary { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.btn:disabled { opacity: .4; cursor: default; }

.sheet {
  position: fixed; inset: 0; z-index: 10; background: rgba(31,35,40,.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet[hidden] { display: none; }
/* While a sheet is open the page behind it is pinned, so the phone keyboard can't scroll it away. */
body.sheet-open { position: fixed; left: 0; right: 0; overflow: hidden; }
.sheet-card {
  background: var(--cream); width: 100%; max-width: 720px; max-height: 94vh; max-height: 94%; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  border-radius: 18px 18px 0 0; padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
}
.sheet-head { display: flex; align-items: baseline; justify-content: space-between; }
.sheet-head h2 { font: 600 26px/1 "Cormorant Garamond", Georgia, serif; margin: 0 0 12px; }
.sheet-head span { font-size: 13px; color: var(--ink-soft); }
.sheet h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); margin: 16px 0 8px; font-weight: 600; }
.preview {
  height: 34vh; min-height: 220px; background: var(--tile); border-radius: 12px;
  display: grid; place-items: center; padding: 14px;
}
.preview { overflow: hidden; }
.preview img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 10px 14px rgba(70,50,30,.2)); }
.working { text-align: center; color: var(--ink-soft); font-size: 13px; }
.working[hidden] { display: none; }
.spinner {
  width: 28px; height: 28px; margin: 0 auto 10px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--tan); animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.err { color: #9B2C1F; font-size: 13px; margin: 10px 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sheet-actions { display: flex; gap: 8px; margin-top: 18px; }
.sheet-actions .btn { flex: 1; }

.look-card { padding-top: 14px; }
.look-working {
  aspect-ratio: 4 / 5; max-height: 72vh; max-height: 58dvh; margin: 0 auto; background: #F3EDE2; border-radius: 10px;
  display: grid; place-content: center; text-align: center; color: var(--ink-soft); font-size: 13px;
}
.look-working p { margin: 0; }
.look-card img { width: 100%; max-height: 72vh; max-height: 58dvh; object-fit: contain; display: block; background: #F3EDE2; border-radius: 10px; box-shadow: 0 1px 0 var(--line); }

/* AI read-out on the add sheet */
.ai-read { margin-top: 12px; }
.ai-desc { margin: 0; font: 600 20px/1.2 "Cormorant Garamond", Georgia, serif; }
.ai-meta { margin: 6px 0 0; font-size: 12px; color: var(--ink-soft); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.swatches span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; background: var(--tile); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px 3px 4px; }
.swatches i { width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }

/* wardrobe tiles */
.tile .label .sw { display: inline-flex; gap: 2px; margin-right: 5px; vertical-align: -1px; }
.tile .label .sw i { width: 9px; height: 9px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.tile .desc { font-size: 11px; color: var(--ink-soft); text-align: center; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile { aspect-ratio: auto; min-height: 220px; }
.tile img { height: 150px; flex: none; }

/* the look sheet */
.look-name { font: 600 28px/1.1 "Cormorant Garamond", Georgia, serif; margin: 0 0 10px; }
.look-why { margin: 12px 0 0; font-size: 15px; }
.react { display: flex; gap: 8px; margin-top: 12px; }
.react .btn { flex: 1; min-height: 40px; font-size: 13px; }
.react .btn.on { background: var(--tan); border-color: var(--tan); color: #fff; }
.react-note { margin: 6px 0 0; font-size: 12px; color: var(--ink-soft); min-height: 1em; }
.look-gap { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--cream-deep); font-size: 13px; }

.look-card { max-height: 96dvh; }
.look-card .look-name { font-size: 24px; margin-bottom: 8px; }
.look-card .look-why { font-size: 14px; }

.look-gap p { margin: 0; }
.look-gap .btn { margin-top: 10px; width: 100%; min-height: 44px; font-size: 14px; }
.look-gap .shop-line { margin-top: 6px; font-size: 13px; }
.look-gap a { color: var(--tan-deep); font-weight: 600; }

.look-card .sheet-actions { position: sticky; bottom: calc(-16px - env(safe-area-inset-bottom)); background: var(--cream); padding: 10px 0 calc(6px + env(safe-area-inset-bottom)); margin-bottom: calc(-16px - env(safe-area-inset-bottom)); }

.sheet-card { position: relative; }
.sheet-x {
  position: sticky; top: 0; float: right; z-index: 3; margin: -6px -4px 0 8px;
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--tile); color: var(--ink); font-size: 16px; line-height: 1; cursor: pointer;
}

.photo-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.photo-row .btn { min-height: 38px; font-size: 13px; background: var(--ink); color: var(--cream); border-color: var(--ink); }
.photo-row .chips button { padding: 5px 10px; font-size: 12px; }
.photo-note { margin: 6px 0 0; font-size: 12px; color: var(--ink-soft); }

/* tabs */
.tabs { display: flex; gap: 4px; margin: 0 16px 6px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: none; padding: 10px 14px; font-weight: 600; font-size: 14px; color: var(--ink-soft); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ink); }

/* the lookbook */
.book-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px 0; flex-wrap: wrap; }
.book-head h2 { flex: 1; margin: 0; font: 600 26px/1.1 "Cormorant Garamond", Georgia, serif; min-width: 0; }
.book-head .btn { min-height: 38px; font-size: 13px; }
.back-link { border: 0; background: none; padding: 0; color: var(--tan-deep); font-weight: 600; cursor: pointer; width: 100%; text-align: left; }
.book { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; padding: 4px 16px 24px; }
.look-tile { background: var(--tile); border-radius: 12px; overflow: hidden; cursor: pointer; border: 0; padding: 0; text-align: left; font: inherit; color: inherit; }
.look-tile .pic { position: relative; aspect-ratio: 1; background: #F3EDE2; }
.look-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.look-tile .pic.flat img { object-fit: contain; }
.look-tile .badge { position: absolute; left: 8px; bottom: 8px; font-size: 11px; background: rgba(31,35,40,.7); color: #fff; border-radius: 999px; padding: 3px 8px; }
.look-tile .name { padding: 8px 10px 10px; font: 600 17px/1.15 "Cormorant Garamond", Georgia, serif; }
.look-tile.gap-tile { display: flex; flex-direction: column; justify-content: center; padding: 16px; background: var(--cream-deep); }
.look-tile.gap-tile b { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--tan-deep); }
.look-tile.gap-tile p { margin: 6px 0 0; font: 600 18px/1.2 "Cormorant Garamond", Georgia, serif; }
.book-wait { grid-column: 1 / -1; text-align: center; padding: 40px 0; color: var(--ink-soft); font-size: 13px; }

/* piece sheet */
.piece-card .preview { height: 30vh; }
.plain-wide { width: 100%; margin-top: 8px; background: transparent; }

.worn { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--cream-deep); }
.worn p { flex: 1; margin: 0; font-size: 13px; }
.worn.flagged { background: #F1DCC4; }
.worn .btn { min-height: 38px; font-size: 13px; background: var(--ink); color: var(--cream); border-color: var(--ink); white-space: nowrap; }
.preview img { width: auto; height: auto; max-width: 100%; max-height: calc(34vh - 28px); min-height: 0; }
.piece-card .preview img { max-height: calc(30vh - 28px); }

.plain-wide.danger { color: #9B2C1F; border-color: #E2C2BB; }
.plain-wide.danger.armed { background: #9B2C1F; color: #fff; border-color: #9B2C1F; }
.photo-row .btn.redo { background: var(--tile); color: var(--ink); border-color: var(--line); }
/* cards: picture pinned to the top and filling the rounded corners, whatever the name's length */
.look-tile { display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; }
.look-tile .pic { flex: none; width: 100%; }
.look-tile .name { flex: 1; }

.book-head .start-over { width: auto; font-weight: 500; color: var(--ink-soft); font-size: 13px; }
.look-tile .stretch { position: absolute; right: 8px; top: 8px; font-size: 11px; font-weight: 600; background: var(--tan); color: #fff; border-radius: 999px; padding: 3px 9px; }

/* invite gate */
.gate { margin: 40px 16px; padding: 28px 22px; background: var(--tile); border-radius: 14px; }
.gate h2 { font: 600 28px/1.1 "Cormorant Garamond", Georgia, serif; margin: 0 0 12px; }
.gate p { color: var(--ink-soft); }
body.gated .tabs, body.gated main, body.gated .dock, body.gated .season, body.gated .foot { display: none !important; }
.foot { text-align: center; font-size: 12px; margin: 30px 0 0; }
.foot a { color: var(--ink-soft); }

.capsule-line { margin: 6px 16px 4px; padding: 12px 14px; background: var(--tile); border-radius: 12px; font-size: 14px; line-height: 1.5; }
.capsule-line b { font-weight: 600; }

/* first-run welcome */
.welcome { margin: 10px 16px 24px; padding: 24px 20px; background: var(--tile); border-radius: 16px; }
.welcome h2 { font: 600 32px/1.1 "Cormorant Garamond", Georgia, serif; margin: 0 0 10px; }
.welcome p { margin: 0 0 12px; color: #3B3F45; }
.welcome ol { margin: 0 0 18px; padding-left: 20px; }
.welcome li { margin-bottom: 10px; color: #3B3F45; }
.welcome .btn { width: 100%; }
.welcome-small { font-size: 13px; margin-top: 12px !important; text-align: center; }
.welcome-small a { color: var(--ink-soft); }

.sizes { margin: 0 16px 12px; padding: 10px 14px; border: 1px solid var(--line, #d9d2c3); border-radius: 12px; background: var(--card, #fff); }
.sizes summary { cursor: pointer; font-weight: 600; }
.sizes summary span { font-weight: 400; color: var(--ink-soft); font-size: 13px; margin-left: 4px; }
.size-row { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 10px; }
.size-row label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-soft); }
.size-row select { font: inherit; font-size: 15px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line, #d9d2c3); background: #fff; color: var(--ink); min-width: 96px; }
.sizes .hint { margin: 8px 0 0; }

/* pack for a trip */
.field { font: inherit; font-size: 16px; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); width: 100%; }
.field-row { display: flex; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.field-row label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-soft); }
.field-row .field { width: 72px; }
.field-row label:last-child .field { width: auto; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 14px; }
.sheet h3 .opt { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 6px; }
.must-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 6px; }
.must-grid button { aspect-ratio: 1; border: 2px solid transparent; border-radius: 10px; background: var(--tile); padding: 4px; cursor: pointer; }
.must-grid button img { width: 100%; height: 100%; object-fit: contain; }
.must-grid button.on { border-color: var(--ink); }
.trips-line { margin: 0 16px 8px; font-size: 13px; color: var(--ink-soft); }
.trips-line a { color: var(--tan-deep); font-weight: 600; text-decoration: none; }
.pack-card { margin: 4px 16px 14px; padding: 14px; border-radius: 14px; background: var(--tile); }
.pack-card h3 { margin: 0 0 2px; font: 600 20px/1.15 "Cormorant Garamond", Georgia, serif; }
.pack-card .wx { margin: 0 0 10px; font-size: 13px; color: var(--ink-soft); }
.pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.pack-grid .pi { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10px; color: var(--ink-soft); text-align: center; line-height: 1.2; }
.pack-grid .pi img { width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--cream); border-radius: 8px; }
.pack-card .advice { margin: 10px 0 0; font-size: 14px; }
.pack-card .pack-actions { display: flex; gap: 8px; margin-top: 12px; }
.pack-card .pack-actions .btn { flex: 1; min-height: 38px; font-size: 13px; }
.pack-card .pack-actions .btn.danger { color: #9B2C1F; }
.pack-card .pack-actions .btn.danger.armed { background: #9B2C1F; color: #fff; border-color: #9B2C1F; }
.look-tile .name .occasion { font: 400 12px/1.3 "IBM Plex Sans", system-ui, sans-serif; color: var(--ink-soft); margin-top: 2px; }
.look-tile .del { position: absolute; top: 8px; right: 8px; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px; background: rgba(243,237,226,.9); color: var(--ink); font-size: 13px; line-height: 28px; text-align: center; cursor: pointer; }
.look-tile .del.armed { background: #9B2C1F; color: #fff; }
.photo-hint { margin: 8px 0 0; font-size: 12px; color: var(--ink-soft); line-height: 1.4; }
