/* ===== 主題：粉紫深色＋半透明卡片。想換風格只改這個檔和 assets/ 的圖 ===== */
:root {
  --bg: #120c1a;
  --card: rgba(30, 19, 42, .62);
  --card2: rgba(255, 255, 255, .07);
  --line: rgba(255, 255, 255, .13);
  --text: #f7f0fb;
  --muted: #b8a8c8;
  --accent: #ff3d6e;
  --accent2: #d6246e;
  --accent-text: #ff6f94;
  --gold: #f5c451;
  --green: #4ade80;
  --yellow: #f5c542;
  --red: #ff5d73;
  --blue: #4aa8ff;
  --purple: #b79cff;
  --radius: 18px;
  --font-body: "Noto Sans TC", system-ui, -apple-system, "PingFang TC", sans-serif;
  --font-title: "Noto Sans TC", system-ui, -apple-system, "PingFang TC", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); }
.app { max-width: 430px; margin: 0 auto; min-height: 100vh; position: relative; display: flex; flex-direction: column; gap: 12px; padding: 16px 14px 96px; overflow: hidden; background: radial-gradient(120% 60% at 80% 0%, #2a1240 0%, #170f22 45%, #0f0a16 100%); }

/* 角色層：每頁可以用 assets/char_<頁名>.png，沒有就用 char_main.png。頁名：today / train / cf / sess / body / me */
.char-layer { position: fixed; top: 0; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 430px; pointer-events: none; z-index: 0; overflow: hidden; }
.char-layer img { position: absolute; right: -8%; top: 0; height: 100%; width: auto; max-width: none; object-fit: cover; opacity: .95; }
.char-layer::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(18,12,26,.35) 0%, rgba(18,12,26,.1) 30%, rgba(18,12,26,.75) 75%, rgba(18,12,26,.95) 100%); }
.app[data-page="train"] .char-layer, .app[data-page="rec"] .char-layer, .app[data-page="other"] .char-layer { display: none; }
.app[data-page="sess"] .char-layer img { right: -30%; opacity: .55; }
.app[data-page="cf"] .char-layer img { right: -25%; top: 30%; height: 70%; opacity: .8; }
.app[data-page="body"] .char-layer img { right: auto; left: -20%; top: 25%; height: 75%; opacity: .75; }
.simple .char-layer { display: none; }

.content { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.title { font-family: var(--font-title); font-weight: 800; letter-spacing: .2px; }
.muted { color: var(--muted); font-size: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.hidden, [hidden] { display: none !important; }

.btn { min-height: 48px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--card2); color: var(--text); font: 700 15px var(--font-body); cursor: pointer; backdrop-filter: blur(10px); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; color: #fff; box-shadow: 0 6px 18px rgba(255,61,110,.35); }
.btn.big { min-height: 56px; width: 100%; font-size: 17px; }
.btn.sm { min-height: 44px; flex: 1; }
a.btn { display: block; text-align: center; text-decoration: none; line-height: 46px; }
.btn[disabled] { opacity: .5; }
.chip { flex: 1; min-height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--card2); color: var(--text); font-size: 13px; cursor: pointer; }
.chip.on { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; color: #fff; }
.stepper button { width: 44px; height: 48px; border-radius: 14px; border: 1px solid var(--line); background: var(--card2); color: var(--text); font-size: 24px; cursor: pointer; }
.stepper .val { min-width: 62px; text-align: center; font: 800 32px var(--font-title); }

.pill, .lvpill { padding: 4px 12px; border-radius: 20px; border: 1px solid var(--gold); color: var(--gold); font-size: 13px; font-weight: 800; background: rgba(245,196,81,.1); white-space: nowrap; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.tag.ok { border-color: var(--green); color: var(--green); }
.tag.warn { border-color: var(--yellow); color: var(--yellow); }
.tag.bad { border-color: var(--red); color: var(--red); }
.toast { padding: 10px 12px; border-radius: 12px; background: rgba(245,196,81,.12); border: 1px solid var(--gold); color: var(--gold); font-size: 14px; font-weight: 700; }
.msg { position: sticky; top: 8px; z-index: 6; padding: 10px 12px; border-radius: 12px; background: rgba(30,19,42,.92); border: 1px solid var(--gold); color: var(--text); font-size: 14px; }

textarea { width: 100%; min-height: 150px; background: var(--card2); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 10px; font: 13px var(--font-body); }
.search { width: 100%; min-height: 44px; background: var(--card2); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; font: 15px var(--font-body); }

/* 狀態燈 */
.light { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; }
.light i { width: 14px; height: 14px; border-radius: 50%; background: var(--green); display: inline-block; box-shadow: 0 0 10px var(--green); }
.light.y i { background: var(--yellow); box-shadow: 0 0 10px var(--yellow); }
.light.r i { background: var(--red); box-shadow: 0 0 10px var(--red); }
.light.big { font-size: 26px; }
.light.big i { width: 22px; height: 22px; }

/* 頁首 */
.hd { display: flex; align-items: center; justify-content: space-between; padding-top: 4px; }
.hd .date { font-size: 20px; font-weight: 800; }
.hd .sub { font-size: 13px; color: var(--gold); border: 1px solid var(--gold); border-radius: 20px; padding: 3px 12px; font-weight: 800; background: rgba(245,196,81,.1); }
.hero { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.bubble { background: rgba(255,255,255,.1); border: 1px solid var(--line); border-radius: 16px; padding: 10px 14px; font-weight: 700; max-width: 62%; backdrop-filter: blur(12px); }
.bubble.sm { font-size: 12px; font-weight: 500; color: var(--muted); }

/* 指標方塊 */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 4px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.tile .k { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.tile .k i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.tile b { font-size: 22px; font-weight: 800; }
.tile b small { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 2px; }
.tile .bar { margin-top: 2px; }
.bar { height: 6px; background: rgba(255,255,255,.12); border-radius: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--blue); border-radius: 6px; }
.bar.pink > i { background: linear-gradient(90deg, var(--accent), #ff9ab5); }
.bar.gold > i { background: linear-gradient(90deg, var(--gold), #ffe08a); }
.bar.green > i { background: var(--green); }
.pbar { height: 8px; background: rgba(255,255,255,.12); border-radius: 8px; overflow: hidden; position: relative; }
.pbar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #ff9ab5); border-radius: 8px; }
.pbar > u { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--text); opacity: .7; text-decoration: none; }
.mini-spark { width: 70px; height: 24px; }
.mini-spark polyline { fill: none; stroke: var(--accent-text); stroke-width: 2; stroke-linejoin: round; }

/* 課表卡 */
.plan h3 { margin: 0; font-size: 18px; font-weight: 800; }
.exrow { display: flex; align-items: flex-start; gap: 10px; }
.exrow .no { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--accent-text); color: var(--accent-text); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; flex: none; margin-top: 2px; }
.exrow .m { flex: 1; min-width: 0; }
.exrow .m b { font-size: 16px; }
.exrow .r { color: var(--accent-text); font-weight: 800; font-size: 14px; white-space: nowrap; }
.warnbar { border: 1px solid var(--yellow); background: rgba(245,197,66,.1); color: var(--yellow); border-radius: 12px; padding: 8px 10px; font-size: 12px; font-weight: 700; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day { border: 1px solid var(--line); background: var(--card2); border-radius: 12px; padding: 6px 0; text-align: center; color: var(--text); cursor: pointer; font: 700 15px var(--font-body); display: flex; flex-direction: column; gap: 2px; }
.day small { font-size: 10px; color: var(--muted); font-weight: 500; }
.day.on { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; }
.day.on small { color: #fff; }
.day.today:not(.on) { border-color: var(--accent-text); }
.ms { display: flex; flex-direction: column; gap: 4px; }
.ms .row b { font-size: 14px; }
.ms .row span { font-size: 13px; color: var(--accent-text); font-weight: 700; }

/* 部位 */
.part-lv { font-size: 28px; font-weight: 800; color: var(--gold); }
.xpbig { font-size: 34px; font-weight: 800; }
.xpbig small { font-size: 14px; color: var(--muted); font-weight: 500; }
.share { display: grid; grid-template-columns: 44px 1fr 44px; gap: 8px; align-items: center; font-size: 13px; }
.share .pbar > i { background: linear-gradient(90deg, var(--blue), #7fd1ff); }
.share.low .pbar > i { background: linear-gradient(90deg, var(--gold), #ffe08a); }
.share.hi .pbar > i { background: linear-gradient(90deg, var(--green), #9af0bd); }
.share span:last-child { text-align: right; font-weight: 700; }
.spark { width: 100%; height: 70px; }
.spark polyline { fill: none; stroke: var(--accent-text); stroke-width: 2; }
.spark circle { fill: var(--gold); }

/* 成就、列表 */
.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.badge { border: 1px solid var(--line); border-radius: 14px; padding: 10px 4px; text-align: center; font-size: 11px; color: var(--muted); background: var(--card2); display: flex; flex-direction: column; gap: 4px; align-items: center; }
.badge i { font-style: normal; font-size: 26px; filter: grayscale(1); opacity: .45; }
.badge.on { color: var(--gold); border-color: var(--gold); }
.badge.on i { filter: none; opacity: 1; }
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; background: none; border-left: 0; border-right: 0; border-top: 0; color: var(--text); font: 600 14px var(--font-body); width: 100%; }
.li:last-child { border-bottom: 0; }
.li span { color: var(--muted); font-weight: 400; }

/* 動作示意 GIF 小框 */
.demo { height: 130px; border-radius: var(--radius); border: 1px dashed var(--line); background: var(--card); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.demo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.demo .ph { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; text-align: center; padding: 8px; }
.demo .ph small { font-size: 11px; opacity: .7; word-break: break-all; }
.exnav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.exnav::-webkit-scrollbar { display: none; }
.exnav .chip { flex: none; padding: 0 12px; white-space: nowrap; }
.seg { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 5px; backdrop-filter: blur(14px); }
.seg::-webkit-scrollbar { display: none; }
.seg .chip { flex: 1 0 auto; padding: 0 14px; min-height: 40px; border: 0; background: transparent; font-weight: 700; color: var(--muted); }
.seg .chip.on { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2)); }

/* 計時環 */
.ring { position: relative; width: 168px; height: 168px; margin: 0 auto; }
.ring svg { width: 168px; height: 168px; transform: rotate(-90deg); }
.ring .t { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring .t b { font: 800 38px var(--font-title); }
.cfbig { font: 800 56px var(--font-title); text-align: center; }
.prrow { gap: 10px; min-height: 36px; }
.prrow input { width: 20px; height: 20px; accent-color: var(--accent); }

/* 底部導覽 */
.nav { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 430px; display: flex; background: rgba(18,12,26,.88); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); z-index: 5; padding-bottom: env(safe-area-inset-bottom); }
.nav button { flex: 1; min-height: 58px; background: none; border: 0; color: var(--muted); font: 700 11px var(--font-body); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.nav button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav button.on { color: var(--accent-text); }
.nav.hidden { display: none; }

details summary { cursor: pointer; color: var(--muted); font-size: 13px; }
details > div { font-size: 13px; white-space: pre-wrap; margin-top: 6px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.metric { background: var(--card2); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.metric b { font: 800 20px var(--font-title); }
.part { cursor: pointer; }
.part .lv { font: 800 22px var(--font-title); color: var(--gold); }
@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important}}

.partimg { position: relative; height: 220px; border-radius: 18px; overflow: hidden; margin-bottom: 12px; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.04); }
.partimg img { width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block; }
.partph { display: none; position: absolute; inset: 0; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 1.5px dashed rgba(255,255,255,.25); border-radius: 18px; color: var(--muted, #b9a9c9); font-size: 14px; }
.partph small { font-size: 11px; opacity: .7; }

.achmodal { display: none; position: fixed; inset: 0; z-index: 100; align-items: center; justify-content: center; background: rgba(10,6,16,.88); padding: 20px; }
.achbox { width: 100%; max-width: 360px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.achhero { width: 100%; height: 320px; border-radius: 22px; overflow: hidden; position: relative; background: radial-gradient(circle at 50% 30%, rgba(255,61,110,.35), rgba(255,255,255,.04)); border: 1px solid rgba(255,255,255,.12); }
.achhero img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.achfb { position: absolute; inset: 0; align-items: center; justify-content: center; font-size: 84px; }
.achbadge { width: 84px; height: 84px; margin-top: -48px; border-radius: 50%; overflow: hidden; position: relative; background: #1d1228; border: 2px solid var(--gold, #f5c451); box-shadow: 0 0 24px rgba(245,196,81,.5); }
.achbadge img { width: 100%; height: 100%; object-fit: cover; }
.achbadge .achfb { font-size: 40px; }
.achtag { color: var(--gold, #f5c451); font-size: 13px; letter-spacing: 2px; }
.achname { font-size: 26px; font-weight: 800; }
.achline { font-size: 15px; }
.achbox .btn { width: 100%; margin-top: 8px; }
.badge i img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.badge i .achfb { font-size: 22px; }
.badge i { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 50%; }
