/* 花樣年華：iOS「Liquid Glass」風格。深色為主（演唱會現場較不刺眼、OLED 較省電），跟隨系統切換淺色。 */

:root {
  color-scheme: dark;
  --bg-0: #0a0612;
  --bg-1: #1d1035;
  --blob-1: rgba(124, 58, 237, 0.55);
  --blob-2: rgba(192, 38, 211, 0.36);
  --blob-3: rgba(59, 130, 246, 0.28);
  --text: rgba(255, 255, 255, 0.96);
  --text-2: rgba(235, 235, 245, 0.68);
  --text-3: rgba(235, 235, 245, 0.42);
  --hairline: rgba(255, 255, 255, 0.10);
  --glass: rgba(255, 255, 255, 0.07);
  --glass-strong: rgba(255, 255, 255, 0.13);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-hi: rgba(255, 255, 255, 0.30);
  --rim: rgba(255, 255, 255, 0.55);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --accent: #c4a8ff;
  --accent-strong: #8b5cf6;
  --green: #30d158;
  --orange: #ff9f0a;
  --red: #ff453a;
  --blue: #64d2ff;
  --shout: #64d2ff;
  --sing: #ff6482;
  --r-xl: 28px;
  --r-l: 22px;
  --r-m: 16px;
  --blur: blur(26px) saturate(180%);
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg-0: #ece5fa;
    --bg-1: #f8f5ff;
    --blob-1: rgba(167, 139, 250, 0.55);
    --blob-2: rgba(240, 171, 252, 0.45);
    --blob-3: rgba(147, 197, 253, 0.45);
    --text: rgba(17, 12, 28, 0.94);
    --text-2: rgba(60, 60, 67, 0.74);
    --text-3: rgba(60, 60, 67, 0.50);
    --hairline: rgba(60, 60, 67, 0.16);
    --glass: rgba(255, 255, 255, 0.50);
    --glass-strong: rgba(255, 255, 255, 0.74);
    --glass-border: rgba(255, 255, 255, 0.75);
    --glass-hi: rgba(255, 255, 255, 0.95);
    --rim: rgba(255, 255, 255, 0.95);
    --shadow: 0 10px 30px rgba(76, 29, 149, 0.14);
    --accent: #6d28d9;
    --accent-strong: #7c3aed;
    --green: #248a3d;
    --orange: #b25000;
    --red: #d70015;
    --blue: #0071a4;
    --shout: #0062b8;
    --sing: #c2185b;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text);
  background: var(--bg-0);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

/* 背景：靜態的漸層光暈（不做動畫，省電） */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0) 70%);
}
.blob { position: absolute; border-radius: 50%; }
.b1 { width: 90vmax; height: 90vmax; left: -40vmax; top: -45vmax; background: radial-gradient(circle, var(--blob-1), transparent 62%); }
.b2 { width: 80vmax; height: 80vmax; right: -45vmax; top: 10vh; background: radial-gradient(circle, var(--blob-2), transparent 62%); }
.b3 { width: 80vmax; height: 80vmax; left: -30vmax; bottom: -50vmax; background: radial-gradient(circle, var(--blob-3), transparent 62%); }

.view {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 8px) 16px calc(env(safe-area-inset-bottom) + 112px);
  outline: none;
}
.boot { padding: 40vh 0; text-align: center; color: var(--text-2); }
.boot-wrap { padding-top: 30vh; }

.large-title { padding: 16px 4px 6px; }
.large-title h1 { margin: 2px 0 0; font-size: 34px; line-height: 1.12; font-weight: 700; letter-spacing: -0.022em; }
.eyebrow { margin: 0; font-size: 13px; font-weight: 600; color: var(--text-2); }
.subtitle { margin: 6px 0 0; font-size: 15px; color: var(--text-2); }

/* 玻璃材質 */
.glass {
  position: relative;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi);
}
.glass::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--rim), transparent 32%, transparent 68%, color-mix(in srgb, var(--rim) 45%, transparent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.card { border-radius: var(--r-xl); padding: 16px 18px; margin: 12px 0; }
.card > h2 { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.card p { margin: 6px 0; }
.big { font-size: 26px; font-weight: 700; line-height: 1.25; letter-spacing: -0.015em; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.mono { font-variant-numeric: tabular-nums; }
.icon { width: 20px; height: 20px; flex: none; }

/* 分段控制 */
.segmented { display: flex; gap: 4px; margin: 12px 0; padding: 4px; border-radius: 999px; }
.segmented button {
  flex: 1 1 0;
  min-width: 0;
  min-height: 40px;
  padding: 0 6px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.segmented button[aria-pressed="true"] {
  background: var(--glass-strong);
  color: var(--text);
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 2px 10px rgba(0, 0, 0, 0.18);
}
.segmented.compact button { min-height: 36px; font-size: 14px; }
.segmented a {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.segmented a[aria-current="page"] {
  background: var(--glass-strong);
  color: var(--text);
  box-shadow: inset 0 1px 0 var(--glass-hi), 0 2px 10px rgba(0, 0, 0, 0.18);
}

/* 應援步驟：喊（藍）／唱（紅），對應官方指南的顏色 */
.act { display: inline-flex; justify-content: center; min-width: 28px; padding: 0 6px; border-radius: 8px; font-size: 12px; font-weight: 700; line-height: 1.7; white-space: nowrap; }
.act.shout { color: var(--shout); background: color-mix(in srgb, var(--shout) 18%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--shout) 45%, transparent); }
.act.sing { color: var(--sing); background: color-mix(in srgb, var(--sing) 18%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--sing) 45%, transparent); }
.act.other { color: var(--text-2); background: var(--glass-strong); }
.legend { margin: 0 0 8px; color: var(--text-2); }
.cue-sections { margin-top: 6px; }
.cue-warning { margin: 6px 0; padding: 6px 10px; border-radius: 10px; background: color-mix(in srgb, var(--orange) 14%, transparent); color: var(--text); }
.cue-sec { padding: 8px 0; border-top: 0.5px solid var(--hairline); }
.cue-sec:first-child { padding-top: 2px; border-top: 0; }
.cue-sec-name { margin-bottom: 4px; font-size: 12px; font-weight: 700; color: var(--accent); }
.cue-sec.same { display: flex; align-items: baseline; gap: 10px; }
.cue-sec.same .cue-sec-name { margin: 0; }
.cue-steps { margin: 0; padding: 0; list-style: none; }
.cue-step { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 8px; padding: 3px 0; }
.cue-step .act { margin-top: 1px; }
.cue-what { font-size: 15px; color: var(--text); }

/* 存官方指南清單 */
.guide-list { margin: 8px 0 0; padding: 0; list-style: none; }
.guide-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 0.5px solid var(--hairline); }
.guide-list li:first-child { border-top: 0; }
.guide-list .guide-check { flex: 1 1 auto; border-top: 0; padding: 10px 2px; align-items: center; }
.guide-list .link { flex: none; white-space: nowrap; }

/* 應援小抄 */
.big-chant { margin: 4px 0; font-size: 18px; line-height: 1.5; }
.cheer-song { padding: 12px 0; border-top: 0.5px solid var(--hairline); }
.cheer-song:first-child { padding-top: 2px; border-top: 0; }
.cheer-cues { margin: 6px 0 4px; font-size: 15px; }
.cheer-cues > ul { margin: 0; padding-left: 1.2em; }
.cue .cue-steps, .cheer-cues .cue-steps { padding-left: 0; }
.cheer-cues li { margin: 3px 0; }

/* 按鈕 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: var(--glass-strong);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: inset 0 1px 0 var(--glass-hi);
  transition: transform 0.12s ease;
}
.btn:active { transform: scale(0.97); }
.btn.primary {
  color: #fff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent-strong) 85%, white 15%), var(--accent-strong));
  border-color: color-mix(in srgb, var(--accent-strong) 55%, white 45%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 8px 24px color-mix(in srgb, var(--accent-strong) 40%, transparent);
}
.btn.block { width: 100%; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.btn-row .btn { flex: 1 1 auto; }
.link { color: var(--accent); font-weight: 600; text-decoration: none; }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }

/* 標籤 */
.badge, .tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--glass-strong);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
  vertical-align: middle;
}
.badge.best, .tag.verified { color: var(--green); }
.badge.ok, .tag.past { color: var(--blue); }
.badge.short, .tag.unverified { color: var(--orange); }
.badge.cheer { color: var(--accent); }
.tag.pending { color: var(--text-2); }

/* 列表 */
.rows { margin: 0; padding: 0; list-style: none; }
.rows > li { padding: 11px 0; border-top: 0.5px solid var(--hairline); }
.rows > li:first-child { padding-top: 4px; border-top: 0; }
.kv { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.steps { margin: 4px 0 0; padding-left: 1.3em; }
.steps li { margin: 6px 0; }

/* 狀態 */
.tone-good { --tone: var(--green); }
.tone-warn { --tone: var(--orange); }
.tone-bad { --tone: var(--red); }
.status { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.dot { flex: none; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--tone, var(--accent)); box-shadow: 0 0 10px var(--tone, var(--accent)); }
.result { border-color: color-mix(in srgb, var(--tone, var(--glass-border)) 65%, transparent); }
.result .big { color: var(--tone, var(--text)); }

/* 倒數 */
.countdown { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 4px 0 2px; }
.countdown b { font-size: 46px; font-weight: 700; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.countdown span { margin-left: 2px; font-size: 15px; font-weight: 600; color: var(--text-2); }

/* 首頁磚塊 */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.tile { display: block; min-height: 100px; padding: 14px; border-radius: var(--r-l); color: inherit; text-decoration: none; }
.tile .icon { width: 22px; height: 22px; color: var(--accent); }
.tile b { display: block; margin-top: 8px; font-size: 17px; line-height: 1.3; }
.tile span { display: block; margin-top: 2px; font-size: 13px; color: var(--text-2); }

/* 現場 */
.now-title { margin: 4px 0; font-size: 30px; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; }
.cue {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: var(--r-m);
  background: color-mix(in srgb, var(--accent-strong) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--text);
  font-size: 15px;
}
.cue ul { margin: 6px 0 0; padding-left: 1.2em; }
.cue li { margin: 3px 0; }
.chant { display: block; margin-top: 4px; font-weight: 600; letter-spacing: 0.01em; }
.fan-event { margin: 0 0 8px; padding: 0 0 8px; border-bottom: 0.5px solid var(--hairline); }
.fan-event .kv { align-items: flex-start; }
.fan-event:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
.cheer-song .fan-event { margin-top: 6px; padding: 8px 10px; border: 0; border-radius: 12px; background: color-mix(in srgb, var(--accent-strong) 16%, transparent); }

.act-title { margin: 20px 6px 8px; font-size: 13px; font-weight: 700; color: var(--text-2); letter-spacing: 0.04em; }
.setlist { padding: 6px; border-radius: var(--r-xl); }
.seg-list { margin: 0; padding: 0; list-style: none; }
.seg { border-radius: var(--r-m); }
.seg + .seg { margin-top: 2px; }
.seg-head {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.seg-time { font-size: 14px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.seg-title { font-weight: 600; }
.seg-note { display: block; font-size: 12px; font-weight: 500; color: var(--text-3); }
.seg-badges { display: flex; gap: 4px; }
.seg.is-aux .seg-title { font-weight: 500; color: var(--text-2); }
.seg.is-past { opacity: 0.5; }
.seg.is-current {
  background: color-mix(in srgb, var(--accent-strong) 24%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent);
}
.seg.is-current .seg-time { color: var(--accent); font-weight: 700; }
.seg-detail { padding: 0 12px 12px 22px; font-size: 14px; color: var(--text-2); }
.seg-detail .btn { margin-top: 10px; }

/* 散場 */
.field { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.field label { font-weight: 600; }
input[type="time"], input[type="text"] {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  background: var(--glass-strong);
  color: var(--text);
  font: inherit;
  font-size: 17px;
}
input[type="time"] { min-width: 124px; font-variant-numeric: tabular-nums; }
input[type="text"] { width: 100%; }
.leg { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.leg-label { font-size: 15px; }
.stepper {
  flex: none;
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 999px;
  background: var(--glass-strong);
  box-shadow: inset 0 1px 0 var(--glass-hi);
}
.stepper button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; color: var(--text); font-size: 20px; line-height: 1; cursor: pointer; }
.stepper button:active { background: var(--glass); }
.stepper output { min-width: 56px; font-size: 15px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.total { display: flex; justify-content: space-between; gap: 12px; padding-top: 10px; border-top: 0.5px solid var(--hairline); font-weight: 700; }
.total.sub { padding-top: 4px; border-top: 0; }

/* 高鐵班次清單 */
.train-list { margin: 4px 0 6px; padding: 0; list-style: none; }
.train-list li + li { border-top: 0.5px solid var(--hairline); }
.train {
  display: grid;
  grid-template-columns: 50px 1fr;
  align-items: center;
  row-gap: 2px;
  gap: 10px;
  width: 100%;
  padding: 10px 8px;
  border: 0;
  border-radius: var(--r-m);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.train[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent-strong) 24%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent);
}
.train-dep { font-size: 18px; font-weight: 700; }
.train-main { display: flex; flex-direction: column; min-width: 0; }
.train-main b { font-weight: 600; }
.train-status { grid-column: 2; display: inline-flex; align-items: center; gap: 6px; color: var(--tone); font-size: 13px; font-weight: 600; }
.train-status .dot { width: 8px; height: 8px; }

/* 清單 */
.progress { height: 8px; margin: 10px 0 4px; overflow: hidden; border-radius: 999px; background: var(--glass-strong); }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-strong), var(--accent)); }
.check {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: start;
  gap: 12px;
  width: 100%;
  padding: 12px 2px;
  border: 0;
  border-top: 0.5px solid var(--hairline);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.card > h2 + .check { border-top: 0; }
.check-box { display: grid; place-items: center; width: 26px; height: 26px; margin-top: 1px; border: 2px solid var(--text-3); border-radius: 50%; color: transparent; }
.check-box .icon { width: 16px; height: 16px; stroke-width: 3; }
.check[aria-checked="true"] .check-box { border-color: var(--green); background: var(--green); color: #fff; }
.check[aria-checked="true"] .check-title { color: var(--text-2); text-decoration: line-through; text-decoration-color: var(--text-3); }
.check-title { font-weight: 600; }
.check-detail { display: block; margin-top: 2px; font-size: 13px; color: var(--text-2); }

/* 急救 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { min-height: 36px; padding: 0 14px; border: 1px solid var(--glass-border); border-radius: 999px; background: var(--glass-strong); color: var(--text); font: inherit; font-size: 14px; cursor: pointer; }
.call-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px; }
.call-grid .btn { flex-direction: column; gap: 0; min-height: 64px; padding: 6px; font-size: 13px; }
.call-grid .btn b { font-size: 22px; }

/* 撇步分頁 */
.tip-nav { margin: 4px 0 8px; }
.tip-section { scroll-margin-top: calc(env(safe-area-inset-top) + 12px); }
.tip { padding: 12px 0; border-top: 0.5px solid var(--hairline); }
.tip-section .tip:first-of-type { border-top: 0; padding-top: 4px; }
.tip-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.tip p { margin: 4px 0; font-size: 15px; color: var(--text-2); }
.tip .caution { color: var(--text); }
.tip-links { margin-top: 6px; }
.tip-area { margin: 16px 0 2px; font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: 0.02em; }
.tip-area + .tip { border-top: 0; padding-top: 4px; }

/* 摺疊區塊 */
details { border-top: 0.5px solid var(--hairline); }
.card > h2 + details { border-top: 0; }
summary { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; font-weight: 600; list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "›"; font-size: 22px; line-height: 1; color: var(--text-3); transition: transform 0.2s; }
details[open] summary::after { transform: rotate(90deg); }
details > div { padding: 0 0 12px; font-size: 15px; color: var(--text-2); }
.caution { padding: 8px 12px; border-radius: 12px; background: color-mix(in srgb, var(--orange) 14%, transparent); color: var(--text); font-size: 14px; }

/* 底部分頁列（浮動膠囊） */
.tabbar {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 10px);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 2px;
  width: min(520px, calc(100% - 24px));
  padding: 6px;
  border-radius: 999px;
}
.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 52px;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
}
.tabbar .icon { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--accent); background: var(--glass-strong); box-shadow: inset 0 1px 0 var(--glass-hi); }

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 84px);
  transform: translateX(-50%);
  max-width: calc(100% - 48px);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}
.toast[hidden] { display: none; }

.footnote { margin: 18px 6px; font-size: 12px; color: var(--text-3); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 不支援毛玻璃的瀏覽器：改用不透明底色，維持可讀性 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root {
    --glass: color-mix(in srgb, var(--bg-1) 90%, gray 10%);
    --glass-strong: color-mix(in srgb, var(--bg-1) 75%, gray 25%);
  }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
