/* 落羽松主題：紅銅/鏽橘的樹、倒影的湖水綠、晨霧米白。
   沿用原本的 token 名稱（olive=主色湖綠、clay=強調鏽橘），其他規則不用改。 */
:root {
  --bg: #f6f1e8; --card: #fffaf3;
  --olive: #2f5d5a; --olive-d: #244a47; --olive-l: #d9e6e2;
  --clay: #c8693a; --clay-l: #f8e3d3;
  --copper: #a8462a;
  --ink: #3a2a20; --muted: #8a7464; --line: #ecdcca; --sand: #efe2d0;
  --tabbar-h: 64px;
  --hero-h: 250px; --water-h: 84px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.5;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
  overflow-wrap: anywhere;
}
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }

/* hero：晨霧天空 → 一排落羽松 → 水面倒影，落葉緩緩飄下 */
.hero {
  position: relative; overflow: hidden; color: var(--ink);
  height: calc(env(safe-area-inset-top) + var(--hero-h));
  padding: calc(env(safe-area-inset-top) + 24px) 20px 0;
  background: linear-gradient(to top,
    #3d6d69 0, var(--olive) var(--water-h),
    #e8b98d var(--water-h), #efd2b2 calc(var(--water-h) + 60px), #f3e3cf 100%);
}
.scene { position: absolute; inset: 0; pointer-events: none; }
.sun {
  position: absolute; left: 60%; top: calc(env(safe-area-inset-top) + 34px); width: 72px; height: 72px; border-radius: 50%;
  background: radial-gradient(circle, #fff3d6 0%, #f6d39a 55%, transparent 72%); opacity: .9;
}
.trees, .refl { position: absolute; left: 0; width: 100%; height: 112px; display: block; }
.trees { bottom: var(--water-h); }
.refl { top: calc(100% - var(--water-h)); transform: scaleY(-1); opacity: .32; filter: blur(1px); }
.ripple { position: absolute; left: 0; right: 0; bottom: calc(var(--water-h) - 18px); height: 2px; background: linear-gradient(90deg, transparent, #ffffff55, transparent); }
.ripple.b { bottom: calc(var(--water-h) - 44px); opacity: .6; }
.leaf {
  position: absolute; top: -12px; width: 10px; height: 3px; border-radius: 2px; background: var(--clay);
  opacity: .85; animation: leaf-fall 8s linear infinite;
}
.leaf:nth-child(1) { left: 8%; }
.leaf:nth-child(2) { left: 24%; animation-delay: -1.5s; background: #e0a35a; }
.leaf:nth-child(3) { left: 47%; animation-delay: -3.5s; }
.leaf:nth-child(4) { left: 71%; animation-delay: -5.5s; background: var(--copper); }
.leaf:nth-child(5) { left: 89%; animation-delay: -2.5s; background: #e0a35a; }
@keyframes leaf-fall {
  0%   { transform: translate(0, 0) rotate(0); }
  50%  { transform: translate(18px, calc(var(--hero-h) / 2)) rotate(160deg); }
  100% { transform: translate(-6px, calc(var(--hero-h) + 20px)) rotate(340deg); }
}
@media (prefers-reduced-motion: reduce) { .leaf { animation: none; display: none; } }

.hero-text {
  position: relative; z-index: 1; display: inline-block; max-width: calc(100% - 56px);
  padding: 6px 12px 8px; margin-left: -6px; border-radius: 14px;
  background: #fbf3e6b8; -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.app-name { font-size: 32px; font-weight: 800; letter-spacing: .04em; color: var(--copper); line-height: 1.2; }
.sub-brand { font-size: 15px; font-weight: 700; color: #5a3a26; margin-top: 2px; }
.dates { font-size: 13px; color: #6a4a36; margin-top: 2px; }
.bell {
  position: absolute; top: calc(env(safe-area-inset-top) + 20px); right: 14px; z-index: 2;
  width: 44px; height: 44px; border-radius: 50%; background: #ffffff8c; font-size: 20px;
  display: grid; place-items: center; box-shadow: 0 1px 4px #3a2a2022;
}
.bell::after {
  content: ""; position: absolute; top: 8px; right: 8px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--clay); border: 2px solid #fffaf3;
}

/* 內容稍微蓋到水面上，和預覽一致 */
main { padding: 0 14px; max-width: 560px; margin: -18px auto 0; position: relative; z-index: 2; }

/* cards */
.card { background: var(--card); border-radius: 18px; padding: 16px; margin-bottom: 12px; box-shadow: 0 2px 0 var(--line); }
.card h2 { font-size: 16px; margin-bottom: 8px; }
/* 倒數卡用米白底，避免和標頭水面同色而「接」在一起 */
.countdown { text-align: center; background: var(--card); color: var(--ink); border: 1.5px solid var(--line); }
.countdown .label { font-size: 13px; color: var(--muted); }
.cd { display: flex; justify-content: center; gap: 10px; margin-top: 8px; }
.cd div { background: var(--clay-l); border-radius: 12px; padding: 6px 0; width: 56px; }
.cd b { display: block; font-size: 24px; color: var(--copper); font-variant-numeric: tabular-nums; }
.cd span { font-size: 11px; color: #8a4a2c; }

.stop .tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--olive-l); color: var(--olive-d); margin-bottom: 8px; }
.stop.now { border: 2px solid var(--clay); }
.stop.now .tag { background: var(--clay); color: #fff; }
.stop .time { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stop h3 { font-size: 20px; margin: 2px 0; }
.stop .place { font-size: 15px; }
.stop .note { font-size: 13px; background: var(--clay-l); color: #8a4a22; border-radius: 10px; padding: 6px 10px; margin-top: 8px; }
.stop .btn { margin-top: 12px; }

.farewell { text-align: center; background: var(--card); border: 2px solid var(--olive-l); }
.farewell h3 { font-size: 22px; margin-bottom: 10px; color: var(--copper); }
.farewell p { font-size: 15px; line-height: 1.8; margin-top: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px;
  border-radius: 12px; padding: 10px 16px; font-weight: 700; font-size: 15px;
  background: var(--olive); color: #fff; text-decoration: none;
}
.btn.full { width: 100%; }
.btn.clay { background: var(--clay); }
.btn.ghost { background: transparent; color: var(--muted); font-weight: 400; }
.btn.sm { min-height: 40px; padding: 6px 14px; font-size: 14px; border-radius: 10px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.announce .a-title { font-weight: 700; }

/* tabbar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex;
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button { flex: 1; min-height: var(--tabbar-h); font-size: 11px; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.tabbar .ti { font-size: 22px; filter: grayscale(1); opacity: .6; }
.tabbar button[aria-current="page"] { color: var(--copper); font-weight: 700; }
.tabbar button[aria-current="page"] .ti { filter: none; opacity: 1; }

/* schedule */
.day-switch { display: flex; background: var(--sand); border-radius: 14px; padding: 4px; margin-bottom: 12px; }
.day-switch button { flex: 1; padding: 10px 8px; border-radius: 10px; font-weight: 700; font-size: 14px; color: var(--muted); }
.day-switch button[aria-selected="true"] { background: var(--card); color: var(--olive-d); box-shadow: 0 1px 3px #0001; }

.timeline { list-style: none; position: relative; margin-top: 6px; }
.timeline::before { content: ""; position: absolute; left: 66px; top: 12px; bottom: 12px; width: 2px; background: var(--line); }
.timeline li { display: grid; grid-template-columns: 54px 22px 1fr auto; gap: 0 6px; align-items: start; padding: 10px 0; border-radius: 12px; }
.timeline .t { text-align: right; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.timeline .t small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
.timeline .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--card); border: 3px solid var(--olive); margin: 2px auto 0; position: relative; z-index: 1; }
.timeline h4 { font-size: 15px; }
.timeline .pl { font-size: 13px; color: var(--muted); }
.timeline .nt { font-size: 12px; color: #8a4a22; margin-top: 2px; }
.map-link { font-size: 12px; background: var(--olive-l); color: var(--olive-d); border-radius: 999px; padding: 8px 12px; font-weight: 700; white-space: nowrap; text-decoration: none; min-height: 36px; display: inline-flex; align-items: center; }
.timeline li.is-done { opacity: .45; }
.timeline li.is-done .dot { background: var(--olive); }
.timeline li.is-now { background: var(--clay-l); }
.timeline li.is-now .dot { border-color: var(--clay); background: var(--clay); box-shadow: 0 0 0 5px #c2703d33; }
.badge { font-size: 11px; background: var(--clay); color: #fff; border-radius: 999px; padding: 1px 7px; margin-left: 4px; vertical-align: 2px; }
.timeline li.flash { animation: flash 1.5s ease; }
@keyframes flash { 0%, 60% { background: var(--clay-l); box-shadow: 0 0 0 3px var(--clay); } 100% { box-shadow: 0 0 0 0 transparent; } }

body[data-mode="after"] #weather-card { display: none !important; }

/* weather */
.wx h2 { display: flex; justify-content: space-between; align-items: baseline; }
.wx h2 small { font-size: 11px; font-weight: 400; color: var(--muted); }
.wx-row { display: grid; grid-template-columns: 70px 30px 1fr auto; align-items: center; gap: 6px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.wx-row .d { font-weight: 700; }
.wx-row .ic { font-size: 22px; text-align: center; }
.wx-row .tp { font-variant-numeric: tabular-nums; }
.wx-row .tp b { color: var(--clay); }
.rain { font-size: 12px; background: #e3ecf0; color: #3d6475; border-radius: 999px; padding: 2px 8px; }
.wx-tip { font-size: 13px; background: var(--olive-l); color: var(--olive-d); border-radius: 10px; padding: 7px 10px; margin-top: 8px; }
.wx-strip { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 14px; padding: 10px 14px; margin-bottom: 12px; font-size: 14px; box-shadow: 0 2px 0 var(--line); }
.wx-strip .ic { font-size: 26px; }
.wx-strip .rain { margin-left: auto; }

/* prep */
.prep { list-style: none; }
.prep li { display: flex; align-items: center; gap: 12px; padding: 14px 2px; border-bottom: 1px dashed var(--line); font-size: 15px; cursor: pointer; min-height: 48px; }
.prep li:last-child { border-bottom: none; }
.box { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--olive); display: grid; place-items: center; color: #fff; font-size: 15px; flex: none; }
.prep li.ok .box { background: var(--olive); }
.prep li.ok span { text-decoration: line-through; color: var(--muted); }
.progress { height: 8px; background: var(--sand); border-radius: 99px; overflow: hidden; margin: 12px 0 6px; }
.progress-bar { height: 100%; width: 0; background: var(--olive); border-radius: 99px; transition: width .25s; }

/* sheets (dialog) */
dialog.sheet {
  border: none; background: var(--bg); color: var(--ink); width: 100%; max-width: 560px;
  margin: auto auto 0; border-radius: 24px 24px 0 0; padding: 0; max-height: 92vh; overflow: auto;
}
dialog.sheet::backdrop { background: #2b241d88; }
dialog.sheet-full { height: 100%; max-height: 100%; border-radius: 0; margin: 0 auto; }
.sheet-inner { padding: 22px 18px calc(env(safe-area-inset-bottom) + 24px); position: relative; }
.sheet h2 { font-size: 20px; text-align: center; }
.sheet .lead { text-align: center; color: var(--muted); font-size: 14px; margin: 4px 0 16px; }
.step { background: var(--card); border-radius: 16px; padding: 14px; margin-bottom: 10px; }
.step-h { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 15px; }
.ok-chip { font-size: 12px; background: var(--olive-l); color: var(--olive-d); border-radius: 999px; padding: 3px 10px; }
.step ol { margin: 10px 0 0 20px; font-size: 13px; line-height: 1.9; color: #5c4c3c; }
.step .btn { margin-top: 10px; }
.step p.muted { margin-top: 6px; }
.share { display: inline-block; border: 1.5px solid #5c4c3c; border-radius: 4px; font-size: 10px; padding: 0 3px; line-height: 14px; }

/* admin */
.x { position: absolute; right: 8px; top: 8px; width: 44px; height: 44px; font-size: 20px; color: var(--muted); }
.stat { display: flex; align-items: baseline; gap: 6px; background: var(--olive); color: #fff; border-radius: 16px; padding: 14px 16px; margin: 16px 0 14px; }
.stat b { font-size: 30px; }
.sec { font-size: 13px; font-weight: 700; color: var(--muted); margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }
.chips button { font-size: 12px; background: var(--card); border: 1.5px solid var(--line); border-radius: 999px; padding: 8px 12px; min-height: 36px; }
.chips button.sel { border-color: var(--olive); background: var(--olive-l); color: var(--olive-d); font-weight: 700; }
.field { display: block; margin-bottom: 10px; }
.field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field input, .field textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--card);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
.field textarea { min-height: 84px; resize: vertical; }
.err { color: #a3361f; font-size: 13px; margin: 6px 0; min-height: 18px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 18px); z-index: 30;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; font-size: 14px; border-radius: 999px; padding: 10px 18px;
  max-width: calc(100vw - 32px); transition: opacity .2s, transform .2s; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
