/* 情侶儲蓄系統 — 溫暖配色主題
   奶油白底 + 蜜桃粉/珊瑚橘/玫瑰金,圓角柔和,手機優先。 */
:root {
  --bg: #fbf3ec;          /* 奶油米白背景 */
  --bg-soft: #fdf8f4;
  --card: #ffffff;
  --primary: #ef7c63;     /* 珊瑚橘 主色 */
  --primary-dark: #e15c40;
  --accent: #eb6f92;      /* 蜜桃玫瑰 */
  --gold: #e6b566;        /* 暖金 */
  --good: #8bbf9f;        /* 柔綠(達標/正常) */
  --warn: #e8a04e;        /* 暖橘(接近上限) */
  --danger: #e06b6b;      /* 柔紅(超支) */
  --text: #5a4a42;        /* 暖棕文字 */
  --text-soft: #9a8378;
  --line: #f0e3d8;        /* 分隔線 */
  --shadow: 0 6px 22px rgba(216, 158, 130, 0.16);
  --radius: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", "Segoe UI", system-ui, sans-serif;
  background: linear-gradient(180deg, #fdf3ec 0%, #fbeee6 100%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 78px; /* 留給底部導覽 */
}

a { color: var(--primary-dark); text-decoration: none; }

/* ---------- 容器 ---------- */
.wrap { max-width: 540px; margin: 0 auto; padding: 16px 16px 8px; }

.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 2px 14px;
}
.app-header h1 { font-size: 20px; margin: 0; font-weight: 800; letter-spacing: 0.5px; }
.app-header .sub { color: var(--text-soft); font-size: 13px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}
.card h2 { font-size: 16px; margin: 0 0 12px; font-weight: 700; }
.card h2 .emoji { margin-right: 6px; }

.muted { color: var(--text-soft); font-size: 13px; }

/* ---------- 進度條 ---------- */
.progress {
  height: 16px; border-radius: 999px; background: #f3e6dc; overflow: hidden;
  position: relative;
}
.progress > span {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  width: 0%; transition: width 0.8s cubic-bezier(.22,1,.36,1);
}
.progress.good > span { background: linear-gradient(90deg, #9ccc9c, var(--good)); }
.progress.warn > span { background: linear-gradient(90deg, var(--gold), var(--warn)); }
.progress.danger > span { background: linear-gradient(90deg, #ef8a6e, var(--danger)); }

/* ---------- 數字大字 ---------- */
.bignum { font-size: 30px; font-weight: 800; color: var(--primary-dark); }
.bignum small { font-size: 14px; color: var(--text-soft); font-weight: 600; }

/* ---------- 按鈕 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; cursor: pointer; font-size: 15px; font-weight: 700;
  padding: 12px 18px; border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; box-shadow: 0 4px 14px rgba(239,124,99,0.35);
  transition: transform .12s, box-shadow .12s; font-family: inherit;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn.block { display: flex; width: 100%; }
.btn.ghost { background: #fff; color: var(--primary-dark); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.gray { background: #f1e7df; color: var(--text); box-shadow: none; }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: 11px; }
.btn.line { background: #06c755; box-shadow: 0 4px 14px rgba(6,199,85,0.3); }

/* ---------- 表單 ---------- */
label.field { display: block; margin-bottom: 12px; font-size: 13px; color: var(--text-soft); font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%; margin-top: 5px; padding: 12px 14px; font-size: 16px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg-soft);
  color: var(--text); font-family: inherit; outline: none;
}
.input:focus { border-color: var(--primary); background: #fff; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* segmented 切換 (誰付/是否約會) */
.seg { display: flex; gap: 8px; margin-top: 5px; flex-wrap: wrap; }
.seg button {
  flex: 1; min-width: 80px; padding: 10px; border-radius: 12px; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--bg-soft); color: var(--text);
  font-size: 14px; font-weight: 600; font-family: inherit;
}
.seg button.on { background: var(--primary); color: #fff; border-color: var(--primary); }

/* chips (分類選擇) */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 5px; }
.chip {
  padding: 8px 12px; border-radius: 999px; cursor: pointer; font-size: 14px;
  border: 1.5px solid var(--line); background: #fff; color: var(--text); font-weight: 600;
}
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- 列表 ---------- */
.tx-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 4px;
  border-bottom: 1px solid var(--line);
}
.tx-item:last-child { border-bottom: none; }
.tx-icon {
  width: 42px; height: 42px; border-radius: 12px; display: flex;
  align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0;
  background: #fbeee6;
}
.tx-main { flex: 1; min-width: 0; }
.tx-main .t1 { font-weight: 700; font-size: 15px; }
.tx-main .t2 { color: var(--text-soft); font-size: 12px; }
.tx-amt { font-weight: 800; font-size: 17px; color: var(--primary-dark); white-space: nowrap; }
.tag {
  display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px;
  color: #fff; font-weight: 700; vertical-align: middle;
}

/* ---------- 提醒橫幅 ---------- */
.banner {
  border-radius: 14px; padding: 12px 16px; margin-bottom: 16px; font-weight: 600;
  display: flex; align-items: center; gap: 8px; font-size: 14px;
}
.banner.warn { background: #fdf0dc; color: #b9772a; }
.banner.danger { background: #fbe2e2; color: #c0494b; }
.banner.good { background: #e6f3ea; color: #4f8b66; }

/* ---------- 底部導覽 ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; justify-content: space-around; align-items: center;
  background: #fffdfb; border-top: 1px solid var(--line);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 18px rgba(216,158,130,0.12);
}
.bottom-nav a {
  flex: 1; text-align: center; color: var(--text-soft); font-size: 11px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-weight: 600;
}
.bottom-nav a .ic { font-size: 21px; line-height: 1; }
.bottom-nav a.on { color: var(--primary-dark); }

/* ---------- 浮動新增鈕 ---------- */
.fab {
  position: fixed; right: 18px; bottom: 86px; z-index: 60;
  width: 58px; height: 58px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; font-size: 30px; line-height: 1;
  box-shadow: 0 8px 22px rgba(239,124,99,0.45);
}

/* ---------- modal ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(90,74,66,0.4); z-index: 100;
  display: none; align-items: flex-end; justify-content: center;
}
.modal-mask.show { display: flex; }
.modal {
  background: var(--card); width: 100%; max-width: 540px;
  border-radius: 22px 22px 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
  max-height: 90vh; overflow-y: auto;
  animation: slideUp .28s cubic-bezier(.22,1,.36,1);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal h3 { margin: 0 0 16px; font-size: 18px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(20px);
  background: #5a4a42; color: #fff; padding: 11px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none;
  transition: opacity .3s, transform .3s; z-index: 200; max-width: 90%;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #c0494b; }

/* 達標慶祝小動畫 */
.reached-badge {
  display: inline-block; background: var(--good); color: #fff; font-size: 11px;
  padding: 2px 9px; border-radius: 999px; font-weight: 700; margin-left: 6px;
  animation: pop .5s ease;
}
@keyframes pop { 0%{transform:scale(0)} 60%{transform:scale(1.25)} 100%{transform:scale(1)} }

/* ---------- 大頭貼 ---------- */
.avatar-pair { display: flex; align-items: center; gap: 8px; }
.avatar-pair .heart { font-size: 20px; }
.avatar {
  width: 52px; height: 52px; border-radius: 50%; object-fit: cover; display: flex;
  align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 20px;
  border: 2.5px solid #fff; box-shadow: 0 2px 8px rgba(216,158,130,.3); position: relative; background: #ddd;
}
.avatar.tappable { cursor: pointer; }
.avatar.tappable::after {
  content: '✎'; position: absolute; right: -2px; bottom: -2px; width: 18px; height: 18px;
  background: var(--primary); color: #fff; border-radius: 50%; font-size: 10px;
  display: flex; align-items: center; justify-content: center; border: 2px solid #fff;
}

/* ---------- 相簿 ---------- */
.album-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; -webkit-overflow-scrolling: touch; }
.album-chip {
  flex-shrink: 0; padding: 8px 14px; border-radius: 999px; cursor: pointer; font-size: 14px;
  border: 1.5px solid var(--line); background: #fff; color: var(--text); font-weight: 600; white-space: nowrap;
}
.album-chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.album-chip .cnt { opacity: .7; font-size: 12px; margin-left: 3px; }

.date-head { font-weight: 700; color: var(--text-soft); font-size: 13px; margin: 14px 2px 8px; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.photo-cell {
  position: relative; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden;
  background: #f1e4da; cursor: pointer;
}
.photo-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-cell .play-badge {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 30px; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.5); background: rgba(0,0,0,.12);
}
.photo-cell .vid-ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 30px; }

/* lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 300; background: rgba(30,22,18,.94);
  display: none; flex-direction: column;
}
.lightbox.show { display: flex; }
.lightbox .lb-top {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 16px;
  color: #fff; gap: 10px; padding-top: calc(14px + env(safe-area-inset-top));
}
.lightbox .lb-top .x { font-size: 26px; cursor: pointer; line-height: 1; background: none; border: none; color: #fff; }
.lightbox .lb-body { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.lightbox .lb-body img, .lightbox .lb-body video { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox .lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); font-size: 34px; color: #fff;
  background: rgba(0,0,0,.25); border: none; width: 46px; height: 46px; border-radius: 50%; cursor: pointer;
}
.lightbox .lb-nav.prev { left: 8px; } .lightbox .lb-nav.next { right: 8px; }
.lightbox .lb-bottom { padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); color: #f3e9e2; }
.lightbox .lb-bottom .meta { font-size: 13px; opacity: .8; margin-bottom: 8px; }
.lightbox .lb-bottom .acts { display: flex; gap: 8px; flex-wrap: wrap; }

/* 上傳進度 */
.up-item { display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid var(--line); }
.up-thumb { width:44px; height:44px; border-radius:8px; object-fit:cover; background:#f1e4da; flex-shrink:0; }
.up-bar { flex:1; height:8px; border-radius:999px; background:#f3e6dc; overflow:hidden; }
.up-bar > span { display:block; height:100%; background:linear-gradient(90deg,var(--primary),var(--accent)); width:0; transition:width .2s; }

.empty { text-align: center; color: var(--text-soft); padding: 28px 10px; font-size: 14px; }
.center { text-align: center; }
.mt8{margin-top:8px}.mt16{margin-top:16px}.mb8{margin-bottom:8px}
.flex-between{display:flex;align-items:center;justify-content:space-between;gap:10px}
