/* Apple 風格・黑白淺黑色系:iOS 分組列表 + 半透明頂部列 */
:root {
  --bg: #f5f5f7;             /* Apple 官網的淺灰 */
  --card: #ffffff;
  --ink: #1d1d1f;            /* Apple 的淺黑,不是純黑 */
  --secondary: #6e6e73;
  --tertiary: #aeaeb2;
  --separator: rgba(0, 0, 0, .1);
  --fill: rgba(0, 0, 0, .05);
  --accent: #1d1d1f;         /* 主要按鈕、開關:淺黑 */
  --on-accent: #ffffff;
  --link: #1d1d1f;
  --danger: #d70015;
  --bar: rgba(245, 245, 247, .72);
  --ease: cubic-bezier(.32, .72, 0, 1);   /* iOS 常用的收尾曲線 */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1c1e; --card: #2c2c2e; --ink: #f5f5f7;
    --secondary: #98989d; --tertiary: #636366;
    --separator: rgba(255, 255, 255, .12); --fill: rgba(255, 255, 255, .08);
    --accent: #f5f5f7; --on-accent: #1d1d1f; --link: #f5f5f7;
    --danger: #ff6961; --bar: rgba(28, 28, 30, .72);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  font-size: 17px; line-height: 1.47; letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: var(--link); text-decoration: underline; text-decoration-color: var(--tertiary); text-underline-offset: 3px; }
[hidden] { display: none !important; }

/* 半透明頂部列,內容從下面捲過去 */
.bar {
  position: sticky; top: 0; z-index: 10;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 .5px 0 var(--separator);
  font-weight: 600; font-size: 17px;
}
.bar .inner { max-width: 640px; margin: 0 auto; position: relative; text-align: center; }
.bar .back { position: absolute; left: 0; top: 0; font-weight: 400; text-decoration: none; }

.wrap { max-width: 640px; margin: 0 auto; padding: 8px 16px calc(env(safe-area-inset-bottom) + 40px); }

/* 大標題:字越大,字距越緊 */
.large-title { margin: 20px 4px 4px; font-size: 34px; line-height: 1.1; font-weight: 700; letter-spacing: -.025em; }
.subtitle { margin: 0 4px 24px; color: var(--secondary); font-size: 15px; letter-spacing: 0; }

/* 分組 */
.section-label { margin: 28px 16px 7px; font-size: 13px; color: var(--secondary); letter-spacing: 0; }
.group { background: var(--card); border-radius: 12px; overflow: hidden; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 16px; min-height: 44px; }
.footnote { margin: 8px 16px 0; font-size: 13px; line-height: 1.4; color: var(--secondary); letter-spacing: 0; }
.card { background: var(--card); border-radius: 12px; padding: 16px; }

/* 輸入 */
textarea {
  display: block; width: 100%; min-height: 220px; resize: vertical; padding: 14px 16px 6px;
  border: 0; background: transparent; color: var(--ink);
  font: inherit; font-size: 17px; line-height: 1.5;
}
textarea::placeholder, input::placeholder { color: var(--tertiary); }
textarea:focus, input:focus { outline: none; }
.counter { padding: 0 16px 10px; text-align: right; font-size: 13px; color: var(--secondary); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.counter.over { color: var(--danger); font-weight: 600; }
input[type=password] { width: 100%; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 17px; padding: 0; }

/* 加入照片:清單裡的動作列 */
.picker {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 11px 16px;
  border: 0; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
  transition: background-color .2s;
}
.picker:active { background: var(--fill); transition: none; }
.picker svg { width: 22px; height: 22px; flex: none; color: var(--secondary); }
.preview { position: relative; display: none; }
.preview img { width: 100%; max-height: 380px; object-fit: contain; display: block; background: var(--fill); }
.preview button {
  position: absolute; top: 10px; right: 10px; border: 0; border-radius: 999px; padding: 6px 14px;
  background: rgba(0, 0, 0, .45); color: #fff; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}

/* 圓形勾選框(像 iOS 提醒事項) */
.check-row { justify-content: flex-start; cursor: pointer; }
.check-row span { font-size: 15px; line-height: 1.4; letter-spacing: 0; }
.checkbox {
  appearance: none; -webkit-appearance: none; flex: none; margin: 0;
  width: 24px; height: 24px; border-radius: 50%; cursor: pointer;
  border: 1.5px solid var(--tertiary); background: transparent; display: grid; place-items: center;
  transition: background-color .2s var(--ease), border-color .2s var(--ease), transform .1s ease-out;
}
.checkbox::after {
  content: ""; width: 6px; height: 11px; margin-top: -2px;
  border: solid var(--on-accent); border-width: 0 2.2px 2.2px 0;
  transform: rotate(45deg) scale(0); transition: transform .3s var(--ease);
}
.checkbox:active { transform: scale(.9); }
.checkbox:checked { background: var(--accent); border-color: var(--accent); }
.checkbox:checked::after { transform: rotate(45deg) scale(1); }
.checkbox:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* 按鈕:按下去的瞬間就有反應 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 12px; padding: 10px 16px; font: inherit; font-size: 15px; font-weight: 600; letter-spacing: 0;
  background: var(--accent); color: var(--on-accent); cursor: pointer; text-decoration: none;
  transition: transform .3s var(--ease), opacity .2s;
}
.btn:active { transform: scale(.97); opacity: .8; transition: transform .1s ease-out, opacity .1s; }
.btn:disabled { opacity: .3; cursor: not-allowed; transform: none; }
.btn.block { width: 100%; margin-top: 24px; font-size: 17px; padding: 15px; border-radius: 14px; }
.btn.ghost { background: var(--fill); color: var(--ink); }
.btn.small { padding: 7px 14px; font-size: 14px; border-radius: 999px; }
.btn.danger { background: var(--fill); color: var(--danger); }
.error { color: var(--danger); font-size: 13px; margin: 10px 16px 0; min-height: 1em; letter-spacing: 0; }

/* 投稿成功 */
.done { text-align: center; padding: 40px 20px 28px; animation: rise .5s var(--ease) both; }
.done .check-icon {
  width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%; background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center; animation: pop .5s var(--ease) .1s both;
}
.done .check-icon svg { width: 34px; height: 34px; }
.done .label { color: var(--secondary); font-size: 15px; letter-spacing: 0; }
.done .big { font-size: 48px; line-height: 1.1; font-weight: 700; letter-spacing: -.03em; margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
.done p { color: var(--secondary); font-size: 15px; margin: 0 0 24px; letter-spacing: 0; }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }

footer { text-align: center; color: var(--secondary); font-size: 12px; margin-top: 36px; letter-spacing: 0; }
footer a { color: var(--secondary); }

.prose h2 { font-size: 20px; font-weight: 600; letter-spacing: -.015em; margin: 24px 0 6px; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { font-size: 16px; letter-spacing: 0; }
.prose ul { padding-left: 20px; }

/* 分段選擇器(後台) */
.segmented { display: flex; padding: 2px; border-radius: 9px; background: var(--fill); margin-bottom: 16px; position: relative; }
.segmented button {
  flex: 1; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 13px; font-weight: 500;
  padding: 6px 4px; border-radius: 7px; cursor: pointer; letter-spacing: 0; position: relative; z-index: 1;
}
.segmented button.on { font-weight: 600; }
.segmented .thumb {
  position: absolute; top: 2px; bottom: 2px; left: 2px; border-radius: 7px; background: var(--card);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04);
  transition: transform .35s var(--ease);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .segmented .thumb { background: #636366; } }

/* 減少動態效果:只淡入淡出,不滑也不彈 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
/* 減少透明度:頂部列改成實心 */
@media (prefers-reduced-transparency: reduce) {
  .bar { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* 頂部列的小圖示 */
.bar-logo { width: 22px; height: 22px; border-radius: 5px; vertical-align: -5px; margin-right: 7px; }
