:root {
  color-scheme: light;
  --page: #f8f7f4;
  --paper: #fffefd;
  --ink: #282238;
  --muted: #666172;
  --purple: #654c99;
  --purple-deep: #553c87;
  --lilac: #eee9f7;
  --line: #e7e1eb;
  --soft: #f9f7fc;
  --error: #8c3237;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--page);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
[hidden], .symbols { display: none !important; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 3px;
}
h1, h2, h3, p { margin: 0; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.shell { width: min(100% - 64px, 1152px); margin-inline: auto; }

.topbar { border-bottom: 1px solid #ebe6e6; background: var(--paper); }
.topbar-inner { min-height: 72px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 1.34rem; font-weight: 750; letter-spacing: .08em; white-space: nowrap; }
.brand-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: white; background: var(--purple); }
.brand-icon .icon { width: 24px; height: 24px; }
nav { display: flex; align-items: center; gap: 8px; }
nav a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 15px; border-radius: 9px; color: var(--muted); font-size: .94rem; font-weight: 600; white-space: nowrap; }
nav a[aria-current="page"], nav a:hover { background: var(--lilac); color: var(--purple-deep); }
nav .icon { width: 17px; height: 17px; }
.account-nav, .account-options { display: flex; min-width: 0; align-items: center; gap: 10px; }
.account-email { overflow: hidden; max-width: 13rem; margin-inline: 7px 2px; color: var(--muted); font-size: .875rem; text-overflow: ellipsis; white-space: nowrap; }
.logout-button { min-height: 39px; white-space: nowrap; }
main { padding-block: 30px 48px; }

.session-status { display: grid; justify-items: center; gap: 12px; padding-block: 16vh; color: var(--muted); }
.auth-view { display: grid; grid-template-columns: 1.06fr 1fr; width: min(100%, 860px); min-height: 452px; margin: clamp(12px, 7vh, 82px) auto 0; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: 0 12px 48px #3324490d; }
.auth-art { background: #ebe4f6 url('/assets/knitwear.jpg') center / cover no-repeat; }
.auth-content { align-self: center; padding: clamp(26px, 4.5vw, 52px); }
.auth-content h1 { margin-bottom: 24px; font-size: clamp(2rem, 4vw, 2.65rem); }
#auth-form { display: grid; gap: 15px; }
#auth-form .button { width: 100%; margin-top: 4px; }
#auth-form .form-error { margin-top: 0; }
.password-hint { margin-top: -8px; color: var(--muted); font-size: .875rem; }
.auth-switch { margin-top: 20px; color: var(--muted); font-size: .94rem; }
.auth-switch .button-link { margin-left: 6px; color: var(--purple-deep); }
.account-error { margin: 0 0 16px; }

.today-hero { padding: 30px 34px 23px; margin-bottom: 24px; border: 1px solid #e2d9ef; border-radius: 20px; background: linear-gradient(115deg, #ede7f7, #f4eff9 80%); }
.today-heading, .outfit-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.today-heading h1 { font-size: clamp(2.25rem, 5vw, 3.15rem); }
.today-heading .button { flex: none; }
.today-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.today-location { margin-top: 8px; color: #534668; line-height: 1.5; }
#today-intro { margin: 12px 0 5px; color: #534668; line-height: 1.6; }
.today-weather { display: grid; grid-template-columns: 1fr 1.2fr 1fr; gap: 10px; margin: 21px 0 9px; }
.today-weather > div { display: grid; grid-template-rows: 1fr auto; min-width: 0; padding: 13px 15px; border: 1px solid #e6ddf1; border-radius: 10px; background: #fffefdcc; }
.today-weather dt { color: #5b506e; font-size: .89rem; }
.today-weather dd { margin: 5px 0 0; color: #392853; font-size: clamp(1.4rem, 3vw, 2.1rem); font-weight: 720; font-variant-numeric: tabular-nums; line-height: 1.2; overflow-wrap: anywhere; }
.weather-source { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px 12px; color: #5a506b; font-size: .82rem; }
.weather-source a { text-decoration: underline; text-underline-offset: 3px; }
.today-state { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; color: var(--muted); }
.outfit-heading { align-items: center; }
.outfit-heading h2 { font-size: 1.4rem; font-weight: 750; }
.outfit-summary, .outfit-feedback { margin-top: 8px; color: #514662; line-height: 1.6; }
.outfit-feedback { padding: 8px 11px; border-radius: 8px; background: var(--lilac); font-size: .92rem; }
.outfit-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 229px), 1fr)); gap: 14px; margin-top: 15px; }
.outfit-items:empty { display: none; }
.outfit-card { display: flex; flex-direction: column; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
.outfit-card > img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: var(--soft); }
.outfit-card-info { display: grid; flex: 1; grid-template-rows: auto auto 1fr auto; align-items: start; gap: 6px; padding: 13px; }
.outfit-slot { color: var(--purple-deep); font-size: .875rem; font-weight: 680; }
.outfit-card-info h3 { font-size: 1rem; overflow-wrap: anywhere; }
.outfit-reason { color: var(--muted); font-size: .875rem; line-height: 1.56; }
.outfit-swap { justify-self: start; margin-top: 4px; padding-inline: 12px; }
.outfit-swap:disabled { border-color: var(--line); color: var(--muted); }
.outfit-missing { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 15px; color: #534668; line-height: 1.5; }
.today-city-dialog { width: min(100% - 28px, 490px); }
.city-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; align-items: end; }
.city-status { margin-top: 13px; color: var(--muted); font-size: .92rem; line-height: 1.5; }
.city-matches { display: grid; gap: 6px; margin-top: 8px; }
.city-match { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--paper); text-align: left; }
.city-match:hover:not(:disabled) { background: var(--lilac); }
.city-region { color: var(--muted); font-size: .875rem; text-align: right; }
.garment-unavailable { display: flex; align-items: center; gap: 8px; width: fit-content; margin-top: 14px; color: var(--muted); font-size: .875rem; }
.garment-unavailable input { width: 17px; height: 17px; margin: 0; accent-color: var(--purple); }
.outfit-conversation { margin-top: 20px; }
.outfit-chat-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.outfit-chat-heading h2 { font-size: 1.24rem; }
.outfit-chat-heading p { margin-top: 5px; color: var(--muted); font-size: .94rem; line-height: 1.55; }
.outfit-chat-heading .button { flex: none; }
.outfit-chat-heading .button:disabled { color: var(--muted); border-color: var(--line); }
.outfit-chat-rules { display: flex; flex-wrap: wrap; gap: 6px; margin: 13px 0 0; padding: 0; list-style: none; }
.outfit-chat-rules li { padding: 5px 9px; border-radius: 6px; background: var(--lilac); color: var(--purple-deep); font-size: .875rem; }
.outfit-chat-messages { display: grid; gap: 9px; max-height: 340px; overflow-y: auto; margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--soft); }
.chat-bubble { max-width: min(100%, 48rem); padding: 8px 12px; border-radius: 8px; color: var(--ink); background: var(--paper); line-height: 1.55; overflow-wrap: anywhere; }
.chat-bubble-user { justify-self: end; background: var(--lilac); }
.chat-bubble-assistant { justify-self: start; }
.chat-speaker { color: var(--purple-deep); font-size: .82rem; font-weight: 700; }
.chat-bubble p + p { white-space: pre-wrap; }
.outfit-chat-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 9px; margin-top: 15px; }
.outfit-chat-form textarea { min-height: 57px; }
.outfit-chat-status { margin-top: 8px; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.today-memory-dialog { width: min(100% - 28px, 545px); }
.today-memory-lists { display: grid; gap: 15px; }
.today-memory-lists h3 { font-size: 1rem; }
.today-memory-list { display: grid; gap: 6px; margin: 7px 0 0; padding: 0; list-style: none; }
.today-memory-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; overflow-wrap: anywhere; }
.today-memory-row .button { flex: none; min-height: 34px; padding: 5px 8px; }
.today-memory-row p, .memory-empty { color: var(--muted); font-size: .875rem; }

.hero { isolation: isolate; overflow: hidden; position: relative; display: flex; align-items: center; min-height: 182px; padding: 32px 42px; margin-bottom: 24px; border-radius: 20px; background: #ebe4f6; }
.hero-copy { position: relative; z-index: 1; }
h1 { color: #332449; font-family: "Songti SC", "Noto Serif CJK SC", "Noto Serif SC", "SimSun", serif; font-size: clamp(2.4rem, 5vw, 3.3rem); line-height: 1.14; letter-spacing: .045em; font-weight: 800; }
.hero p { margin-top: 13px; line-height: 1.65; color: #514564; }
.hero-art { position: absolute; inset: 0 0 0 48%; background: linear-gradient(90deg, #ebe4f6, transparent 40%), url('/assets/knitwear.jpg') center 44% / cover no-repeat; }
.intake-grid { display: grid; grid-template-columns: minmax(0, 4.7fr) minmax(0, 6.3fr); align-items: start; gap: 22px; }
.panel { padding: 25px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); box-shadow: 0 3px 12px #33244905; }
.panel-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 19px; }
.panel-heading h2, .dialog-heading h2 { font-size: 1.19rem; line-height: 1.35; font-weight: 730; }
.panel-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 10px; background: var(--lilac); color: var(--purple-deep); }
.photo-zone { position: relative; display: grid; place-items: center; overflow: hidden; height: 250px; border: 1px dashed #b9aad3; border-radius: 12px; background: var(--soft); text-align: center; }
.photo-zone.has-photo { border-style: solid; border-color: var(--line); }
.photo-zone.dragging { border-color: var(--purple); background: var(--lilac); }
.photo-zone img { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.photo-count { margin-left: auto; color: var(--muted); font-size: .875rem; white-space: nowrap; }
.photo-thumbnails { display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 7px; margin: 12px 0; }
.photo-thumb { display: grid; gap: 4px; align-content: start; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); font: inherit; font-size: .76rem; }
.photo-thumb[aria-pressed="true"] { border: 1px solid var(--purple); box-shadow: 0 0 0 1px var(--purple); }
.photo-thumb img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; background: var(--soft); }
.photo-thumb span { overflow-wrap: anywhere; }
.photo-details { display: grid; gap: 9px; margin-bottom: 12px; }
.photo-details-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 7px; }
.photo-details-heading h3 { font-size: .95rem; }
.photo-detail-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.photo-detail-actions .button { min-height: 32px; padding: 4px 8px; font-size: .8125rem; }
.photo-details textarea { min-height: 60px; }
.photo-empty { padding: 14px; }
.photo-placeholder { display: grid; place-items: center; width: 62px; height: 62px; margin: 0 auto 14px; border-radius: 19px; background: var(--lilac); color: var(--purple-deep); }
.photo-placeholder .icon { width: 29px; height: 29px; }
.photo-empty p { font-weight: 680; }
.photo-empty small { display: block; margin-top: 6px; color: var(--muted); font-size: .875rem; line-height: 1.55; }
.photo-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 15px 0; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 8px 15px; border: 1px solid transparent; border-radius: 8px; font-weight: 650; font-size: .94rem; line-height: 1.4; text-align: center; }
.button .icon { width: 18px; height: 18px; }
.button-primary { background: var(--purple); color: white; }
.button-primary:hover:not(:disabled) { background: var(--purple-deep); }
.button-primary:disabled { opacity: .6; }
.button-outline { color: var(--purple-deep); background: var(--paper); border-color: #d9cfe8; }
.button-outline:hover:not(:disabled), .icon-button:hover:not(:disabled) { background: var(--lilac); }
.recognition { display: flex; align-items: flex-start; gap: 8px; min-height: 43px; padding: 10px 12px; border-radius: 8px; background: var(--soft); color: #514367; font-size: .875rem; line-height: 1.55; }
.recognition .icon { width: 18px; height: 18px; margin-top: 1px; }
.recognition[data-state="pending"] { background: var(--lilac); }
.recognition[data-state="success"], .success-message { background: #eff6ed; color: #345841; }
.recognition[data-state="error"] { background: #fff2ee; color: var(--error); }
.button-link { flex: none; margin-left: auto; padding: 0; color: inherit; background: transparent; border: 0; font-size: inherit; font-weight: 650; line-height: inherit; text-decoration: underline; text-underline-offset: 3px; }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 13px; }
.field { display: flex; min-width: 0; flex-direction: column; gap: 6px; font-size: .875rem; font-weight: 620; }
.field.wide { grid-column: 1 / -1; }
.required { color: #994049; }
.field input, .field select, .field textarea { width: 100%; min-width: 0; min-height: 42px; padding: 9px 11px; color: var(--ink); background-color: var(--paper); border: 1px solid #dcd5e2; border-radius: 7px; font-size: 1rem; font-weight: 400; line-height: 1.4; }
.field select { appearance: none; padding-right: 31px; background-image: linear-gradient(45deg, transparent 50%, #655575 50%), linear-gradient(135deg, #655575 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.field select:disabled { background-color: #f5f3f6; color: #756e7d; }
.field textarea { min-height: 78px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: #766e80; }
.grouping { border-top: 1px solid var(--line); margin-top: 15px; padding-top: 13px; }
.grouping h3 { display: flex; align-items: center; gap: 7px; margin-bottom: 10px; font-size: .94rem; font-weight: 680; }
.grouping h3 .icon { width: 17px; height: 17px; color: var(--purple-deep); }
.grouping h3 span { color: var(--muted); font-size: .82rem; font-weight: 400; }
.group-field { display: flex; align-items: stretch; gap: 6px; }
.icon-button { display: grid; flex: none; place-items: center; width: 42px; min-height: 42px; padding: 0; border: 1px solid #ded6e9; border-radius: 7px; color: var(--purple-deep); background: var(--paper); }
.icon-button:disabled { opacity: .52; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.form-actions .button-primary { min-width: 122px; }
.form-error { margin-top: 12px; color: var(--error); font-size: .9rem; line-height: 1.55; }

.closet-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 22px; }
.closet-heading h1 { font-size: clamp(2rem, 5vw, 2.8rem); }
.success-message { padding: 12px 16px; margin-bottom: 16px; border-radius: 9px; }
.filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(76px, .35fr); gap: 14px; align-items: end; padding: 17px 20px; margin-bottom: 18px; }
.closet-count { color: var(--muted); font-size: .875rem; text-align: right; align-self: end; padding-block: 11px; white-space: nowrap; }
.closet-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 212px), 1fr)); gap: 16px; }
.garment { display: block; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); box-shadow: 0 3px 10px #33244908; }
.garment:hover { border-color: #b7a6d4; }
.garment img { display: block; width: 100%; aspect-ratio: 5 / 4; object-fit: contain; background: var(--soft); }
.garment-info { padding: 13px 15px 15px; }
.garment-info h2 { font-size: 1rem; margin-bottom: 5px; overflow-wrap: anywhere; }
.garment-info p { color: var(--muted); line-height: 1.45; font-size: .875rem; overflow-wrap: anywhere; }
.garment-info .location { color: var(--purple-deep); margin-top: 8px; }
.closet-empty { display: grid; justify-items: center; gap: 12px; padding: 47px 16px; text-align: center; }
.closet-empty h2 { margin-bottom: 5px; font-size: 1.15rem; }
.closet-empty .photo-placeholder { margin-bottom: 0; }

dialog { width: min(100% - 32px, 400px); padding: 22px; border: 1px solid var(--line); border-radius: 15px; color: var(--ink); background: var(--paper); box-shadow: 0 12px 55px #291a4860; }
dialog::backdrop { background: #231b3770; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 16px; }
.group-context { margin-bottom: 12px; overflow-wrap: anywhere; color: var(--muted); font-size: .9rem; }

@media (min-width: 1000px) {
  .details-fields { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .details-fields .field { grid-column: span 3; }
  .details-fields .wide { grid-column: 1 / -1; }
  .details-fields .detail-short { grid-column: span 2; }
}
@media (max-width: 860px) {
  .shell { width: calc(100% - 40px); }
  .panel { padding: 19px; }
  .intake-grid { gap: 14px; grid-template-columns: minmax(0, 4.6fr) minmax(0, 6.4fr); }
  .hero { padding-inline: 27px; }
}
@media (max-width: 700px) {
  .shell { width: calc(100% - 28px); }
  .topbar-inner { display: grid; grid-template-columns: 1fr auto; min-height: 62px; gap: 7px; padding-block: 9px; }
  .brand { font-size: 1.12rem; gap: 6px; }
  .brand-icon { width: 32px; height: 32px; border-radius: 8px; }
  .brand-icon .icon { width: 20px; height: 20px; }
  .account-nav { display: contents; }
  .account-options { grid-row: 1; grid-column: 2; }
  nav { display: grid; grid-row: 2; grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  nav a { padding: 9px 8px; gap: 5px; font-size: .875rem; }
  .account-nav nav a { justify-content: center; }
  nav .icon { width: 15px; height: 15px; }
  .account-email { display: none; }
  .logout-button { min-height: 36px; padding-inline: 9px; font-size: .875rem; }
  main { padding-block: 16px 32px; }
  .today-hero { padding: 17px 14px 14px; margin-bottom: 17px; border-radius: 14px; }
  .today-heading { gap: 8px; }
  .today-heading .button { padding-inline: 8px; }
  .today-weather { gap: 5px; margin-top: 14px; }
  .today-weather > div { padding: 8px 6px; }
  .today-weather dt { font-size: .8rem; }
  .today-weather dd { font-size: clamp(.93rem, 4.2vw, 1.45rem); }
  .outfit-items { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .outfit-card-info { padding: 10px; }
  .auth-view { grid-template-columns: 1fr; max-width: 450px; min-height: initial; margin-top: 6px; }
  .auth-art { height: clamp(118px, 32vw, 170px); background-position: center 40%; }
  .hero { min-height: 150px; padding: 22px 17px; margin-bottom: 14px; border-radius: 14px; }
  .hero p { margin-top: 8px; max-width: 58%; font-size: .92rem; }
  .hero-art { left: 40%; background-position: center, 43% 48%; }
  .intake-grid { grid-template-columns: 1fr; }
  .panel { padding: 16px; }
  .panel-heading { margin-bottom: 14px; }
  .photo-zone { height: clamp(208px, 55vw, 280px); }
  .form-actions { flex-wrap: wrap; }
  .form-actions .button-primary { flex: 1 1 auto; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .closet-items { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .garment-info { padding: 10px; }
}
@media (max-width: 428px) {
  nav .icon { display: none; }
  nav a { padding-inline: 6px; }
  .today-heading { flex-wrap: wrap; }
  .today-heading .today-actions { width: 100%; justify-content: flex-start; }
  .outfit-actions .button { padding-inline: 7px; }
  .outfit-actions .button .icon { display: none; }
}
@media (max-width: 375px) {
  .today-heading h1 { font-size: 1.9rem; }
  .photo-actions { gap: 6px; }
  .field-grid { gap: 12px 8px; }
}
