/* sub2run — 手機優先。單手操作，跑完累癱時也點得動。 */
:root {
  --bg: #0d0d10;
  --surface: #16161b;
  --surface-2: #1e1e25;
  --line: #2a2a33;
  --text: #e9e9ec;
  --muted: #8b8b96;
  --accent: #ff7a45;
  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;
  --z1: #64748b; --z2: #4ade80; --z3: #fbbf24; --z4: #fb923c; --z5: #f87171;
  --r: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: 0 0 96px;
  min-height: 100dvh;
}
a { color: var(--accent); text-decoration: none; }

/* ── 版面 ───────────────────────────────────── */
.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px; }

header.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(13, 13, 16, .88);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
  padding: env(safe-area-inset-top) 0 0;
}
header.top .row {
  display: flex; align-items: baseline; gap: 10px;
  padding: 12px 16px; max-width: 640px; margin: 0 auto;
}
header.top h1 { font-size: 1.05rem; margin: 0; letter-spacing: .04em; }
header.top .sub { color: var(--muted); font-size: .8rem; margin-left: auto; }

/* ── 卡片 ───────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
  margin: 12px 0;
}
.card.accent { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.card h2 { font-size: .95rem; margin: 0 0 10px; letter-spacing: .03em; }
.card h3 { font-size: .85rem; margin: 16px 0 6px; color: var(--muted); font-weight: 600; }

.muted { color: var(--muted); }
.small { font-size: .84rem; }
.center { text-align: center; }

/* ── 今日大卡 ───────────────────────────────── */
.today .date { color: var(--muted); font-size: .82rem; letter-spacing: .06em; }
.today .title { font-size: 1.5rem; font-weight: 650; margin: 4px 0 10px; line-height: 1.3; }
.today .spec { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 12px; font-size: .84rem;
}
.chip.z2 { border-color: color-mix(in srgb, var(--z2) 50%, var(--line)); }
.chip.z4 { border-color: color-mix(in srgb, var(--z4) 50%, var(--line)); }

/* ── 按鈕 ───────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 12px 20px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px;
  font: inherit; font-weight: 600; cursor: pointer;
  width: 100%; margin-top: 10px;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a0d06; }
.btn.ghost { background: transparent; }
.btn.danger { border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); color: var(--danger); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { margin-top: 10px; }

/* ── 表單 ───────────────────────────────────── */
label { display: block; font-size: .82rem; color: var(--muted); margin: 14px 0 5px; }
input, select, textarea {
  width: 100%; padding: 13px 14px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 11px;
  font: inherit; font-size: 1.05rem;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input.unread { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--surface-2)); }
.field-note { font-size: .76rem; color: var(--danger); margin-top: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

/* ── 狀態列 ─────────────────────────────────── */
.banner {
  border-radius: 11px; padding: 12px 14px; margin: 12px 0; font-size: .88rem;
  border: 1px solid;
}
.banner.err { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); color: #ffd9d9; }
.banner.warn { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); color: #ffeec2; }
.banner.ok { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); color: #d6ffe4; }

/* ── 清單 ───────────────────────────────────── */
.sess {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 0; border-top: 1px solid var(--line);
}
.sess:first-of-type { border-top: 0; }
.sess .dot {
  flex: none; width: 10px; height: 10px; border-radius: 50%;
  margin-top: 8px; background: var(--muted);
}
.sess.done .dot { background: var(--ok); }
.sess.skipped .dot { background: var(--danger); }
.sess.today-row .dot { background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.sess .body { flex: 1; min-width: 0; }
.sess .t { font-weight: 600; font-size: .95rem; }
.sess .m { color: var(--muted); font-size: .8rem; }
.sess a.go { flex: none; color: var(--muted); font-size: 1.3rem; padding: 4px 2px; }

/* ── 照片 ───────────────────────────────────── */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; margin-top: 10px; }
.photos figure { margin: 0; position: relative; aspect-ratio: 3/4; }
.photos img { width: 100%; height: 100%; object-fit: cover; border-radius: 9px; border: 1px solid var(--line); }
.photos button.x {
  position: absolute; top: 4px; right: 4px; width: 26px; height: 26px;
  border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; cursor: pointer;
}

/* ── 底部導覽 ───────────────────────────────── */
nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: rgba(13,13,16,.94);
  backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs a {
  flex: 1; text-align: center; padding: 11px 0 9px;
  color: var(--muted); font-size: .7rem; letter-spacing: .04em;
}
nav.tabs a .i { display: block; font-size: 1.25rem; line-height: 1.2; }
nav.tabs a.on { color: var(--accent); }

/* ── 進度條 ─────────────────────────────────── */
.bar { height: 7px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 6px 0; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

.kpi { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0; }
.kpi div { background: var(--surface-2); border-radius: 11px; padding: 11px; text-align: center; }
.kpi .n { font-size: 1.25rem; font-weight: 650; }
.kpi .l { font-size: .72rem; color: var(--muted); }

.spin { display: inline-block; width: 15px; height: 15px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

.hide { display: none !important; }
