/* 衣序 · 天蓝色主题 */
:root {
  --primary: #4A9EDA;
  --primary-deep: #2C6B9E;
  --primary-light: #DCEEFB;
  --bg: #F2F8FC;
  --card: #ffffff;
  --text: #243240;
  --text2: #7A8A99;
  --line: #E3EDF5;
  --warm: #E8944A;
  --danger: #E06A5A;
  --ok: #3FA97C;
  --radius: 16px;
  --shadow: 0 4px 16px rgba(44,107,158,.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, 'PingFang SC', 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
  background: #DFE9F1; color: var(--text); font-size: 15.5px;
}
#app {
  max-width: 480px; margin: 0 auto; height: 100dvh; min-height: 560px;
  background: var(--bg); display: flex; flex-direction: column; position: relative;
  box-shadow: 0 0 40px rgba(44,107,158,.15); overflow: hidden;
}
button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--text); outline: none; border: none; background: none; }
img { display: block; }
::-webkit-scrollbar { width: 0; height: 0; }

/* ---------- 顶栏 ---------- */
.topbar {
  padding: calc(env(safe-area-inset-top) + 14px) 18px 12px;
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, #EAF4FB, var(--bg));
  position: relative; z-index: 5; flex-shrink: 0;
}
.topbar-title { font-size: 21px; font-weight: 800; letter-spacing: 1px; }
.topbar-right { display: flex; gap: 8px; }
.topbar-right .icon-btn {
  width: 34px; height: 34px; border-radius: 50%; background: var(--card);
  box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center;
  color: var(--primary-deep); font-size: 14px;
}

/* ---------- 主内容 ---------- */
#view { flex: 1; overflow-y: auto; padding: 4px 16px 96px; }
.sec-h { display: flex; justify-content: space-between; align-items: baseline; margin: 18px 2px 10px; }
.sec-h h3 { font-size: 17px; font-weight: 700; }
.sec-h .more { font-size: 13px; color: var(--text2); }
.sec-h .more i { margin-left: 2px; font-size: 10px; }

/* ---------- 今日页 ---------- */
.weather-card {
  border-radius: 20px; padding: 18px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #5BA8DC, #3E7FB8);
  box-shadow: 0 10px 24px rgba(62,127,184,.3);
}
.weather-card .sun { position: absolute; right: -30px; top: -30px; width: 130px; height: 130px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.3), transparent 70%); }
.weather-main { display: flex; justify-content: space-between; align-items: center; }
.weather-temp { font-size: 52px; font-weight: 200; line-height: 1; }
.weather-temp small { font-size: 20px; }
.weather-desc { font-size: 14px; opacity: .92; margin-top: 6px; }
.weather-loc { font-size: 12.5px; opacity: .85; margin-top: 10px; display: flex; align-items: center; gap: 5px; }
.weather-loc .loc-btn { color: #fff; opacity: .95; text-decoration: underline; font-size: 12.5px; }
.weather-meta { display: flex; gap: 14px; margin-top: 12px; padding-top: 11px; border-top: 1px solid rgba(255,255,255,.25); font-size: 12.5px; opacity: .95; flex-wrap: wrap; }
.weather-emoji { font-size: 46px; opacity: .9; }

.mode-switch { display: flex; gap: 8px; margin: 14px 0 4px; }
.mode-switch button {
  flex: 1; padding: 10px 0; border-radius: 12px; background: var(--card); color: var(--text2);
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow); transition: .15s;
}
.mode-switch button.on { background: linear-gradient(135deg, #4A9EDA, #2C6B9E); color: #fff; box-shadow: 0 6px 16px rgba(74,158,218,.4); }

.outfit-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-top: 12px; }
.outfit-card .oc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.outfit-card .oc-title { font-weight: 700; font-size: 15.5px; }
.badge { font-size: 11px; padding: 3px 9px; border-radius: 6px; font-weight: 600; }
.badge.warm { background: #FDEFDF; color: var(--warm); }
.badge.beauty { background: var(--primary-light); color: var(--primary-deep); }
.warmth-score { font-size: 11px; color: var(--text2); }
.slot-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.slot { flex: 0 0 auto; width: 94px; text-align: center; position: relative; }
.slot .slot-img {
  width: 94px; height: 94px; border-radius: 14px; background: var(--primary-light);
  display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--primary); font-size: 22px;
}
.slot .slot-img img { width: 100%; height: 100%; object-fit: cover; }
.slot .slot-name { font-size: 12.5px; margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot .slot-type { font-size: 10.5px; color: var(--text2); }
.slot .slot-swap {
  position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.15); color: var(--primary); font-size: 10px;
  display: flex; align-items: center; justify-content: center;
}
.reason-box { background: #F4FAFE; border-radius: 12px; padding: 11px 13px; font-size: 13px; color: var(--primary-deep); margin-top: 10px; line-height: 1.7; }
.oc-actions { display: flex; gap: 8px; margin-top: 12px; }
.btn { border-radius: 999px; font-weight: 600; font-size: 14.5px; padding: 13px 0; text-align: center; transition: .15s; }
.btn:active { transform: scale(.97); }
.btn-main { flex: 1; background: linear-gradient(135deg, #4A9EDA, #2C6B9E); color: #fff; box-shadow: 0 6px 16px rgba(74,158,218,.35); }
.btn-sub { flex: 1; background: var(--primary-light); color: var(--primary-deep); }
.btn-plain { background: #EDF3F8; color: var(--text2); }
.btn-danger { background: #FBEAE7; color: var(--danger); }

.empty-tip { text-align: center; padding: 40px 20px; color: var(--text2); }
.empty-tip i { font-size: 40px; color: #B9D4E8; margin-bottom: 14px; }
.empty-tip p { font-size: 13px; line-height: 1.8; }
.empty-tip .btn { display: inline-block; padding: 10px 22px; margin-top: 14px; }

/* ---------- 衣橱页 ---------- */
.search-bar { display: flex; gap: 8px; margin-top: 8px; }
.search-bar .input-wrap {
  flex: 1; display: flex; align-items: center; gap: 8px; background: var(--card);
  border-radius: 999px; padding: 0 14px; height: 40px; box-shadow: var(--shadow);
}
.search-bar input { flex: 1; font-size: 15px; }
.filter-row { display: flex; gap: 7px; overflow-x: auto; margin: 10px 0 4px; padding-bottom: 2px; }
.fchip { flex: 0 0 auto; font-size: 13px; padding: 8px 15px; border-radius: 999px; background: var(--card); color: var(--text2); box-shadow: var(--shadow); }
.fchip.on { background: var(--primary); color: #fff; font-weight: 600; }
.item-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.item-card { background: var(--card); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); position: relative; }
.item-card .ic-img { height: 130px; background: var(--primary-light); display: flex; align-items: center; justify-content: center; color: var(--primary); font-size: 28px; }
.item-card .ic-img img { width: 100%; height: 100%; object-fit: cover; }
.item-card .ic-info { padding: 8px 10px 10px; }
.item-card .ic-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-card .ic-meta { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text2); margin-top: 4px; }
.item-card .ic-tags { position: absolute; top: 7px; left: 7px; display: flex; gap: 4px; }
.mini-tag { font-size: 9px; padding: 2px 6px; border-radius: 5px; background: rgba(255,255,255,.92); color: var(--primary-deep); font-weight: 600; }
.mini-tag.warm { background: rgba(232,148,74,.92); color: #fff; }
.mini-tag.gray { background: rgba(90,100,110,.75); color: #fff; }
.fab {
  position: absolute; right: 18px; bottom: 104px; width: 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(135deg, #4A9EDA, #2C6B9E); color: #fff; font-size: 20px;
  box-shadow: 0 8px 20px rgba(44,107,158,.45); display: flex; align-items: center; justify-content: center; z-index: 20;
}

/* ---------- 搭配页 ---------- */
.outfit-list .outfit-card { margin-top: 10px; }
.olist-items { display: flex; gap: 6px; margin-top: 8px; }
.olist-items .thumb { width: 52px; height: 52px; border-radius: 9px; overflow: hidden; background: var(--primary-light); display: flex; align-items: center; justify-content: center; color: var(--primary); }
.olist-items .thumb img { width: 100%; height: 100%; object-fit: cover; }
.hist-row { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 13px; box-shadow: var(--shadow); padding: 11px 13px; margin-top: 8px; }
.hist-date { width: 42px; text-align: center; flex-shrink: 0; }
.hist-date b { display: block; font-size: 16px; }
.hist-date span { font-size: 9.5px; color: var(--text2); }
.hist-info { flex: 1; font-size: 14px; }
.hist-info small { color: var(--text2); display: block; margin-top: 3px; font-size: 12px; }
.undo-btn { font-size: 12.5px; color: var(--danger); }

/* ---------- 我的页 ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-box { background: var(--card); border-radius: 14px; padding: 13px; box-shadow: var(--shadow); }
.stat-box .s-label { font-size: 12.5px; color: var(--text2); }
.stat-box .s-value { font-size: 24px; font-weight: 800; margin-top: 3px; }
.stat-box .s-sub { font-size: 11.5px; color: var(--text2); margin-top: 2px; }
.hbar-row { margin-bottom: 10px; }
.hbar-row .hb-top { display: flex; justify-content: space-between; font-size: 11.5px; margin-bottom: 4px; }
.hbar { height: 7px; border-radius: 4px; background: #E9F1F8; overflow: hidden; }
.hbar > div { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #7DBBE8, #3E7FB8); }
.rank-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.rank-row:last-child { border-bottom: none; }
.rank-row .r-idx { width: 20px; height: 20px; border-radius: 50%; background: var(--primary-light); color: var(--primary-deep); font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.rank-row .r-info { flex: 1; }
.rank-row small { color: var(--text2); margin-left: 8px; font-size: 10.5px; }
.setting-group { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.setting-row { display: flex; align-items: center; padding: 15px; border-bottom: 1px solid var(--line); font-size: 15px; }
.setting-row:last-child { border-bottom: none; }
.setting-row .sg-icon { width: 26px; color: var(--primary); margin-right: 10px; text-align: center; }
.setting-row .sg-body { flex: 1; }
.setting-row .sg-val { color: var(--text2); font-size: 12px; }
.setting-row > i.fa-angle-right { color: #C4D3E0; }
.seg { display: flex; background: #EDF3F8; border-radius: 11px; padding: 3px; gap: 2px; margin-top: 9px; }
.seg button { flex: 1; padding: 7px 0; border-radius: 9px; font-size: 12px; color: var(--text2); }
.seg button.on { background: #fff; color: var(--primary-deep); font-weight: 700; box-shadow: 0 2px 6px rgba(44,107,158,.15); }

/* ---------- 弹层 ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 60; display: flex; flex-direction: column;
  background: var(--bg); animation: slideUp .22s ease;
}
@keyframes slideUp { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.overlay-nav {
  padding: calc(env(safe-area-inset-top) + 14px) 16px 10px; display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, #EAF4FB, var(--bg)); flex-shrink: 0;
}
.overlay-nav .on-title { font-weight: 700; font-size: 15.5px; }
.overlay-nav .on-btn { font-size: 13px; color: var(--text2); }
.overlay-nav .on-btn.primary { color: var(--primary-deep); font-weight: 700; }
.overlay-body { flex: 1; overflow-y: auto; padding: 6px 16px 40px; }
.modal-mask { position: absolute; inset: 0; background: rgba(20,35,50,.45); z-index: 70; display: flex; align-items: flex-end; animation: fadeIn .18s; }
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  width: 100%; background: #fff; border-radius: 22px 22px 0 0; padding: 20px 18px calc(env(safe-area-inset-bottom) + 20px);
  animation: slideUp .22s ease; max-height: 78%; overflow-y: auto;
}
.modal h4 { font-size: 15.5px; margin-bottom: 14px; text-align: center; }

/* ---------- 表单（大字号 · 纵向滚动版式） ---------- */
.form-group { margin-bottom: 22px; }
.form-label { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 10px; display: block; }
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-label .hint { font-size: 12px; font-weight: 400; color: var(--primary); margin-left: 6px; }
.form-input, .form-select {
  width: 100%; background: #fff; border: 1.5px solid var(--line); border-radius: 14px;
  padding: 16px 16px; font-size: 16px; appearance: none;
}
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237A8A99' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center;
}
.form-input::placeholder, textarea.form-input::placeholder { color: #A9BAC9; font-size: 15px; }
.form-input:focus, .form-select:focus { border-color: var(--primary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 9px; }
.chips .fchip { box-shadow: none; border: 1.5px solid var(--line); font-size: 14px; padding: 11px 20px; }
.chips .fchip.on { border-color: var(--primary); background: var(--primary-light); color: var(--primary-deep); font-weight: 700; }
.color-dot { width: 40px; height: 40px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.color-dot.on { border-color: var(--primary-deep); transform: scale(1.1); }
.photo-upload {
  width: 100%; height: 200px; border-radius: 18px; border: 2px dashed #9EC7E8; background: #EFF7FD;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  color: var(--text2); font-size: 16px; overflow: hidden; flex-shrink: 0; cursor: pointer;
}
.photo-upload .ph-icon { font-size: 38px; color: var(--primary); }
.photo-upload .ph-sub { font-size: 13px; color: #8FA6B8; }
.photo-upload img { width: 100%; height: 100%; object-fit: cover; }
.link-card { background: #fff; border-radius: 16px; padding: 16px; box-shadow: var(--shadow); margin-bottom: 22px; }
.link-card .lk-title { font-size: 14.5px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 7px; }
.link-card .lk-row { display: flex; gap: 9px; }
.link-card .form-input { flex: 1; background: #F4F9FD; border: none; font-size: 14.5px; padding: 14px 15px; }
.link-card .lk-tip { font-size: 12px; color: var(--text2); margin-top: 9px; line-height: 1.6; }
.link-card .lk-btn { flex: 0 0 auto; padding: 0 22px; font-size: 15px; border-radius: 14px; }

/* 弹层底部固定操作条 */
.overlay-footer {
  flex-shrink: 0; padding: 12px 16px calc(env(safe-area-inset-bottom) + 14px);
  background: #fff; border-top: 1px solid var(--line);
  display: flex; gap: 10px;
}
.overlay-footer .btn { font-size: 16.5px; padding: 16px 0; border-radius: 16px; }

/* 单品详情 */
.detail-hero { height: 230px; border-radius: 18px; overflow: hidden; background: var(--primary-light); display: flex; align-items: center; justify-content: center; color: var(--primary); font-size: 50px; }
.detail-hero img { width: 100%; height: 100%; object-fit: cover; }
.detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.dg-cell { background: #fff; border-radius: 11px; text-align: center; padding: 10px 2px; box-shadow: var(--shadow); }
.dg-cell b { font-size: 14.5px; color: var(--primary-deep); }
.dg-cell span { display: block; font-size: 9.5px; color: var(--text2); margin-top: 2px; }
.kv-list { background: #fff; border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; margin-top: 12px; }
.kv { display: flex; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text2); }

/* 提示 */
#toast {
  position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%) translateY(20px);
  background: rgba(36,50,64,.9); color: #fff; font-size: 14px; padding: 11px 20px; border-radius: 999px;
  opacity: 0; transition: .25s; z-index: 99; pointer-events: none; white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%); }

/* TabBar */
.tabbar {
  position: absolute; bottom: 0; left: 0; right: 0; height: calc(66px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255,255,255,.94); backdrop-filter: blur(16px);
  border-top: 1px solid var(--line); display: flex; z-index: 30;
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: #9AACBC; font-size: 11px; cursor: pointer; }
.tabbar a i { font-size: 20px; }
.tabbar a.on { color: var(--primary-deep); font-weight: 700; }
