:root {
  --bg: #0b0e13;
  --card: #151a21;
  --card2: #1e252e;
  --line: #262d38;
  --text: #e8ecf1;
  --muted: #8b95a3;
  --accent: #7cc4ff;
  --on-accent: #06121e;
  --good: #6fd19a;
  --warn: #ffc163;
  --bad: #ff7a7a;
  --radius: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --head-h: 88px; /* 比原本多 18px，避開 iOS 狀態列下方的霧化區 */
  --spring: cubic-bezier(.22, 1, .36, 1);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme=dark]) {
    --bg: #f2f4f7; --card: #ffffff; --card2: #eef1f5; --line: #e1e5eb;
    --text: #141a22; --muted: #66707e; --accent: #0b6bcb; --on-accent: #ffffff;
    --good: #138a4e; --warn: #a76400; --bad: #c62828;
    color-scheme: light;
  }
}

[data-theme=light] {
  --bg: #f2f4f7; --card: #ffffff; --card2: #eef1f5; --line: #e1e5eb;
  --text: #141a22; --muted: #66707e; --good: #138a4e; --warn: #a76400; --bad: #c62828;
  color-scheme: light;
}
[data-size=s] body { font-size: 14px; }
[data-size=l] body { font-size: 17px; }
[data-size=l] .cls .what, [data-size=l] .list-row .l > div:first-child { font-size: 17px; }
[data-motion=off] *, [data-motion=off] *::before, [data-motion=off] *::after { animation: none !important; transition: none !important; }

/* ---------- 像 App：不縮放、不選字、不回彈、整頁不捲動（由各分頁自己捲） ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: manipulation; overscroll-behavior: none; }
body {
  font: 15px/1.5 "Chiron GoRound TC WS", -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  position: fixed; inset: 0;
}
.selectable, .selectable *, input, textarea { -webkit-user-select: text; user-select: text; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.mt { margin-top: 16px; }

/* ---------- 頂部：左右對稱 ---------- */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9;
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px;
  padding: calc(var(--safe-t) + 28px) 16px 14px;
  background: var(--bg);
  pointer-events: none;
}
.top > * { pointer-events: auto; }
.top-mid { text-align: center; min-width: 0; }
.top h1 { margin: 0; font-size: 22px; letter-spacing: 1px; transition: opacity .2s; }
.top h1.swap { animation: titleIn .35s var(--spring); }
@keyframes titleIn { from { opacity: 0; transform: translateY(6px); } }
.top p { margin: 0; font-size: 12px; color: var(--muted); }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); display: grid; place-items: center; padding: 0; transition: transform .2s var(--spring); }
.icon-btn:active { transform: scale(.9); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.spin svg { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 左右滑動的分頁 ---------- */
.pager { position: fixed; inset: 0; display: flex; width: 500vw; will-change: transform; backface-visibility: hidden; }
.pager.dragging .pane { overflow-y: hidden; } /* 左右滑的時候不要同時上下捲 */
.pane { contain: layout paint; }
.pane {
  width: 100vw; height: 100%; flex: none; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain;
  padding: calc(var(--safe-t) + var(--head-h) + 8px) 16px calc(var(--safe-b) + 64px);
}
.pane.enter > * { animation: rise .55s var(--spring) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } }

/* ---------- 底部分頁列（一般實色） ---------- */
.tabs {
  position: fixed; z-index: 10; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 3px 4px max(2px, calc(var(--safe-b) - 16px));
  background: var(--bg); border-top: 1px solid var(--line);
}
.tabs button { position: relative; background: none; border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; font-size: 10px; min-height: 44px;
  color: color-mix(in srgb, var(--accent) calc(var(--on, 0) * 100%), var(--muted)); } /* 滑到一半時顏色跟著漸變 */
.tabs button svg { transform: scale(calc(1 + var(--on, 0) * .08)); }
.tabs svg { width: 22px; height: 22px; transition: transform .4s var(--spring); }
.tabs button:active svg { transform: scale(.85); }
.tabs .dot { position: absolute; top: 4px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--bad); display: none; box-shadow: 0 0 0 2px var(--bg); }
.tabs .dot.show { display: block; animation: pop .5s var(--spring); }
@keyframes pop { from { transform: scale(0); } }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.card-title { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 1px; text-align: center; }
.section-title { font-size: 13px; color: var(--muted); margin: 22px 4px 8px; font-weight: 600; text-align: center; letter-spacing: 1px; }

.clock { text-align: center; padding: 18px 16px 16px; }
.clock .t { font-size: 46px; font-weight: 700; letter-spacing: 1px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.clock .t .s { color: var(--muted); font-weight: 600; }
.clock .d { color: var(--muted); font-size: 14px; margin-top: 4px; letter-spacing: 1px; }

.hero { text-align: center; padding: 20px 16px; background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 22%, var(--card)), var(--card)); }
.hero .label { font-size: 12px; color: var(--accent); font-weight: 600; letter-spacing: 1px; }
.hero .name { font-size: 24px; font-weight: 700; margin: 6px 0 2px; }
.hero .meta { color: var(--muted); font-size: 14px; }

/* 提醒卡（預警） */
.alert { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); background: color-mix(in srgb, var(--bad) 8%, var(--card)); }
.alert.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); background: color-mix(in srgb, var(--warn) 7%, var(--card)); }
.alert-head { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 10px; font-weight: 700; }
.alert-head .ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--bad) 20%, transparent); color: var(--bad); }
.alert.warn .alert-head .ico { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.alert-head .ico svg { width: 18px; height: 18px; }
.alert-head .x { width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--card2); display: grid; place-items: center; padding: 0; color: var(--muted); }
.alert-head .x svg { width: 15px; height: 15px; }
.alert p { margin: 8px 0 0; font-size: 14px; }
.alert.leaving { animation: leave .4s var(--spring) forwards; }
@keyframes leave { to { opacity: 0; transform: scale(.94); margin-bottom: -120px; } }
.rule { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--muted); }
.alert-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0 0; margin-top: 10px; border-top: 1px solid var(--line); min-height: 44px; }

.meter { height: 8px; border-radius: 8px; background: var(--card2); overflow: hidden; margin-top: 10px; }
.meter > i { display: block; height: 100%; border-radius: 8px; background: var(--warn); transform-origin: left; animation: fill 1s var(--spring) both .15s; }
.meter.bad > i { background: var(--bad); }
@keyframes fill { from { transform: scaleX(0); } }
.meter-legend { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* 課程列 */
.cls { display: grid; grid-template-columns: 58px 1fr 18px; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.cls:first-of-type { border-top: 0; }
.cls .time { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); line-height: 1.35; text-align: center; }
.cls .time b { display: block; color: var(--text); font-size: 15px; font-weight: 600; }
.cls .what { font-weight: 600; }
.cls .where { font-size: 13px; color: var(--muted); }
.cls.now { position: relative; }
.cls.now::before { content: ""; position: absolute; left: -16px; top: 11px; bottom: 11px; width: 3px; border-radius: 3px; background: var(--accent); }
.cls.past { opacity: .45; }

.seg { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); margin-bottom: 12px; }
.seg button { position: relative; z-index: 1; min-height: 40px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-weight: 600; transition: color .3s; line-height: 1.15; }
.seg button.on { color: var(--on-accent); }
.seg .seg-ind { position: absolute; top: 4px; bottom: 4px; left: 4px; border-radius: 12px; background: var(--accent); transition: transform .45s var(--spring); }
.seg button small { display: block; font-size: 10px; font-weight: 500; opacity: .75; }
.sheet .seg { background: var(--bg); }

/* 統計格：永遠等寬、對稱 */
.stats { display: grid; grid-template-columns: repeat(var(--n, 3), 1fr); gap: 8px; }
.stat { background: var(--card2); border-radius: 14px; padding: 10px 4px; text-align: center; border: 0; color: inherit; transition: transform .25s var(--spring); }
button.stat:active { transform: scale(.94); }
.stat b { display: block; font-size: 22px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.stat.bad b { color: var(--bad); }
.stat.warn b { color: var(--warn); }

.list-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); min-height: 48px; }
.list-row.chev3 { grid-template-columns: 1fr auto 18px; }
.list-row.chev2 { grid-template-columns: 1fr 18px; }
.list-row.kv { grid-template-columns: 84px 1fr; }
.list-row.kv > :last-child { text-align: right; }
.list-row:first-child { border-top: 0; }
.list-row .l { min-width: 0; flex: 1; }
.list-row .l > div:first-child { font-weight: 600; }
.sub { font-size: 12px; color: var(--muted); }
.scores { display: grid; grid-template-columns: 52px 52px; gap: 6px; flex: none; }
.score { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; white-space: nowrap; min-width: 44px; }
.score small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); }
.score.fail { color: var(--bad); }
.score.pending { color: var(--muted); font-weight: 400; }
.tappable { cursor: pointer; transition: opacity .15s, transform .25s var(--spring); }
.tappable:active { opacity: .6; transform: scale(.985); }
.chev { color: var(--muted); flex: none; width: 18px; height: 18px; }

details.card { padding: 0; }
details.card > summary { list-style: none; padding: 14px 16px; display: grid; grid-template-columns: minmax(0, 1fr) auto 18px; align-items: center; gap: 10px; min-height: 52px; cursor: pointer; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary > .chev, details.card > summary .chev { transition: transform .35s var(--spring); }
details.card[open] > summary .chev { transform: rotate(90deg); }
details.card .body { padding: 0 16px 12px; }
details[open] .body { animation: rise .4s var(--spring); }
.pill { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 99px; background: var(--card2); color: var(--muted); white-space: nowrap; }
.pill.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.pill.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.pill.good { color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); }
.pills { display: flex; flex-wrap: wrap; justify-content: flex-end; align-content: center; gap: 6px; max-width: 150px; }
.row-main { min-width: 0; }
.row-main .name { font-weight: 600; }
.detail { font-size: 13px; color: var(--muted); margin: 4px 0 0; padding-left: 16px; }
.detail li { margin: 2px 0; }

.empty { text-align: center; padding: 56px 16px; color: var(--muted); }
.empty .big { margin: 0 auto 10px; }
.empty .big svg { width: 48px; height: 48px; stroke-width: 1.4; color: var(--accent); }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 50px; border-radius: 16px; padding: 0 18px; font-weight: 700; border: 0; transition: transform .25s var(--spring), opacity .2s; }
.btn:active { transform: scale(.97); }
.btn svg { width: 20px; height: 20px; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.danger { background: var(--bad); color: #fff; }
.btn:disabled { opacity: .55; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* 評分方式 */
.gbar { display: flex; height: 14px; border-radius: 8px; overflow: hidden; background: var(--card2); margin: 6px 0 12px; }
.gbar i { display: block; height: 100%; transform-origin: left; animation: fill .9s var(--spring) both; }
.grow { display: grid; grid-template-columns: 12px 1fr 48px; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.grow:first-of-type { border-top: 0; }
.grow .sw { width: 12px; height: 12px; border-radius: 4px; }
.grow b { text-align: right; font-variant-numeric: tabular-nums; font-size: 17px; }
.grow .bar { grid-column: 2 / 4; height: 4px; border-radius: 4px; background: var(--card2); overflow: hidden; margin-top: -4px; }
.grow .bar i { display: block; height: 100%; transform-origin: left; animation: fill .9s var(--spring) both .1s; }
.prose { white-space: pre-line; font-size: 15px; line-height: 1.75; }

/* 行事曆 */
.ev { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.ev:first-of-type { border-top: 0; }
.ev .dt { text-align: center; font-variant-numeric: tabular-nums; line-height: 1.25; }
.ev .dt b { display: block; font-size: 16px; }
.ev .dt span { font-size: 12px; color: var(--muted); }
.ev .t { font-weight: 500; }
.ev.now .dt b { color: var(--accent); }
.ev.past { opacity: .5; }
.wk { display: inline-block; margin-top: 8px; padding: 3px 12px; border-radius: 99px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); font-size: 13px; font-weight: 600; }

/* 月曆 */
.cal-head { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; text-align: center; margin-bottom: 8px; }
.icon-btn.sm { width: 40px; height: 40px; }
.icon-btn.sm svg { width: 18px; height: 18px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal-grid.dow span { font-size: 12px; color: var(--muted); padding-bottom: 4px; }
.cd { border: 0; background: transparent; border-radius: 10px; min-height: 50px; min-width: 0; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 2px; font-variant-numeric: tabular-nums; color: var(--text); padding: 4px 2px; overflow: hidden; }
.cd .n { font-size: 14px; text-align: center; line-height: 18px; }
.cd em { font-style: normal; font-size: 9.5px; line-height: 13px; padding: 0 3px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: clip; text-align: left; background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--text); }
.cd em.span { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--muted); }
.cd em.more { background: none; color: var(--muted); text-align: center; }
.cd.off .n { color: var(--bad); }
.cd.today .n { color: var(--on-accent); background: var(--accent); border-radius: 9px; width: 22px; margin: 0 auto; }
.cd.sel { background: color-mix(in srgb, var(--accent) 16%, transparent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.cal-grid { gap: 2px; }
.today-ev { border-color: color-mix(in srgb, var(--accent) 45%, var(--line, transparent)); }
.chip { border: 0; margin-left: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); vertical-align: 2px; }
/* 主色選擇 */
.swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.sw-btn { border: 1px solid var(--line); background: var(--bg); border-radius: 14px; padding: 8px 0; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.sw-btn i { width: 22px; height: 22px; border-radius: 50%; background: var(--c); }
.sw-btn.on { border-color: var(--c); color: var(--text); box-shadow: inset 0 0 0 1px var(--c); }

/* ---------- 底部面板（可往下拖關閉） ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.5); display: flex; align-items: flex-end; animation: fade .25s ease-out; }
.sheet.hidden { display: none; }
.sheet.closing { animation: fade .25s ease-in reverse forwards; }
@keyframes fade { from { opacity: 0; } }
.sheet-card { width: 100%; max-height: calc(100% - var(--safe-t) - 24px); display: flex; flex-direction: column; background: var(--card); border-radius: 26px 26px 0 0; animation: sheetUp .5s var(--spring); will-change: transform; box-shadow: 0 -10px 40px rgba(0,0,0,.3); }
.sheet.closing .sheet-card { animation: sheetDown .28s ease-in forwards; }
@keyframes sheetUp { from { transform: translateY(100%); } }
@keyframes sheetDown { to { transform: translateY(100%); } }
.sheet-grab { display: grid; place-items: center; height: 18px; touch-action: none; }
.sheet-grab i { width: 38px; height: 5px; border-radius: 3px; background: var(--line); }
.sheet-head { padding: 2px 16px 8px; touch-action: none; }
.sheet-head h2 { margin: 0; font-size: 18px; text-align: center; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 4px 18px 12px; flex: 1; min-height: 0; }
/* 操作都放在下面，拇指不用伸到最上面 */
.sheet-foot { padding: 10px 18px calc(10px + var(--safe-b)); border-top: 1px solid var(--line); background: var(--card); display: grid; gap: 10px; }
.sheet-foot .seg { margin: 0; background: var(--bg); }
#sheetFootExtra:empty { display: none; }
.sheet-body > * { animation: rise .5s var(--spring) both; }

.field { display: block; margin-top: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.input {
  display: block; width: 100%; min-height: 50px; font-size: 17px; /* 16px 以上 iOS 才不會自動放大 */
  padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); color: var(--text);
  -webkit-appearance: none; appearance: none;
}
textarea.input { padding: 12px 14px; min-height: 96px; resize: none; }
.input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
input[type=date].input { line-height: 50px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; margin-top: 14px; min-height: 44px; }
.check input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--accent); }
.captcha-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.captcha { border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 0; overflow: hidden; display: grid; place-items: center; min-height: 50px; }
.captcha img { width: 100%; height: 50px; object-fit: contain; image-rendering: pixelated; display: none; }
.captcha span { color: #555; font-size: 12px; }
.err { color: var(--bad); font-size: 14px; min-height: 20px; margin: 10px 0 0; white-space: pre-wrap; word-break: break-all; max-height: 30vh; overflow: auto; text-align: center; -webkit-user-select: text; user-select: text; }
.note { font-size: 13px; color: var(--muted); background: var(--card2); border-radius: 14px; padding: 10px 12px; margin-top: 12px; }
.note.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, var(--card2)); }

.classes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cls-pick { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 6px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); font-size: 14px; line-height: 1.3; transition: border-color .2s; }
.cls-pick input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; margin: 0; }
.cls-pick:has(input:checked) { border-color: var(--accent); }

.news-body { font-size: 15px; line-height: 1.7; word-break: break-word; margin-top: 12px; }
.news-body img { max-width: 100%; height: auto; }
.news-body table { width: 100%; border-collapse: collapse; font-size: 13px; }
.news-body td, .news-body th { border: 1px solid var(--line); padding: 4px; }
.news-body a { color: var(--accent); }

.toast { position: fixed; left: 50%; bottom: calc(var(--safe-b) + 64px); transform: translateX(-50%) translateY(16px) scale(.96); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 99px; font-size: 14px; opacity: 0; pointer-events: none; transition: .4s var(--spring); z-index: 30; max-width: 88vw; text-align: center; white-space: pre-line; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }

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

/* ---------- 忘記密碼 ---------- */
.forgot { display: block; text-align: center; margin-top: 14px; color: var(--accent); font-size: 14px; text-decoration: none; padding: 6px; }

/* ---------- 下拉重新整理 ---------- */
.pane { position: relative; }
.ptr { position: absolute; left: 50%; top: calc(var(--safe-t) + var(--head-h) - 18px); transform: translate(-50%, 0); width: 34px; height: 34px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--line); display: grid; place-items: center; opacity: 0; pointer-events: none; z-index: 2; color: var(--muted); }
.ptr svg { width: 18px; height: 18px; }
.ptr.ready { color: var(--accent); border-color: var(--accent); }

/* ---------- 使用教學 ---------- */
.guide { padding-bottom: 6px; }
.guide-art { width: 76px; height: 76px; margin: 6px auto 12px; border-radius: 50%; display: grid; place-items: center; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); animation: pop .6s var(--spring); }
.guide-art svg { width: 38px; height: 38px; stroke-width: 1.5; }
.guide-art.ok { color: var(--good, #4ade80); background: color-mix(in srgb, var(--good, #4ade80) 14%, transparent); }
.guide p { line-height: 1.7; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 14px 0 0; }
.steps li { counter-increment: s; position: relative; padding: 10px 12px 10px 46px; margin-bottom: 8px; background: var(--card2); border-radius: 14px; line-height: 1.6; }
.steps li::before { content: counter(s); position: absolute; left: 12px; top: 10px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 13px; font-weight: 700; display: grid; place-items: center; }
.inl { width: 18px; height: 18px; vertical-align: -3px; color: var(--accent); }
.gdots { display: flex; justify-content: center; gap: 6px; }
.gdots i { width: 7px; height: 7px; border-radius: 4px; background: var(--line); transition: width .35s var(--spring), background .35s; }
.gdots i.on { width: 20px; background: var(--accent); }

/* ---------- 更滑順的回饋 ---------- */
.card, .btn, .stat, .tappable { will-change: auto; }
.tappable:active, .btn:active, button.stat:active { transition-duration: .08s; }
details.card { overflow: hidden; }

/* ---------- 示範帳號提示 ---------- */
.demo-hint { display: block; width: 100%; margin-top: 12px; padding: 10px 12px; border-radius: 14px; border: 1px dashed var(--line); background: transparent; color: var(--muted); font-size: 13px; line-height: 1.5; }
.demo-hint b { color: var(--accent); }

/* ---------- 課表：表格模式 ---------- */
.wg-card { padding: 10px 8px; }
.wg { display: grid; grid-template-columns: 22px repeat(var(--cols), minmax(0, 1fr)); grid-template-rows: 40px repeat(var(--rows), minmax(46px, auto)); gap: 3px; }
.wg-h { grid-row: 1; text-align: center; font-size: 13px; font-weight: 700; line-height: 1.15; padding-top: 2px; color: var(--muted); }
.wg-h small { display: block; font-size: 10px; font-weight: 500; }
.wg-h.today { color: var(--accent); }
.wg-p { grid-column: 1; display: grid; place-items: center; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.wg-bg { background: var(--card2); border-radius: 8px; opacity: .45; }
.wg-bg.today { background: color-mix(in srgb, var(--accent) 12%, var(--card2)); opacity: 1; }
.wg-c { position: relative; z-index: 1; border-radius: 9px; padding: 5px 4px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 2px;
  background: color-mix(in srgb, var(--accent) 22%, var(--card)); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); overflow: hidden; }
.wg-c b { font-size: 12px; line-height: 1.25; word-break: break-all; }
.wg-c span { font-size: 10px; color: var(--muted); }
.wg-c.now { background: var(--accent); color: var(--on-accent); }
.wg-c.now span { color: inherit; opacity: .8; }

/* ---------- 成績密碼鎖 ---------- */
.lock { text-align: center; padding: 28px 20px 20px; }
.lock-ico { width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.lock-ico svg { width: 30px; height: 30px; stroke-width: 1.6; }
.avatar-ico { width: 56px; height: 56px; margin: 0 auto 8px; border-radius: 50%; display: grid; place-items: center; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.avatar-ico svg { width: 28px; height: 28px; stroke-width: 1.6; }
.inl-ico svg { width: 22px; height: 22px; vertical-align: -4px; }
.input.pin { text-align: center; letter-spacing: 8px; font-size: 22px; margin-top: 14px; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

.today-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line, rgba(127,127,127,.2)); }
.today-head .wk { margin: 0; }

/* ---------- 學校信箱（預設關閉） ---------- */
:root:not([data-mail="on"]) .tab-mail, :root:not([data-mail="on"]) #pane-mail { display: none; }
:root[data-mail="on"] .tabs { grid-template-columns: repeat(6, 1fr); }
.mail-head { margin: 4px 6px 8px; }
.mail-row { display: grid !important; grid-template-columns: 10px minmax(0, 1fr); gap: 8px; align-items: start; }
.mail-row .udot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: transparent; }
.mail-row.unread .udot { background: var(--accent); }
.mail-row .l { min-width: 0; }
.mail-row .mtop { display: flex; justify-content: space-between; gap: 8px; }
.mail-row .mtop b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-row.unread .mtop b { font-weight: 700; }
.mail-row .mtop .sub { flex: none; }
.mail-row .msub { color: var(--muted); font-size: .9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.mail-row.unread .msub { color: var(--text); }
.mail-row .att svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 3px; }
.mail-title { font-size: 18px; font-weight: 700; line-height: 1.4; margin-bottom: 10px; }
.mail-meta { border-radius: 12px; padding: 8px 12px; background: color-mix(in srgb, var(--text) 5%, transparent); }
.kv2 { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 8px; padding: 3px 0; font-size: 13px; word-break: break-all; }
.mail-body { margin-top: 14px; white-space: pre-wrap; word-break: break-word; line-height: 1.65; font-size: 15px; }
.mail-body a { color: var(--accent); word-break: break-all; }
.att-btn { margin-top: 8px; display: flex; gap: 6px; align-items: center; }
.att-btn .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; text-align: left; }
.danger-text { color: var(--bad); }

.stat b .unit { font-size: .45em; font-weight: 600; margin-left: 3px; color: var(--muted); }

/* ---------- App 內建瀏覽器提示 ---------- */
.inapp-gate { position: fixed; inset: 0; z-index: 9999; background: var(--bg, #0b0d12); display: grid; place-items: center; padding: calc(env(safe-area-inset-top) + 20px) 22px calc(env(safe-area-inset-bottom) + 20px); overflow-y: auto; }
.inapp-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; text-align: center; color: var(--text, #e8eaf0); }
.inapp-card h2 { margin: 4px 0 0; font-size: 22px; }
.inapp-card p { margin: 0; line-height: 1.6; color: var(--muted, #9aa3b2); }
.inapp-card ol { text-align: left; margin: 4px auto; padding-left: 22px; line-height: 1.9; }
.inapp-card .btn { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.inapp-card .inl { width: 18px; height: 18px; vertical-align: -4px; fill: currentColor; }
.inapp-ico { width: 76px; height: 76px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; color: var(--accent, #7cc4ff); background: color-mix(in srgb, var(--accent, #7cc4ff) 14%, transparent); }
.inapp-ico svg { width: 38px; height: 38px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.linkbtn { background: none; border: 0; color: var(--muted, #9aa3b2); font-size: 13px; text-decoration: underline; padding: 6px; }

.where { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 1px 8px; border-radius: 8px; font-size: .9em; font-weight: 600; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.where i { font-style: normal; opacity: .6; margin: 0 2px; }
.gsec { font-weight: 700; margin: 12px 2px 2px; color: var(--text); }

/* ---------- App 標誌（學士帽 ST） ---------- */
.app-logo { width: 84px; height: 84px; margin: 4px auto 12px; animation: pop .6s var(--spring); }
.app-logo svg { width: 100%; height: 100%; display: block; border-radius: 22%; }
.app-logo.sm { width: 56px; height: 56px; margin-bottom: 8px; animation: none; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin: -4px 0 6px; font-weight: 700; letter-spacing: .5px; }
.login-brand .app-logo { width: 34px; height: 34px; margin: 0; animation: none; }
