/* ============ 基础与手机壳 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --brand: #f59e0b;
  --brand-deep: #d97706;
  --brand-soft: #fef3c7;
  --green: #10b981;
  --green-soft: #d1fae5;
  --blue: #3b82f6;
  --blue-soft: #dbeafe;
  --red: #ef4444;
  --ink: #1f2937;
  --ink-soft: #6b7280;
  --line: #f0ece4;
  --bg: #f7f4ee;
  --card: #ffffff;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

.phone-frame {
  background: var(--bg);
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* 桌面端：居中卡片形态，模拟App窗口 */
@media (min-width: 640px) {
  body {
    background: linear-gradient(135deg, #f5ede0 0%, #f9f3ea 50%, #f3ecf7 100%);
    padding: 24px 12px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
  }
  .phone-frame {
    width: 420px;
    min-height: 0;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 24px 60px -12px rgba(31, 41, 55, 0.35), 0 0 0 1px rgba(31, 41, 55, 0.08);
    min-height: 800px;
  }
}

/* ============ 头部（适配刘海屏safe-area） ============ */
.app-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(14px + env(safe-area-inset-top)) 18px 14px;
}
.header-left { display: flex; align-items: center; gap: 8px; }
.header-logo {
  width: 40px; height: 40px; border-radius: 14px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 22px;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}
.app-title { font-size: 19px; font-weight: 800; letter-spacing: -0.3px; }
.app-subtitle { font-size: 11px; color: var(--ink-soft); font-weight: 500; }

.weather-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--blue-soft); color: #1d4ed8;
  font-size: 12px; font-weight: 700;
  border: 1px solid #bfdbfe;
}

/* ============ 主内容与Tab ============ */
.app-main { flex: 1; overflow-y: auto; padding: 0 14px 18px; scrollbar-width: none; }
.app-main::-webkit-scrollbar { display: none; }
.tab-panel { animation: fadeUp 0.35s ease; }
.hidden { display: none; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.tab-bar {
  display: flex; background: #fff;
  border-top: 1px solid var(--line);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
}
.tab-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: none; cursor: pointer;
  font-size: 10.5px; color: var(--ink-soft); font-weight: 600;
  padding: 4px 0; transition: color 0.2s;
}
.tab-item i { font-size: 21px; }
.tab-item.active { color: var(--brand-deep); }
.tab-item.active i { transform: translateY(-2px); }
.tab-item i { transition: transform 0.2s; }

/* ============ 通用卡片 ============ */
.card {
  background: var(--card); border-radius: 18px;
  padding: 16px; margin-bottom: 14px;
  border: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(31, 41, 55, 0.04);
}

.card-title-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.card-title { font-size: 15px; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.card-title i { color: var(--brand); }

/* ============ 今日方案 · 时间轴 ============ */
.plan-header {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 60%, #d97706 100%);
  border-radius: 18px; padding: 18px; margin-bottom: 14px;
  color: #fff; position: relative; overflow: hidden;
}
.plan-header::after {
  content: ""; position: absolute; right: -30px; top: -30px;
  width: 110px; height: 110px; border-radius: 50%;
  background: rgba(255,255,255,0.15);
}
.plan-header::before {
  content: ""; position: absolute; right: 20px; bottom: -40px;
  width: 90px; height: 90px; border-radius: 50%;
  background: rgba(255,255,255,0.12);
}
.plan-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 700;
  background: rgba(255,255,255,0.25); border: 1px solid rgba(255,255,255,0.4);
  padding: 3px 10px; border-radius: 999px; margin-bottom: 8px;
}
.plan-title { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.plan-desc { font-size: 12px; opacity: 0.92; line-height: 1.5; }
.plan-stats { display: flex; gap: 14px; margin-top: 12px; }
.plan-stat { display: flex; flex-direction: column; }
.plan-stat b { font-size: 16px; font-weight: 800; }
.plan-stat span { font-size: 10px; opacity: 0.85; }

/* 时间轴 */
.timeline { position: relative; padding-left: 26px; }
.timeline::before {
  content: ""; position: absolute; left: 9px; top: 12px; bottom: 12px;
  width: 2.5px; border-radius: 2px;
  background: linear-gradient(to bottom, #fcd34d 0%, #fcd34d 55%, #e5e7eb 55%, #e5e7eb 100%);
}
.tl-item { position: relative; margin-bottom: 14px; }
.tl-dot {
  position: absolute; left: -26px; top: 4px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 3px solid #fcd34d;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--brand-deep); font-weight: 800;
  z-index: 2;
}
.tl-item.done .tl-dot { background: var(--green); border-color: var(--green); color: #fff; }
.tl-item.done .tl-card { opacity: 0.55; }
.tl-item.now .tl-dot {
  border-color: var(--red);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

.tl-card {
  background: var(--card); border-radius: 14px;
  border: 1px solid var(--line); padding: 12px 14px;
  display: flex; gap: 10px; align-items: flex-start;
  box-shadow: 0 2px 8px rgba(31, 41, 55, 0.04);
  transition: transform 0.2s;
}
.tl-item.now .tl-card {
  border-color: #fca5a5;
  background: linear-gradient(135deg, #fff 0%, #fff5f5 100%);
}
.tl-time { font-size: 12.5px; font-weight: 800; color: var(--brand-deep); white-space: nowrap; }
.tl-item.now .tl-time { color: var(--red); }
.tl-body { flex: 1; min-width: 0; }
.tl-name { font-size: 13.5px; font-weight: 700; margin-bottom: 2px; }
.tl-desc { font-size: 11.5px; color: var(--ink-soft); line-height: 1.55; }
.tl-icons { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.tl-chip {
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
}
.chip-drive { background: var(--blue-soft); color: #1d4ed8; }
.chip-walk { background: var(--green-soft); color: #047857; }
.chip-free { background: var(--brand-soft); color: #b45309; }
.chip-eat { background: #fce7f3; color: #be185d; }
.chip-play { background: #ede9fe; color: #6d28d9; }
.chip-park { background: #e0f2fe; color: #0369a1; }
.chip-nap { background: #ede9fe; color: #6d28d9; }

/* 午睡策略卡 */
.nap-spot-list { display: flex; flex-direction: column; gap: 8px; }
.nap-spot {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px;
  background: #fff; transition: all 0.2s;
}
.nap-spot.on { border-color: #8b5cf6; background: #faf5ff; }
.nap-spot-head { display: flex; align-items: center; gap: 8px; }
.nap-score {
  font-size: 12px; font-weight: 800; color: #fff; background: #8b5cf6;
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.nap-spot.on .nap-score { background: #6d28d9; }
.nap-spot-name { font-size: 12.5px; font-weight: 700; flex: 1; }
.nap-tag {
  font-size: 9px; font-weight: 700; padding: 1px 6px; border-radius: 999px;
  background: #f3f4f6; color: #4b5563; margin-left: 4px;
}
.nap-spot.on .nap-tag { background: #ede9fe; color: #6d28d9; }
.nap-spot-meta { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.nap-spot-meta span {
  font-size: 9.5px; color: var(--ink-soft); font-weight: 600;
  background: #f9fafb; padding: 2px 7px; border-radius: 999px;
}
.nap-spot-why { font-size: 10.5px; color: var(--ink-soft); line-height: 1.55; margin-top: 6px; }

/* 周排程 午睡标记 */
.week-day .wd-nap {
  font-size: 8.5px; font-weight: 700; color: #6d28d9;
  background: #ede9fe; border-radius: 999px; padding: 1px 4px;
  margin-top: 3px; white-space: nowrap;
}
.week-day .wd-flag {
  font-size: 8px; font-weight: 600; color: #047857; margin-top: 2px;
}
.week-day.today .wd-flag { color: #065f46; }

/* 演示控制条 */
.demo-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: #fffbeb; border: 1px dashed #fcd34d;
  border-radius: 12px; padding: 10px 14px; margin-bottom: 14px;
}
.demo-bar-label { font-size: 11px; color: #92400e; font-weight: 600; line-height: 1.4; }
.demo-bar-btns { display: flex; gap: 6px; }
.demo-btn {
  border: 1px solid #f59e0b; background: #fff; color: #b45309;
  font-size: 11px; font-weight: 700; border-radius: 8px;
  padding: 6px 12px; cursor: pointer; transition: all 0.2s;
}
.demo-btn:hover { background: #f59e0b; color: #fff; }
.demo-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* 倒计时徽章 */
.countdown-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 800; color: var(--red);
  animation: blink 1.2s infinite;
}
@keyframes blink { 50% { opacity: 0.5; } }

/* ============ 地图动线 ============ */
.map-wrap {
  background: #fff; border-radius: 18px; overflow: hidden;
  border: 1px solid var(--line); margin-bottom: 14px;
  position: relative;
}
.map-svg { width: 100%; display: block; }
.map-legend {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px;
  background: #fff; border-top: 1px solid var(--line);
}
.legend-item {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; color: var(--ink-soft); font-weight: 600;
}
.legend-dot { width: 9px; height: 9px; border-radius: 50%; }
.legend-free { background: var(--green); }
.legend-paid { background: var(--red); }
.legend-school { background: var(--blue); }
.legend-park { background: #16a34a; }
.legend-route { width: 14px; height: 3px; border-radius: 2px; background: var(--brand); }

.poi-list { display: flex; flex-direction: column; gap: 10px; }
.poi-item {
  display: flex; gap: 10px; align-items: flex-start;
  background: #fff; border-radius: 14px; padding: 12px;
  border: 1px solid var(--line); cursor: pointer;
  transition: all 0.2s;
}
.poi-item:hover { border-color: #fcd34d; transform: translateY(-1px); }
.poi-item.active { border-color: var(--brand); background: #fffbeb; }
.poi-icon {
  width: 36px; height: 36px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; color: #fff;
}
.poi-body { flex: 1; min-width: 0; }
.poi-name { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.poi-addr { font-size: 11px; color: var(--ink-soft); margin-top: 2px; line-height: 1.5; }
.poi-tags { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.poi-badge {
  font-size: 9.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
}
.badge-free { background: var(--green-soft); color: #047857; }
.badge-mins { background: var(--blue-soft); color: #1d4ed8; }
.badge-book { background: #fef9c3; color: #854d0e; }
.badge-seats { background: #fce7f3; color: #be185d; }

.poi-detail {
  background: #fffbeb; border-radius: 12px; padding: 12px;
  font-size: 11.5px; color: #78350f; line-height: 1.7;
  border: 1px solid #fde68a; margin-top: 8px;
  animation: fadeUp 0.25s ease;
}

/* ============ 美食轮换 ============ */
.week-strip { display: flex; gap: 6px; margin-bottom: 14px; }
.week-day {
  flex: 1; background: #fff; border-radius: 12px; padding: 8px 2px;
  text-align: center; border: 1px solid var(--line); cursor: pointer;
  transition: all 0.2s;
}
.week-day:hover { border-color: #fcd34d; }
.week-day .wd-name { font-size: 10px; color: var(--ink-soft); font-weight: 600; }
.week-day .wd-icon { font-size: 18px; margin: 3px 0; }
.week-day .wd-short { font-size: 9px; font-weight: 700; color: var(--ink); line-height: 1.3; }
.week-day.today { background: var(--brand-soft); border-color: var(--brand); }
.week-day.today .wd-name { color: var(--brand-deep); }
.week-day.past { opacity: 0.45; }

.food-card {
  background: #fff; border-radius: 16px; padding: 14px;
  border: 1px solid var(--line); margin-bottom: 10px;
  display: flex; gap: 12px;
}
.food-thumb {
  width: 64px; height: 64px; border-radius: 14px; flex-shrink: 0;
  object-fit: cover; background: var(--brand-soft);
}
.food-body { flex: 1; min-width: 0; }
.food-name { font-size: 14px; font-weight: 800; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.food-meta { display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.food-meta span { font-size: 10.5px; color: var(--ink-soft); font-weight: 600; display: inline-flex; gap: 3px; align-items: center; }
.food-note { font-size: 11px; color: var(--ink-soft); margin-top: 6px; line-height: 1.6; }
.food-actions { display: flex; gap: 6px; margin-top: 8px; }
.food-btn {
  font-size: 10.5px; font-weight: 700; padding: 5px 10px;
  border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-soft); cursor: pointer; transition: all 0.2s;
  display: inline-flex; align-items: center; gap: 4px;
}
.food-btn:hover { border-color: var(--brand); color: var(--brand-deep); }
.food-btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.food-btn.primary:hover { background: var(--brand-deep); }
.food-btn.liked { background: #fce7f3; border-color: #f9a8d4; color: #be185d; }

.cat-tabs { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  flex-shrink: 0; font-size: 11.5px; font-weight: 700;
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
  background: #fff; border: 1px solid var(--line); color: var(--ink-soft);
  transition: all 0.2s; white-space: nowrap;
}
.cat-tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ============ 偏好设置 ============ */
.set-group-title {
  font-size: 12px; font-weight: 800; color: var(--ink-soft);
  margin: 4px 2px 10px; display: flex; align-items: center; gap: 6px;
}
.set-row {
  background: #fff; border-radius: 14px; padding: 13px 14px;
  border: 1px solid var(--line); margin-bottom: 10px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.set-label { font-size: 13px; font-weight: 700; }
.set-sub { font-size: 10.5px; color: var(--ink-soft); margin-top: 3px; line-height: 1.5; }

.seg { display: flex; background: #f3f4f6; border-radius: 10px; padding: 3px; gap: 2px; }
.seg-btn {
  font-size: 11px; font-weight: 700; padding: 6px 12px; border-radius: 8px;
  border: none; background: transparent; color: var(--ink-soft); cursor: pointer;
  transition: all 0.2s; white-space: nowrap;
}
.seg-btn.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,0.12); }

.toggle {
  position: relative; width: 44px; height: 25px; flex-shrink: 0;
  background: #d1d5db; border-radius: 999px; cursor: pointer;
  transition: background 0.2s; border: none;
}
.toggle::after {
  content: ""; position: absolute; top: 2.5px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; transition: left 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.toggle.on { background: var(--green); }
.toggle.on::after { left: 21px; }

.plate-row { display: flex; flex-wrap: wrap; gap: 7px; }
.plate-chip {
  font-size: 11px; font-weight: 700; padding: 6px 12px;
  border-radius: 999px; border: 1.5px solid var(--line);
  background: #fff; color: var(--ink-soft); cursor: pointer; transition: all 0.2s;
}
.plate-chip.on { border-color: var(--red); color: var(--red); background: #fef2f2; }
.plate-chip:hover { border-color: #fca5a5; }

/* Toast */
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: rgba(17, 24, 39, 0.92); color: #fff;
  font-size: 12px; font-weight: 600; padding: 10px 18px;
  border-radius: 999px; opacity: 0; pointer-events: none;
  transition: all 0.3s; z-index: 99; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 页脚 */
.app-footer {
  text-align: center; padding: 10px 0 6px;
  font-size: 11px; color: #a8a29e;
}
.app-footer a { text-decoration: none; }

/* ============ PWA安装引导条 ============ */
.install-tip {
  display: flex; align-items: center; gap: 8px;
  background: #fffbeb; border: 1px dashed #f59e0b;
  border-radius: 12px; padding: 10px 12px; margin: 0 14px 8px;
  font-size: 11.5px; color: #92400e; font-weight: 600; line-height: 1.4;
  animation: fadeUp 0.35s ease;
}
.install-tip i { font-size: 18px; color: #f59e0b; flex-shrink: 0; }
.install-tip span { flex: 1; }
.install-close {
  border: none; background: none; color: #b45309;
  font-size: 18px; cursor: pointer; padding: 0 4px; line-height: 1;
}

/* ============ 响应式 ============ */
/* 小屏手机：全屏App形态 */
@media (max-width: 639px) {
  .phone-frame { min-height: 100dvh; }
}
/* 超小屏微调 */
@media (max-width: 400px) {
  .app-title { font-size: 17px; }
  .weather-chip { font-size: 11px; padding: 5px 10px; }
}
