/* iOS 风格：系统字体、分组圆角列表、毛玻璃导航栏、系统配色 */
:root {
  --bg: #f2f2f7;               /* systemGroupedBackground */
  --card: #ffffff;             /* secondarySystemGroupedBackground */
  --fill: rgba(118, 118, 128, 0.12);   /* tertiarySystemFill（搜索框） */
  --fill-2: rgba(118, 118, 128, 0.08);
  --sep: rgba(60, 60, 67, 0.18);       /* separator */
  --label: #000000;
  --label-2: rgba(60, 60, 67, 0.60);   /* secondaryLabel */
  --label-3: rgba(60, 60, 67, 0.30);   /* tertiaryLabel */
  --blue: #007aff;
  --orange: #ff9500;
  --hl: rgba(255, 204, 0, 0.35);
  --bar: rgba(242, 242, 247, 0.80);

  --red: #ff3b30; --teal: #30b0c7; --indigo: #5856d6; --orange-c: #ff9500;
  --green: #34c759; --pink: #ff2d55; --yellow: #ffb800; --purple: #af52de;

  --r-card: 12px;
  --r-tile: 18px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --card: #1c1c1e;
    --fill: rgba(118, 118, 128, 0.24);
    --fill-2: rgba(118, 118, 128, 0.16);
    --sep: rgba(84, 84, 88, 0.60);
    --label: #ffffff;
    --label-2: rgba(235, 235, 245, 0.60);
    --label-3: rgba(235, 235, 245, 0.30);
    --blue: #0a84ff;
    --orange: #ff9f0a;
    --hl: rgba(255, 214, 10, 0.28);
    --bar: rgba(0, 0, 0, 0.72);
    --red: #ff453a; --teal: #40c8e0; --indigo: #5e5ce6; --orange-c: #ff9f0a;
    --green: #30d158; --pink: #ff375f; --yellow: #ffd60a; --purple: #bf5af2;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --card: #1c1c1e; --fill: rgba(118, 118, 128, 0.24); --fill-2: rgba(118, 118, 128, 0.16);
  --sep: rgba(84, 84, 88, 0.60); --label: #ffffff; --label-2: rgba(235, 235, 245, 0.60); --label-3: rgba(235, 235, 245, 0.30);
  --blue: #0a84ff; --orange: #ff9f0a; --hl: rgba(255, 214, 10, 0.28); --bar: rgba(0, 0, 0, 0.72);
  --red: #ff453a; --teal: #40c8e0; --indigo: #5e5ce6; --orange-c: #ff9f0a;
  --green: #30d158; --pink: #ff375f; --yellow: #ffd60a; --purple: #bf5af2;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font: 17px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

/* ---------- 导航栏 ---------- */
.bar {
  position: sticky; top: 0; z-index: 10;
  background: var(--bar);
  backdrop-filter: saturate(1.8) blur(20px);
  -webkit-backdrop-filter: saturate(1.8) blur(20px);
  padding-top: env(safe-area-inset-top);
  border-bottom: 0.5px solid transparent;
  transition: border-color .2s;
}
.bar.scrolled { border-bottom-color: var(--sep); }
.bar-inner { max-width: 720px; margin: 0 auto; padding: 8px 16px 10px; }

.nav { position: relative; height: 34px; display: flex; align-items: center; margin-bottom: 6px; }
.nav[hidden] { display: none; }
.nav-back { color: var(--blue); display: inline-flex; align-items: center; gap: 2px; font-size: 17px; margin-left: -6px; padding: 4px 6px; }
.nav-back svg { margin-top: 1px; }
.nav-title {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-weight: 600; font-size: 17px; white-space: nowrap;
  opacity: 0; transition: opacity .2s;
}
.bar.scrolled .nav-title { opacity: 1; }

.search { display: flex; align-items: center; gap: 10px; }
.field { position: relative; flex: 1; display: flex; align-items: center; }
.field svg { position: absolute; left: 8px; color: var(--label-2); pointer-events: none; }
.field input {
  width: 100%; height: 36px;
  padding: 0 30px 0 30px;
  border: 0; border-radius: 10px;
  background: var(--fill);
  color: var(--label);
  font: inherit; font-size: 17px;
  outline: none;
  -webkit-appearance: none; appearance: none;
}
.field input::-webkit-search-cancel-button { display: none; }
.field input::placeholder { color: var(--label-2); }
.field .x {
  position: absolute; right: 7px;
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--label-3); color: var(--card);
  display: grid; place-items: center;
}
.field .x[hidden] { display: none; }
.cancel { color: var(--blue); font-size: 17px; white-space: nowrap; }
.cancel[hidden] { display: none; }

/* ---------- 页面 ---------- */
main { max-width: 720px; margin: 0 auto; padding: 4px 16px 32px; outline: none; }
.loading, .empty { color: var(--label-2); text-align: center; padding: 48px 16px; font-size: 15px; }

.large-title { font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: 0.01em; margin: 6px 0 2px; }
.subtitle { color: var(--label-2); font-size: 15px; margin: 0 0 4px; }

.section-header {
  font-size: 13px; color: var(--label-2);
  text-transform: uppercase;
  margin: 28px 16px 7px;
  display: flex; justify-content: space-between; gap: 8px;
}
.section-header b { font-weight: 400; }
.section-footer { font-size: 13px; color: var(--label-2); margin: 7px 16px 0; line-height: 1.4; }
.section-footer + .section-footer { margin-top: 4px; }

/* ---------- 首页：房间方块 ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 18px; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
.tile {
  background: var(--card);
  border-radius: var(--r-tile);
  padding: 14px 14px 13px;
  min-height: 128px;
  display: flex; flex-direction: column;
  transition: transform .15s ease, opacity .15s ease;
}
.tile:active { transform: scale(0.97); opacity: .85; }
.tile .glyph { width: 36px; height: 36px; border-radius: 50%; background: var(--rc); color: #fff; display: grid; place-items: center; margin-bottom: 12px; }
.tile .t-name { font-weight: 600; font-size: 17px; line-height: 1.2; }
.tile .t-sub { font-size: 13px; color: var(--label-2); margin-top: 2px; }
.tile .t-meta { margin-top: auto; padding-top: 8px; font-size: 13px; color: var(--label-2); }
.tile .t-meta .warn { color: var(--orange); }

.suggest { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 4px; }
.suggest button {
  background: var(--card); color: var(--blue);
  border-radius: 999px; padding: 7px 14px; font-size: 15px;
}
.suggest button:active { opacity: .6; }

/* ---------- 分组列表 ---------- */
.list { background: var(--card); border-radius: var(--r-card); overflow: hidden; }
.row { position: relative; }
.row + .row::before {
  content: ""; position: absolute; top: 0; right: 0; left: 58px;
  border-top: 0.5px solid var(--sep);
}
.row-main {
  width: 100%; min-height: 60px;
  display: flex; align-items: center; gap: 12px;
  padding: 9px 16px; text-align: left;
}
button.row-main:active, a.row-main:active { background: var(--fill-2); }
.tag {
  flex: none; width: 30px; height: 30px; border-radius: 7px;
  background: var(--rc); color: #fff;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 600; letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.row-text { flex: 1; min-width: 0; }
.row-title { display: block; font-size: 17px; line-height: 22px; }
.row-sub { display: block; font-size: 13px; line-height: 18px; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-detail { flex: none; color: var(--label-2); font-size: 17px; font-variant-numeric: tabular-nums; }
.chev { flex: none; color: var(--label-3); transition: transform .2s ease; }
.row.open .chev { transform: rotate(90deg); }
.row.open .row-sub { display: none; }

.row.pending .tag { background: var(--fill); color: var(--label-2); }
.row.pending .row-title { color: var(--label-2); }
.row.pending .row-main { cursor: default; }

/* 展开后的物品清单 */
.items { display: none; padding: 0 0 8px 58px; }
.row.open .items { display: block; }
.items .box { font-size: 13px; color: var(--label-2); text-transform: uppercase; padding: 10px 16px 4px 0; }
.items ul { list-style: none; margin: 0; padding: 0; }
.items li {
  font-size: 15px; line-height: 20px;
  padding: 7px 16px 7px 0;
  border-top: 0.5px solid var(--sep);
}
.items .box + ul li:first-child { border-top: 0; }
.items li.flash { animation: flash 2.6s ease-out 1; margin-left: -8px; padding-left: 8px; border-radius: 6px; }
@keyframes flash { 0%, 45% { background: var(--hl); } 100% { background: transparent; } }

/* ---------- 搜索结果 ---------- */
.result .row-main { min-height: 56px; }
.result .row-title mark { background: none; color: inherit; font-weight: 600; }
.result.note .row-title { font-size: 15px; line-height: 20px; color: var(--label-2); white-space: normal; }
.result .row-sub { white-space: normal; }
.path-room { color: var(--rc); }

.ai {
  position: relative;
  margin-top: 16px;
  border-radius: 16px;
  padding: 14px 16px 12px;
  background:
    linear-gradient(var(--card), var(--card)) padding-box,
    linear-gradient(120deg, #ff9f0a, #ff2d55, #af52de, #007aff, #30b0c7) border-box;
  border: 1.5px solid transparent;
}
.ai-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600;
  background: linear-gradient(90deg, #af52de, #007aff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 6px;
}
.ai-label svg { color: #af52de; }
.ai p { margin: 0; font-size: 17px; line-height: 1.45; }
.ai .muted { color: var(--label-2); font-size: 15px; }
.ai .list { background: var(--fill-2); margin: 12px -4px 2px; }
.shimmer { display: grid; gap: 8px; padding: 4px 0 2px; }
.shimmer i { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--fill-2), var(--fill), var(--fill-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.shimmer i:nth-child(2) { width: 70%; }
@keyframes shimmer { to { background-position: -200% 0; } }

.ask-row .row-title { color: var(--blue); }
.ask-row .tag { background: linear-gradient(135deg, #af52de, #007aff); }

/* ---------- 页脚 ---------- */
.foot { max-width: 720px; margin: 0 auto; padding: 0 32px calc(24px + env(safe-area-inset-bottom)); font-size: 12px; color: var(--label-2); text-align: center; }
