/* =====================================================
 * 學測倒數 & 讀書計畫 — 樣式
 *
 * 目錄（用編輯器搜尋 「* 」後面的名稱就能跳過去）
 *   配色（淺色、深色、科目顏色）
 *   頂部列
 *   主內容、按鈕
 *   1. 倒數
 *   2. 每週進度
 *   3. 行事曆
 *   4. 待辦
 *   5. 讀書計時
 *   6. 統計
 *   8. AI 讀書計畫
 *   9. 讀書房間
 *   質感效果（背景光、數字滾動、按鈕回饋、開啟畫面、滑動、指令面板、分享卡片）
 *   改版 2：子頁面頂部、區塊標題、標籤、固定按鈕
 *   個人設定
 *   完整網站導覽
 *   底部分頁列（手機在下方，電腦在上方）
 *   彈出視窗、提示訊息
 *   2-2. 學測範圍
 *   聊天訊息通知（頂部橫幅／頂部小膠囊）
 *   讀書房間：讀書紀錄
 *   待辦日期、邀請連結
 *   計時頁「今天的紀錄」、編輯讀書紀錄
 *   自訂倒數、首頁自己排、專注畫面置中、全螢幕時鐘
 *
 * 注意：後面的區塊會蓋過前面同樣的設定（後來加的功能放在最後面），
 *       所以區塊的先後順序不要隨便對調，不然畫面可能會跑掉
 * ===================================================== */

/* =====================================================
 * 配色：淺色與深色共用同一套版面，只換顏色
 * ===================================================== */
:root {
    --bg: #F7F6F2;
    --bg-rgb: 247, 246, 242;
    --glow: rgba(var(--accent-rgb), 0.2);
    --text: #16140F;
    --muted: rgba(22, 20, 15, 0.64);
    --faint: rgba(22, 20, 15, 0.34);
    --line: rgba(22, 20, 15, 0.11);
    --surface: rgba(22, 20, 15, 0.05);
    --surface-2: rgba(22, 20, 15, 0.08);
    --accent: #E9B154;
    --accent-rgb: 233, 177, 84;
    --on-accent: #16140F;
    --accent-text: #8F560A;
    --accent-soft: rgba(var(--accent-rgb), 0.22);
    --important: #D9932B;
    --important-text: #8F560A;
    --important-soft: rgba(233, 177, 84, 0.2);
    --exam: #D92D2D;
    --exam-text: #B91C1C;
    --exam-soft: rgba(217, 45, 45, 0.1);
    --nav-bg: rgba(247, 246, 242, 0.97);
    --modal-bg: #FFFFFF;
    --card-rgb: 255, 255, 255;
    --shadow: 0 20px 50px rgba(22, 20, 15, 0.18);
    --mark-green-bg: rgba(16, 185, 129, 0.16);  --mark-green: #047857;
    --mark-blue-bg: rgba(59, 130, 246, 0.14);   --mark-blue: #1D4ED8;
    --mark-yellow-bg: rgba(245, 158, 11, 0.18); --mark-yellow: #92400E;
    --mark-pink-bg: rgba(236, 72, 153, 0.14);   --mark-pink: #BE185D;
    --s0: #2A78D6; --s1: #EB6834; --s2: #1BAF7A; --s3: #EDA100; --s4: #E87BA4;
}
[data-theme="dark"] {
    --bg: #050608;
    --bg-rgb: 5, 6, 8;
    --glow: rgba(var(--accent-rgb), 0.12);
    --text: #F2F0E9;
    --muted: rgba(242, 240, 233, 0.64);
    --faint: rgba(242, 240, 233, 0.34);
    --line: rgba(242, 240, 233, 0.12);
    --surface: rgba(242, 240, 233, 0.06);
    --surface-2: rgba(242, 240, 233, 0.1);
    --accent: #E9B154;
    --accent-rgb: 233, 177, 84;
    --on-accent: #050608;
    --accent-text: #E9B154;
    --accent-soft: rgba(var(--accent-rgb), 0.16);
    --important: #E9B154;
    --important-text: #F0C277;
    --important-soft: rgba(233, 177, 84, 0.16);
    --exam: #FF5A5F;
    --exam-text: #FF7A7E;
    --exam-soft: rgba(255, 90, 95, 0.16);
    --nav-bg: rgba(5, 6, 8, 0.96);
    --modal-bg: #12131A;
    --card-rgb: 30, 31, 40;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    --mark-green-bg: rgba(16, 185, 129, 0.18);  --mark-green: #34D399;
    --mark-blue-bg: rgba(59, 130, 246, 0.2);    --mark-blue: #7DB2FF;
    --mark-yellow-bg: rgba(245, 158, 11, 0.2);  --mark-yellow: #FBBF24;
    --mark-pink-bg: rgba(236, 72, 153, 0.2);    --mark-pink: #F59AC8;
    --s0: #3987E5; --s1: #D95926; --s2: #199E70; --s3: #C98500; --s4: #D55181;
}

/* 主題色（在帳號視窗裡切換）：淺色模式的文字用比較深的同色，確保看得清楚 */
[data-accent="mint"]   { --accent: #5ED3A8; --accent-rgb: 94, 211, 168;  --accent-text: #0B7A55; }
[data-accent="violet"] { --accent: #A99BF0; --accent-rgb: 169, 155, 240; --accent-text: #5A48C8; }
[data-accent="sakura"] { --accent: #F4A3BE; --accent-rgb: 244, 163, 190; --accent-text: #B23A68; }
[data-theme="dark"][data-accent="mint"]   { --accent-text: #5ED3A8; }
[data-theme="dark"][data-accent="violet"] { --accent-text: #A99BF0; }
[data-theme="dark"][data-accent="sakura"] { --accent-text: #F4A3BE; }
[data-accent="ocean"]  { --accent: #6CB4EE; --accent-rgb: 108, 180, 238; --accent-text: #1F63A8; }
[data-accent="coral"]  { --accent: #FF8B74; --accent-rgb: 255, 139, 116; --accent-text: #B4442C; }
[data-accent="matcha"] { --accent: #A9C46C; --accent-rgb: 169, 196, 108; --accent-text: #557021; }
[data-accent="moon"]   { --accent: #C3CAD6; --accent-rgb: 195, 202, 214; --accent-text: #4E5666; }
[data-theme="dark"][data-accent="ocean"]  { --accent-text: #6CB4EE; }
[data-theme="dark"][data-accent="coral"]  { --accent-text: #FF8B74; }
[data-theme="dark"][data-accent="matcha"] { --accent-text: #A9C46C; }
[data-theme="dark"][data-accent="moon"]   { --accent-text: #C3CAD6; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
    margin: 0; min-height: 100vh; min-height: 100dvh;
    background: transparent;   /* 底色在 html，背景光在 .bg-fx */
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'PingFang TC', 'Manrope', 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s, color 0.3s;
}
button, input, textarea, select { font-family: inherit; color: inherit; }
button { cursor: pointer; }
.zh { font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', 'Manrope', sans-serif; }
.num { font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Manrope', sans-serif; font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- 頂部列 --- */
.topbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; justify-content: space-between;
    padding: calc(18px + env(safe-area-inset-top)) 20px 12px;
    background: transparent; border-bottom: 1px solid transparent;
    transition: background-color 0.2s, border-color 0.2s;
}
.topbar.scrolled { background: var(--bg); }
/* 有背景圖案時，捲動後的頂部列改成半透明毛玻璃，看起來和背景是同一塊，不會像一條色塊 */
html:not([data-bg="glow"]):not([data-bg="plain"]) .topbar.scrolled {
    background: rgba(var(--bg-rgb), 0.84); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2);
}
html:not([data-bg="glow"]):not([data-bg="plain"]) .topbar::after { display: none; }
.topbar::after {
    content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 24px;
    background: linear-gradient(var(--bg), transparent);
    opacity: 0; transition: opacity 0.2s; pointer-events: none;
}
.topbar.scrolled::after { opacity: 1; }
.topbar-title { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: 0.1em; }
.topbar-actions { display: flex; gap: 8px; }
.icon-btn {
    width: 44px; height: 44px; border-radius: 22px; flex-shrink: 0;
    border: 1px solid var(--line); background: transparent;
    display: inline-flex; align-items: center; justify-content: center; padding: 0;
    transition: background-color 0.2s, border-color 0.2s;
}
.icon-btn:hover { background: var(--surface); }
.icon-btn svg { width: 20px; height: 20px; }
.avatar-btn img { width: 32px; height: 32px; border-radius: 16px; object-fit: cover; }
[data-theme="dark"] .icon-sun, [data-theme="light"] .icon-moon { display: none; }

/* --- 主內容 --- */
.main {
    max-width: 1000px; margin: 0 auto;
    padding: 8px 20px calc(110px + env(safe-area-inset-bottom));
}
.narrow { max-width: 520px; margin: 0 auto; }
.tab { display: none; }
/* ① 頁面切換：淡入＋輕微往上滑 */
.tab.active { display: block; animation: pageIn 0.38s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes pageIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ③ 會呼吸的背景光＋顆粒 */
.bg-fx { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.bg-glow {
    position: absolute; left: -25%; top: -45%; width: 150%; height: 120%;
    background: radial-gradient(closest-side, var(--glow), transparent);
    animation: breathe 14s ease-in-out infinite alternate; will-change: transform, opacity;
}
@keyframes breathe {
    0% { transform: translate(-7%, -3%) scale(1); opacity: 0.75; }
    50% { opacity: 1; }
    100% { transform: translate(8%, 6%) scale(1.16); opacity: 0.85; }
}
.bg-grain { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.045; background-image: var(--grain, none); background-size: 160px 160px; }
[data-theme="light"] .bg-grain { opacity: 0.03; }

/* ⑨ 背景（個人設定裡選）：呼吸光是原本的樣子，其他背景由 JS 放進 .bg-layer */
.bg-layer { position: absolute; inset: 0; }
.bg-layer > * { position: absolute; }
.bg-layer canvas { inset: 0; width: 100%; height: 100%; }
html:not([data-bg="glow"]) .bg-glow { display: none; }
html:not([data-bg="glow"]):not([data-bg="aurora"]):not([data-bg="mist"]) .bg-grain { display: none; }
/* 不會動的時候（專注中、聊天室、省電）把 CSS 動畫停住 */
html.bg-still .bg-fx *, html.bg-still .bg-fx *::before, html.bg-still .bg-fx *::after { animation-play-state: paused !important; }
/* 星空：深色是夜空，淺色是天剛亮 */
.b-sky { inset: 0; background: linear-gradient(180deg, #E9EEF7 0%, #F6F1EA 60%, var(--bg) 100%); }
[data-theme="dark"] .b-sky { background: radial-gradient(120% 60% at 50% 0%, #121A33 0%, #080B16 55%, #050608 100%); }
/* 極光 */
/* 不用 filter: blur（手機很吃效能），改用本身就很柔的放射漸層 */
/* 三條光帶分散在畫面上半到中間，不會全部擠在最上面 */
.b-au { width: 190%; height: 62%; left: -45%; opacity: .55; will-change: transform; }
.b-au.a1 { top: -16%; background: radial-gradient(closest-side, rgba(var(--accent-rgb), .85), rgba(var(--accent-rgb), .25) 55%, transparent); animation: au1 18s ease-in-out infinite alternate; }
.b-au.a2 { top: 10%; background: radial-gradient(closest-side, rgba(70, 215, 194, .8), rgba(70, 215, 194, .2) 55%, transparent); opacity: .4; animation: au2 23s ease-in-out infinite alternate; }
.b-au.a3 { top: 30%; background: radial-gradient(closest-side, rgba(140, 124, 240, .8), rgba(140, 124, 240, .2) 55%, transparent); opacity: .34; animation: au3 27s ease-in-out infinite alternate; }
[data-theme="light"] .b-au { opacity: .28; }
[data-theme="light"] .b-au.a2, [data-theme="light"] .b-au.a3 { opacity: .2; }
@keyframes au1 { from { transform: rotate(-6deg); } to { transform: translate(10%, 8%) rotate(-12deg) scaleY(1.25); } }
@keyframes au2 { from { transform: rotate(8deg); } to { transform: translate(-12%, 6%) rotate(3deg) scaleY(.85); } }
@keyframes au3 { from { transform: rotate(-4deg); } to { transform: translate(8%, -6%) rotate(-9deg) scaleX(1.15); } }
/* 晨霧：幾團柔和的色塊慢慢飄 */
.b-mist { width: 95vmax; height: 95vmax; opacity: .55; will-change: transform; }
.b-mist.m1 { left: -35vmax; top: -30vmax; background: radial-gradient(closest-side, rgba(var(--accent-rgb), .8), rgba(var(--accent-rgb), .3) 50%, transparent); animation: mist1 20s ease-in-out infinite alternate; }
.b-mist.m2 { right: -45vmax; top: 0; background: radial-gradient(closest-side, rgba(159, 211, 240, .9), rgba(159, 211, 240, .3) 50%, transparent); animation: mist2 24s ease-in-out infinite alternate; }
.b-mist.m3 { left: -20vmax; bottom: -45vmax; background: radial-gradient(closest-side, rgba(243, 201, 218, .95), rgba(243, 201, 218, .3) 50%, transparent); animation: mist3 28s ease-in-out infinite alternate; }
[data-theme="dark"] .b-mist { opacity: .3; }
[data-theme="dark"] .b-mist.m1 { opacity: .42; }
@keyframes mist1 { to { transform: translate(30%, 20%) scale(1.15); } }
@keyframes mist2 { to { transform: translate(-25%, 15%) scale(.9); } }
@keyframes mist3 { to { transform: translate(20%, -25%) scale(1.2); } }
/* 方格紙 */
.b-grid { inset: 0; background-color: #FBFAF5;
    background-image: linear-gradient(rgba(60, 90, 140, .09) 1px, transparent 1px), linear-gradient(90deg, rgba(60, 90, 140, .09) 1px, transparent 1px);
    background-size: 24px 24px; background-position: 12px 12px; }
/* v80 拿掉左邊那條主題色的筆記本邊線（離格線太近看起來像兩條線疊在一起，還穿過標題） */
[data-theme="dark"] .b-grid { background-color: #0C0E12;
    background-image: linear-gradient(rgba(242, 240, 233, .055) 1px, transparent 1px), linear-gradient(90deg, rgba(242, 240, 233, .055) 1px, transparent 1px); }
/* v72 天空：跟著時間變（顏色由 JS 每 5 分鐘算一次）；星星只在夜晚、太陽月亮沿著弧線走 */
.b-tsky { inset: 0; background: linear-gradient(180deg, #CFE3F4, #F7F5EF); transition: background 2s; }
.b-tstars { inset: 0; opacity: 0; transition: opacity 2s;
    background: radial-gradient(1.2px 1.2px at 12% 18%, #fff, transparent), radial-gradient(1px 1px at 28% 8%, #fff, transparent), radial-gradient(1.4px 1.4px at 46% 22%, #fff, transparent),
        radial-gradient(1px 1px at 63% 12%, #fff, transparent), radial-gradient(1.2px 1.2px at 81% 26%, #fff, transparent), radial-gradient(1px 1px at 92% 9%, #fff, transparent),
        radial-gradient(1px 1px at 8% 42%, rgba(255,255,255,.8), transparent), radial-gradient(1.2px 1.2px at 36% 38%, rgba(255,255,255,.8), transparent), radial-gradient(1px 1px at 72% 44%, rgba(255,255,255,.7), transparent),
        radial-gradient(1px 1px at 55% 58%, rgba(255,255,255,.5), transparent), radial-gradient(1px 1px at 20% 64%, rgba(255,255,255,.45), transparent), radial-gradient(1px 1px at 88% 60%, rgba(255,255,255,.45), transparent); }
.b-orb { width: 120px; height: 120px; margin: -60px; border-radius: 50%; transition: left 2s, top 2s, opacity 2s; }
.b-orb.sun { background: radial-gradient(circle, rgba(255, 236, 190, .95) 0 16%, rgba(255, 214, 150, .45) 30%, rgba(255, 200, 140, 0) 70%); }
.b-orb.moon { width: 90px; height: 90px; margin: -45px; background: radial-gradient(circle, rgba(250, 248, 236, .85) 0 17%, rgba(230, 236, 255, .28) 32%, transparent 70%); }
[data-theme="dark"] .b-orb.sun { background: radial-gradient(circle, rgba(255, 214, 160, .7) 0 13%, rgba(255, 170, 110, .22) 32%, transparent 70%); }
.th.t-sky { background: radial-gradient(circle at 70% 62%, rgba(255, 230, 180, .95) 0 7%, transparent 20%), linear-gradient(180deg, #9FB6E0 0%, #E7B9B2 60%, #F7D7B5 100%); }
/* v72 我的照片：照片（先模糊）＋一層目前主題的底色（淡化），卡片底色加深一點，文字才看得清楚 */
.b-photo { inset: 0; width: 100%; height: 100%; object-fit: cover; }
.b-veil { inset: 0; background: var(--bg); opacity: .55; }
html[data-bg="photo"][data-theme="light"] { --surface: rgba(255, 255, 255, .5); }
html[data-bg="photo"][data-theme="dark"] { --surface: rgba(12, 13, 18, .42); }
.th.t-photo { background: var(--surface) center / cover no-repeat; display: flex; align-items: center; justify-content: center; }
.th.t-photo:not(.has)::before { content: '+'; font-size: 26px; font-weight: 300; color: var(--muted); line-height: 1; }
.bg-photo-acts { display: flex; gap: 8px; padding: 0 14px 14px; }
.bg-photo-acts .btn { flex: 1; min-height: 38px; font-size: 13px; }
.bgp-sheet h2 { margin-bottom: 12px; }
.bgp-prev { position: relative; width: 200px; height: 356px; margin: 0 auto; border-radius: 18px; overflow: hidden;
    border: 1.5px solid var(--line); background: var(--bg); touch-action: none; cursor: grab; isolation: isolate; }
.bgp-prev.drag { cursor: grabbing; }
.bgp-prev img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.bgp-veil { position: absolute; inset: 0; background: var(--bg); }
.bgp-mock { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; padding-top: 13cqh; pointer-events: none; color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.bgp-mock small { font-size: 10px; color: var(--muted); letter-spacing: .1em; }
.bgp-mock b { font: 600 clamp(28px, 13cqh, 52px)/1 Manrope, sans-serif; margin: 6px 0 2px; }
.bgp-prev { container-type: size; }
.bgp-mock span { font-size: 10px; color: var(--muted); }
.bgp-card { margin-top: 8cqh; width: min(78%, 220px); padding: 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 6px; }
.bgp-card { background: rgba(255, 255, 255, .5); }
[data-theme="dark"] .bgp-card { background: rgba(12, 13, 18, .42); }
.bgp-card em { display: block; height: 7px; border-radius: 4px; background: var(--faint); }
.bgp-card em:nth-child(1) { width: 70%; background: var(--muted); } .bgp-card em:nth-child(3) { width: 45%; }
.bgp-tip { text-align: center; font-size: 12px; color: var(--faint); margin: 8px 0 12px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.bgp-row { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.bgp-row span { width: 36px; flex: none; color: var(--muted); }
.bgp-row input { flex: 1; min-width: 0; accent-color: var(--accent); height: 28px; }
/* 雨夜：隔著玻璃窗，外面是模糊的城市燈光 */
.b-rain-sky { inset: 0; background: linear-gradient(180deg, #DCE3EA 0%, #E9ECEE 55%, #F2F1EE 100%); }
[data-theme="dark"] .b-rain-sky { background: linear-gradient(180deg, #0B1220 0%, #0A0E18 50%, #07080C 100%); }
.b-bokeh { border-radius: 50%; animation: bokeh 9s ease-in-out infinite alternate; will-change: transform, opacity; }
[data-theme="light"] .b-bokeh { opacity: .45; }
@keyframes bokeh { 0% { opacity: .55; transform: scale(1); } 100% { opacity: 1; transform: scale(1.08); } }
.b-fog { inset: 0; background: linear-gradient(180deg, rgba(255, 255, 255, .05), transparent 30%, transparent 70%, rgba(255, 255, 255, .04)); }
[data-theme="light"] .b-fog { background: linear-gradient(180deg, rgba(255, 255, 255, .35), transparent 40%); }
@media (prefers-reduced-motion: reduce) { .bg-fx * { animation: none !important; } }

/* ② 數字滾動 */
.roll { display: inline-flex; }
.rd { display: inline-block; height: 1em; line-height: 1; overflow: hidden; vertical-align: top; }
.rd-col { display: block; transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
.rd-col span { display: block; height: 1em; line-height: 1; text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ⑤ 按鈕回饋：按下縮小、放開彈回 */
.btn, .icon-btn, .tab-btn, .chip, .subj-btn, .day-chip, .seg button, .color-dot, .accent-opt, .cal-cell, .bar-col, .fab {
    transition: transform 0.16s cubic-bezier(0.3, 1.6, 0.5, 1), background-color 0.2s, border-color 0.2s, color 0.2s, opacity 0.2s;
}
.icon-btn:active, .tab-btn:active, .chip:active, .subj-btn:active, .day-chip:active, .seg button:active,
.color-dot:active, .accent-opt:active, .cal-cell:active, .fab:active { transform: scale(0.93); }
.btn:active { transform: scale(0.96); }
.slot:active, .event-row:active { transform: scale(0.985); }

/* ⑩ App 開啟畫面 */
#splash {
    position: fixed; inset: 0; z-index: 500; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
    background: #050608; color: rgba(242, 240, 233, 0.8); font: 700 13px -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; letter-spacing: 0.4em; text-indent: 0.4em;
    transition: opacity 0.5s ease, visibility 0.5s;
}
#splash img { animation: splashIn 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes splashIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: none; } }
@media (display-mode: standalone), (display-mode: fullscreen) { #splash { display: flex; } }
#splash.hide { opacity: 0; visibility: hidden; }

.label { margin: 0; font-size: 11.5px; letter-spacing: 0.24em; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.block { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 22px; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.empty { color: var(--muted); font-size: 14px; padding: 10px 0; margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }

/* --- 按鈕 --- */
.btn {
    min-height: 44px; padding: 0 18px; border-radius: 22px;
    border: 1px solid var(--line); background: transparent;
    font-size: 14px; font-weight: 600; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    transition: background-color 0.2s, border-color 0.2s, transform 0.15s;
}
.btn:hover { background: var(--surface); }
.btn:active { transform: scale(0.97); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-accent:hover { background: var(--accent); filter: brightness(1.05); }
.btn-outline-accent { border-color: var(--accent); }
.btn-danger { color: var(--important-text); border-color: var(--important); }
.btn-small { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn-wide { width: 100%; min-height: 50px; border-radius: 25px; }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }

/* =====================================================
 * 1. 倒數
 * ===================================================== */
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 26px 0 6px; }
.eyebrow {
    margin: 0; color: var(--accent-text); font-size: 11.5px; font-weight: 700;
    letter-spacing: 0.32em; text-indent: 0.32em; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', 'Manrope', sans-serif;
}
.days {
    margin-top: 12px; font-size: clamp(84px, 24vw, 108px); font-weight: 500;
    line-height: 1; letter-spacing: -0.02em;
}
.days-label { margin: 10px 0 0; font-size: 12px; font-weight: 600; letter-spacing: 0.5em; text-indent: 0.5em; color: var(--muted); }
.hms { margin-top: 18px; display: flex; align-items: flex-start; gap: 20px; font-size: 22px; font-weight: 600; }
.hms > div { display: flex; flex-direction: column; gap: 4px; min-width: 32px; }
.hms small { font-size: 11px; font-weight: 500; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.hms .colon { color: var(--faint); }
.hero-date {
    margin: 18px 0 0; padding: 7px 16px; border-radius: 18px; border: 1px solid var(--line);
    font-size: 13px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif;
}
.hero-date strong { color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Manrope', sans-serif; font-weight: 700; letter-spacing: 0.02em; }
.hero-note { margin: 14px 0 0; font-size: 13px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; min-height: 1em; }

.chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 22px 0 18px; }
.chip {
    min-height: 38px; padding: 0 16px; border-radius: 19px;
    border: 1px solid var(--line); background: transparent;
    font-size: 13px; font-weight: 500; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif;
}
.chip.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); font-weight: 700; }
.chip.past { color: var(--faint); }

.check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.check-item { display: flex; align-items: center; gap: 12px; min-height: 46px; font-size: 15px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.check-item .text { flex: 1; word-break: break-word; }
.check-item.done .text { color: var(--muted); text-decoration: line-through; }
.subj { font-weight: 700; margin-right: 6px; }
.checkbox {
    appearance: none; -webkit-appearance: none; margin: 0; flex-shrink: 0;
    width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--faint);
    display: grid; place-content: center; cursor: pointer; transition: all 0.15s;
}
.checkbox:checked { background: var(--accent); border-color: var(--accent); }
.checkbox:checked::after {
    content: ''; width: 10px; height: 6px; margin-top: -2px;
    border-left: 2.5px solid var(--on-accent); border-bottom: 2.5px solid var(--on-accent);
    transform: rotate(-45deg);
}
.next-line { margin: 12px 0 0; font-size: 13px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.next-line strong { color: var(--accent-text); }
.count { font-size: 13px; font-weight: 700; color: var(--accent-text); }

/* =====================================================
 * 2. 每週進度
 * ===================================================== */
.week-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; }
.week-center { text-align: center; }
.week-range { font-size: 17px; font-weight: 700; letter-spacing: 0.04em; }
.week-sub { font-size: 12px; color: var(--muted); margin-top: 3px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.progress { height: 4px; border-radius: 2px; background: var(--surface-2); margin: 14px 0; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--accent); border-radius: 2px; transition: width 0.3s; }
.week-tools { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.week-tools svg { width: 15px; height: 15px; }

.day-chips { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-bottom: 18px; }
.day-chip {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    min-height: 62px; padding: 8px 0; border-radius: 14px;
    border: 1px solid var(--line); background: transparent;
}
.day-chip .w { font-size: 11px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.day-chip .n { font-size: 16px; font-weight: 700; }
.day-chip .dot { width: 4px; height: 4px; border-radius: 2px; background: transparent; }
.day-chip.has .dot { background: var(--accent); }
.day-chip.today { border-color: var(--accent); }
.day-chip.selected { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.day-chip.selected .w { color: var(--on-accent); opacity: 0.75; }
.day-chip.selected.has .dot { background: var(--on-accent); }

.subject-row { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.subject-name { width: 40px; flex-shrink: 0; font-size: 15px; font-weight: 700; padding-top: 8px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.slots { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.slot {
    width: 100%; text-align: left; border: 1px solid transparent;
    font-size: 14px; line-height: 1.45; padding: 9px 12px; border-radius: 10px;
    background: var(--surface); white-space: pre-wrap; word-break: break-word;
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; min-height: 40px;
}
.slot:hover { background: var(--surface-2); }
.slot.empty { background: transparent; border: 1px dashed var(--line); color: var(--faint); }
.slot.done { text-decoration: line-through; opacity: 0.6; }
.slot.c-green { background: var(--mark-green-bg); color: var(--mark-green); }
.slot.c-blue { background: var(--mark-blue-bg); color: var(--mark-blue); }
.slot.c-yellow { background: var(--mark-yellow-bg); color: var(--mark-yellow); }
.slot.c-pink { background: var(--mark-pink-bg); color: var(--mark-pink); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.week-table { width: 100%; min-width: 720px; border-collapse: collapse; table-layout: fixed; }
.week-table th, .week-table td { padding: 5px; vertical-align: top; border-bottom: 1px solid var(--line); }
.week-table th { font-size: 14px; font-weight: 700; padding: 10px 5px; text-align: left; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.week-table th .d { display: block; font-size: 12px; font-weight: 500; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Manrope', sans-serif; }
.week-table th.today { color: var(--accent-text); }
.week-table td.today { background: var(--accent-soft); }
.week-table .add-hint { opacity: 0; transition: opacity 0.15s; }
.week-table .slot:hover .add-hint, .week-table .slot:focus-visible .add-hint { opacity: 1; }
.week-table .subject-col { width: 72px; font-weight: 700; vertical-align: middle; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.exam-tag {
    display: inline-block; margin-top: 4px; font-size: 11px; font-weight: 700; padding: 2px 7px;
    border-radius: 6px; background: var(--exam); color: #FFFFFF; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif;
}
.important-tag {
    display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px;
    background: var(--important-soft); color: var(--important-text); border: 1px solid var(--important);
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif;
}

.desktop-only { display: none; }
@media (min-width: 768px) {
    .mobile-only { display: none; }
    .desktop-only { display: block; }
}

/* =====================================================
 * 3. 行事曆
 * ===================================================== */
.cal-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 14px 0 12px; }
.cal-year { font-size: 11.5px; font-weight: 700; letter-spacing: 0.28em; color: var(--accent-text); }
.cal-month { font-size: 26px; font-weight: 700; margin-top: 2px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', 'Manrope', sans-serif; }
.cal-nav { display: flex; gap: 8px; }
.cal-weekdays, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-weekdays { text-align: center; font-size: 11.5px; color: var(--muted); padding: 6px 0; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.cal-cell {
    min-height: 56px; border: none; background: transparent; padding: 4px 2px;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 5px;
    border-radius: 12px; position: relative;
}
.cal-cell.blank { pointer-events: none; }
.cal-num {
    width: 34px; height: 34px; border-radius: 17px; display: flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 600; border: 1.5px solid transparent;
}
.cal-cell.past .cal-num { color: var(--faint); }
.cal-cell.exam .cal-num { border-color: var(--exam); color: var(--exam-text); }
.cal-cell.selected .cal-num { background: var(--surface-2); }
.cal-cell.today .cal-num { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.cal-dots { display: flex; gap: 3px; height: 6px; align-items: center; }
.cal-dots i { width: 5px; height: 5px; border-radius: 3px; background: var(--text); }
.cal-dots i.imp { width: 6px; height: 6px; background: var(--important); }
.cal-titles { display: none; }
/* 重要的日期：數字外面再圈一圈 */
.cal-cell.imp-day .cal-num { outline: 2px solid var(--important); outline-offset: 1.5px; }
.cal-cell.imp-day:not(.today) .cal-num { color: var(--important-text); font-weight: 700; }
/* 連續多天：日期下方連成一條線 */
.cal-bar { position: absolute; left: 0; right: 0; bottom: 2px; height: 4px; background: var(--faint); }
.cal-bar.imp { background: var(--important); }
.cal-bar.head { left: 8px; border-top-left-radius: 2px; border-bottom-left-radius: 2px; }
.cal-bar.tail { right: 8px; border-top-right-radius: 2px; border-bottom-right-radius: 2px; }

.legend { display: flex; gap: 18px; justify-content: center; font-size: 11.5px; color: var(--muted); padding: 10px 0 4px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 6px; height: 6px; border-radius: 3px; background: var(--text); }
.legend i.imp { background: var(--important); }
.legend i.ring { width: 10px; height: 10px; border-radius: 5px; background: transparent; border: 1.5px solid var(--exam); }
.legend i.imp-ring { width: 11px; height: 11px; border-radius: 6px; background: transparent; border: 2px solid var(--important); }
.legend i.bar { width: 16px; height: 4px; border-radius: 2px; background: var(--faint); }
.event-span { margin-bottom: 14px; }
.event-dates.one { grid-template-columns: 1fr; }
.event-span-note { margin: -6px 0 10px; font-size: 12.5px; color: var(--muted); }
.event-span-note[hidden] { display: none; }
.toggle-row .imp-hint { margin-left: auto; font-size: 12px; color: var(--muted); }

.event-list { list-style: none; margin: 0; padding: 0; }
.event-row {
    display: flex; align-items: center; gap: 14px; min-height: 54px; width: 100%;
    background: transparent; border: none; text-align: left; padding: 6px 0; border-radius: 10px;
}
.event-row:hover { background: var(--surface); }
.event-date { width: 48px; text-align: center; flex-shrink: 0; }
.event-date .d { font-size: 16px; font-weight: 700; }
.event-date .w { font-size: 11px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.event-bar { width: 3px; height: 30px; border-radius: 2px; background: var(--faint); flex-shrink: 0; }
.event-bar.imp { background: var(--important); }
.event-bar.exam { background: var(--exam); }
.event-title { flex: 1; font-size: 15px; min-width: 0; word-break: break-word; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.event-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
#selDayList .event-row { padding-left: 4px; }
.event-meta { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.event-rel { font-size: 12px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }

.fab {
    position: fixed; right: max(20px, calc(50% - 480px)); bottom: calc(96px + env(safe-area-inset-bottom));
    width: 56px; height: 56px; border-radius: 28px; border: none; z-index: 35;
    background: var(--accent); color: var(--on-accent);
    display: none; align-items: center; justify-content: center;
    box-shadow: 0 10px 30px rgba(var(--accent-rgb), 0.3);
}
.fab svg { width: 24px; height: 24px; }
body[data-tab="tab-calendar"] .fab { display: flex; }
#tab-calendar { padding-bottom: 72px; }

@media (min-width: 768px) {
    .cal-grid { gap: 4px; }
    .cal-cell { min-height: 96px; align-items: stretch; padding: 6px; border: 1px solid var(--line); }
    .cal-cell.blank { border-color: transparent; }
    .cal-num { width: 30px; height: 30px; font-size: 14px; }
    .cal-dots { display: none; }
    .cal-titles { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
    .cal-titles span {
        font-size: 12px; padding: 2px 6px; border-radius: 5px; text-align: left;
        background: var(--surface-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif;
    }
    .cal-titles span.imp { background: var(--important-soft); color: var(--important-text); }
    .cal-titles span.exam { background: var(--exam); color: #FFFFFF; font-weight: 700; }
    .cal-titles span.multi { border-left: 3px solid var(--faint); }
    .cal-titles span.multi.imp { border-left-color: var(--important); }
    .cal-titles span.cont { opacity: 0.7; }
    .cal-bar, .legend .lg-bar { display: none; }
    .cal-cell:hover { background: var(--surface); }
    .cal-cell.selected { border-color: var(--accent); background: var(--accent-soft); }
    .cal-cell.selected .cal-num { background: transparent; }
    .cal-cell.today .cal-num { background: var(--accent); }
    .fab { display: none !important; }  /* 電腦版用「＋ 新增」按鈕，不需要浮動按鈕 */
}
@media (min-width: 1000px) {
    .cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 40px; align-items: start; }
    .cal-lists { position: sticky; top: 84px; padding-top: 14px; }
    .cal-lists .block:first-child { border-top: none; margin-top: 0; padding-top: 0; }
    .cal-cell { min-height: 84px; }
    .main { max-width: 1160px; }
}

/* =====================================================
 * 4. 待辦
 * ===================================================== */
.input-row { display: flex; gap: 10px; padding-top: 18px; margin-bottom: 8px; }
.text-input {
    flex: 1; min-width: 0; min-height: 46px; padding: 0 18px; border-radius: 23px;
    border: 1px solid var(--line); background: var(--surface);
    font-size: 16px; outline: none; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif;
}
.text-input:focus { border-color: var(--accent); }
.del-btn {
    width: 36px; height: 36px; border-radius: 18px; border: none; background: transparent;
    color: var(--faint); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.del-btn:hover { color: var(--important-text); background: var(--important-soft); }
.del-btn svg { width: 16px; height: 16px; }
.todo-list .check-item { border-bottom: 1px solid var(--line); transition: opacity 0.2s, transform 0.2s; }

/* ⑥ 待辦左右滑 */
.todo-list .swipe-row { display: block; position: relative; overflow: hidden; padding: 0; }
.swipe-fg {
    position: relative; display: flex; align-items: center; gap: 12px; min-height: 46px;
    touch-action: pan-y; background: transparent; z-index: 1;
}
.swipe-fg.anim { transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1); }
.swipe-row.swiping .swipe-fg { background: var(--bg); }
.swipe-bg {
    position: absolute; inset: 0; display: none; align-items: center; justify-content: space-between;
    padding: 0 18px; color: #FFFFFF; font-size: 14px; font-weight: 700;
}
.swipe-row.swiping .swipe-bg { display: flex; }
.swipe-row.to-right .swipe-bg { background: #199E70; }
.swipe-row.to-left .swipe-bg { background: #E5484D; }
.swipe-row.to-right .sw-del, .swipe-row.to-left .sw-done { visibility: hidden; }
.swipe-bg span { display: inline-flex; align-items: center; gap: 6px; }
.swipe-bg svg { width: 18px; height: 18px; }
.swipe-hint { font-size: 12px; color: var(--faint); margin: 10px 0 0; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
@media (hover: hover) { .swipe-hint { display: none; } }

/* ⑥ 行事曆滑動換月 */
#calGrid { touch-action: pan-y; }
#calGrid.slide-next { animation: slideNext 0.32s cubic-bezier(0.2, 0.8, 0.2, 1); }
#calGrid.slide-prev { animation: slidePrev 0.32s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes slideNext { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes slidePrev { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }

/* =====================================================
 * 5. 讀書計時
 * ===================================================== */
.timer-wrap { max-width: 520px; margin: 0 auto; }
.timer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 10px; }
.sdot { width: 8px; height: 8px; border-radius: 4px; flex-shrink: 0; display: inline-block; }
.sdot.s0 { background: var(--s0); } .sdot.s1 { background: var(--s1); } .sdot.s2 { background: var(--s2); }
.sdot.s3 { background: var(--s3); } .sdot.s4 { background: var(--s4); }
.subj-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.subj-btn {
    min-height: 44px; border-radius: 14px; border: 1px solid var(--line); background: transparent;
    font-size: 14px; font-weight: 500; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif;
    display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 2px;
}
.subj-btn:hover { background: var(--surface); }
.subj-btn.active { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 4px; border-radius: 22px; border: 1px solid var(--line); }
.seg.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.seg button {
    min-height: 36px; border: none; border-radius: 18px; background: transparent; color: var(--muted);
    font-size: 13px; font-weight: 500; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; padding: 0 12px;
}
.seg button.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 700; }
.ring-wrap { position: relative; width: min(70vw, 280px); aspect-ratio: 1; margin: 22px auto 0; }
.ring-wrap svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--surface-2); stroke-width: 5; }
.ring-bar { fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset 0.9s linear; }
.ring-bar.paused { stroke: var(--faint); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.ring-time { font-size: clamp(52px, 16vw, 72px); font-weight: 500; letter-spacing: -0.02em; line-height: 1; }
.ring-sub { font-size: 13px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; padding: 0 20px; }
.task-line { text-align: center; font-size: 14px; color: var(--muted); margin: 16px 0 0; min-height: 1.4em; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.task-line b { color: var(--text); font-weight: 500; }
.stat3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); text-align: center; border-top: 1px solid var(--line); padding-top: 16px; margin-top: 22px; }
.stat3 > div { display: flex; flex-direction: column; gap: 4px; }
.stat3 > div + div { border-left: 1px solid var(--line); }
.stat3 strong { font-size: 20px; font-weight: 700; }
.stat3 strong.hot { color: var(--accent-text); }
.stat3 strong small { font-size: 12px; font-weight: 500; color: var(--muted); margin: 0 2px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.stat3 > div > span { font-size: 11.5px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.chip-subj {
    display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px;
    border-radius: 18px; border: 1px solid var(--line); font-size: 14px; font-weight: 700; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif;
}
.round-dots { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 22px; flex-wrap: wrap; }
.round-dots i { width: 10px; height: 10px; border-radius: 5px; background: var(--accent); }
.round-dots i.cur { width: 22px; opacity: 0.5; }
.round-dots span { margin-left: 6px; font-size: 13px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.focus-btns { display: flex; justify-content: center; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
.btn-big { min-height: 56px; padding: 0 26px; border-radius: 28px; font-size: 16px; }
.btn-big.btn-outline-accent { background: var(--accent-soft); min-width: 150px; }
.focus-extra { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 30px; }
.hint { font-size: 12px; color: var(--faint); text-align: center; margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
body.focus-mode .tabbar, body.focus-mode .topbar { display: none; }
body.focus-mode .main { padding-top: calc(24px + env(safe-area-inset-top)); }
.done-badge {
    width: 56px; height: 56px; border-radius: 28px; margin: 18px auto 0;
    background: var(--mark-green-bg); color: var(--mark-green); display: flex; align-items: center; justify-content: center;
}
.done-badge svg { width: 26px; height: 26px; }
.break-title { text-align: center; margin: 14px 0 4px; font-size: 22px; font-weight: 700; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.break-sub { text-align: center; margin: 0; font-size: 13px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.task-check {
    display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 16px; margin-top: 20px;
    border-radius: 16px; border: 1px solid var(--line); font-size: 14px; cursor: pointer; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif;
}
.task-check .text { flex: 1; }
.task-check small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.break-time { text-align: center; margin-top: 22px; }
.break-time .num { display: block; font-size: 56px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; }
.break-time.over .num { color: var(--accent-text); }
.steps { margin: 0 0 16px; padding-left: 20px; font-size: 14px; line-height: 1.7; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.steps b { color: var(--accent-text); }
.sheet p.note { font-size: 13px; color: var(--muted); line-height: 1.6; margin: 0 0 14px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.field-row > div { min-width: 0; }
.field-row .field { min-width: 0; width: 100%; }

/* =====================================================
 * 6. 統計
 * ===================================================== */
.stats-wrap { max-width: 640px; margin: 0 auto; }
.stats-range { display: flex; justify-content: center; margin-top: 12px; }
.hero-total { display: flex; align-items: baseline; gap: 6px; margin-top: 6px; }
.hero-total b { font-size: 56px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.hero-total span { font-size: 16px; color: var(--muted); margin-right: 6px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.delta { display: flex; align-items: center; gap: 6px; margin: 10px 0 0; font-size: 13px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.delta svg { width: 14px; height: 14px; flex-shrink: 0; }
.delta .up { color: var(--mark-green); }
.chart { display: flex; gap: 8px; margin-top: 24px; }
.chart-y { width: 26px; height: 200px; position: relative; flex-shrink: 0; font-size: 11px; color: var(--faint); }
.chart-y span { position: absolute; right: 0; transform: translateY(50%); }
.chart-plot { flex: 1; position: relative; height: 200px; min-width: 0; }
.chart-grid { position: absolute; left: 0; right: 0; height: 1px; background: var(--line); }
.chart-grid.base { background: var(--faint); }
.chart-bars { position: absolute; inset: 0; display: flex; }
.bar-col {
    flex: 1; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center;
    border: none; padding: 0; background: transparent; border-radius: 6px;
}
.bar-col:hover { background: var(--surface); }
.bar-col.sel { background: var(--surface); }
.bar-stack { display: flex; flex-direction: column-reverse; gap: 2px; width: min(24px, 62%); }
.bar-stack i { display: block; }
.bar-stack i:last-child { border-radius: 4px 4px 0 0; }
.chart-x { display: flex; margin: 8px 0 0 34px; }
.chart-x span { flex: 1; min-width: 0; text-align: center; font-size: 12px; color: var(--muted); white-space: nowrap; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.chart-x span.sel { color: var(--text); font-weight: 700; }
.legend-row { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 12px 0 0 34px; font-size: 12px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.legend-row span { display: inline-flex; align-items: center; gap: 6px; }
.legend-row .sdot { border-radius: 2px; }
.subj-row { display: flex; align-items: center; gap: 12px; min-height: 34px; }
.subj-row .nm { width: 44px; font-size: 14px; font-weight: 700; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.subj-row .track { flex: 1; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.subj-row .track i { display: block; height: 100%; border-radius: 4px; }
.subj-row .t { width: 84px; text-align: right; font-size: 13px; font-weight: 600; }
.subj-row .p { width: 38px; text-align: right; font-size: 12px; color: var(--faint); }
.goal-select {
    border: none; background: transparent; color: var(--muted); font-size: 11.5px; padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; text-align: center; cursor: pointer;
}
.log-row { display: flex; align-items: center; gap: 12px; min-height: 48px; border-bottom: 1px solid var(--line); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.log-row .at { width: 46px; font-size: 13px; font-weight: 600; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Manrope', sans-serif; }
.log-row .nm { flex: 1; font-size: 14px; }
.log-row .mn { font-size: 13px; font-weight: 600; font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Manrope', sans-serif; }

/* =====================================================
 * 8. AI 讀書計畫
 * ===================================================== */
.sub-wrap { max-width: 560px; margin: 0 auto; }
.ai-note { margin: 4px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--surface); font-size: 12.5px; line-height: 1.7; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.ai-loading, .ai-error { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0; padding: 18px 0; font-size: 14px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; text-align: center; }
.ai-error { color: var(--exam-text); }
.ai-spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--surface-2); border-top-color: var(--accent); animation: aiSpin 0.8s linear infinite; flex-shrink: 0; }
@keyframes aiSpin { to { transform: rotate(360deg); } }
.ai-bullets { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ai-bullets li { position: relative; padding-left: 16px; font-size: 14px; line-height: 1.6; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.ai-bullets li::before { content: ''; position: absolute; left: 0; top: 9px; width: 6px; height: 6px; border-radius: 3px; background: var(--accent); }
.plan-day { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.plan-w { width: 34px; flex-shrink: 0; font-size: 14px; font-weight: 700; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; display: flex; flex-direction: column; padding-top: 4px; }
.plan-w small { font-size: 11px; font-weight: 500; color: var(--muted); }
.plan-items { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }

/* =====================================================
 * 9. 讀書房間
 * ===================================================== */
.room-empty { text-align: center; padding: 40px 10px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.room-empty .empty { line-height: 1.7; }
.avatars { display: flex; }
.avatars .av + .av { margin-left: -8px; }
.av {
    width: 32px; height: 32px; border-radius: 16px; flex-shrink: 0; border: 2px solid var(--bg); box-sizing: border-box;
    display: inline-flex; align-items: center; justify-content: center; color: #fff;
    font-size: 13px; font-weight: 700; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif;
}
.av.more { background: var(--surface-2); color: var(--text); font-size: 11px; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 4px; background: var(--mark-green); margin-right: 2px; animation: livePulse 2s ease-in-out infinite; }
@keyframes livePulse { 50% { opacity: 0.4; } }

/* =====================================================
 * 改版 2：子頁面頂部、區塊標題、標籤、固定按鈕
 * ===================================================== */
.topbar-left { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 1; }
.topbar-left .topbar-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back-top { display: none; border-color: transparent; margin-left: -10px; }
body.sub .back-top { display: inline-flex; }
body.sub #themeBtn, body.sub #accountBtn { display: none; }
.top-extra { display: flex; align-items: center; gap: 8px; }
.top-extra:empty { display: none; }
@media (min-width: 900px) { body.sub .topbar-title { visibility: visible; } }
.icon-btn.ghost { border-color: transparent; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sec-head h3 { margin: 0; font-size: 16px; font-weight: 700; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.sec-head > span { font-size: 12.5px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 11px; font-size: 12px; font-weight: 700; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; white-space: nowrap; }
.tag.ok { background: var(--mark-green-bg); color: var(--mark-green); }
.tag.warn { background: var(--accent-soft); color: var(--accent-text); }
.tag.mute { background: var(--surface-2); color: var(--muted); }
.tag .live-dot { width: 6px; height: 6px; margin: 0; }
.muted { color: var(--muted); }
.grow { flex: 1; }
.text-link { border: none; background: none; padding: 8px 4px; color: var(--accent-text); font-size: 14px; font-weight: 600; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; display: inline-flex; align-items: center; gap: 4px; }
.text-link svg { width: 16px; height: 16px; }
.stats-sec { border-top: 1px solid var(--line); padding-top: 22px; margin-top: 24px; }
/* 畫面最下面固定的主按鈕（在分頁列上方） */
.sticky-cta {
    position: sticky; bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 5;
    display: flex; gap: 10px; margin: 18px -20px 0; padding: 16px 20px 12px;
    background: none;   /* 不畫底色：有背景（星空、極光…）時，底色會變成一塊擋住背景的色塊 */
}
.sticky-cta .btn { min-height: 52px; border-radius: 26px; font-size: 15px; }
.sticky-cta .btn[disabled] { opacity: 0.5; }
/* 寬螢幕（iPad 橫放、電腦）：按鈕不用固定在底部，也不要畫出一塊深色底（會看起來像破圖） */
@media (min-width: 900px) { .sticky-cta { position: static; margin: 22px 0 0; padding: 0; background: none; } }
/* 下方滑出的面板（手機） */
.grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--faint); margin: -8px auto 16px; cursor: pointer; }
@media (max-width: 899px) {
    .modal.bottom { align-items: flex-end; padding: 0; }
    .modal.bottom .sheet { max-width: 560px; border-radius: 26px 26px 0 0; border-bottom: none; padding-bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateY(40px); }
    .modal.bottom.open .sheet { transform: none; }
}
@media (min-width: 900px) { .grabber { display: none; } }
.menu-list { display: flex; flex-direction: column; margin: -4px 0 12px; }
.menu-list button { display: flex; align-items: center; gap: 14px; min-height: 52px; border: none; border-bottom: 1px solid var(--line); background: none; font-size: 15px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; text-align: left; padding: 0 4px; }
.menu-list button svg { width: 20px; height: 20px; color: var(--muted); }
.menu-list button.danger { color: var(--exam-text); }
.menu-list button.danger svg { color: var(--exam-text); }

/* --- 倒數：今天 --- */
#tab-countdown .chips { margin: 14px 0 0; }
#tab-countdown .next-line { margin-top: 10px; }
.today-sec { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 22px; }
.today-time { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.today-time .num { font-size: 30px; font-weight: 700; display: flex; align-items: baseline; gap: 2px; }
.today-time small { font-size: 13px; font-weight: 500; color: var(--muted); margin: 0 3px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.goal-of { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 8px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.today-bar { margin: 12px 0 6px; height: 6px; border-radius: 3px; }
.today-bar > div { border-radius: 3px; }

/* --- 計時：房間／統計大按鈕、今日目標 --- */
.go-row { display: flex; gap: 10px; padding: 12px 0 16px; }
.go-btn {
    flex: 1; min-width: 0; min-height: 62px; padding: 0 12px; border-radius: 18px; text-align: left;
    border: 1px solid rgba(var(--accent-rgb), 0.45); background: var(--accent-soft);
    display: flex; align-items: center; gap: 10px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; transition: transform 0.15s;
}
.go-btn:active { transform: scale(0.97); }
.go-btn.room { border-color: color-mix(in srgb, var(--mark-green) 50%, transparent); background: var(--mark-green-bg); }
.go-ic { width: 36px; height: 36px; border-radius: 12px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--accent-text); background: rgba(var(--accent-rgb), 0.18); }
.go-btn.room .go-ic { color: var(--mark-green); background: var(--mark-green-bg); }
.go-ic svg { width: 20px !important; height: 20px !important; }
.go-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.go-tx b { font-size: 14.5px; }
.go-tx small { font-size: 12px; color: var(--accent-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.go-btn.room .go-tx small { color: var(--mark-green); }
.go-arrow { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.goal-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.goal-track { fill: none; stroke: var(--surface); stroke-width: 3; }
.goal-bar { fill: none; stroke: var(--mark-green); stroke-width: 3; stroke-linecap: round; opacity: 0.85; transition: stroke-dashoffset 0.6s; }
.goal-line { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 14px 0 0; font-size: 13px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.goal-line i { width: 8px; height: 8px; border-radius: 4px; background: var(--mark-green); }
#tab-timer .task-line { margin-top: 8px; }
.mini-stats { display: flex; justify-content: center; gap: 22px; margin: 18px 0 0; font-size: 13px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.mini-stats b { color: var(--text); font-size: 15px; margin-right: 2px; }
.mini-stats b.hot { color: var(--accent-text); }

/* --- 統計 --- */
.stats-head { display: flex; align-items: center; gap: 4px; padding-top: 4px; }
.stats-head .icon-btn.ghost:first-child { margin-left: -12px; }
.stats-head .period { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.stats-head .period b { font-size: 16px; font-weight: 700; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.stats-head .period span { font-size: 12.5px; color: var(--muted); }
.stats-head .seg { margin-left: 4px; }
.stats-head .seg button { min-height: 32px; padding: 0 14px; }
.delta .up { display: inline-flex; align-items: center; gap: 6px; }
.kpi3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 18px; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.kpi3 > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.kpi3 > div + div { border-left: 1px solid var(--line); padding-left: 14px; }
.kpi3 b { font-size: 21px; font-weight: 700; }
.kpi3 b.hot { color: var(--accent-text); }
.kpi3 b.ok { color: var(--mark-green); }
.kpi3 b small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 3px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.kpi3 > div > span { font-size: 12px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.kpi3 .goal-select { text-align: left; color: var(--accent-text); font-weight: 600; font-size: 12px; }
.bar-col { flex-direction: column; justify-content: flex-end; align-items: center; }
.bar-top { font-size: 10.5px; color: var(--faint); margin-bottom: 4px; white-space: nowrap; }
.bar-top.ok { color: var(--mark-green); font-weight: 700; }
.goal-dash { position: absolute; left: 0; right: 0; border-top: 1.5px dashed var(--mark-green); opacity: 0.7; pointer-events: none; }
.goal-key { color: var(--mark-green); }
.goal-key i { width: 14px; border-top: 1.5px dashed var(--mark-green); }
.day-row {
    width: 100%; margin-top: 16px; min-height: 54px; padding: 0 14px; border-radius: 16px;
    border: 1px solid var(--line); background: var(--surface); text-align: left;
    display: flex; align-items: center; gap: 10px; font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif;
}
.day-row:hover { background: var(--surface-2); }
.day-row svg { width: 18px; height: 18px; color: var(--muted); }
.split-bar { display: flex; height: 12px; gap: 2px; border-radius: 6px; overflow: hidden; margin-bottom: 10px; }
.split-bar i { display: block; height: 100%; }
.rank-subj { display: flex; align-items: center; gap: 12px; min-height: 36px; font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.rank-subj .rk { width: 14px; color: var(--muted); font-size: 13px; }
.rank-subj .nm { flex: 1; font-weight: 600; }
.rank-subj .t { font-weight: 600; }
.rank-subj .p { width: 38px; text-align: right; color: var(--muted); font-size: 12px; }
.day-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.day-head h2 { margin: 0; }
.day-head b { font-size: 17px; }
#daySplit { height: 8px; border-radius: 4px; }
#dayLogs { max-height: 46vh; overflow-y: auto; }

/* --- AI 計畫：分步驟 --- */
.steps-bar { display: flex; gap: 6px; margin: 4px 0 22px; }
.steps-bar > div { flex: 1; }
.steps-bar i { display: block; height: 4px; border-radius: 2px; background: var(--surface-2); }
.steps-bar span { display: block; margin-top: 8px; font-size: 12px; color: var(--faint); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.steps-bar .done i, .steps-bar .cur i { background: var(--accent); }
.steps-bar .done span { color: var(--text); }
.steps-bar .cur span { color: var(--accent-text); font-weight: 700; }
.step-q { margin: 0; font-size: 22px; font-weight: 700; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.step-sub { margin: 8px 0 18px; font-size: 13.5px; color: var(--muted); line-height: 1.6; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.rate-list { border-top: 1px solid var(--line); }
.rate-row { display: flex; align-items: center; gap: 12px; min-height: 56px; border-bottom: 1px solid var(--line); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.rate-row b { flex: 1; font-size: 15px; }
.rate-seg { display: inline-grid; grid-template-columns: repeat(3, auto); padding: 3px; }
.rate-seg button { min-height: 32px; padding: 0 13px; }
.rate-seg button.active.r0 { background: var(--exam-soft); color: var(--exam-text); }
.rate-seg button.active.r2 { background: var(--mark-green-bg); color: var(--mark-green); }
.ai-advice { padding: 14px 16px; border-radius: 16px; background: var(--accent-soft); border: 1px solid rgba(var(--accent-rgb), 0.3); font-size: 14px; line-height: 1.65; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.ai-advice b { display: flex; align-items: center; gap: 6px; color: var(--accent-text); margin-bottom: 4px; }
.ai-advice b svg { width: 16px; height: 16px; }
.ai-advice p { margin: 4px 0 0; }
.plan-items { flex-direction: column; flex-wrap: nowrap; gap: 0; }
.plan-item { display: flex; align-items: center; gap: 10px; min-height: 42px; border: none; background: none; padding: 0; text-align: left; font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; width: 100%; }
.plan-item .pt { flex: 1; min-width: 0; }
.plan-item .pt small { color: var(--muted); font-size: 11.5px; }
.plan-item .pm { font-size: 12.5px; color: var(--muted); }
.pbox { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--faint); flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.plan-item:not(.off) .pbox { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.pbox svg { width: 13px; height: 13px; }
.plan-item.off .pt, .plan-item.off .pm { opacity: 0.45; text-decoration: line-through; }
.plan-item:disabled { cursor: not-allowed; }
.plan-w { padding-top: 10px; }

/* --- 讀書房間：票券、座位 --- */
.ticket { width: 100%; display: flex; margin-bottom: 12px; padding: 0; border: none; background: none; text-align: left; --tk-bd: var(--line); --tk-bg: var(--surface); }
.ticket.hot { --tk-bd: rgba(var(--accent-rgb), 0.55); --tk-bg: var(--accent-soft); }
.tk-main { flex: 1; min-width: 0; padding: 16px 16px 14px; border: 1px solid var(--tk-bd); border-right: none; border-radius: 18px 0 0 18px; background: var(--tk-bg); display: flex; flex-direction: column; gap: 12px; }
.tk-main b { font-size: 16.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tk-stub { width: 86px; flex-shrink: 0; position: relative; border: 1px solid var(--tk-bd); border-left: 2px dashed var(--tk-bd); border-radius: 0 18px 18px 0; background: var(--tk-bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
/* 票根的半圓缺口：用遮罩真的挖空（看得到後面的背景），不再疊一個底色圓點，
   換背景或主題時不會出現多餘的白點 */
.tk-main {
    -webkit-mask: radial-gradient(circle at 100% 0, transparent 9px, #000 9.5px) top / 100% 51% no-repeat,
                  radial-gradient(circle at 100% 100%, transparent 9px, #000 9.5px) bottom / 100% 51% no-repeat;
            mask: radial-gradient(circle at 100% 0, transparent 9px, #000 9.5px) top / 100% 51% no-repeat,
                  radial-gradient(circle at 100% 100%, transparent 9px, #000 9.5px) bottom / 100% 51% no-repeat;
}
.tk-stub {
    -webkit-mask: radial-gradient(circle at 0 0, transparent 9px, #000 9.5px) top / 100% 51% no-repeat,
                  radial-gradient(circle at 0 100%, transparent 9px, #000 9.5px) bottom / 100% 51% no-repeat;
            mask: radial-gradient(circle at 0 0, transparent 9px, #000 9.5px) top / 100% 51% no-repeat,
                  radial-gradient(circle at 0 100%, transparent 9px, #000 9.5px) bottom / 100% 51% no-repeat;
}
.tk-stub small { font-size: 10.5px; letter-spacing: 0.15em; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.tk-stub b { font-size: 13px; letter-spacing: 0.08em; }
.ticket:active { transform: scale(0.99); }
.me-chip { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px 0 4px; border-radius: 20px; border: 1px solid var(--line); background: transparent; font-size: 13px; font-weight: 600; max-width: 150px; }
.me-chip .av { width: 30px; height: 30px; border: none; font-size: 12px; }
.me-chip .zh { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-wrap { position: relative; display: block; cursor: text; }
.code-boxes { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; pointer-events: none; }
.cb { height: 54px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; }
.code-wrap:focus-within .cb.cur { border-color: var(--accent); }
#roomCodeInput { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; border: none; }
.room-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; padding-top: 2px; }
.code-stub { display: flex; align-items: stretch; height: 36px; padding: 0; border-radius: 12px; overflow: hidden; border: 1px dashed rgba(var(--accent-rgb), 0.7); background: var(--accent-soft); }
.code-stub .num { display: flex; align-items: center; padding: 0 10px; font-size: 13px; font-weight: 700; letter-spacing: 0.1em; }
.code-stub .cs-r { display: flex; align-items: center; gap: 4px; padding: 0 10px; border-left: 1px dashed rgba(var(--accent-rgb), 0.7); color: var(--accent-text); font-size: 12.5px; font-weight: 600; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.code-stub svg { width: 14px; height: 14px; }
.seats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 22px; padding: 24px 0 6px; }
.seat { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; min-width: 0; }
.seat.idle { opacity: 0.5; }
.seat.idle.rested { opacity: 0.8; }   /* 今天讀過、現在休息：不要淡到像沒來 */
.seat-av { position: relative; width: 68px; height: 68px; margin-bottom: 4px; }
.seat-av svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.st-track { fill: none; stroke: var(--surface-2); stroke-width: 3.5; }
.st-bar { fill: none; stroke: var(--mark-green); stroke-width: 3.5; stroke-linecap: round; transition: stroke-dashoffset 0.9s linear; }
.seat.break .st-bar, .seat.idle .st-bar { stroke: transparent; }
.seat-face { position: absolute; inset: 9px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 19px; font-weight: 700; }
.sn { font-size: 13.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sn small { font-weight: 500; color: var(--muted); }
.ss { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.ss.on { color: var(--mark-green); }
.sc { font-size: 13px; font-weight: 600; }
.seat:not(.focus) .sc { color: var(--muted); font-weight: 500; font-size: 12px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.rank-row { display: flex; align-items: center; gap: 10px; min-height: 40px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.rank-row.me { background: var(--accent-soft); margin: 0 -10px; padding: 0 10px; border-radius: 12px; }
.rank-row .rk { width: 24px; height: 24px; border-radius: 12px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: var(--muted); }
.rank-row .nm { width: 64px; flex-shrink: 0; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .track { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.rank-row .track i { display: block; height: 100%; border-radius: 3px; transition: width 0.4s; }
.rank-row .t { width: 76px; text-align: right; font-size: 13px; font-weight: 600; }

/* --- 讀書房間：大家／聊天 切換 --- */
.seg-n { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--exam); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Manrope', sans-serif; }
.seg-n.ok { background: var(--mark-green-bg); color: var(--mark-green); }
.seg-n[hidden] { display: none; }

/* --- 聊天室 --- */
.chat-empty { text-align: center; padding: 60px 10px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.chat-empty p { margin: 0 0 6px; font-size: 16px; font-weight: 700; }
.chat-empty span { font-size: 13px; color: var(--muted); }
.chat-sys { text-align: center; margin: 16px 0 6px; font-size: 12px; color: var(--faint); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.msg { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.msg.grouped { margin-top: 3px; }
.msg.mine { justify-content: flex-end; }
.msg-col { min-width: 0; max-width: 78%; }
.msg-line { display: flex; align-items: flex-end; gap: 6px; }
.chat-av, .chat-av-sp { width: 30px; height: 30px; border-radius: 15px; flex-shrink: 0; }
.chat-av { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: 700; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.chat-who { margin: 0 0 3px 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.bubble {
    padding: 9px 13px; border-radius: 18px; font-size: 15px; line-height: 1.5; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif;
    white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere;
    -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
/* v81 跟 App 一樣：一組訊息裡，外側都是大圓角；跟上一則、下一則接起來的那個角是小圓角 */
.msg.them .bubble { background: var(--surface-2); }
.msg.mine .bubble { background: var(--accent); color: var(--on-accent); max-width: 78%; }
.msg.them.grouped .bubble { border-top-left-radius: 5px; }
.msg.them.cont .bubble { border-bottom-left-radius: 5px; }
.msg.mine.grouped .bubble { border-top-right-radius: 5px; }
.msg.mine.cont .bubble { border-bottom-right-radius: 5px; }
.msg.mine .bubble a { color: inherit; text-decoration: underline; }
.bubble a { color: var(--accent-text); }
.chat-img { display: block; max-width: min(240px, 66vw); max-height: 300px; border-radius: 16px; border: 1px solid var(--line); object-fit: cover; cursor: zoom-in; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.chat-meta { display: flex; flex-direction: column; gap: 1px; font-size: 10.5px; color: var(--faint); white-space: nowrap; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; flex-shrink: 0; }
.msg.mine .chat-meta { align-items: flex-end; }

.chat-bar .icon-btn { width: 42px; height: 42px; cursor: pointer; }
#chatInput {
    flex: 1; min-width: 0; min-height: 42px; max-height: 120px; resize: none; padding: 10px 16px; border-radius: 21px;
    border: 1px solid var(--line); background: var(--surface); font-size: 16px; line-height: 1.35; outline: none;
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif;
}
#chatInput:focus { border-color: var(--accent); }
.chat-send { width: 42px; height: 42px; border-radius: 21px; border: none; flex-shrink: 0; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; }
.chat-send svg { width: 18px; height: 18px; }
.chat-send:active { transform: scale(0.92); }
.img-modal img { max-width: 100%; max-height: 86vh; border-radius: 12px; object-fit: contain; }
.img-close { position: absolute; top: calc(16px + env(safe-area-inset-top)); right: 16px; background: rgba(0, 0, 0, 0.5); color: #fff; border-color: rgba(255, 255, 255, 0.2); }

/* --- 加到主畫面教學（置中圖卡） --- */
.install-card { max-width: 380px; padding: 26px 22px 22px; border-radius: 28px; }
.install-head { text-align: center; margin-bottom: 18px; }
.install-icon { border-radius: 16px; background: #fff; display: block; margin: 0 auto 14px; box-shadow: 0 10px 30px rgba(var(--accent-rgb), 0.25); }
.install-head h2 { margin: 0 0 6px; font-size: 19px; }
.install-head p { margin: 0; font-size: 13.5px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.install-card .seg { display: grid; margin-bottom: 6px; }
.install-steps { list-style: none; margin: 0 0 16px; padding: 0; }
.install-steps[hidden] { display: none; }
.install-steps li { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.install-steps li:last-child { border-bottom: none; }
.st-n { width: 26px; height: 26px; border-radius: 13px; background: var(--accent-soft); color: var(--accent-text); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; flex-shrink: 0; }
.install-steps li > div { flex: 1; min-width: 0; }
.install-steps b { display: block; font-size: 15px; }
.install-steps li > div > span { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.st-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.st-ic svg { width: 22px; height: 22px; }
.mini-app { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); display: block; }

/* 有固定按鈕的頁面，提示訊息往上移，不要蓋住按鈕 */
body:has(.tab.active .sticky-cta) .toast, body:has(.tab.active .chat-bar) .toast { bottom: calc(160px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { body:has(.tab.active .sticky-cta) .toast, body:has(.tab.active .chat-bar) .toast { bottom: 110px; } }

/* --- 房間內的「聊天室」入口 --- */
.chat-entry {
    width: 100%; margin-top: 14px; min-height: 64px; padding: 0 14px; border-radius: 18px; text-align: left;
    /* v73 毛玻璃：半透明卡片＋深一點的主題色，換成照片背景也不會太淡 */
    border: 1px solid rgba(var(--accent-rgb), 0.6);
    background: linear-gradient(rgba(var(--accent-rgb), .3), rgba(var(--accent-rgb), .3)), rgba(var(--card-rgb), .6);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .08);
    display: flex; align-items: center; gap: 12px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif;
}
/* 背景不會動時才加模糊（會動的背景加模糊每一格都要重算，手機會變卡） */
html[data-bg="photo"] .chat-entry, html[data-bg="grid"] .chat-entry, html[data-bg="plain"] .chat-entry { -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4); }
.chat-entry:active { transform: scale(0.98); }
.ce-ic { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--accent); color: var(--on-accent); flex-shrink: 0; }
.ce-ic svg { width: 23px; height: 23px; }
.ce-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ce-tx b { font-size: 15px; }
.ce-tx small { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-stub { position: relative; }
.tk-unread { position: absolute; top: 8px; right: 8px; }
.tab-btn { position: relative; }
.tab-dot { position: absolute; top: 6px; left: calc(50% + 8px); width: 9px; height: 9px; border-radius: 5px; background: var(--exam); border: 2px solid var(--bg); }
@media (min-width: 900px) { .tab-dot { top: 8px; left: 30px; } }

/* --- 全螢幕聊天室 --- */
.chat-screen {
    /* 永遠蓋滿整個畫面；鍵盤打開時改用上下留白把內容擠進看得到的範圍，後面的頁面不會露出來 */
    position: fixed; inset: 0; z-index: 90;
    display: none; flex-direction: column; background: var(--bg);
    overscroll-behavior: none;
}
.chat-screen.open { display: flex; animation: chatIn 0.22s ease-out; }
@keyframes chatIn { from { opacity: 0; } to { opacity: 1; } }
body.chat-open .bg-fx { display: none; }   /* 聊天時關掉會動的背景，鍵盤動畫比較順 */
.chat-screen .chat-list { contain: content; }
body.chat-open { overflow: hidden; }
@media (max-width: 899px) {
    /* 手機：聊天時把後面的頁面整個關掉，不會被滑到，也比較不卡 */
    body.chat-open .tabbar, body.chat-open .topbar, body.chat-open .main { display: none; }
    html:has(body.chat-open) { overflow: hidden; overscroll-behavior: none; }
}
.chat-head {
    display: flex; align-items: center; gap: 6px; flex-shrink: 0;
    padding: calc(16px + env(safe-area-inset-top)) 14px 10px; border-bottom: 1px solid var(--line); background: var(--bg);
}
.chat-head .icon-btn.ghost { margin-left: -6px; }
.chat-head-tx { flex: 1; min-width: 0; }
.chat-head-tx h2 { margin: 0; font-size: 17px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head-tx span { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.chat-head-tx .live-dot { width: 6px; height: 6px; }
.notify-bar { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 16px; background: var(--accent-soft); font-size: 13px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; flex-shrink: 0; }
.notify-bar span { flex: 1; }
.notify-bar .icon-btn { width: 34px; height: 34px; }
.chat-screen .chat-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 6px 16px 14px; }
.chat-screen .chat-list > *:first-child { margin-top: 10px; }
.chat-bar {
    display: flex; align-items: flex-end; gap: 8px; flex-shrink: 0;
    padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line);
}
.chat-screen.kb-open .chat-bar { padding-bottom: 8px; }   /* 鍵盤打開時不需要留 Home 鍵的空間 */
.chat-bar .icon-btn { width: 42px; height: 42px; cursor: pointer; }
@media (min-width: 900px) {
    .chat-screen { left: 50%; right: auto; width: 640px; transform: translateX(-50%); border-left: 1px solid var(--line); border-right: 1px solid var(--line); padding: 0 !important; }
    body.chat-open::before { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 89; }
}
.bubble.expired { font-style: italic; color: var(--muted); }
.pressing { transform: scale(0.96); transition: transform 0.35s; }

/* --- 長按訊息：訊息卡片浮起來（像 IG） --- */
.msg-pop {
    position: fixed; inset: 0; z-index: 150; display: flex; align-items: center; justify-content: center; padding: 24px;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0; pointer-events: none; visibility: hidden; transition: opacity 0.18s, visibility 0s 0.18s;
}
.msg-pop.open { opacity: 1; pointer-events: auto; visibility: visible; transition: opacity 0.18s; backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); }
.pop-inner { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.msg-pop.mine .pop-inner { align-items: flex-end; }
.pop-msg { max-width: 100%; display: flex; flex-direction: column; gap: 4px; transform: scale(0.9); transition: transform 0.25s cubic-bezier(0.3, 1.5, 0.5, 1); }
.msg-pop.mine .pop-msg { align-items: flex-end; }
.msg-pop.open .pop-msg { transform: scale(1.04); }
.pop-msg .bubble { max-width: 100%; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35); -webkit-user-select: text; user-select: text; }
.pop-msg.them .bubble { background: var(--modal-bg); border-radius: 18px; }
.pop-msg.mine .bubble { background: var(--accent); color: var(--on-accent); border-radius: 18px; }
.pop-msg .chat-img { max-height: 46vh; max-width: 100%; }
.pop-time { font-size: 11px; color: rgba(255, 255, 255, 0.75); padding: 0 6px; }
.pop-msg .chat-who { color: rgba(255, 255, 255, 0.8); }
.pop-menu {
    width: 230px; border-radius: 16px; overflow: hidden; background: var(--modal-bg); border: 1px solid var(--line); box-shadow: var(--shadow);
    transform: translateY(8px) scale(0.96); opacity: 0; transition: transform 0.22s 0.04s, opacity 0.22s 0.04s;
}
.msg-pop.open .pop-menu { transform: none; opacity: 1; }
.pop-menu button { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 0 16px; border: none; border-bottom: 1px solid var(--line); background: none; font-size: 15px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; text-align: left; }
.pop-menu button:last-child { border-bottom: none; }
.pop-menu button:hover { background: var(--surface); }
.pop-menu button svg { width: 19px; height: 19px; color: var(--muted); }
.pop-menu button.danger, .pop-menu button.danger svg { color: var(--exam-text); }
.pop-note { margin: 0; padding: 0 6px; font-size: 11.5px; color: rgba(255, 255, 255, 0.75); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.pop-note:empty { display: none; }

/* =====================================================
 * 個人設定（依手繪草圖）
 * ===================================================== */
.acct-sheet { max-width: 400px; padding: 18px 18px 22px; display: flex; flex-direction: column; gap: 12px; }
.acct-sheet > * { flex-shrink: 0; }   /* 內容變多時整個視窗捲動，不要把每一塊擠扁 */
.acct-top { display: flex; align-items: center; gap: 10px; margin-bottom: 2px; }
.acct-sheet .acct-top h2 { margin: 0; font-size: 18px; line-height: 44px; }
.acct-group { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); overflow: hidden; }
.acct-row { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 16px; border: none; background: none; text-align: left; font-size: 15px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
button.acct-row:hover { background: var(--surface-2); }
.acct-row + .acct-row { border-top: 1px solid var(--line); }
.acct-user { min-height: 76px; }
.acct-user img { width: 50px; height: 50px; border-radius: 25px; object-fit: cover; background: var(--surface-2); flex-shrink: 0; }
.acct-who { min-width: 0; }
.acct-who .name { font-weight: 700; font-size: 16px; }
.acct-who .email { font-size: 13px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-sync { min-height: 46px; font-size: 13.5px; color: var(--muted); }
.sync-dot { width: 8px; height: 8px; border-radius: 4px; background: var(--faint); flex-shrink: 0; }
.sync-dot.ok { background: var(--mark-green); box-shadow: 0 0 0 4px var(--mark-green-bg); }
.sync-dot.wait { background: var(--accent); }
.sync-dot.bad { background: var(--exam); }
.acct-hint { margin: -4px 4px 0; font-size: 12.5px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.acct-ic { width: 34px; height: 34px; border-radius: 11px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-text); flex-shrink: 0; }
.acct-ic svg { width: 19px; height: 19px; }
.acct-label { font-weight: 700; }
.acct-value { font-size: 13px; color: var(--muted); }
.acct-swatch { width: 26px; height: 26px; border-radius: 13px; background: var(--accent); box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px var(--line); flex-shrink: 0; }
.acct-chev { width: 18px; height: 18px; color: var(--faint); flex-shrink: 0; }
.acct-group .accent-grid { padding: 4px 14px 14px; }
.acct-fold + .acct-row { border-top: 1px solid var(--line); }
/* 主題色、背景：展開／收起動畫（高度用 grid 0fr → 1fr，內容淡入） */
.acct-fold { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.34s cubic-bezier(0.2, 0.8, 0.2, 1); }
.acct-fold.open { grid-template-rows: 1fr; }
.acct-fold-in { min-height: 0; overflow: hidden; }
.acct-fold-in > * { opacity: 0; transform: translateY(-8px); transition: opacity 0.2s, transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.acct-fold.open .acct-fold-in > * { opacity: 1; transform: none; transition-delay: 0.06s; }
.acct-fold-chev { width: 18px; height: 18px; color: var(--faint); flex-shrink: 0; transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.acct-row[aria-expanded="true"] .acct-fold-chev { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .acct-fold, .acct-fold-in > *, .acct-fold-chev { transition: none; } }
/* 背景選擇：小縮圖 */
.bg-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 8px; padding: 4px 14px 14px; }
.bg-opt { border: none; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.bg-opt .th { width: 100%; aspect-ratio: 3 / 4; border-radius: 12px; border: 1.5px solid var(--line); position: relative; overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.bg-opt.active { color: var(--accent-text); font-weight: 700; }
.bg-opt.active .th { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.bg-opt:active .th { transform: scale(.95); }
.th.t-glow { background: radial-gradient(circle at 30% 10%, rgba(var(--accent-rgb), .55), transparent 65%), var(--bg); }
.th.t-stars { background: radial-gradient(1px 1px at 20% 30%, #fff, transparent), radial-gradient(1px 1px at 70% 20%, #fff, transparent), radial-gradient(1.5px 1.5px at 50% 60%, #fff, transparent), radial-gradient(1px 1px at 80% 75%, #fff, transparent), radial-gradient(1px 1px at 30% 80%, #fff, transparent), linear-gradient(#121A33, #050608); }
.th.t-aurora { background: linear-gradient(170deg, transparent 20%, rgba(var(--accent-rgb), .7) 38%, transparent 55%), linear-gradient(190deg, transparent 30%, rgba(70, 215, 194, .55) 48%, transparent 66%), #070A12; }
.th.t-mist { background: radial-gradient(circle at 20% 20%, rgba(var(--accent-rgb), .7), transparent 50%), radial-gradient(circle at 85% 50%, #9FD3F0, transparent 50%), radial-gradient(circle at 30% 95%, #F3C9DA, transparent 50%), #F7F6F2; }
.th.t-rain { background: radial-gradient(2px 2.5px at 30% 30%, rgba(255, 255, 255, .8), transparent), radial-gradient(1.5px 2px at 70% 55%, rgba(255, 255, 255, .7), transparent), radial-gradient(1.5px 2px at 45% 80%, rgba(255, 255, 255, .7), transparent), radial-gradient(circle at 25% 75%, rgba(var(--accent-rgb), .75), transparent 22%), radial-gradient(circle at 75% 85%, rgba(255, 170, 90, .6), transparent 20%), radial-gradient(circle at 60% 30%, rgba(110, 160, 255, .45), transparent 20%), linear-gradient(#0B1220, #07080C); }
.th.t-petal { background: radial-gradient(3px 2px at 25% 25%, rgba(var(--accent-rgb), 1), transparent), radial-gradient(3px 2px at 70% 45%, rgba(var(--accent-rgb), 1), transparent), radial-gradient(3px 2px at 40% 75%, rgba(var(--accent-rgb), 1), transparent), radial-gradient(2px 2px at 85% 85%, rgba(var(--accent-rgb), .8), transparent), var(--bg); }
.th.t-grid { background-color: #FBFAF5; background-image: linear-gradient(rgba(60, 90, 140, .16) 1px, transparent 1px), linear-gradient(90deg, rgba(60, 90, 140, .16) 1px, transparent 1px); background-size: 7px 7px; }
.th.t-plain { background: var(--bg); }
.th.t-plain::after { content: ''; position: absolute; inset: 35% 30%; border-radius: 4px; border: 1.5px dashed var(--faint); }
/* 外觀：淺色／深色／跟系統 */
.acct-mode { flex-wrap: wrap; }
.mode-seg { display: inline-grid; grid-template-columns: repeat(3, auto); padding: 3px; gap: 2px; border-radius: 14px; background: var(--surface-2); }
.mode-seg button { border: none; background: transparent; border-radius: 11px; padding: 6px 11px; font-size: 12.5px; font-weight: 600; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.mode-seg button.active { background: var(--modal-bg); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); font-weight: 700; }
.acct-login { margin-top: 6px; min-height: 50px; border-radius: 25px; }
.acct-ver { margin: 14px 0 0; text-align: center; font-size: 11.5px; color: var(--faint); letter-spacing: .04em; }
.btn-logout { color: var(--exam-text); border-color: color-mix(in srgb, var(--exam) 55%, transparent); background: var(--exam-soft); font-weight: 700; }

/* --- 簡易導覽（第一次打開） --- */
.tour-card { max-width: 400px; padding: 26px 22px 22px; border-radius: 28px; }
.tour-kicker { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.2em; color: var(--accent-text); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.tour-card h2 { margin: 0; font-size: 22px; }
.tour-sub { margin: 6px 0 14px; font-size: 13.5px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.tour-list { list-style: none; margin: 0 0 14px; padding: 0; }
.tour-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.tour-list li:last-child { border-bottom: none; }
.tour-ic { width: 38px; height: 38px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tour-ic svg { width: 20px; height: 20px; }
.tour-list b { display: block; font-size: 15px; }
.tour-list span:not(.tour-ic) { font-size: 12.5px; color: var(--muted); }
.tour-note { margin: 0 0 16px; padding: 10px 12px; border-radius: 12px; background: var(--surface); font-size: 12.5px; color: var(--muted); line-height: 1.6; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.tour-note b { color: var(--text); }

/* =====================================================
 * 完整網站導覽（整頁往下滑，圖文並茂）
 * ===================================================== */
.guide-screen { position: fixed; inset: 0; z-index: 95; display: none; flex-direction: column; background: var(--bg); }
.guide-screen.open { display: flex; animation: chatIn 0.22s ease-out; }
body.guide-open { overflow: hidden; }
@media (max-width: 899px) { body.guide-open .main, body.guide-open .tabbar, body.guide-open .topbar { display: none; } }
.guide-head { display: flex; align-items: center; gap: 6px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; border-bottom: 1px solid var(--line); background: var(--bg); flex-shrink: 0; }
.guide-head .icon-btn { margin-left: -6px; }
.guide-head h2 { margin: 0; font-size: 17px; }
.guide-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 0 20px calc(30px + env(safe-area-inset-bottom)); }
.guide-body > * { max-width: 620px; margin-left: auto; margin-right: auto; }
.guide-hero { padding: 26px 0 8px; }
.guide-hero h1 { margin: 0 0 8px; font-size: 26px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.guide-hero p:last-child { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.7; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.guide-toc { position: sticky; top: 0; z-index: 2; display: flex; gap: 6px; overflow-x: auto; padding: 12px 0; background: var(--bg); scrollbar-width: none; }
.guide-toc::-webkit-scrollbar { display: none; }
.guide-toc a { flex-shrink: 0; padding: 7px 13px; border-radius: 16px; border: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: 13px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.guide-toc a:hover { background: var(--surface); }
.g-sec { padding: 26px 0 8px; border-top: 1px solid var(--line); }
.g-num { margin: 0; font-size: 13px; font-weight: 800; color: var(--accent-text); letter-spacing: 0.1em; }
.g-sec h3 { margin: 4px 0 6px; font-size: 21px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.g-lead { margin: 0 0 16px; font-size: 14px; color: var(--muted); line-height: 1.7; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.g-fig { margin: 0 0 16px; padding: 20px 12px; border-radius: 22px; background: radial-gradient(circle at 50% 0%, rgba(var(--accent-rgb), 0.16), transparent 70%), var(--surface); border: 1px solid var(--line); display: flex; justify-content: center; }
.g-points { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14.5px; line-height: 1.7; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.g-points b { color: var(--accent-text); }
.g-tip { margin: 14px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); font-size: 13.5px; line-height: 1.6; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.g-tip b { display: inline-block; margin-right: 8px; color: var(--accent-text); }
.guide-end { padding: 30px 0 10px; border-top: 1px solid var(--line); text-align: center; }
.guide-end p { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }

/* 導覽裡的小插圖（用真的配色畫，跟著主題色變） */
.g-phone { width: 236px; padding: 16px 14px; border-radius: 26px; background: var(--bg); border: 1px solid var(--line); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18); display: flex; flex-direction: column; gap: 8px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; font-size: 11px; }
.g-chips { display: flex; gap: 4px; justify-content: center; }
.g-chips span { padding: 3px 7px; border-radius: 9px; border: 1px solid var(--line); font-size: 9.5px; display: inline-flex; align-items: center; gap: 3px; }
.g-chips span.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); font-weight: 700; }
.g-chips span.past { opacity: 0.4; }
.g-eyebrow { margin: 4px 0 0; text-align: center; font-size: 9px; font-weight: 700; letter-spacing: 0.2em; color: var(--accent-text); }
.g-days { text-align: center; font-size: 54px; font-weight: 500; line-height: 1; }
.g-days small { font-size: 11px; color: var(--muted); margin-left: 3px; }
.g-hms { margin: 0; text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); }
.g-line { height: 1px; background: var(--line); margin: 2px 0; }
.g-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.g-row.center { justify-content: center; }
.g-tag { padding: 2px 7px; border-radius: 8px; font-size: 9px; font-weight: 700; }
.g-tag.warn { background: var(--accent-soft); color: var(--accent-text); }
.g-tag.ok { background: var(--mark-green-bg); color: var(--mark-green); }
.g-bar { height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.g-bar i { display: block; height: 100%; background: var(--accent); }
.g-check { display: flex; align-items: center; gap: 6px; font-size: 10.5px; }
.g-check span { width: 12px; height: 12px; border-radius: 4px; border: 1.5px solid var(--faint); }
.g-check.on span { background: var(--accent); border-color: var(--accent); }
.g-check.on { color: var(--muted); text-decoration: line-through; }
.g-btn { margin-top: 2px; padding: 8px; border-radius: 14px; background: var(--accent); color: var(--on-accent); text-align: center; font-weight: 700; font-size: 10.5px; }
.g-btn.g-btn2 { margin-top: 6px; background: transparent; color: var(--text); border: 1px solid var(--line); }
.g-days7 { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.g-days7 span { display: flex; flex-direction: column; align-items: center; padding: 4px 0; border-radius: 8px; border: 1px solid var(--line); font-size: 10px; font-weight: 700; }
.g-days7 small { font-size: 8px; color: var(--muted); font-weight: 500; }
.g-days7 span.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.g-days7 span.on small { color: inherit; }
.g-subj { display: flex; align-items: center; gap: 5px; }
.g-subj b { width: 26px; font-size: 10px; }
.g-slot { flex: 1; padding: 6px 5px; border-radius: 8px; background: var(--surface-2); font-size: 9px; text-align: center; overflow: hidden; white-space: nowrap; }
.g-slot.empty { background: none; border: 1px dashed var(--faint); color: var(--muted); }
.g-slot.done { color: var(--muted); text-decoration: line-through; }
.g-slot.c-blue { background: var(--mark-blue-bg); color: var(--mark-blue); }
.g-slot.c-pink { background: var(--mark-pink-bg); color: var(--mark-pink); }
.g-ai { display: flex; gap: 5px; align-items: center; padding: 7px 8px; border-radius: 10px; border: 1px solid var(--accent); background: var(--accent-soft); font-size: 9px; }
.g-ai span { color: var(--accent-text); font-weight: 700; }
.g-dot { width: 5px; height: 5px; border-radius: 3px; display: inline-block; }
.g-dot.s0 { background: var(--s0); } .g-dot.s1 { background: var(--s1); } .g-dot.s2 { background: var(--s2); }
.g-chips.sm span { font-size: 9.5px; padding: 4px 8px; }
.g-ring { position: relative; width: 130px; height: 130px; margin: 2px auto; }
.g-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.g-ring circle { fill: none; }
.g-ring .tr { stroke: var(--surface-2); stroke-width: 4; } .g-ring .br { stroke: var(--accent); stroke-width: 4; stroke-linecap: round; }
.g-ring .gt { stroke: var(--surface); stroke-width: 2.5; } .g-ring .gb { stroke: var(--mark-green); stroke-width: 2.5; stroke-linecap: round; }
.g-ring > span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 500; }
.g-pill { padding: 6px 12px; border-radius: 12px; border: 1px solid var(--accent); background: var(--accent-soft); font-size: 10px; font-weight: 700; }
.g-pill.solid { background: var(--accent); color: var(--on-accent); }
.g-cap { margin: 0; text-align: center; font-size: 9.5px; color: var(--muted); }
.g-cap.left { text-align: left; }
.g-cap .up { color: var(--mark-green); font-weight: 700; }
.g-total { font-size: 30px; font-weight: 700; line-height: 1; }
.g-total small { font-size: 10px; color: var(--muted); margin: 0 3px; }
.g-chart { position: relative; height: 82px; display: flex; align-items: flex-end; gap: 6px; padding: 0 2px; border-bottom: 1px solid var(--line); }
.g-goal { position: absolute; left: 0; right: 0; bottom: 52px; border-top: 1px dashed var(--mark-green); }
.g-col { flex: 1; display: flex; flex-direction: column-reverse; gap: 1px; }
.g-col i { display: block; border-radius: 1px; }
.g-col i:last-child { border-radius: 3px 3px 0 0; }
.g-split { display: flex; height: 6px; gap: 1px; border-radius: 3px; overflow: hidden; }
.g-split i { display: block; height: 100%; }
.g-dayrow { display: flex; justify-content: space-between; padding: 7px 9px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 9.5px; font-weight: 700; }
.g-ticket { display: flex; border: 1px solid rgba(var(--accent-rgb), 0.55); border-radius: 12px; background: var(--accent-soft); overflow: hidden; }
.g-ticket > div { flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.g-ticket b { font-size: 10.5px; }
.g-ticket .stub { width: 56px; border-left: 1.5px dashed rgba(var(--accent-rgb), 0.55); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 8.5px; font-weight: 700; letter-spacing: 0.06em; }
.g-ticket .stub small { font-size: 7px; color: var(--muted); font-weight: 500; }
.g-seats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px 0; }
.g-seats .seat { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 8.5px; color: var(--muted); opacity: 1; }
.g-seats .seat.on { color: var(--mark-green); font-weight: 700; }
.g-seats i { width: 32px; height: 32px; border-radius: 16px; color: #fff; font-style: normal; font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--surface-2); }
.g-seats .seat.on i { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--mark-green); }
.g-rank { display: flex; align-items: center; gap: 6px; font-size: 9.5px; font-weight: 700; }
.g-rank span { width: 14px; height: 14px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 8px; color: #050608; }
.g-rank .m1 { background: #E9B154; } .g-rank .m2 { background: #C9CED6; }
.g-rank i { height: 4px; border-radius: 2px; background: var(--accent); }
.g-msg { display: flex; align-items: flex-end; gap: 5px; }
.g-msg.mine { justify-content: flex-end; }
.g-msg > i { width: 18px; height: 18px; border-radius: 9px; color: #fff; font-style: normal; font-size: 8px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.g-msg > span { padding: 6px 9px; border-radius: 12px; font-size: 10px; background: var(--surface-2); }
.g-msg.mine > span { background: var(--accent); color: var(--on-accent); }
.g-msg .photo { width: 92px; height: 60px; padding: 0; background: linear-gradient(135deg, #2B3A55, #1B2333) !important; border: 1px solid var(--line); }
.g-sys { margin: 0; text-align: center; font-size: 8.5px; color: var(--faint); }
.g-pop { position: relative; margin-top: 4px; padding: 10px 8px; border-radius: 14px; background: rgba(0, 0, 0, 0.35); backdrop-filter: blur(4px); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.g-pop .menu { width: 110px; border-radius: 10px; background: var(--modal-bg); border: 1px solid var(--line); font-size: 9.5px; overflow: hidden; }
.g-pop .menu span { display: block; padding: 6px 9px; border-bottom: 1px solid var(--line); }
.g-pop .menu span:last-child { border-bottom: none; }
.g-pop .red { color: var(--exam-text); }
.g-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.g-cal span { height: 22px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 600; }
.g-cal .today { background: var(--accent); color: var(--on-accent); }
.g-cal .exam { background: var(--exam); color: #fff; }
.g-cal .imp { box-shadow: inset 0 0 0 1.5px var(--important); }
.g-todo { display: flex; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); font-size: 10px; }
.g-todo .item { flex: 1; padding: 8px; background: var(--surface); }
.g-todo .swipe { padding: 8px; font-weight: 700; color: #fff; font-size: 9.5px; }
.g-todo .ok { background: var(--mark-green); }
.g-todo .del { background: var(--exam); }
.g-acct { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.g-acct .av { width: 28px; height: 28px; border-radius: 14px; background: var(--accent); }
.g-acct b { display: block; font-size: 11px; }
.g-acct small { font-size: 8.5px; color: var(--mark-green); }
.g-acct-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 10.5px; font-weight: 700; }
.g-acct-row .sw { display: flex; gap: 3px; }
.g-acct-row .sw i { width: 12px; height: 12px; border-radius: 6px; }
.g-keys { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.g-keys div { display: flex; align-items: center; gap: 12px; }
.g-keys .kbd { min-width: 56px; text-align: center; }

/* 電腦子母畫面（內容會複製到小視窗） */
.pip-body { margin: 0; height: 100vh; display: flex; align-items: center; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Manrope', -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; overflow: hidden; }
.pip { display: flex; align-items: center; gap: 18px; padding: 0 18px; width: 100%; }
.pip .ring-wrap { width: 92px; margin: 0; flex-shrink: 0; }
.pip .ring-center { font-size: 11px; color: var(--muted); }
.pip-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pip-info .who { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.pip-info .tm { font-size: 42px; font-weight: 500; letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.pip-info .row { display: flex; gap: 8px; margin-top: 4px; }

/* =====================================================
 * 底部分頁列
 * ===================================================== */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 6px max(4px, calc(50% - 320px)) calc(8px + env(safe-area-inset-bottom));
    background: var(--nav-bg); border-top: 1px solid var(--line);
}
@media (min-width: 900px) { .tabbar { backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); } }
.tab-btn {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    min-height: 50px; padding: 6px 0; border: none; background: transparent;
    color: var(--muted); font-size: 11px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif;
}
.tab-btn svg { width: 22px; height: 22px; }
.tab-btn.active { color: var(--accent-text); font-weight: 700; }

/* =====================================================
 * 彈出視窗
 * ===================================================== */
@media (min-width: 900px) {
    .tabbar {
        top: calc(10px + env(safe-area-inset-top)); bottom: auto; left: 50%; right: auto;
        transform: translateX(-50%); display: flex; gap: 4px; padding: 4px;
        width: max-content; max-width: calc(100vw - 260px);   /* 寬度照內容，不會被 left:50% 限制成半個螢幕而把字擠成直排 */
        border: 1px solid var(--line); border-radius: 26px; z-index: 45;
    }
    .tab-btn { flex-direction: row; gap: 8px; min-height: 40px; padding: 0 18px; border-radius: 21px; font-size: 14px; white-space: nowrap; flex-shrink: 0; }
    .tab-btn svg { width: 18px; height: 18px; }
    .tab-btn:hover { background: var(--surface); }
    .tab-btn.active { background: var(--accent-soft); }
    .topbar { min-height: 66px; }
    .topbar-title { visibility: hidden; }
    .hero { padding-top: 48px; }
    .days { font-size: 156px; }
    .hms { font-size: 28px; gap: 28px; }
    .hms small { font-size: 12px; }
    .main { padding-bottom: 48px; }
    .toast { bottom: 32px; }
    #tab-calendar { padding-bottom: 0; }
}

.modal {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(0, 0, 0, 0.55);
    display: flex; align-items: center; justify-content: center; padding: 20px;
    opacity: 0; pointer-events: none; visibility: hidden; transition: opacity 0.2s, visibility 0s 0.2s;
}
/* 模糊背景只在打開時才加：關著的視窗如果也有 backdrop-filter，捲動時每一格畫面都要重算，手機會卡 */
.modal.open { opacity: 1; pointer-events: auto; visibility: visible; transition: opacity 0.2s; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
body.modal-open { overflow: hidden; }
.modal { overscroll-behavior: contain; }
.sheet {
    width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto;
    background: var(--modal-bg); border: 1px solid var(--line); border-radius: 24px; overflow-x: hidden;
    padding: 24px; box-shadow: var(--shadow);
    transform: translateY(12px) scale(0.98); transition: transform 0.2s;
}
.modal.open .sheet { transform: none; }
.sheet h2 { margin: 0 0 16px; font-size: 17px; font-weight: 700; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.field-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.field {
    width: 100%; border: 1px solid var(--line); background: var(--surface);
    border-radius: 14px; padding: 11px 14px; font-size: 16px; outline: none; margin-bottom: 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; color-scheme: light dark;
    display: block; min-width: 0; max-width: 100%; height: 48px;
}
input[type="date"].field, input[type="time"].field {
    -webkit-appearance: none; appearance: none; text-align: left; line-height: 24px;
}
/* v73 下拉選單：自己畫箭頭（iPhone、Android、電腦的箭頭位置和文字都對齊） */
select.field { -webkit-appearance: none; appearance: none; padding: 0 40px 0 14px; line-height: normal; text-align: left; text-align-last: left; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center; background-size: 16px 16px; text-overflow: ellipsis; white-space: nowrap; }
select.field::-ms-expand { display: none; }
input[type="date"].field::-webkit-date-and-time-value, input[type="time"].field::-webkit-date-and-time-value { text-align: left; margin: 0; }
input[type="date"].field::-webkit-calendar-picker-indicator, input[type="time"].field::-webkit-calendar-picker-indicator { opacity: 0.6; }
[data-theme="dark"] input[type="date"].field, [data-theme="dark"] input[type="time"].field, [data-theme="dark"] #todoDate { color-scheme: dark; }
[data-theme="light"] input[type="date"].field, [data-theme="light"] input[type="time"].field, [data-theme="light"] #todoDate { color-scheme: light; }
.field:focus { border-color: var(--accent); }
textarea.field { height: auto; min-height: 96px; resize: vertical; line-height: 1.5; }
.toggle-row { display: flex; align-items: center; gap: 12px; min-height: 44px; margin-bottom: 14px; font-size: 15px; cursor: pointer; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.toggle-row.imp .checkbox:checked { background: var(--important); border-color: var(--important); }
.toggle-row.imp .checkbox:checked::after { border-color: var(--on-accent); }
.colors { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.color-dot { width: 30px; height: 30px; border-radius: 15px; border: 2px solid transparent; padding: 0; }
.color-dot.selected { border-color: var(--text); }
.color-dot[data-color=""] { background: var(--surface-2); border: 1px dashed var(--faint); }
.color-dot[data-color=""].selected { border: 2px solid var(--text); }
.color-dot[data-color="green"] { background: #10B981; }
.color-dot[data-color="blue"] { background: #3B82F6; }
.color-dot[data-color="yellow"] { background: #F59E0B; }
.color-dot[data-color="pink"] { background: #EC4899; }
.sheet-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin-top: 4px; }
.sheet-btns .spacer { flex: 1; }

.roulette-result { text-align: center; font-size: 40px; font-weight: 700; padding: 24px 0 28px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; color: var(--accent-text); }
.account { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.account img { width: 52px; height: 52px; border-radius: 26px; object-fit: cover; background: var(--surface-2); }
.account .name { font-weight: 700; font-size: 16px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.account .status { font-size: 13px; color: var(--muted); margin-top: 2px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }

.toast {
    position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 200;
    transform: translate(-50%, 16px); opacity: 0; pointer-events: none; transition: all 0.25s;
    background: var(--modal-bg); border: 1px solid var(--line); box-shadow: var(--shadow);
    padding: 10px 18px; border-radius: 22px; font-size: 14px; max-width: 90%; text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ④ 帳號視窗裡的主題色 */
.accent-block { margin: 4px 0 18px; }
.accent-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.accent-opt {
    min-height: 44px; border-radius: 14px; border: 1px solid var(--line); background: transparent;
    display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; padding: 0 4px;
}
.accent-opt i { width: 14px; height: 14px; border-radius: 7px; flex-shrink: 0; }
.acct-group .accent-opt { gap: 5px; font-size: 12.5px; white-space: nowrap; padding: 0 2px; }
.accent-opt.active { border: 1.5px solid var(--accent); background: var(--accent-soft); font-weight: 700; }

/* ⑧ 分享卡片 */
.share-sheet { max-width: 380px; text-align: center; }
.share-sheet img { width: 100%; max-width: 270px; aspect-ratio: 9 / 16; border-radius: 16px; display: block; margin: 0 auto 12px; background: #050608; box-shadow: var(--shadow); }
.share-sheet .sheet-btns { justify-content: center; }
.share-sheet a.btn { text-decoration: none; color: inherit; }

/* ⑦ 指令面板、快捷鍵 */
.kbd {
    display: inline-block; min-width: 22px; text-align: center; padding: 2px 7px; border-radius: 6px;
    border: 1px solid var(--line); font: 600 12px 'Manrope', sans-serif; color: var(--muted);
}
.palette-modal { align-items: flex-start; padding-top: max(12vh, 60px); }
.palette { max-width: 580px; padding: 0; overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.palette-input svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.palette-input input {
    flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-size: 17px;
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; color: var(--text);
}
.palette-list { max-height: 56vh; overflow-y: auto; padding: 8px; }
.palette-group { margin: 8px 12px 6px; font-size: 11.5px; letter-spacing: 0.2em; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.palette-item {
    width: 100%; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border: none;
    background: transparent; border-radius: 10px; text-align: left; font-size: 15px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif;
}
.palette-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item.sel { background: var(--accent-soft); }
.keys-list { display: flex; flex-direction: column; margin-bottom: 14px; }
.keys-list > div { display: flex; align-items: center; justify-content: space-between; min-height: 38px; font-size: 14px; border-bottom: 1px solid var(--line); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.toast { display: flex; align-items: center; gap: 14px; width: max-content; max-width: min(92vw, 380px); text-align: left; line-height: 1.5; }
.toast > span { min-width: 0; }
.toast-btn { white-space: nowrap; flex-shrink: 0; }   /* 「復原」「查看」不要被擠成直的 */
.toast.has-action.show { pointer-events: auto; }
.toast-btn { border: none; background: none; padding: 4px 2px; font-weight: 700; font-size: 14px; color: var(--accent-text); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
[hidden] { display: none !important; }
body.chat-open .toast { bottom: calc(86px + env(safe-area-inset-bottom)); }

/* --- 流暢度 --- */
html { touch-action: pan-x pan-y; }              /* 擋雙指縮放，但不影響捲動 */
/* v57：關掉整頁的橡皮筋回彈。iPhone 滑到最底再往上拉時，會把固定在下面的分頁列一起拉起來、下面露出空白 */
html, body { overscroll-behavior-y: none; }
.bg-glow { contain: strict; }
.g-sec { content-visibility: auto; contain-intrinsic-size: auto 900px; }   /* 導覽頁：看不到的段落先不畫 */
.g-full .g-sec { content-visibility: visible; }   /* v58：點目錄跳段落時全部排好，才停得準 */
.event-list, .todo-list, .seats { contain: layout paint; }
@media (max-width: 899px) { .bg-glow { animation-duration: 20s; } }
@media (prefers-reduced-motion: reduce) { .bg-glow { animation: none; } }

.ai-code { margin: -8px 0 6px; text-align: center; font-size: 11px; color: var(--faint); word-break: break-all; font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Manrope', monospace; }

/* =====================================================
 * 2-2. 學測範圍
 * ===================================================== */
.prog-seg { margin: 0 auto 16px; }
#tab-weekly .prog-seg { max-width: 520px; }
.syl-empty { text-align: center; padding: 40px 12px; display: flex; flex-direction: column; align-items: center; gap: 10px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.syl-empty-ic { width: 64px; height: 64px; border-radius: 22px; background: var(--accent-soft); color: var(--accent-text); display: flex; align-items: center; justify-content: center; }
.syl-empty-ic svg { width: 30px; height: 30px; }
.syl-empty h3 { margin: 6px 0 0; font-size: 19px; }
.syl-empty p { margin: 0 0 8px; color: var(--muted); font-size: 14px; line-height: 1.7; max-width: 30em; }
.syl-sum { position: relative; display: flex; align-items: center; gap: 16px; padding: 4px 0 14px; }
.syl-ring { width: 76px; height: 76px; flex-shrink: 0; }
.syl-ring circle { fill: none; stroke-width: 7; }
.syl-ring .tr { stroke: var(--surface-2); }
.syl-ring .pr { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
.syl-pct { position: absolute; left: 0; top: 4px; width: 76px; height: 76px; display: flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 800; }
.syl-pct small { font-size: 11px; font-weight: 700; margin-left: 1px; color: var(--muted); }
.syl-sum-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.syl-sum-t b { font-size: 16px; }
.syl-sum-t > span { font-size: 12.5px; color: var(--muted); }
.syl-sum-t .num { font-weight: 800; color: var(--text); }
.syl-stack { display: flex; gap: 2px; height: 6px; border-radius: 3px; overflow: hidden; margin-top: 8px; background: var(--surface-2); }
.syl-stack i { height: 100%; transition: width 0.4s; }
.syl-tools { display: flex; gap: 8px; margin-bottom: 14px; }
.syl-tools .btn svg { width: 15px; height: 15px; }
.syl-focus { border-radius: 18px; padding: 13px 14px; background: var(--accent-soft); margin-bottom: 8px; }
.syl-focus h4 { margin: 0 0 9px; display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--accent-text); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.syl-focus h4 svg { width: 16px; height: 16px; fill: currentColor; }
.syl-focus h4 small { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--muted); }
.syl-fchips { display: flex; flex-wrap: wrap; gap: 6px; }
.syl-fchip, .rl-chip { border: none; background: var(--modal-bg); color: var(--text); font-size: 13px; font-weight: 600; padding: 6px 11px; border-radius: 14px; display: inline-flex; align-items: center; gap: 6px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; max-width: 100%; }
.syl-fchip i, .rl-chip i { width: 8px; height: 8px; border-radius: 4px; flex-shrink: 0; }
.syl-fempty { font-size: 13px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.syl-subj { border-top: 1px solid var(--line); }
.syl-subj-h { width: 100%; display: flex; align-items: center; gap: 9px; padding: 14px 0 0; border: none; background: none; font-size: 16px; font-weight: 700; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; text-align: left; }
.syl-subj-h > i { width: 10px; height: 10px; border-radius: 5px; flex-shrink: 0; }
.syl-cnt { font-size: 12px; font-weight: 500; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Manrope', sans-serif; }
.syl-subj-pct { margin-left: auto; font-size: 14px; font-weight: 800; color: var(--muted); }
.syl-chev { width: 18px; height: 18px; color: var(--faint); transition: transform 0.2s; }
.syl-subj.open .syl-chev { transform: rotate(180deg); }
.syl-bar { height: 4px; border-radius: 2px; background: var(--surface-2); margin: 10px 0 12px; overflow: hidden; }
.syl-bar i { display: block; height: 100%; border-radius: 2px; transition: width 0.4s; }
.syl-grp { font-size: 11.5px; font-weight: 700; color: var(--faint); letter-spacing: 0.12em; margin: 6px 0 2px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.syl-units { list-style: none; margin: 0 0 8px; padding: 0; }
.syl-unit { display: flex; align-items: center; gap: 8px; min-height: 46px; border-radius: 10px; transition: background-color 0.4s; }
.syl-unit.flash { background: var(--accent-soft); }
.syl-u { flex: 1; min-width: 0; font-size: 15px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; word-break: break-word; }
.syl-unit.done .syl-u { color: var(--muted); }
.syl-st { border: none; min-width: 54px; min-height: 30px; padding: 0 10px; border-radius: 15px; font-size: 12.5px; font-weight: 700; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; flex-shrink: 0; transition: background-color 0.2s, color 0.2s; }
.syl-st[data-s="0"] { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.syl-st[data-s="1"] { background: var(--surface-2); color: var(--text); }
.syl-st[data-s="2"] { background: var(--mark-green-bg); color: var(--mark-green); }
.syl-flag { width: 36px; height: 36px; border-radius: 18px; border: none; background: transparent; color: var(--faint); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.syl-flag svg { width: 18px; height: 18px; }
.syl-flag.on { color: var(--accent-text); background: var(--accent-soft); }
.syl-flag.on svg { fill: currentColor; }
.syl-st:active, .syl-flag:active, .syl-fchip:active, .rl-chip:active, .syl-pill:active { transform: scale(0.93); }
.syl-unit.edit { gap: 6px; min-height: 52px; }
.syl-unit.edit .syl-name { flex: 1; min-width: 0; margin: 0; min-height: 42px; }
.syl-del { width: 38px; height: 38px; flex-shrink: 0; }
.syl-del svg { width: 15px; height: 15px; }
.syl-add { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 2px 0 14px; }
.syl-add .field { flex: 1; min-width: 150px; margin: 0; min-height: 42px; }
.btn-ghost { border-color: transparent; color: var(--muted); }
/* 選科目 */
.syl-pick { max-width: 420px; }
.syl-pick h2 { margin-bottom: 4px; }
.syl-pick-sub { margin: 0 0 16px; font-size: 13px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
#sylPickBody { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.syl-pgrp > b { display: flex; align-items: center; gap: 7px; font-size: 14px; margin-bottom: 8px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.syl-pgrp > b i { width: 9px; height: 9px; border-radius: 5px; }
.syl-pgrp > b small { font-size: 11.5px; font-weight: 500; color: var(--muted); }
.syl-pills { display: flex; flex-wrap: wrap; gap: 7px; }
.syl-pill { border: 1px solid var(--line); background: transparent; font-size: 14px; font-weight: 600; padding: 0 15px; min-height: 38px; border-radius: 19px; display: inline-flex; align-items: center; gap: 6px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.syl-pill svg { width: 13px; height: 13px; }
.syl-pill.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); font-weight: 700; }
/* 倒數頁：重點複習提醒 */
.review-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.rl-label { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; color: var(--accent-text); margin-right: 2px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.rl-label svg { width: 15px; height: 15px; fill: currentColor; }
.rl-chip { background: var(--surface-2); }
.rl-chip.more { color: var(--muted); }
.roulette-sub { margin: -16px 0 18px; text-align: center; font-size: 14px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; min-height: 1em; }
.roulette-sub:empty { display: none; }
/* v72 吃飯抽籤 */
.lunch-btn { gap: 8px; }
.lunch-btn svg { width: 19px; height: 19px; }
.lunch-sheet h2 { text-align: center; }
.lunch-wheel-box { position: relative; width: min(260px, 72vw, 46vh); aspect-ratio: 1; margin: 8px auto 0; }
.lunch-wheel { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 6px 24px rgba(0, 0, 0, .12), 0 0 0 5px var(--modal-bg), 0 0 0 6.5px var(--line); }
.lunch-wheel svg { width: 100%; height: 100%; display: block; will-change: transform; }
.lw-s { stroke: var(--modal-bg); stroke-width: 1.5; }
.lw-s.s0 { fill: var(--accent); } .lw-s.s1 { fill: rgba(var(--accent-rgb), .42); } .lw-s.s2 { fill: rgba(var(--accent-rgb), .7); } .lw-s.s3 { fill: rgba(var(--accent-rgb), .22); }
.lw-s.off { fill: var(--surface); }
.lw-t { fill: var(--on-accent); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; font-weight: 700; text-anchor: middle; dominant-baseline: central; }
.lw-t.lt { fill: var(--text); }
.lw-t.off { fill: var(--faint); font-weight: 500; }
.lunch-pin { position: absolute; left: 50%; top: -10px; width: 0; height: 0; margin-left: -11px; border: 11px solid transparent; border-top: 18px solid var(--text); border-bottom: 0; filter: drop-shadow(0 2px 2px rgba(0,0,0,.2)); }
.lunch-go { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px; border-radius: 50%; border: 3px solid var(--modal-bg);
    background: var(--text); color: var(--modal-bg); font: 700 16px -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; box-shadow: 0 3px 10px rgba(0, 0, 0, .2); }
.lunch-go:active { transform: scale(.94); }
.lunch-go:disabled { opacity: .9; }
.lunch-result { text-align: center; font-size: 18px; margin: 14px 0 4px; min-height: 30px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; color: var(--muted); }
.lunch-result b { font-size: 26px; color: var(--accent-text); }
.lunch-skip { display: flex; align-items: center; gap: 8px; margin: 0 auto 14px; border: none; background: none; color: var(--muted); font: 13px -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; padding: 6px; }
.lunch-skip i { width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--faint); position: relative; flex: none; }
.lunch-skip.on i { background: var(--accent); border-color: var(--accent); }
.lunch-skip.on i::after { content: ''; position: absolute; left: 5px; top: 1.5px; width: 4px; height: 9px; border: solid var(--on-accent); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.lunch-edit { border-top: 1px solid var(--line); padding-top: 14px; margin-bottom: 8px; }
.lunch-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.lunch-chip { display: inline-flex; align-items: center; gap: 2px; height: 32px; padding: 0 4px 0 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); font: 14px -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.lunch-chip button { width: 26px; height: 26px; border: none; background: none; color: var(--muted); font-size: 17px; border-radius: 50%; }
.lunch-add { display: flex; gap: 8px; }
.lunch-add .field { margin: 0; flex: 1; min-width: 0; }
/* 手機橫放（很矮）：轉盤放左邊，標題、結果和按鈕放右邊，上下左右都置中，不用捲動 */
@media (orientation: landscape) and (max-height: 500px) {
    .lunch-sheet { max-width: 600px; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: 1fr auto auto 1fr; column-gap: 24px; }
    .lunch-sheet .lunch-wheel-box { grid-column: 1; grid-row: 1 / 5; align-self: center; width: min(240px, 70vh); margin: 4px 0; }
    .lunch-sheet h2 { grid-column: 2; grid-row: 2; margin-bottom: 0; text-align: center; }
    .lunch-sheet .lunch-side { grid-column: 2; grid-row: 3; text-align: center; }
    .lunch-sheet .lunch-result { margin: 8px 0 0; }
    .lunch-sheet .lunch-skip { margin: 0 auto 8px; }
    .lunch-sheet .sheet-btns { justify-content: center; }
    .lunch-sheet .sheet-btns .spacer { display: none; }
    .lunch-sheet .lunch-chips { justify-content: center; }
}
/* 網站導覽：學測範圍、背景示意 */
.g-syl-sum { display: flex; align-items: center; gap: 10px; padding: 4px 2px 8px; }
.g-syl-ring { width: 42px; height: 42px; border-radius: 21px; border: 4px solid var(--surface-2); border-top-color: var(--accent); border-right-color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; flex-shrink: 0; }
.g-syl-sum b { display: block; font-size: 11.5px; }
.g-syl-sum small { font-size: 10px; color: var(--muted); }
.g-syl-focus { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 8px; border-radius: 10px; background: var(--accent-soft); margin-bottom: 6px; }
.g-syl-focus b { font-size: 10.5px; color: var(--accent-text); margin-right: 2px; }
.g-syl-focus span { font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 8px; background: var(--modal-bg); }
.g-syl-unit { display: flex; align-items: center; gap: 6px; padding: 6px 2px; border-top: 1px solid var(--line); font-size: 11px; }
.g-syl-unit span { flex: 1; }
.g-syl-unit i { font-style: normal; font-size: 9.5px; font-weight: 700; padding: 2px 7px; border-radius: 8px; }
.g-syl-unit i.s0 { box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); }
.g-syl-unit i.s1 { background: var(--surface-2); }
.g-syl-unit i.s2 { background: var(--mark-green-bg); color: var(--mark-green); }
.g-syl-unit em { width: 9px; height: 11px; background: var(--accent); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%); }
.g-syl-unit em.off { background: var(--faint); }
.g-bgs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-top: 6px; }
.g-bgs .th { aspect-ratio: 3 / 4; border-radius: 6px; border: 1px solid var(--line); position: relative; overflow: hidden; }
.g-bgs .th.t-photo::before { font-size: 14px; }
.g-acct-row .sw i { width: 10px; height: 10px; border-radius: 5px; }

/* --- 倒數頁：點目標直接改 --- */
.goal-btn { border: none; background: none; padding: 4px 6px; margin-left: 4px; border-radius: 10px; display: inline-flex; align-items: center; gap: 2px; cursor: pointer; }
.goal-btn svg { width: 14px; height: 14px; opacity: .7; }
.goal-btn:hover { background: var(--surface-2); }
.goal-btn:active { transform: scale(0.95); }
.goal-sheet { max-width: 360px; }
.goal-sheet h2 { margin-bottom: 4px; }
.goal-sub { margin: 0 0 16px; font-size: 13px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.goal-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.goal-opt { min-height: 62px; border-radius: 16px; border: 1px solid var(--line); background: transparent; display: flex; align-items: baseline; justify-content: center; gap: 3px; font-size: 13px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; padding-top: 16px; }
.goal-opt b { font-size: 22px; color: var(--text); }
.goal-opt.active { border: 1.5px solid var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.goal-opt.active b { color: var(--accent-text); }
.goal-opt:active { transform: scale(0.95); }
/* --- 每週進度：從學測範圍選單元 --- */
.unit-sug { margin: -4px 0 14px; }
.unit-chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.unit-chips::-webkit-scrollbar { display: none; }
.unit-chip { flex-shrink: 0; border: 1px solid var(--line); background: transparent; border-radius: 15px; min-height: 32px; padding: 0 12px; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; white-space: nowrap; }
.unit-chip svg { width: 13px; height: 13px; fill: currentColor; color: var(--accent-text); }
.unit-chip small { font-size: 10.5px; font-weight: 500; color: var(--muted); }
.unit-chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.unit-chip:active { transform: scale(0.95); }


/* =====================================================
 * 聊天訊息通知（個人設定裡選：頂部橫幅／頂部小膠囊）
 * 收起時：先往上滑出畫面＋淡出，動畫結束才 visibility: hidden，保證不會卡在畫面邊緣
 * ===================================================== */
.nbanner, .npill { position: fixed; z-index: 220; top: calc(env(safe-area-inset-top) + 8px); visibility: hidden; opacity: 0; touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; }
.nbanner[hidden], .npill[hidden] { display: none; }
/* A 頂部橫幅 */
.nbanner {
    left: max(14px, calc(50% - 200px)); right: max(14px, calc(50% - 200px));
    display: flex; gap: 12px; align-items: center; padding: 13px 20px 15px 14px; border-radius: 22px;
    /* 毛玻璃：底色留一點透明，後面的畫面會柔柔地透出來；加上主題色細邊和陰影，維持醒目 */
    background: rgba(var(--card-rgb), 0.85); backdrop-filter: blur(26px) saturate(1.7); -webkit-backdrop-filter: blur(26px) saturate(1.7);
    border: 1px solid rgba(var(--accent-rgb), 0.42);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.2), 0 2px 6px rgba(0, 0, 0, 0.06);
    transform: translate3d(0, calc(-100% - env(safe-area-inset-top) - 24px), 0);
    transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s, visibility 0s 0.42s;
}
[data-theme="dark"] .nbanner { background: rgba(var(--card-rgb), 0.8); border-color: rgba(var(--accent-rgb), 0.5); box-shadow: 0 14px 36px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(255, 255, 255, 0.08) inset; }
.nbanner.show { transform: translate3d(0, 0, 0); opacity: 1; visibility: visible; transition: transform 0.48s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s, visibility 0s; }
.nbanner.dragging { transition: none; }
.nb-av { width: 38px; height: 38px; border-radius: 19px; align-self: center; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; flex-shrink: 0; position: relative; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.nb-av .nb-room { position: absolute; right: -4px; bottom: -4px; width: 17px; height: 17px; border-radius: 9px; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px rgb(var(--card-rgb)); }
.nb-av .nb-room svg { width: 11px; height: 11px; }
.nb-tx { flex: 1; min-width: 0; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.nb-hd { display: flex; align-items: baseline; gap: 6px; font-size: 14px; line-height: 1.35; font-weight: 700; min-width: 0; }
.nb-hd b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-hd small { font-size: 11px; font-weight: 500; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.nb-hd em { margin-left: auto; font-style: normal; font-size: 10.5px; color: var(--muted); flex-shrink: 0; font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Manrope', sans-serif; }
.nb-msg { margin-top: 2px; font-size: 13.5px; line-height: 1.5; padding-right: 6px; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.nb-more { margin-top: 4px; font-size: 11.5px; font-weight: 700; color: var(--accent-text); }
.nb-grab { position: absolute; left: 50%; bottom: 5px; width: 28px; height: 3px; border-radius: 2px; background: var(--line); transform: translateX(-50%); }
/* C 頂部小膠囊 */
.npill {
    top: calc(env(safe-area-inset-top) + 22px);   /* 往下一點，不會被頂部的毛玻璃擋住 */
    left: 50%; width: 240px; max-width: calc(100vw - 28px); height: 42px; border-radius: 21px; padding: 0 9px 0 8px; overflow: hidden;
    /* 深色毛玻璃（不是死黑）：淺色主題時柔和一點，不會像一塊黑色貼紙 */
    background: rgba(28, 28, 36, 0.84); backdrop-filter: blur(22px) saturate(1.6); -webkit-backdrop-filter: blur(22px) saturate(1.6);
    color: #F2F0E9; border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28), 0 1px 0 rgba(255, 255, 255, 0.1) inset;
    transform: translate3d(-50%, calc(-100% - env(safe-area-inset-top) - 40px), 0);
    transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s, visibility 0s 0.42s, width 0.38s cubic-bezier(0.22, 1, 0.36, 1), height 0.38s cubic-bezier(0.22, 1, 0.36, 1), border-radius 0.38s;
}
/* 深色主題：膠囊改成亮一點的灰，再加一圈主題色細邊，才不會和黑色背景混在一起 */
[data-theme="dark"] .npill { background: rgba(58, 59, 72, 0.8); border-color: rgba(var(--accent-rgb), 0.5); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 1px 0 rgba(255, 255, 255, 0.12) inset; }
.npill.show { transform: translate3d(-50%, 0, 0); opacity: 1; visibility: visible; transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s, visibility 0s, width 0.38s cubic-bezier(0.22, 1, 0.36, 1), height 0.38s cubic-bezier(0.22, 1, 0.36, 1), border-radius 0.38s; }
.npill.dragging { transition: none; }
.np-row { display: flex; align-items: center; gap: 9px; height: 40px; }
.np-av { width: 26px; height: 26px; border-radius: 13px; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 700; flex-shrink: 0; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; line-height: 1; }
.np-t { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif;
    line-height: 20px; position: relative; }
/* iPhone（Safari 排版）的中文字會比電腦上低一點點，只在 iPhone 上把文字往上提 1px，兩邊看起來都在正中間 */
@supports (-webkit-touch-callout: none) {
    .np-t { top: -1px; }
    .np-n { padding-bottom: 1px; }
}
.np-n { min-width: 22px; height: 22px; padding: 0 6px; line-height: 1; border-radius: 11px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Manrope', sans-serif; }
.np-exp { opacity: 0; padding: 2px 8px 0; display: flex; flex-direction: column; gap: 9px; transition: opacity 0.2s; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.np-exp p { margin: 0; font-size: 13px; line-height: 1.45; color: rgba(242, 240, 233, 0.92); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.np-exp small { font-size: 11px; color: rgba(242, 240, 233, 0.55); }
.np-btns { display: flex; gap: 7px; }
.np-btns button { flex: 1; height: 34px; border-radius: 17px; border: none; font-size: 12.5px; font-weight: 700; background: rgba(242, 240, 233, 0.12); color: #F2F0E9; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.np-btns button.go { background: var(--accent); color: var(--on-accent); }
.npill.open { width: min(400px, calc(100vw - 28px)); height: 166px; /* 實際高度由程式照內容設定 */ border-radius: 28px; padding: 2px 12px 0; cursor: default; }
.npill.open .np-t { white-space: nowrap; }
.npill.open .np-exp { opacity: 1; transition-delay: 0.12s; }
@media (prefers-reduced-motion: reduce) {
    .nbanner, .npill, .nbanner.show, .npill.show { transition: opacity 0.2s, visibility 0s 0.2s; transform: translate3d(0, 0, 0); }
    .npill, .npill.show { transform: translate3d(-50%, 0, 0); }
    .nbanner.show, .npill.show { transition: opacity 0.2s, visibility 0s; }
}
/* 個人設定：訊息通知樣式 */
.notify-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 4px 14px 10px; }
.notify-opt { border: 1px solid var(--line); border-radius: 16px; background: transparent; padding: 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.notify-opt.active { border: 1.5px solid var(--accent); background: var(--accent-soft); }
.notify-opt:active { transform: scale(0.97); }
.nt-th { width: 100%; height: 64px; border-radius: 10px; background: var(--surface-2); position: relative; overflow: hidden; margin-bottom: 6px; }
.nt-banner { position: absolute; left: 7px; right: 7px; top: 7px; height: 26px; border-radius: 8px; background: var(--modal-bg); border: 1px solid rgba(var(--accent-rgb), 0.5); display: flex; align-items: center; gap: 5px; padding: 0 6px; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12); }
.nt-banner i, .nt-pill i { width: 13px; height: 13px; border-radius: 7px; background: var(--accent); flex-shrink: 0; }
.nt-banner > span { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.nt-banner b, .nt-banner em { display: block; height: 3px; border-radius: 2px; background: var(--faint); }
.nt-banner b { width: 40%; background: var(--muted); }
.nt-banner em.s { width: 70%; }
.nt-pill { position: absolute; left: 50%; top: 7px; transform: translateX(-50%); width: 62%; height: 16px; border-radius: 8px; background: rgba(28, 28, 36, 0.85); display: flex; align-items: center; gap: 4px; padding: 0 3px; }
[data-theme="dark"] .nt-pill { background: rgba(70, 71, 86, 0.9); box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.5); }
.nt-pill i { width: 10px; height: 10px; }
.nt-pill em { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.5); }
.nt-pill u { width: 9px; height: 9px; border-radius: 5px; background: var(--accent); }
.nt-name { font-size: 13.5px; font-weight: 700; }
.notify-opt.active .nt-name { color: var(--accent-text); }
.nt-sub { font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.nt-try { display: block; margin: 0 14px 14px auto; border: none; background: none; color: var(--accent-text); font-size: 13px; font-weight: 700; padding: 4px 2px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }

.g-chat-entry { display: flex; align-items: center; gap: 7px; padding: 7px 8px; border-radius: 12px; border: 1px solid rgba(var(--accent-rgb), 0.45); background: var(--accent-soft); margin-top: 2px; }
.g-chat-entry .ic { width: 22px; height: 22px; border-radius: 7px; background: rgba(var(--accent-rgb), 0.2); color: var(--accent-text); display: flex; align-items: center; justify-content: center; }
.g-chat-entry .ic svg { width: 15px; height: 15px; }
.g-chat-entry b { font-size: 11px; }
.g-chat-entry small { font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* 網站導覽：通知示意 */
.g-notice { display: flex; align-items: center; gap: 8px; padding: 8px 12px 9px 9px; border-radius: 14px; background: var(--modal-bg); border: 1px solid rgba(var(--accent-rgb), 0.45); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12); margin-bottom: 4px; }
.g-notice > i { width: 24px; height: 24px; border-radius: 12px; color: #fff; font-style: normal; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.g-notice b { display: block; font-size: 10.5px; }
.g-notice b small { font-weight: 500; color: var(--muted); margin-left: 4px; }
.g-notice span { font-size: 10px; color: var(--muted); }

/* 我在房間裡的樣子：頭像顏色 */
.me-colors { display: flex; flex-wrap: wrap; gap: 10px; margin: 2px 0 16px; }
.me-color { width: 34px; height: 34px; border-radius: 17px; border: none; color: #fff; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; box-shadow: 0 0 0 2px var(--modal-bg), 0 0 0 3px transparent; transition: box-shadow 0.2s, transform 0.15s; }
.me-color.auto { background: conic-gradient(var(--s0), var(--s1), var(--s2), var(--s3), var(--s4), var(--s0)); font-size: 10px; }
.me-color.active { box-shadow: 0 0 0 2px var(--modal-bg), 0 0 0 4px var(--text); }
.me-color:active { transform: scale(0.92); }
.me-preview { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; }
.me-preview .av { width: 46px; height: 46px; border-radius: 23px; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 700; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.me-preview b { font-size: 15px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }

/* =====================================================
 * 讀書房間：讀書紀錄（開始讀書下面）
 * ===================================================== */
.room-cta { position: static; margin: 18px 0 0; padding: 0; }   /* 下面還有讀書紀錄，按鈕不要黏在底部擋住列表 */
.rh { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
.rh-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rh-head h3 { margin: 0; font-size: 17px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; white-space: nowrap; }
.rh-seg { display: inline-grid; grid-auto-flow: column; padding: 3px; gap: 2px; border-radius: 14px; background: var(--surface-2); flex-shrink: 0; }
.rh-seg button { border: none; background: transparent; border-radius: 11px; padding: 6px 11px; font-size: 12.5px; font-weight: 600; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.rh-seg button.active { background: var(--modal-bg); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14); font-weight: 700; }
.rh-custom { margin-top: 12px; padding: 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); }
.rh-custom .field-row { margin: 0; }
.rh-custom .field { margin-bottom: 0; }
.rh-quick { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.rh-quick button { border: 1px solid var(--line); background: transparent; border-radius: 13px; padding: 4px 11px; font-size: 12px; font-weight: 600; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.rh-quick button.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
/* 大時間＋右邊的期間，永遠排成一行 */
.rh-sum { display: flex; align-items: baseline; gap: 10px; margin: 16px 0 2px; white-space: nowrap; min-width: 0; }
.rh-sum b { font-size: 28px; font-weight: 800; flex-shrink: 0; }
.rh-sum b small { font-size: 14px; font-weight: 600; margin: 0 2px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.rh-sum span { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; min-width: 0; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.rh-chart { display: flex; align-items: flex-end; gap: 3px; height: 72px; margin: 12px 0 4px; }
.rh-chart i { flex: 1; min-height: 2px; border-radius: 3px 3px 1px 1px; background: rgba(var(--accent-rgb), 0.5); }
.rh-chart i.today { background: var(--accent); }
.rh-chart i.future { background: var(--surface-2); }
.rh-axis { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--faint); margin-bottom: 6px; }
.rh-list { list-style: none; margin: 8px 0 0; padding: 0; }
.rh-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.rh-row:first-child { border-top: none; }
.rh-rk { width: 18px; text-align: center; font-size: 12.5px; font-weight: 800; color: var(--muted); flex-shrink: 0; }
.rh-av { width: 38px; height: 38px; border-radius: 19px; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; position: relative; flex-shrink: 0; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.rh-row.first .rh-av { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9), 0 0 0 4px #F5C02B; }
/* 皇冠：斜斜地戴在頭像左上角 */
/* 顏色和陰影都是固定的，不跟主題變，每個主題看起來都一樣 */
.rh-crown { position: absolute; left: -13px; top: -9px; width: 26px; height: 16px; transform: rotate(-28deg); filter: drop-shadow(0 1.5px 1.2px rgba(120, 80, 0, 0.38)); pointer-events: none; overflow: visible; }
.rh-mid { flex: 1; min-width: 0; display: block; }
.rh-name { display: flex; align-items: baseline; gap: 6px; min-width: 0; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.rh-name b { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rh-name small { font-size: 11.5px; color: var(--muted); white-space: nowrap; flex-shrink: 0; }
.rh-track { display: block; height: 7px; border-radius: 4px; background: var(--surface-2); margin-top: 7px; overflow: hidden; }
/* 進度條下面：左邊時間、右邊讀了幾天（淡灰色小字） */
.rh-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 5px; font-size: 12px; color: var(--muted); white-space: nowrap; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.rh-meta .num { font-weight: 600; }
.rh-track i { display: block; height: 100%; border-radius: 4px; transition: width 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); }
.rh-t { font-size: 13.5px; font-weight: 800; white-space: nowrap; flex-shrink: 0; }
.rh-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 18px 0 4px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.rh-note { margin: 12px 0 0; text-align: center; font-size: 11.5px; color: var(--faint); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }

/* 網站導覽：讀書紀錄示意 */
.g-rh { margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.g-rh-head { display: flex; align-items: center; justify-content: space-between; }
.g-rh-head b { font-size: 11.5px; }
.g-rh-seg { display: inline-flex; gap: 1px; padding: 2px; border-radius: 8px; background: var(--surface-2); }
.g-rh-seg i { font-style: normal; font-size: 9px; padding: 2px 5px; border-radius: 6px; color: var(--muted); }
.g-rh-seg i.on { background: var(--modal-bg); color: var(--text); font-weight: 700; }
.g-rh-sum { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.g-rh-sum b { font-size: 15px; font-weight: 800; }
.g-rh-sum b small { font-size: 9px; margin: 0 1px; }
.g-rh-sum span { font-size: 9.5px; color: var(--muted); }
.g-rh-row { display: flex; align-items: center; gap: 7px; font-size: 10.5px; }
.g-rh-row b { flex: 1; }
.g-rh-row em { font-style: normal; font-weight: 800; }
.g-rh-av { width: 20px; height: 20px; border-radius: 10px; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; position: relative; flex-shrink: 0; }
.g-rh-row:nth-child(3) .g-rh-av { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.9), 0 0 0 2.5px #F5C02B; }
.g-rh-crown { position: absolute; left: -8px; top: -6px; width: 15px; height: 10px; transform: rotate(-28deg); }

.g-rh-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.g-rh-mid b { font-size: 10.5px; }
.g-rh-bar { display: block; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.g-rh-bar i { display: block; height: 100%; border-radius: 2px; }
.g-rh-meta { display: flex; justify-content: space-between; font-size: 9px; color: var(--muted); }

/* =====================================================
 * 待辦日期、邀請連結
 * ===================================================== */
/* 待辦輸入列的日期按鈕：透明的原生日期欄位蓋在上面，點了就跳出系統日曆 */
.todo-date-btn {
    position: relative; flex-shrink: 0; min-width: 46px; height: 46px; padding: 0 12px; border-radius: 23px;
    border: 1px solid var(--line); background: var(--surface); color: var(--muted);
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
    font: 600 13.5px -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; transition: border-color .15s, background .15s, color .15s;
}
.todo-date-btn svg { width: 19px; height: 19px; flex-shrink: 0; }
.todo-date-btn:active { transform: scale(0.97); }
.todo-date-btn #todoDateLabel:empty { display: none; }
.todo-date-btn.has { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); padding-right: 4px; }
.todo-date-btn input[type="date"] {
    position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; margin: 0; padding: 0;
    cursor: pointer; font-size: 16px; -webkit-appearance: none; appearance: none; z-index: 1;
}
.todo-date-btn input[type="date"]::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: auto; height: auto; opacity: 0; cursor: pointer; }
.todo-date-x {
    position: relative; z-index: 2; width: 30px; height: 30px; border-radius: 15px; border: none; background: transparent;
    color: inherit; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.todo-date-x[hidden] { display: none; }
.todo-date-x svg { width: 13px; height: 13px; }
.todo-date-x:hover { background: rgba(var(--card-rgb), .5); }

/* 待辦清單上的日期標籤 */
.todo-date {
    display: inline-flex; align-items: center; height: 20px; vertical-align: 1px; margin-left: 8px; padding: 0 8px; border-radius: 7px;
    font-size: 11.5px; font-weight: 700; line-height: 1; white-space: nowrap;
    background: var(--surface-2); color: var(--muted);
}
.todo-date.today { background: var(--mark-green-bg); color: var(--mark-green); }
.todo-date.late { background: rgba(239, 68, 68, 0.14); color: var(--exam); }
.check-item.done .todo-date { text-decoration: none; }
.subj.todo-subj { color: var(--mark-green); }

/* 行事曆：待辦是綠色小點／綠色標題 */
.cal-dots i.td { background: var(--mark-green); }
@media (min-width: 768px) {
    .cal-titles span.td { background: var(--mark-green-bg); color: var(--mark-green); }
}
.legend i.td { background: var(--mark-green); }
.legend { flex-wrap: wrap; gap: 6px 14px; }
.cal-todo label { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 4px 4px; cursor: pointer; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; font-size: 15px; }
.cal-todo-tag { flex-shrink: 0; display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 7px; font-size: 11.5px; font-weight: 700; line-height: 1; background: var(--mark-green-bg); color: var(--mark-green); }
.cal-todo-tx { flex: 1; min-width: 0; word-break: break-word; }

/* 導覽示意 */
.g-check .g-td, .g-todo .g-td-date { font-style: normal; font-size: 8.5px; font-weight: 700; padding: 0 5px; border-radius: 5px; background: var(--mark-green-bg); color: var(--mark-green); }
.g-check .g-td { margin-right: 2px; }
.g-todo .g-td-date { margin-left: 5px; }
.g-cal span.td { position: relative; }
.g-cal span.td::after { content: ''; position: absolute; bottom: 2px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 2px; background: var(--mark-green); }

/* 邀請連結：加入房間確認 */
.join-sheet { max-width: 340px; text-align: center; }
.join-ic { width: 56px; height: 56px; margin: 4px auto 12px; border-radius: 18px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-text); }
.join-ic svg { width: 28px; height: 28px; }
.join-kicker { margin: 0 0 4px; font: 600 12.5px -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; color: var(--muted); letter-spacing: .04em; }
.join-sheet h2 { margin: 0 0 6px; word-break: break-word; }
.join-info { margin: 0 0 18px; font-size: 13px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.join-sheet .sheet-btns { justify-content: center; }
.join-sheet .sheet-btns .btn { flex: 1; }


/* =====================================================
 * 計時頁「今天的紀錄」、編輯讀書紀錄
 * ===================================================== */
.tlog {
    margin-top: 22px; padding: 16px 16px 8px; border-radius: 20px;
    background: var(--surface); border: 1px solid var(--line);
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; text-align: left;
}
.tlog-head { display: flex; align-items: flex-start; gap: 12px; }
.tlog-tx { flex: 1; min-width: 0; }
.tlog-tx h3 { margin: 0; font-size: 15px; font-weight: 700; line-height: 22px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tlog-ok { display: inline-flex; align-items: center; height: 19px; padding: 0 8px; border-radius: 7px; font-size: 11px; font-weight: 700; line-height: 1; background: var(--mark-green-bg); color: var(--mark-green); }
.tlog-tx p { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.tlog-tx p b { color: var(--text); font-weight: 700; font-size: 13.5px; }
.tlog-tx p span { white-space: nowrap; }
.tlog-tx p { display: flex; flex-direction: column; gap: 1px; }
.tlog-sub { display: flex; flex-wrap: wrap; column-gap: 12px; font-size: 12px; }
.tlog-sub span + span { position: relative; }
.tlog-sub span + span::before { content: ''; position: absolute; left: -7px; top: 50%; width: 3px; height: 3px; margin-top: -1px; border-radius: 2px; background: currentColor; opacity: .55; }
.tlog-add {
    flex-shrink: 0; min-height: 36px; padding: 0 13px 0 10px; border-radius: 18px; border: 1px solid var(--line);
    background: transparent; color: var(--text); font: 600 13px -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif;
    display: inline-flex; align-items: center; gap: 4px; cursor: pointer; transition: transform .15s, background .15s;
}
.tlog-add svg { width: 14px; height: 14px; }
.tlog-add:hover { background: var(--surface-2); }
.tlog-add:active { transform: scale(0.96); }
.tlog-bar { display: flex; gap: 2px; height: 6px; border-radius: 3px; overflow: hidden; background: var(--surface-2); margin: 12px 0 4px; }
.tlog-bar i { display: block; height: 100%; flex-shrink: 0; transition: width .4s ease; }
.tl-list { list-style: none; margin: 0; padding: 0; }
.tl-list li + li .tl-row { border-top: 1px solid var(--line); }
.tl-row, .log-main {
    width: 100%; display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 2px;
    border: none; background: transparent; color: var(--text); text-align: left; cursor: pointer;
    font: 400 14.5px -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; border-radius: 10px; transition: background .15s;
}
.tl-row:hover, .log-main:hover { background: var(--surface-2); }
.tl-row:active, .log-main:active { background: var(--surface-2); }
.tl-row .at { width: 42px; flex-shrink: 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.tl-row .nm { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
.tl-row .mn { font-size: 14px; font-weight: 700; }
.tl-edited { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 6px; font-style: normal; font-size: 10.5px; font-weight: 700; line-height: 1; background: var(--mark-green-bg); color: var(--mark-green); white-space: nowrap; flex-shrink: 0; }
.tl-pen { width: 30px; height: 30px; border-radius: 15px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--muted); transition: color .15s, background .15s; }
.tl-pen svg { width: 14px; height: 14px; }
.tl-row:hover .tl-pen, .log-main:hover .tl-pen { color: var(--accent-text); background: var(--accent-soft); }
.tl-more { width: 100%; min-height: 40px; border: none; background: transparent; color: var(--accent-text); font: 600 13px -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; display: flex; align-items: center; justify-content: center; gap: 4px; cursor: pointer; border-top: 1px solid var(--line); }
.tl-more svg { width: 14px; height: 14px; transition: transform .2s; }
.tl-more[aria-expanded="true"] svg { transform: rotate(180deg); }
.tlog-hint, .tlog-empty { margin: 6px 0 6px; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.6; }
.tlog-empty { margin: 10px 0 12px; font-size: 13px; }
.break-edit { display: flex; width: fit-content; margin: 6px auto 0; font-size: 13px; }
.break-edit svg { width: 14px; height: 14px; }

/* 統計 → 當天明細：整列可以點來編輯，右邊保留刪除 */
.log-row { gap: 4px; }
.log-main { flex: 1; min-width: 0; gap: 12px; min-height: 48px; }
.log-main .nm { flex: 1; min-width: 0; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.log-main .tl-pen { width: 28px; height: 28px; }

/* 編輯紀錄視窗 */
.sess-sheet { max-width: 400px; }
.sess-sheet h2 { margin-bottom: 2px; }
.sess-sub { margin: 0 0 6px; font-size: 13px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.sess-subj { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-bottom: 16px; }
.sess-subj button {
    min-height: 40px; padding: 0 2px; border-radius: 12px; border: 1px solid var(--line); background: transparent; color: var(--muted);
    font: 500 13px -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; display: flex; align-items: center; justify-content: center; gap: 5px; cursor: pointer; transition: all .15s;
}
.sess-subj button .sdot { width: 7px; height: 7px; }
.sess-subj button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--text); font-weight: 700; }
.sess-dur { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.sess-step { width: 48px; height: 48px; border-radius: 24px; border: 1px solid var(--line); background: transparent; color: var(--text); font-size: 15px; font-weight: 700; cursor: pointer; flex-shrink: 0; transition: transform .12s, background .15s; }
.sess-step:hover { background: var(--surface-2); }
.sess-step:active { transform: scale(0.92); }
.sess-min { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.sess-min-row { display: flex; align-items: baseline; justify-content: center; gap: 4px; }
.sess-min input {
    width: 3.2ch; border: none; background: transparent; color: var(--text); text-align: center; padding: 0;
    font-size: 40px; font-weight: 700; line-height: 1.1; outline: none; -moz-appearance: textfield; appearance: textfield;
    border-bottom: 2px solid transparent; transition: border-color .15s;
}
.sess-min input:focus { border-bottom-color: var(--accent); }
.sess-min input::-webkit-outer-spin-button, .sess-min input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sess-min small { font-size: 15px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.sess-min em { font-style: normal; font-size: 12px; color: var(--muted); min-height: 1.5em; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; text-align: center; }
.sess-quick { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin: 8px 0 16px; }
.sess-quick button { min-height: 34px; border-radius: 10px; border: 1px solid transparent; background: var(--surface-2); color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s; }
.sess-quick button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.sess-end { display: flex; align-items: center; color: var(--muted); border-style: dashed; white-space: nowrap; overflow: hidden; }
.sess-note { margin: 2px 0 10px; font-size: 12px; color: var(--muted); line-height: 1.6; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.sess-del { color: var(--exam); border-color: transparent; padding-left: 8px; padding-right: 10px; }
.sess-del svg { width: 16px; height: 16px; }

/* 導覽示意：今天的紀錄 */
.g-tlog { margin-top: 4px; padding: 8px 9px 4px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 9.5px; }
.g-tlog-h { display: flex; justify-content: space-between; align-items: center; }
.g-tlog-h b { font-size: 10.5px; }
.g-tlog-h span { font-size: 8.5px; padding: 2px 7px; border-radius: 8px; border: 1px solid var(--line); font-weight: 700; }
.g-tlog-bar { display: flex; gap: 1px; height: 4px; border-radius: 2px; overflow: hidden; background: var(--surface-2); margin: 6px 0 3px; }
.g-tlog-bar i { display: block; height: 100%; }
.g-tlog-r { display: flex; align-items: center; gap: 6px; min-height: 22px; }
.g-tlog-r + .g-tlog-r { border-top: 1px solid var(--line); }
.g-tlog-r > span.num { width: 26px; color: var(--muted); font-weight: 600; }
.g-tlog-r .n { flex: 1; display: flex; align-items: center; gap: 4px; }
.g-tlog-r .n small { font-size: 7.5px; font-weight: 700; padding: 0 4px; border-radius: 4px; background: var(--mark-green-bg); color: var(--mark-green); }
.g-tlog-r em { font-style: normal; width: 16px; height: 16px; border-radius: 8px; background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; font-size: 8px; color: var(--muted); }
.sess-sheet p.field-label { margin-top: 0; }

@supports (-webkit-touch-callout: none) {
    .tlog-ok, .tl-edited, .todo-date, .cal-todo-tag { padding-bottom: 1px; }
}
.fab { transition: opacity .2s ease, transform .2s ease, visibility .2s; }
.fab.away { opacity: 0; transform: scale(0.8); visibility: hidden; pointer-events: none; }
#loginBtn.busy { opacity: .7; pointer-events: none; }

/* =====================================================
 * 自訂倒數、首頁自己排、專注畫面置中、全螢幕時鐘
 * ===================================================== */
/* --- 倒數頁上方的切換鈕 --- */
.chip { display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background .2s, border-color .2s, color .2s, transform .15s; }
.cd-dot { width: 7px; height: 7px; border-radius: 4px; flex-shrink: 0; display: inline-block; }
.chip-more { width: 46px; padding: 0; border-style: dashed; color: var(--muted); }
.chip-more svg { width: 18px; height: 18px; }
.hero.custom .eyebrow { color: var(--cd-color); }
.hero.swap { animation: heroSwap .42s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes heroSwap { from { opacity: .35; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* --- 我的倒數 --- */
.cdm-sheet { max-height: min(86dvh, 760px); overflow-y: auto; overscroll-behavior: contain; }
.cdm-head, .he-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.cdm-head h2, .he-head h2 { margin: 0 0 4px; }
.cdm-head p, .he-head p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.cdm-head .btn svg { width: 15px; height: 15px; }
.cdm-label { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 4px; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .06em; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.cdm-label[hidden] { display: none; }
.cdm-list, .he-list { list-style: none; margin: 0; padding: 0; position: relative; }
.cdm-row, .he-row {
    display: flex; align-items: center; gap: 10px; min-height: 60px; position: relative;
    border-bottom: 1px solid var(--line); background: var(--modal-bg); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif;
}
.cdm-list.sorting .cdm-row:not(.dragging), .he-list.sorting .he-row:not(.dragging) { transition: transform .2s cubic-bezier(0.22, 1, 0.36, 1); }
.cdm-row.dragging, .he-row.dragging { z-index: 2; border-radius: 14px; box-shadow: 0 10px 28px rgba(0, 0, 0, .28); border-bottom-color: transparent; }
.cdm-row.ended { opacity: .55; }
.cdm-pin, .he-check {
    width: 26px; height: 26px; border-radius: 13px; flex-shrink: 0; padding: 0; cursor: pointer;
    border: 1.5px solid var(--faint); background: transparent; color: transparent;
    display: inline-flex; align-items: center; justify-content: center; transition: background .18s, border-color .18s, transform .15s;
}
.cdm-pin svg, .he-check svg { width: 14px; height: 14px; }
.cdm-pin.on, .he-check.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.cdm-pin:active, .he-check:active { transform: scale(.88); }
.he-check.dim { opacity: .45; cursor: default; }
.cdm-main { flex: 1; min-width: 0; border: none; background: transparent; color: var(--text); text-align: left; padding: 8px 0; cursor: pointer; display: flex; flex-direction: column; gap: 3px; }
.cdm-name { display: flex; align-items: center; gap: 7px; min-width: 0; }
.cdm-name b { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.35; }
.cdm-tag { flex-shrink: 0; display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 6px; font-style: normal; font-size: 10.5px; font-weight: 700; line-height: 1; border: 1px solid var(--line); color: var(--muted); }
.cdm-tag.yr { border-color: transparent; background: var(--mark-green-bg); color: var(--mark-green); }
.cdm-sub { font-size: 12.5px; color: var(--muted); padding-left: 14px; }
.cdm-edit { width: 34px; height: 34px; border-radius: 17px; border: none; background: var(--surface-2); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; cursor: pointer; }
.cdm-edit svg { width: 14px; height: 14px; }
.drag-h { width: 40px; height: 44px; margin-right: -8px; border: none; background: transparent; color: var(--faint); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; cursor: grab; touch-action: none; border-radius: 10px; }
.drag-h svg { width: 22px; height: 22px; }
.drag-h:active { cursor: grabbing; color: var(--muted); }
.drag-sp { width: 32px; flex-shrink: 0; }
.cdm-list .empty { padding: 14px 0; font-size: 13px; color: var(--muted); }

/* 新增／修改倒數 */
.cde-sheet { max-width: 420px; }
.cde-sheet p.field-label { margin-top: 0; }
#cdeEndWrap.off { opacity: .4; }
.cde-colors { display: flex; gap: 12px; margin: 2px 0 16px; flex-wrap: wrap; }
.cde-color { width: 32px; height: 32px; border-radius: 16px; border: none; background: var(--c); cursor: pointer; transition: transform .15s, box-shadow .15s; }
.cde-color.on { box-shadow: 0 0 0 2.5px var(--modal-bg), 0 0 0 4.5px var(--c); }
.cde-color:active { transform: scale(.9); }
.cde-switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 50px; border-top: 1px solid var(--line); cursor: pointer; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; font-size: 14.5px; }
.cde-switch span { display: flex; flex-direction: column; gap: 2px; }
.cde-switch small { font-size: 12px; color: var(--muted); }
.cde-switch input { position: absolute; opacity: 0; pointer-events: none; }
.cde-switch i { width: 48px; height: 29px; border-radius: 15px; background: var(--surface-2); border: 1px solid var(--line); position: relative; flex-shrink: 0; transition: background .2s, border-color .2s; }
.cde-switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 11px; background: var(--text); opacity: .75; transition: transform .22s cubic-bezier(0.22, 1, 0.36, 1), background .2s; }
.cde-switch input:checked + i { background: var(--accent); border-color: var(--accent); }
.cde-switch input:checked + i::after { transform: translateX(19px); background: var(--on-accent); opacity: 1; }
.cde-switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.cde-sheet .sheet-btns { margin-top: 10px; }

/* 行事曆上的自訂倒數 */
@media (min-width: 768px) { .cal-titles span.cdt { background: color-mix(in srgb, var(--cd-color) 18%, transparent); color: var(--text); border-left: 3px solid var(--cd-color); } }
.cd-row { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 52px; border: none; background: transparent; color: var(--text); text-align: left; padding: 0 4px; cursor: pointer; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; border-radius: 10px; }
.cd-row:hover { background: var(--surface); }
.cd-row-bar { width: 4px; height: 26px; border-radius: 2px; flex-shrink: 0; }
.cd-row-tx { flex: 1; min-width: 0; font-size: 15px; display: flex; flex-direction: column; gap: 1px; }
.cd-row-tx small { font-size: 12px; color: var(--muted); }
.cd-row-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 7px; font-size: 11.5px; font-weight: 700; line-height: 1; background: color-mix(in srgb, var(--cd-color) 18%, transparent); color: var(--text); flex-shrink: 0; }

/* --- 首頁區塊 --- */
.home-mod + .home-mod { margin-top: 16px; }
.home-mod.mod-off, .home-mod.mod-empty { display: none; }
.home-mod[data-mod="time"] + .home-mod[data-mod="list"] { margin-top: 4px; }
.home-mod[data-mod="review"] .review-line { margin-top: 0; }
.mod-title { margin: 0 0 8px; font-size: 16px; font-weight: 700; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.home-mod[data-mod="list"]:not(.with-head) .mod-title { display: none; }
.home-mod { animation: modIn .35s ease both; }
@keyframes modIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.home-edit-wrap { display: flex; justify-content: center; margin: 26px 0 4px; }
.home-edit-btn {
    min-height: 40px; padding: 0 16px; border-radius: 20px; border: 1px solid var(--line); background: transparent; color: var(--muted);
    font: 600 13px -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; transition: color .15s, background .15s, transform .15s;
}
.home-edit-btn svg { width: 15px; height: 15px; }
.home-edit-btn:hover { color: var(--text); background: var(--surface); }
.home-edit-btn:active { transform: scale(.96); }
/* 接下來 */
.hu-list { list-style: none; margin: 0; padding: 0; }
.hu-row { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 0 2px; border: none; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); text-align: left; cursor: pointer; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.hu-list li:last-child .hu-row { border-bottom: none; }
.hu-date { width: 44px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.hu-date b { font-size: 14px; }
.hu-date small { font-size: 11px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.hu-bar { width: 3px; height: 24px; border-radius: 2px; flex-shrink: 0; }
.hu-tx { flex: 1; min-width: 0; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hu-rel { font-size: 12.5px; color: var(--muted); flex-shrink: 0; }
.hu-list .empty { padding: 10px 0; font-size: 13px; color: var(--muted); }
/* 讀書房間 */
.hr-box { display: flex; flex-direction: column; }
.hr-sum { display: flex; align-items: center; gap: 6px; margin: 0 0 4px; font-size: 12.5px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.hr-sum i { width: 7px; height: 7px; border-radius: 4px; background: var(--mark-green); }
.hr-row { display: flex; align-items: center; gap: 10px; min-height: 46px; border: none; background: transparent; color: var(--text); padding: 0 2px; cursor: pointer; text-align: left; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; border-radius: 10px; }
.hr-row .av { width: 30px; height: 30px; border-radius: 15px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; font-weight: 700; }
.hr-row.focus .av { box-shadow: 0 0 0 2px var(--modal-bg, var(--bg)), 0 0 0 3.5px var(--mark-green); }
.hr-name { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hr-st { font-size: 12.5px; color: var(--muted); flex-shrink: 0; }
.hr-row.focus .hr-st { color: var(--mark-green); font-weight: 600; }
.hr-empty { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 13.5px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }

/* --- 編輯首頁 --- */
.he-sheet { max-height: min(88dvh, 760px); overflow-y: auto; overscroll-behavior: contain; }
.he-done { width: 48px; height: 48px; border-radius: 24px; border: none; background: var(--accent); color: var(--on-accent); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; cursor: pointer; box-shadow: 0 8px 22px rgba(var(--accent-rgb), .3); transition: transform .15s; }
.he-done svg { width: 22px; height: 22px; }
.he-done:active { transform: scale(.92); }
.he-list { margin-top: 10px; }
.he-row { gap: 14px; min-height: 62px; }
.he-row.fixed { opacity: .6; }
.he-ic { width: 26px; height: 26px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; color: var(--accent-text); }
.he-ic svg { width: 22px; height: 22px; }
.he-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 8px 0; }
.he-tx b { font-size: 15.5px; font-weight: 600; line-height: 1.35; }
.he-tx small { font-size: 12px; color: var(--muted); line-height: 1.4; }
.he-reset { display: flex; margin: 14px auto 0; color: var(--muted); font-weight: 500; font-size: 13px; }

/* --- 專注畫面：手機、平板、電腦都置中，標題列和按鈕排在一起 --- */
body.focus-mode .main { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
.focus-wrap {
    min-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    display: flex; flex-direction: column; justify-content: center; padding: 20px 0 24px; box-sizing: border-box;
}
.focus-wrap .timer-head { padding: 0 0 6px; }
.focus-wrap .chip-subj { min-height: 42px; padding: 0 16px 0 14px; font-size: 17px; gap: 9px; border-radius: 21px; background: var(--surface); }
.focus-wrap .chip-subj .sdot { width: 10px; height: 10px; border-radius: 5px; }
.focus-wrap .timer-head .label { font-size: 12.5px; }
.focus-wrap .task-line { margin-top: 6px; }
.focus-wrap .ring-wrap { width: min(74vw, 46dvh, 340px); margin-top: 18px; }
.focus-wrap .ring-time {
    font-family: ui-rounded, 'SF Pro Rounded', 'Nunito', 'Manrope', system-ui, sans-serif;
    font-weight: 600; font-size: clamp(54px, min(17vw, 10dvh), 86px); font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}
.focus-wrap .round-dots { margin-top: 18px; }
.focus-wrap .focus-btns { margin-top: 22px; }
.focus-wrap .focus-extra { margin-top: 20px; gap: 12px; }
.focus-tools { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.tool-btn {
    min-height: 38px; padding: 0 14px; border-radius: 19px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
    font: 600 13px -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; transition: background .15s, transform .15s;
}
.tool-btn svg { width: 16px; height: 16px; }
.tool-btn:hover { background: var(--surface-2); }
.tool-btn:active { transform: scale(.96); }
@media (orientation: landscape) and (max-height: 540px) {
    /* 手機橫放：圓環和按鈕左右並排，不用捲動 */
    .focus-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "head head" "ring side"; align-content: center; column-gap: 24px; padding: 12px 0; }
    .focus-wrap .timer-head { grid-area: head; }
    .focus-wrap .task-line { display: none; }
    .focus-wrap .ring-wrap { grid-area: ring; width: min(64dvh, 260px); margin: 0 auto; }
    .focus-wrap .round-dots, .focus-wrap .focus-btns, .focus-wrap .focus-extra { grid-column: 2; margin-top: 10px; }
    .focus-wrap .round-dots { grid-row: 2; align-self: start; margin-top: 24px; }
    .focus-wrap .focus-btns { grid-row: 2; align-self: center; }
    .focus-wrap .focus-extra { grid-row: 2; align-self: end; margin-bottom: 8px; }
    .focus-wrap .focus-extra .hint { display: none; }
}

/* --- 全螢幕時鐘：主題背景在後面，大數字像 iPhone 待機模式 --- */
.standby {
    position: fixed; inset: 0; z-index: 240; display: flex; flex-direction: column; justify-content: center; align-items: center;
    padding: calc(18px + env(safe-area-inset-top)) calc(22px + env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) calc(22px + env(safe-area-inset-left));
    background: rgba(var(--bg-rgb), .42); color: var(--text); opacity: 0; transition: opacity .35s ease;
    -webkit-user-select: none; user-select: none; cursor: default;
}
.standby[hidden] { display: none; }
.standby.show { opacity: 1; }
body.sb-on { overflow: hidden; }
body.sb-on .tabbar, body.sb-on .topbar, body.sb-on .main { visibility: hidden; }
.sb-mid {
    --ring: min(76vw, 56dvh, 460px);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(14px, 3dvh, 26px);
    transform: translate3d(var(--sb-x, 0), var(--sb-y, 0), 0); transition: transform 2s ease;
}
.sb-head { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; transition: opacity .5s; }
.sb-subj { display: inline-flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 20px 0 16px; border-radius: 23px; background: rgba(var(--card-rgb), .5); border: 1px solid var(--line); font: 700 clamp(19px, 2.6vw, 24px) -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.sb-subj .sdot { width: 12px; height: 12px; border-radius: 6px; }
.sb-now { font-size: clamp(18px, 2.4vw, 22px); color: var(--muted); font-weight: 700; letter-spacing: .02em; }
.sb-ring { position: relative; width: var(--ring); aspect-ratio: 1; }
.sb-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.sb-ring .ring-track { stroke-width: 4.5; }
.sb-ring .ring-bar { stroke-width: 4.5; }
.sb-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.sb-time {
    font-family: ui-rounded, 'SF Pro Rounded', 'Nunito', 'Manrope', system-ui, sans-serif; font-weight: 600; font-variant-numeric: tabular-nums;
    font-size: calc(var(--ring) * .25); line-height: 1; letter-spacing: -0.01em; color: var(--text); transition: opacity .4s;
}
.standby.long .sb-time { font-size: calc(var(--ring) * .19); }
.standby.paused .sb-time { opacity: .5; }
.sb-sub { font: 600 clamp(13px, calc(var(--ring) * .045), 18px) -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; color: var(--muted); }
.sb-task { margin: 0; font: 500 15px -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; color: var(--muted); max-width: 80vw; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-task:empty { display: none; }
.sb-ctrl { display: flex; gap: 10px; justify-content: center; transition: opacity .5s, transform .5s; }
.sb-btn {
    min-height: 50px; padding: 0 24px; border-radius: 25px; border: 1px solid color-mix(in srgb, var(--text) 18%, transparent);
    background: rgba(var(--card-rgb), .55); color: var(--text); font: 700 15px -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; cursor: pointer;
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); transition: transform .15s;
}
.sb-btn:active { transform: scale(.95); }
.sb-exit { width: 50px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.sb-exit svg { width: 20px; height: 20px; }
.standby.idle .sb-ctrl { opacity: 0; transform: translateY(8px); pointer-events: none; }
.standby.idle .sb-head { opacity: .7; }
.standby.idle { cursor: none; }
/* 手機橫放：圓圈在左、科目和按鈕在右，整組置中 */
@media (orientation: landscape) and (max-height: 540px) {
    .sb-mid { --ring: min(78dvh, 44vw); display: grid; grid-template-columns: auto auto; grid-template-areas: "ring head" "ring task" "ring ctrl"; column-gap: clamp(24px, 6vw, 56px); row-gap: 14px; align-items: center; justify-items: center; }
    .sb-ring { grid-area: ring; }
    .sb-head { grid-area: head; flex-direction: column; gap: 8px; align-self: end; }
    .sb-task { grid-area: task; max-width: 34vw; }
    .sb-ctrl { grid-area: ctrl; align-self: start; flex-wrap: wrap; max-width: 260px; }
}
@media (prefers-reduced-motion: reduce) { .sb-mid { transition: none; } }
.g-chips span.more { letter-spacing: 1px; }
.g-chips span .g-dot { margin-right: 3px; vertical-align: 1px; }
/* 倒數切換鈕：放得下就置中，放不下就左右滑，不會掉到第二行 */
#examChips { flex-wrap: nowrap; justify-content: flex-start; gap: 7px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px; margin-left: -20px; margin-right: -20px; padding-left: 20px; padding-right: 20px; scroll-padding: 0 20px; }
#examChips::-webkit-scrollbar { display: none; }
#examChips > :first-child { margin-left: auto; }
#examChips > :last-child { margin-right: auto; }
#examChips .chip { flex-shrink: 0; padding: 0 14px; }
#examChips .chip-more { padding: 0; width: 42px; }

/* 平板、電腦：捲動後頂部改成「上深下淡」的漸層毛玻璃，選單列清楚、下面的內容自然淡出，不會像一塊黑色擋住 */
@media (min-width: 900px) {
    .topbar, html:not([data-bg="glow"]):not([data-bg="plain"]) .topbar.scrolled, .topbar.scrolled { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; border-bottom-color: transparent; }
    .topbar::after { display: none; }
    .topbar::before {
        content: ''; position: absolute; left: 0; right: 0; top: 0; bottom: -26px; z-index: -1; pointer-events: none;
        background: linear-gradient(to bottom, rgba(var(--bg-rgb), .9) 0%, rgba(var(--bg-rgb), .72) 62%, rgba(var(--bg-rgb), 0) 100%);
        backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
        -webkit-mask-image: linear-gradient(#000 58%, transparent); mask-image: linear-gradient(#000 58%, transparent);
        opacity: 0; transition: opacity .25s ease;
    }
    .topbar.scrolled::before { opacity: 1; }
}
/* 900–1100 寬（iPad 直放、小筆電）：選單按鈕縮一點，右邊的按鈕也不會被擠到 */
@media (min-width: 900px) and (max-width: 1100px) {
    .tab-btn { padding: 0 13px; gap: 6px; font-size: 13.5px; }
}
/* 我的倒數：學測固定、⋯ 亮起表示正在看沒放在上方的倒數 */
.cdm-pin.lock { cursor: default; opacity: .55; }
.cdm-row.cur .cdm-name b { color: var(--accent-text); }
.cdm-row.ended .cdm-name b, .cdm-row.ended .cdm-sub { color: var(--faint); }
.cdm-row.ended .cd-dot { filter: grayscale(1); opacity: .6; }
#examChips .chip-more.active { border-style: solid; border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.cdm-head .btn, .he-head .he-done { flex-shrink: 0; white-space: nowrap; }
.cdm-head > div, .he-head > div { min-width: 0; }
/* 文字不亂換行：設定列、統計那一列、計時頁捷徑，窄螢幕自動縮小或省略 */
.acct-label, .acct-value { white-space: nowrap; }
.acct-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.day-row > * { white-space: nowrap; }
.day-row b { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.go-tx b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sess-subj button { white-space: nowrap; }
@media (max-width: 374px) {
    .acct-row .acct-value:not(#notifyName):not(#accentName):not(#bgName) { display: none; }
    .go-btn { padding: 0 10px; gap: 8px; }
    .go-ic { width: 30px; height: 30px; }
    .go-tx b { font-size: 13.5px; }
    .sess-subj { gap: 4px; }
    .sess-subj button { font-size: 12px; gap: 3px; }
    .sess-subj button .sdot { display: none; }
    .day-row { gap: 8px; }
    .day-row .muted { display: none; }
}

/* 拖曳排序：不會選到文字（iPhone 長按會出現藍色選取框） */
.cdm-list, .he-list, .cdm-row, .he-row { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body.sorting, body.sorting * { -webkit-user-select: none !important; user-select: none !important; }
.drag-h { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.cdm-lock { display: inline-flex; align-items: center; justify-content: center; color: var(--faint); width: 32px; }
.cdm-lock svg { width: 16px; height: 16px; }
.cdm-row.fixed { background: transparent; }
/* 電腦、平板：打開聊天室時，後面房間頁的標題列也收起來，不會出現兩個標題 */
@media (min-width: 900px) { body.chat-open .topbar { visibility: hidden; } }

/* =====================================================
 * v52：聊天室回覆、表情、往右滑回覆、連點兩下愛心
 * ===================================================== */
.chat-screen .chat-list { touch-action: pan-y; }
/* 頭像對齊訊息泡泡（跟 IG 一樣對齊最後一行的中間）；下面有表情時跟著往上，不會對到表情 */
.msg.them { align-items: flex-end; }
.msg.them .chat-av, .msg.them .chat-av-sp { margin-bottom: 5px; }
.msg.them.has-r .chat-av, .msg.them.has-r .chat-av-sp { margin-bottom: 19px; }
.msg { position: relative; }
.msg-line { align-items: flex-end; }
.mb { display: flex; flex-direction: column; min-width: 0; max-width: 100%; }
.msg.mine .msg-line { max-width: min(88%, 600px); min-width: 0; }
.msg.them .msg-col { max-width: min(calc(100% - 38px), 640px); }
.msg.mine .mb { align-items: flex-end; max-width: 100%; min-width: 0; }
.msg-line .chat-meta { flex-shrink: 0; }
.msg.mine .mb .bubble { max-width: 100%; }
.msg.them .mb { align-items: flex-start; }
.bw { position: relative; display: flex; flex-direction: column; max-width: 100%; min-width: 0; }
.msg.mine .bw { align-items: flex-end; }
.msg.them .bw { align-items: flex-start; }
/* 被回覆的那則：在泡泡上面的小卡，點一下跳過去 */
.msg-rlab { display: flex; align-items: center; gap: 4px; margin: 0 4px 4px; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.msg-rlab svg { width: 12px; height: 12px; flex-shrink: 0; }
.msg-quote {
    display: block; max-width: min(240px, 66vw); margin-bottom: 4px; padding: 8px 12px;
    border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--muted); text-align: left; cursor: pointer;
    font: 400 13px/1.45 -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; opacity: .9;
}
.msg-quote span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.msg-quote:active { opacity: .7; }
.mb.has-q .bubble, .mb.has-q .chat-img { position: relative; }
/* 表情：貼在泡泡右下角（自己的在左下角），只疊到泡泡下緣的留白，不會蓋到字 */
.msg-reacts {
    position: relative; z-index: 1; box-sizing: border-box;
    display: inline-flex; align-items: center; gap: 3px; height: 24px; padding: 0 7px; margin-top: -8px; border-radius: 12px;
    border: 2px solid var(--bg); background: var(--modal-bg); color: var(--text); cursor: pointer; flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .18); animation: reactIn .28s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.msg.them .msg-reacts { align-self: flex-end; margin-right: -6px; }
.msg.mine .msg-reacts { align-self: flex-start; margin-left: -6px; }
.msg-reacts.mine { box-shadow: 0 2px 8px rgba(0,0,0,.18), inset 0 0 0 1px rgba(var(--accent-rgb), .7); }
.mr-e { font-size: 14px; line-height: 1; letter-spacing: 1px; }
.mr-n { font-size: 11px; font-weight: 700; line-height: 1; color: var(--text); }
.msg.has-r .chat-meta { margin-bottom: 14px; }
.msg.them.has-r .chat-meta { margin-left: 8px; }
.msg.mine.has-r .chat-meta { margin-right: 8px; }
@keyframes reactIn { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
/* 往右滑回覆 */
.msg > .swipe-reply {
    position: absolute; left: 0; top: 50%; width: 30px; height: 30px; margin-top: -15px; border-radius: 15px;
    display: flex; align-items: center; justify-content: center; color: var(--accent-text); background: var(--accent-soft);
    opacity: 0; transform: scale(.6); pointer-events: none; transition: opacity .15s, transform .15s;
}
.msg > .swipe-reply svg { width: 16px; height: 16px; }
.msg.swiping > .swipe-reply { opacity: calc(var(--sw, 0px) / 58px); transform: scale(.85); transition: none; }
.msg.sw-hit > .swipe-reply { opacity: 1; transform: scale(1.05); transition: transform .15s; }
.msg > :not(.swipe-reply) { transition: transform .22s cubic-bezier(0.22, 1, 0.36, 1); }
.msg.swiping > :not(.swipe-reply) { transform: translate3d(var(--sw, 0px), 0, 0); transition: none; }
.msg.flash .bubble, .msg.flash .chat-img { animation: msgFlash 1.1s ease; }
@keyframes msgFlash { 0%, 100% { filter: none; } 25%, 60% { filter: brightness(1.25) saturate(1.2); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .45); } }
/* 連點兩下的大愛心 */
.heart-burst { position: fixed; z-index: 160; font-size: 54px; line-height: 1; pointer-events: none; transform: translate(-50%, -50%) scale(.2); animation: heartPop .75s cubic-bezier(0.2, 1.4, 0.4, 1) forwards; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .35)); }
@keyframes heartPop { 0% { transform: translate(-50%, -50%) scale(.2); opacity: 0; } 35% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; } 60% { transform: translate(-50%, -50%) scale(.95); } 100% { transform: translate(-50%, -80%) scale(1); opacity: 0; } }
/* 長按：上面一排表情 */
.pop-reacts { display: flex; gap: 2px; padding: 5px 6px; border-radius: 26px; background: var(--modal-bg); border: 1px solid var(--line); box-shadow: var(--shadow); transform: translateY(6px) scale(.9); opacity: 0; transition: transform .25s cubic-bezier(0.3, 1.5, 0.5, 1), opacity .2s; }
.pop-reacts[hidden] { display: none; }
.msg-pop.open .pop-reacts { transform: none; opacity: 1; }
.pop-reacts button { width: 42px; height: 42px; border: none; border-radius: 21px; background: transparent; font-size: 25px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform .15s, background .15s; padding: 0; }
.pop-reacts button:active { transform: scale(1.25); }
.pop-reacts button.on { background: var(--accent-soft); }
@media (hover: hover) { .pop-reacts button:hover { transform: scale(1.15); } }
/* 傳送欄上面的「回覆 誰」 */
.reply-bar { display: flex; align-items: center; gap: 10px; flex-shrink: 0; padding: 8px 12px 8px 16px; background: var(--surface); border-top: 1px solid var(--line); transform: translateY(6px); opacity: 0; transition: transform .2s ease, opacity .2s ease; }
.reply-bar[hidden] { display: none; }
.reply-bar.show { transform: none; opacity: 1; }
.reply-bar > i { width: 3px; align-self: stretch; border-radius: 2px; background: var(--accent); flex-shrink: 0; }
.reply-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.reply-tx b { font-size: 12.5px; color: var(--accent-text); }
.reply-tx span { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-x { width: 32px; height: 32px; border-radius: 16px; border: none; background: var(--surface-2); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; cursor: pointer; }
.reply-x svg { width: 14px; height: 14px; }
.reply-bar + .chat-bar { border-top: none; }
/* 導覽：回覆、表情 */
.g-msg.q { flex-direction: column; align-items: flex-end; gap: 0; }
.g-msg > span.g-quote { margin-bottom: -4px; padding: 4px 8px 7px; font-size: 8.5px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; }
.g-msg > span.g-rx-wrap { position: relative; margin-bottom: 9px; }
.g-rx { position: absolute; right: -4px; bottom: -11px; padding: 1px 5px; border-radius: 8px; border: 1.5px solid var(--bg); background: var(--modal-bg); color: var(--text); font-style: normal; font-size: 8px; font-weight: 700; white-space: nowrap; }
.g-rbar { display: flex; gap: 2px; padding: 3px 6px; border-radius: 14px; background: var(--modal-bg); border: 1px solid var(--line); font-size: 12px; }
.g-rbar span { width: 18px; text-align: center; }
/* 表情：優先用 iPhone／Mac 系統的表情字型 */
.mr-e, .pop-reacts button, .heart-burst, .g-rbar { font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; }
.bubble, #chatInput, .g-msg > span, .g-rx { font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', -apple-system, 'PingFang TC', 'Microsoft JhengHei', 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; }
.mr-n { font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Manrope', -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
/* v53：長按不會選到旁邊的字（時間、名字、已讀…），iOS 也不會跳出「拷貝／查詢」 */
.chat-list, .chat-list *, .msg-pop, .msg-pop * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
@media (hover: hover) and (pointer: fine) { .pop-msg .bubble { -webkit-user-select: text; user-select: text; } }
@media not ((hover: hover) and (pointer: fine)) { .pop-msg .bubble { -webkit-user-select: none; user-select: none; } }
/* v53：表情小一點，整個收在外框裡 */
.msg-reacts { height: 22px; padding: 0 6px; gap: 2px; border-radius: 11px; margin-top: -7px; overflow: hidden; }
.mr-e { font-size: 11px; line-height: 1; letter-spacing: .5px; display: inline-flex; align-items: center; height: 14px; }
.mr-n { font-size: 10.5px; }
.msg.has-r .chat-meta { margin-bottom: 13px; }
.msg.them.has-r .chat-av, .msg.them.has-r .chat-av-sp { margin-bottom: 18px; }
/* v53：表情在小框裡上下置中（iPhone 的表情字型本身偏下，裁掉上下多餘的字型留白再置中） */
.msg-reacts { align-items: center; }
.mr-e { height: auto; line-height: 1; text-box: trim-both cap alphabetic; }
.pop-reacts button { text-box: trim-both cap alphabetic; }
@supports (-webkit-touch-callout: none) and (not (text-box: trim-both cap alphabetic)) {
    .mr-e { transform: translateY(-1px); }
}

/* =====================================================
 * v54：收起計時（計時繼續）＋下方浮動膠囊
 * ===================================================== */
.min-btn { border-color: rgba(var(--accent-rgb), .6) !important; background: var(--accent-soft) !important; color: var(--accent-text) !important; }
.min-tip {
    align-self: flex-end; margin: -2px 0 6px; padding: 7px 12px; border-radius: 12px; max-width: 80%;
    background: var(--text); color: var(--bg); font-size: 12.5px; font-weight: 500; line-height: 1.45; text-align: left;
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; animation: tipIn .3s ease-out both .4s;
}
.focus-wrap .min-tip { margin-left: auto; width: max-content; }
@keyframes tipIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.end-link {
    border: none; background: transparent; color: var(--muted); padding: 8px 6px; min-height: 40px; cursor: pointer;
    font: 500 13px -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--faint);
}
.end-link:hover { color: var(--text); }

/* 收起後的計時頁：最上面一張「正在專注」小卡 */
.mini-now {
    display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 14px; padding: 12px 14px; border-radius: 18px; text-align: left; cursor: pointer;
    border: 1px solid rgba(var(--accent-rgb), .45); background: var(--accent-soft); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif;
}
.mini-now > svg { width: 20px; height: 20px; color: var(--accent-text); flex-shrink: 0; }
.mn-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mn-tx b { font-size: 15px; }
.mn-tx small { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.mn-ring, .fp-ring, .tb-ring {
    position: relative; flex-shrink: 0; border-radius: 50%;
    background: conic-gradient(var(--accent) calc(var(--fp, 0) * 360deg), rgba(var(--accent-rgb), .18) 0);
}
.mn-ring { width: 38px; height: 38px; }
.fp-ring::after { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: var(--modal-bg); }
/* 圓環中間挖空（用遮罩，不管背景是什麼主題都看得到後面） */
.mn-ring, .tb-ring { -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px)); mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px)); }

/* 浮動膠囊 */
.focus-pill {
    position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 42;
    display: flex; align-items: center; gap: 10px; height: 52px; max-width: calc(100vw - 32px); padding: 0 8px 0 7px; box-sizing: border-box;
    border: 1px solid rgba(var(--accent-rgb), .55); border-radius: 26px; cursor: pointer;
    background: var(--modal-bg); color: var(--text); box-shadow: 0 10px 28px rgba(0, 0, 0, .35);
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; -webkit-tap-highlight-color: transparent;
    transform: translate(-50%, 14px) scale(.96); opacity: 0;
    transition: transform .28s cubic-bezier(.2, 1.2, .4, 1), opacity .2s;
}
.focus-pill[hidden] { display: none; }
.focus-pill.show { transform: translate(-50%, 0); opacity: 1; }
.focus-pill:active { transform: translate(-50%, 0) scale(.97); }
.fp-ring { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; }
.fp-ring .sdot { position: relative; z-index: 1; width: 9px; height: 9px; }
.fp-tx { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; line-height: 1.15; }
.fp-tx small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.fp-tx b { font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Manrope', -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; font-size: 18px; font-weight: 700; letter-spacing: .02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fp-go { width: 32px; height: 32px; border-radius: 16px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-text); }
.fp-go svg { width: 16px; height: 16px; }
.focus-pill.paused .fp-ring { background: conic-gradient(var(--muted) calc(var(--fp, 0) * 360deg), var(--line) 0); }
/* 時間到：整顆變成主色，輕輕跳動提醒 */
.focus-pill.up { background: var(--accent); color: var(--on-accent); border-color: transparent; animation: fpPulse 1.6s ease-in-out infinite; }
.focus-pill.up .fp-tx small { color: var(--on-accent); opacity: .8; }
.focus-pill.up .fp-tx b { font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; font-size: 15px; letter-spacing: 0; }
.focus-pill.up .fp-ring { background: var(--on-accent); }
.focus-pill.up .fp-ring::after { background: var(--accent); }
.focus-pill.up .fp-go { background: rgba(0, 0, 0, .14); color: var(--on-accent); }
@keyframes fpPulse { 0%, 100% { box-shadow: 0 10px 28px rgba(0, 0, 0, .35), 0 0 0 0 rgba(var(--accent-rgb), .5); } 50% { box-shadow: 0 10px 28px rgba(0, 0, 0, .35), 0 0 0 8px rgba(var(--accent-rgb), 0); } }
/* 聊天室裡（只有時間到才會出現）：放在標題下面，不擋輸入框 */
.focus-pill.in-chat { top: calc(env(safe-area-inset-top) + 78px); bottom: auto; z-index: 95; }
@media (prefers-reduced-motion: reduce) { .focus-pill { transition: opacity .2s; } .focus-pill.up { animation: none; } }
/* 膠囊出現時：頁面底部多留空間、提示訊息和固定按鈕往上移，不會疊在一起 */
body.pill-on .main::after, body.net-on .main::after { content: "" ; display: block; height: 64px; }
body.pill-on.net-on .main::after { height: 120px; }
body.pill-on .toast { bottom: calc(140px + env(safe-area-inset-bottom)); }
body.pill-on:has(.tab.active .sticky-cta) .toast { bottom: calc(200px + env(safe-area-inset-bottom)); }
body.pill-on .sticky-cta { bottom: calc(126px + env(safe-area-inset-bottom)); }
body.pill-on.chat-open .toast { bottom: calc(86px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) {
    .focus-pill { bottom: calc(24px + env(safe-area-inset-bottom)); }
    body.pill-on .toast, body.pill-on:has(.tab.active .sticky-cta) .toast { bottom: 92px; }
}
/* 下方「計時」分頁：計時中換成會跑的小圓環 */
.tb-ring { display: none; width: 22px; height: 22px; }
.tab-btn.running > svg { display: none; }
.tab-btn.running .tb-ring { display: block; }
.tab-btn.running { color: var(--accent-text); }
@media (min-width: 900px) { .tb-ring { width: 18px; height: 18px; } }
/* 導覽：收起後的浮動膠囊示意 */
.g-fpill { align-self: center; display: flex; align-items: center; gap: 7px; margin: 8px auto 0; width: max-content; padding: 4px 6px 4px 5px; border-radius: 16px; border: 1px solid rgba(var(--accent-rgb), .55); background: var(--modal-bg); box-shadow: 0 6px 16px rgba(0, 0, 0, .25); }
.g-fp-ring { width: 20px; height: 20px; border-radius: 50%; background: conic-gradient(var(--accent) 0 70%, rgba(var(--accent-rgb), .18) 0); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px)); mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px)); }
.g-fpill span { display: flex; flex-direction: column; line-height: 1.1; }
.g-fpill small { font-size: 7.5px; color: var(--muted); }
.g-fpill b { font-size: 11px; }
.g-fpill em { font-style: normal; width: 18px; height: 18px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-text); font-size: 10px; display: flex; align-items: center; justify-content: center; }

/* =====================================================
 * v55：離線提示小膠囊（畫面下方中間；聊天室裡在標題下面）
 * ===================================================== */
.net-pill {
    position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 43;
    display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px); box-sizing: border-box;
    padding: 8px 14px 8px 10px; border-radius: 18px; border: 1px solid var(--line);
    background: var(--modal-bg); color: var(--text); box-shadow: 0 8px 22px rgba(0, 0, 0, .3);
    font: 500 13px/1.4 -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; pointer-events: none;
    transform: translate(-50%, 10px); opacity: 0; transition: transform .25s ease, opacity .2s;
}
.net-pill[hidden] { display: none; }
.net-pill.show { transform: translate(-50%, 0); opacity: 1; }
.net-pill #netText { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.np-ic { width: 22px; height: 22px; border-radius: 11px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.np-ic svg { width: 14px; height: 14px; display: none; }
.net-pill[data-kind="off"] .np-ic { background: rgba(229, 72, 77, .16); color: #E5484D; }
.net-pill[data-kind="off"] .np-off { display: block; }
.net-pill[data-kind="sync"] .np-ic { background: var(--accent-soft); color: var(--accent-text); }
.net-pill[data-kind="sync"] .np-sync { display: block; animation: npSpin 1s linear infinite; }
.net-pill[data-kind="ok"] .np-ic { background: rgba(48, 164, 108, .16); color: #30A46C; }
.net-pill[data-kind="ok"] .np-ok { display: block; }
@keyframes npSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .net-pill[data-kind="sync"] .np-sync { animation: none; } }
/* 計時膠囊也在時：疊在它上面 */
body.pill-on .net-pill { bottom: calc(138px + env(safe-area-inset-bottom)); }
/* 碼錶畫面（沒有分頁列） */
body.focus-mode .net-pill { bottom: calc(18px + env(safe-area-inset-bottom)); }
/* 聊天室：放在標題下面，不擋輸入框 */
body.chat-open .net-pill { top: calc(env(safe-area-inset-top) + 76px); bottom: auto; z-index: 96; }
body.chat-open.pill-on .net-pill { top: calc(env(safe-area-inset-top) + 136px); }
/* 提示訊息往上移，不要疊在一起 */
body.net-on .toast { bottom: calc(140px + env(safe-area-inset-bottom)); }
body.net-on.pill-on .toast { bottom: calc(196px + env(safe-area-inset-bottom)); }
body.net-on.chat-open .toast { bottom: calc(86px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) {
    .net-pill { bottom: calc(24px + env(safe-area-inset-bottom)); }
    body.pill-on .net-pill { bottom: 86px; }
    body.net-on .toast { bottom: 80px; }
    body.net-on.pill-on .toast { bottom: 140px; }
}
/* 窄螢幕：只留「離線中 · 記錄存在本裝置」，維持一行 */
@media (max-width: 370px) { .net-pill .nt-tail { display: none; } }
/* 個人設定裡的連結列（隱私權政策）：長得跟其他列一樣 */
a.acct-row { text-decoration: none; color: inherit; }
a.acct-row:hover { background: var(--surface-2); }

/* =====================================================
 * v55：刪除帳號
 * ===================================================== */
.acct-del {
    display: block; margin: 6px auto 0; min-height: 40px; padding: 8px 12px; border: none; background: none; cursor: pointer;
    color: var(--muted); font: 500 13px -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--faint);
}
.acct-del[hidden] { display: none; }
.acct-del:hover { color: #E5484D; }
.del-sheet { text-align: left; }
.del-ic { display: flex; width: 56px; height: 56px; margin: 4px auto 10px; border-radius: 28px; align-items: center; justify-content: center; background: rgba(229, 72, 77, .14); color: #E5484D; }
.del-ic svg { width: 26px; height: 26px; }
.del-sheet h2 { text-align: center; }
.del-sub { margin: 4px 0 10px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.6; }
.del-list { margin: 0 0 14px; padding: 12px 14px 12px 32px; border-radius: 14px; background: var(--surface-2); font-size: 14px; line-height: 1.75; }
.del-input { width: 100%; box-sizing: border-box; }
.del-input:focus { border-color: #E5484D; }
.del-note { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.del-note.err { color: #E5484D; }
.del-btns { margin-top: 16px; }
.del-btns .btn { flex: 1; }
.btn.del-go { background: #E5484D; border-color: #E5484D; color: #fff; font-weight: 700; }
.btn.del-go[disabled] { opacity: .45; cursor: not-allowed; }
.btn.del-go.busy { opacity: .8; pointer-events: none; }
/* v55：手機橫放的碼錶畫面：右邊改成上下排好（v54 多了「讀書房間」和「結束這一輪」後會疊在一起） */
@media (orientation: landscape) and (max-height: 540px) {
    .focus-wrap { position: relative; grid-template-areas: "head head" "ring dots" "ring btns" "ring extra"; grid-template-rows: auto 1fr auto 1fr; row-gap: 0; }
    /* 第一次的小提示：放在收起按鈕左邊，不另外佔一排 */
    .focus-wrap .min-tip { position: absolute; right: 0; top: 58px; margin: 0; max-width: 40%; font-size: 12px; padding: 6px 10px; z-index: 2; }
    .focus-wrap .ring-wrap { grid-area: ring; align-self: center; }
    .focus-wrap .round-dots { grid-area: dots; align-self: end; margin: 0 0 2px; }
    .focus-wrap .focus-btns { grid-area: btns; align-self: center; margin: 10px 0 0; }
    .focus-wrap .focus-extra { grid-area: extra; align-self: start; margin: 10px 0 0; gap: 4px; }
    .focus-wrap .end-link { min-height: 34px; padding: 4px 6px; }
}
/* v57：右邊（輪數圓點、按鈕、工具列）整組跟圓環一起上下置中。
   自由計時沒有輪數圓點時，按鈕原本會被排在圓環正中間、工具列掛在下面，整組看起來往下掉 */
@media (orientation: landscape) and (max-height: 540px) {
    .focus-wrap { grid-template-areas: "head head" "ring ." "ring dots" "ring btns" "ring extra" "ring ."; grid-template-rows: auto 1fr auto auto auto 1fr; }
    .focus-wrap .round-dots { align-self: center; margin: 0 0 12px; }
    .focus-wrap .focus-btns { align-self: center; margin: 0; }
    .focus-wrap .focus-extra { align-self: center; margin: 12px 0 0; }
}
@media (orientation: landscape) and (max-height: 540px) {
    .focus-wrap .min-tip { white-space: nowrap; max-width: none; }
    .focus-wrap .focus-btns { flex-wrap: nowrap; gap: 10px; }
    .focus-wrap .focus-btns .btn-big { min-width: 0; flex: 0 1 150px; padding-left: 12px; padding-right: 12px; }
}
/* v55：最窄的手機（320 寬）通知樣式說明維持一行 */
@media (max-width: 359px) {
    .notify-grid { gap: 8px; padding-left: 10px; padding-right: 10px; }
    .notify-opt { padding: 9px 8px; }
    .nt-sub { white-space: nowrap; font-size: 11px; letter-spacing: -0.01em; }
}

/* =====================================================
 * v56：個人設定視窗固定大小、內容可以往下捲；隱私權政策在 App 裡滑進來
 * ===================================================== */
.acct-sheet { max-height: min(722px, 90vh, 90dvh); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.acct-del { margin: -6px auto -8px; min-height: 34px; padding: 4px 12px; }
.privacy-screen {
    position: fixed; inset: 0; z-index: 110; display: flex; flex-direction: column; background: var(--bg);
    transform: translateX(100%); transition: transform .3s cubic-bezier(.2, .8, .2, 1), box-shadow .3s;
    will-change: transform;
}
.privacy-screen[hidden] { display: none; }
.privacy-screen.open { transform: none; box-shadow: -12px 0 30px rgba(0, 0, 0, .25); }
.privacy-body { position: relative; flex: 1; min-height: 0; }
.privacy-body iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; opacity: 0; transition: opacity .2s; }
.privacy-body iframe.ready { opacity: 1; }
.privacy-load { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.privacy-load[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .privacy-screen { transition: opacity .2s; transform: none; opacity: 0; } .privacy-screen.open { opacity: 1; } }

/* =====================================================
 * v60：課表（行事曆分頁裡切換）、首頁「今天的課」、讀書熱力圖
 * ===================================================== */
.cal-switch { max-width: 560px; margin: 6px auto 2px; }
body.cal-tt .cal-layout, body.cal-tt #calFab { display: none !important; }
.tt-view { max-width: 640px; margin: 0 auto; padding-bottom: 24px; }
.tt-view[hidden] { display: none; }
.tt-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 12px; }
.tt-range { font-size: 24px; font-weight: 700; font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Manrope', -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; letter-spacing: .01em; }
.tt-range small { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-left: 8px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; letter-spacing: 0; }
.tt { display: grid; grid-template-columns: 34px repeat(5, minmax(0, 1fr)); column-gap: 5px; row-gap: 5px; }
.tt-dh { text-align: center; padding: 0 0 6px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.tt-dh b { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.tt-dh span { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 15px; margin-top: 3px; font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Manrope', sans-serif; font-weight: 700; font-size: 15px; }
.tt-dh.today span { background: var(--accent); color: var(--on-accent); }
.tt-dh.off b, .tt-dh.off span { color: var(--exam-text); }
.tt-dh em { display: block; font-style: normal; font-size: 10px; color: var(--exam-text); margin-top: 1px; line-height: 1.2; }
.tt-p { display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Manrope', sans-serif; }
.tt-p b { font-size: 14px; font-weight: 800; line-height: 1.1; }
.tt-p small { font-size: 9.5px; color: var(--faint); font-weight: 600; margin-top: 2px; }
.tt-p.now b { color: var(--accent-text); }
.tt-c {
    min-height: 52px; border-radius: 12px; padding: 6px 3px; border: none; display: flex; align-items: center; justify-content: center; text-align: center;
    font-size: 12.5px; font-weight: 600; line-height: 1.3; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; position: relative; overflow: hidden; min-width: 0;
    background: var(--surface); color: var(--text); word-break: break-all;
}
.tt-c[data-c] { background: color-mix(in srgb, var(--c) 15%, transparent); color: color-mix(in srgb, var(--c) 78%, var(--text)); }
.tt-c.plain { background: var(--surface); color: var(--muted); }
.tt-c.empty { background: transparent; border: 1.5px dashed var(--line); color: var(--faint); font-size: 16px; font-weight: 400; }
.tt-c.off { opacity: .35; }
.tt-c.past { opacity: .55; }
.tt-c.now { box-shadow: 0 0 0 2px var(--accent); }
.tt-c.now::after { content: ''; position: absolute; left: 0; bottom: 0; height: 3px; width: var(--prog, 0%); background: var(--accent); }
.tt-c .dot { position: absolute; top: 5px; right: 5px; width: 6px; height: 6px; border-radius: 3px; background: var(--important); }
.tt-c .alt { position: absolute; left: 4px; bottom: 3px; font-size: 9px; font-weight: 700; opacity: .7; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.tt-break { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 11.5px; padding: 4px 0; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.tt-break::before, .tt-break::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.tt-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 16px 0 4px; font-size: 12px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.tt-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 4px; margin-right: 5px; }
.tt-hint { text-align: center; font-size: 12px; color: var(--faint); margin: 12px 0 0; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; line-height: 1.6; }
.tt-empty-tip { margin: 0 0 12px; padding: 12px 14px; border-radius: 14px; background: var(--accent-soft); color: var(--text); font-size: 13px; line-height: 1.6; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; display: flex; align-items: center; gap: 10px; }
.tt-empty-tip .btn { margin-left: auto; flex-shrink: 0; }
/* 編輯一格 */
.tt-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }
.tt-suggest button { height: 30px; padding: 0 11px; border-radius: 15px; border: 1px solid var(--line); background: transparent; color: var(--text); font-size: 12.5px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.tt-colors { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 14px; }
.tt-colors button { height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 12.5px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; display: inline-flex; align-items: center; gap: 6px; }
.tt-colors button i { width: 9px; height: 9px; border-radius: 5px; background: var(--faint); }
.tt-colors button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); font-weight: 700; }
/* 節數和時間 */
.tt-time-note { font-size: 12.5px; color: var(--muted); margin: -6px 0 12px; line-height: 1.6; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.tt-times { display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow-y: auto; }
.tt-trow { display: grid; grid-template-columns: 52px minmax(0, 1fr) 14px minmax(0, 1fr); align-items: center; gap: 6px; }
.tt-trow b { font-size: 13px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.tt-trow span { text-align: center; color: var(--faint); }
.tt-trow .field { min-width: 0; width: 100%; margin: 0; padding-left: 10px; padding-right: 6px; text-align: center; font-variant-numeric: tabular-nums; }
.tt-time-acts { display: flex; gap: 8px; margin-top: 10px; }
.tt-time-acts .btn { flex: 1; }
.tt-import-prev { padding: 12px 14px; border-radius: 14px; background: var(--surface); font-size: 13.5px; line-height: 1.7; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; margin-bottom: 4px; }
.tt-import-prev b { color: var(--accent-text); }
#ttImportText { resize: none; font-size: 13px; }

/* 首頁：今天的課 */
.cls-now { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); width: 100%; text-align: left; color: var(--text); }
.cls-now .ring { width: 46px; height: 46px; flex-shrink: 0; }
.cls-now .tx { min-width: 0; flex: 1; }
.cls-now .t1 { font-size: 11.5px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.cls-now .t2 { font-size: 17px; font-weight: 700; margin-top: 1px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cls-now .t3 { font-size: 12.5px; color: var(--muted); margin-top: 2px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.cls-now .t3 b { color: var(--accent-text); font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Manrope', sans-serif; }
.cls-now > svg.go { width: 18px; height: 18px; color: var(--faint); flex-shrink: 0; }
.cls-strip { display: flex; gap: 6px; margin-top: 10px; }
.cls-strip span { flex: 1; min-width: 0; text-align: center; padding: 7px 1px; border-radius: 10px; font-size: 11px; font-weight: 600; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; white-space: nowrap; overflow: hidden; text-overflow: clip;
    background: var(--surface); color: var(--muted); }
.cls-strip span[data-c] { background: color-mix(in srgb, var(--c) 13%, transparent); color: color-mix(in srgb, var(--c) 78%, var(--text)); }
.cls-strip span.past { opacity: .45; }
.cls-strip span.now { box-shadow: 0 0 0 1.5px var(--accent); }
.cls-next { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 12.5px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.cls-mini { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 0 14px; border-radius: 16px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 13.5px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; text-align: left; }
.cls-mini svg { width: 18px; height: 18px; flex-shrink: 0; }
.cls-mini b { color: var(--text); font-weight: 600; }
.cls-mini .grow { flex: 1; }
.cls-mini .go { color: var(--faint); }
#homeClass .sec-head { margin-bottom: 10px; }

/* 讀書熱力圖（統計頁） */
.hm-sec { position: relative; }
.hm-tabs { display: flex; gap: 6px; }
.hm-tabs button { height: 28px; padding: 0 11px; border-radius: 14px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 12px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.hm-tabs button.on { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; font-weight: 700; }
.hm-card { padding: 16px 14px 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); }
.hm-top { display: flex; gap: 18px; margin-bottom: 14px; flex-wrap: wrap; }
.hm-top b { display: block; font-size: 20px; font-weight: 800; font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Manrope', sans-serif; }
.hm-top b small { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 2px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.hm-top span { font-size: 11.5px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.hm-wrap { display: flex; gap: 5px; }
.hm-wd { display: grid; grid-template-rows: 14px repeat(7, 11px); row-gap: 3px; align-content: start; font-size: 9.5px; color: var(--faint); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; flex-shrink: 0; }
.hm-wd span { display: flex; align-items: center; line-height: 1; }
.hm-scroll { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.hm-scroll::-webkit-scrollbar { display: none; }
.hm-grid { display: grid; grid-auto-flow: column; grid-template-rows: 14px repeat(7, auto); gap: 3px; }
.hm-grid.half { grid-template-columns: repeat(var(--cols), minmax(0, 16px)); justify-content: end; }
.hm-grid.year { grid-template-columns: repeat(var(--cols), 11px); }
.hm-m { font-size: 9.5px; color: var(--faint); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; white-space: nowrap; overflow: visible; line-height: 14px; }
.hm-d { aspect-ratio: 1; border-radius: 3px; background: var(--surface-2); border: none; padding: 0; min-width: 0; }
.hm-d.l1 { background: rgba(var(--accent-rgb), .28); }
.hm-d.l2 { background: rgba(var(--accent-rgb), .5); }
.hm-d.l3 { background: rgba(var(--accent-rgb), .75); }
.hm-d.l4 { background: rgb(var(--accent-rgb)); }
.hm-d.fut { background: transparent; pointer-events: none; }
.hm-d.sel { box-shadow: 0 0 0 2px var(--text); }
.hm-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; font-size: 11.5px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.hm-leg { display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
.hm-leg .hm-d { width: 11px; height: 11px; display: inline-block; }
.hm-tip { position: absolute; z-index: 3; transform: translate(-50%, calc(-100% - 8px)); padding: 6px 10px; border-radius: 10px; background: var(--modal-bg); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 12px; white-space: nowrap; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; pointer-events: none; }
.hm-tip b { font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Manrope', sans-serif; }
.hm-acts { display: flex; justify-content: flex-end; margin-top: 10px; }

/* v60 導覽頁：課表示意圖 */
.g-tt { display: grid; grid-template-columns: 12px repeat(5, minmax(0, 1fr)); gap: 3px; font-size: 8.5px; }
.g-tt span { display: flex; align-items: center; justify-content: center; color: var(--muted); }
.g-tt span.h.on { color: var(--on-accent); background: var(--accent); border-radius: 8px; font-weight: 700; }
.g-tt span.p { font-weight: 800; color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Manrope', sans-serif; }
.g-tt i { font-style: normal; position: relative; text-align: center; padding: 6px 0; border-radius: 6px; font-weight: 600; white-space: nowrap; overflow: hidden;
    background: var(--surface-2); color: var(--muted); }
.g-tt i[style] { background: color-mix(in srgb, var(--c) 16%, transparent); color: color-mix(in srgb, var(--c) 80%, var(--text)); }
.g-tt i.now { box-shadow: 0 0 0 1.5px var(--accent); }
.g-tt i.add { background: transparent; border: 1px dashed var(--line); color: var(--faint); padding: 5px 0; }
.g-tt i em { position: absolute; left: 2px; bottom: 0; font-style: normal; font-size: 6.5px; opacity: .75; }

/* v61 推播通知設定 */
.push-box { padding: 4px 16px 14px; }
.push-note { margin: 0 0 12px; font-size: 13px; line-height: 1.6; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.push-on { width: 100%; }
.push-on[hidden], .push-off[hidden], #pushOpts[hidden] { display: none; }
.push-time { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 50px; border-top: 1px solid var(--line); font-size: 14.5px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.push-time .field { width: auto; min-width: 96px; margin: 0; padding-top: 8px; padding-bottom: 8px; }
.push-time .field:disabled { opacity: .45; }
.push-off { margin-top: 6px; padding-left: 0; color: var(--exam-text); }

/* v62 待辦：選了日期之後的時間列 */
.todo-time-row { display: flex; align-items: center; gap: 6px; margin: -2px 0 10px; flex-wrap: wrap; }
.todo-time-row[hidden] { display: none; }
.todo-time-btn { height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); color: var(--muted);
    display: inline-flex; align-items: center; gap: 6px; font: 600 13px -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', 'Manrope', sans-serif; }
.todo-time-btn svg { width: 17px; height: 17px; }
.todo-time-btn.has { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Manrope', -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; font-size: 14px; }
.todo-time-row .todo-date-x { width: 30px; height: 30px; color: var(--muted); }
.todo-time-hint { font-size: 12px; color: var(--faint); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.todo-time-hint[hidden] { display: none; }

/* =====================================================
 * v62：通知設定頁、時間滾輪、叫朋友讀書
 * ===================================================== */
.nf-body { padding-top: 4px; }
.nf-sec { margin: 22px 0 0; }
.nf-sec:first-child { margin-top: 16px; }
.nf-sec > h3 { margin: 0 0 8px 6px; font-size: 12.5px; font-weight: 700; color: var(--muted); letter-spacing: .06em; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.nf-foot { margin: 8px 6px 0; font-size: 12px; color: var(--faint); line-height: 1.6; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.nf-card { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); overflow: hidden; }
.nf-dev { display: flex; align-items: center; gap: 12px; padding: 14px 16px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.nf-dev .dot { width: 10px; height: 10px; border-radius: 5px; background: var(--mark-green); box-shadow: 0 0 0 4px var(--mark-green-bg); flex-shrink: 0; margin: 0 4px; }
.nf-dev .dot.off { background: var(--faint); box-shadow: 0 0 0 4px var(--surface-2); }
.nf-dev .btn { flex-shrink: 0; }
.nf-test { width: 100%; margin-top: 10px; }
.nf-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 64px; cursor: pointer; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; position: relative; }
.nf-card > * + .nf-row { border-top: 1px solid var(--line); }
.nf-ic { width: 34px; height: 34px; border-radius: 11px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-text); flex-shrink: 0; }
.nf-ic svg { width: 19px; height: 19px; }
.nf-tx { flex: 1; min-width: 0; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.nf-tx b { display: block; font-size: 15px; font-weight: 700; line-height: 1.35; }
.nf-tx small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.5; }
.nf-row input { position: absolute; opacity: 0; pointer-events: none; }
.nf-sw { width: 48px; height: 29px; border-radius: 15px; background: var(--surface-2); border: 1px solid var(--line); position: relative; flex-shrink: 0; transition: background .2s, border-color .2s; }
.nf-sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 11px; background: var(--text); opacity: .75; transition: transform .22s cubic-bezier(0.22, 1, 0.36, 1), background .2s; }
.nf-row input:checked + .nf-sw { background: var(--accent); border-color: var(--accent); }
.nf-row input:checked + .nf-sw::after { transform: translateX(19px); background: var(--on-accent); opacity: 1; }
.nf-row input:focus-visible + .nf-sw { outline: 2px solid var(--accent); outline-offset: 2px; }
/* 開關下面的細項：從文字開頭那條線對齊；值一律靠右、同樣寬度 */
.nf-sub { padding: 0 16px 12px 62px; display: flex; flex-direction: column; gap: 8px; margin-top: -4px; }
.nf-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; font-size: 13.5px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.nf-line > span { min-width: 0; line-height: 1.45; }
.nf-line.col { flex-direction: column; align-items: stretch; gap: 8px; min-height: 0; padding-top: 2px; }
.nf-val { flex-shrink: 0; min-width: 104px; height: 40px; padding: 0 8px 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg);
    display: inline-flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--text);
    font: 700 15px 'Manrope', -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; font-variant-numeric: tabular-nums; cursor: pointer; }
.nf-val span { white-space: nowrap; }
.nf-val svg { width: 16px; height: 16px; color: var(--faint); flex-shrink: 0; }
.nf-val:active { transform: scale(0.97); }
.nf-warn { margin: -2px 0 0; font-size: 12px; color: var(--exam-text); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; text-align: right; }
.nf-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.nf-chip { height: 32px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px; border-radius: 16px; border: 1px solid var(--line); background: var(--bg); color: var(--muted); font: 600 12.5px -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.nf-chip i { width: 7px; height: 7px; border-radius: 4px; }
.nf-chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); font-weight: 700; }
.nf-style.notify-grid { padding: 12px 14px 4px; }
.nf-card .nt-try { margin: 0 14px 12px; }
/* 時間滾輪 */
.wh-note { margin: -8px 0 10px; font-size: 12.5px; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.wh-note[hidden] { display: none; }
.wh-cols { display: grid; align-items: center; gap: 8px; margin: 4px 0 14px; }
.wh-sep { font-size: 26px; font-weight: 800; color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Manrope', sans-serif; }
.wh-col { height: 200px; overflow-y: auto; scroll-snap-type: y mandatory; scrollbar-width: none; border-radius: 16px; background: var(--surface); position: relative; overscroll-behavior: contain; outline: none;
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 30%, #000 70%, transparent); mask-image: linear-gradient(to bottom, transparent, #000 30%, #000 70%, transparent); }
.wh-col::-webkit-scrollbar { display: none; }
.wh-col:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.wh-pad { height: 80px; }
.wh-item { height: 40px; display: flex; align-items: center; justify-content: center; gap: 3px; scroll-snap-align: center; font: 600 20px 'Manrope', -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; color: var(--faint); cursor: pointer; font-variant-numeric: tabular-nums; }
.wh-item small { font-size: 13px; font-weight: 600; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.wh-item.on { color: var(--text); font-size: 26px; font-weight: 800; }
.wh-cols::before { content: none; }
.wh-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.wh-quick button { height: 34px; padding: 0 13px; border-radius: 17px; border: 1px solid var(--line); background: transparent; color: var(--text); font: 600 13px 'Manrope', -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.wh-quick button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.wh-sheet .sheet-btns { margin-top: 14px; }
/* 房間：點朋友的頭像 */
.pk-pop { position: absolute; z-index: 60; width: 248px; padding: 14px; border-radius: 20px; background: var(--modal-bg); border: 1px solid var(--line); box-shadow: var(--shadow); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; animation: pkIn .18s ease-out; }
.pk-pop[hidden] { display: none; }
.pk-pop::before { content: ''; position: absolute; top: -7px; left: var(--ax, 50%); width: 12px; height: 12px; background: var(--modal-bg); border-left: 1px solid var(--line); border-top: 1px solid var(--line); transform: translateX(-50%) rotate(45deg); }
.pk-pop.up::before { top: auto; bottom: -7px; transform: translateX(-50%) rotate(225deg); }
@keyframes pkIn { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.pk-head { display: flex; align-items: center; gap: 10px; }
.pk-av { width: 40px; height: 40px; border-radius: 20px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 16px; flex-shrink: 0; }
.pk-who { min-width: 0; }
.pk-who b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-who small { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.pk-stat { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 12px 0; }
.pk-stat div { padding: 8px 6px; border-radius: 12px; background: var(--surface); text-align: center; }
.pk-stat b { display: block; font-size: 16px; font-weight: 800; }
.pk-stat b small { font-size: 11px; font-weight: 600; margin-left: 1px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.pk-stat span { font-size: 11px; color: var(--muted); }
.pk-btn { width: 100%; min-height: 44px; padding: 6px 10px; border-radius: 22px; border: none; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 14.5px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; line-height: 1.35; }
.pk-btn.done { background: var(--surface-2); color: var(--muted); font-size: 13px; }
.pk-btn:not(:disabled):active { transform: scale(0.97); }
.pk-note { margin: 8px 0 0; text-align: center; font-size: 11.5px; color: var(--faint); line-height: 1.5; }
.seat { cursor: pointer; }
/* 通知上面「回覆了你」那一行 */
.nb-q { margin-top: 2px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-exp p.np-q { font-size: 12px; color: rgba(242, 240, 233, 0.6); -webkit-line-clamp: 1; }
/* v62 導覽：通知設定示意圖 */
.g-nfp { gap: 5px; }
.g-nfdev { display: flex; align-items: center; gap: 7px; padding: 7px 9px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.g-nfdev i { width: 6px; height: 6px; border-radius: 3px; background: var(--mark-green); box-shadow: 0 0 0 3px var(--mark-green-bg); flex-shrink: 0; }
.g-nfdev b { display: block; font-size: 10px; }
.g-nfdev small { font-size: 8.5px; color: var(--muted); }
.g-nfh { margin: 4px 0 0 2px; font-size: 8.5px; font-weight: 700; color: var(--muted); letter-spacing: .05em; }
.g-nfr { display: flex; align-items: center; justify-content: space-between; padding: 5px 9px; border-radius: 8px; background: var(--surface); font-size: 10px; }
.g-nfr.sub { background: transparent; padding: 0 9px 0 18px; color: var(--muted); font-size: 9px; }
.g-nfr u { width: 22px; height: 13px; border-radius: 7px; background: var(--surface-2); position: relative; }
.g-nfr u.on { background: var(--accent); }
.g-nfr u::after { content: ''; position: absolute; top: 2px; left: 2px; width: 9px; height: 9px; border-radius: 5px; background: var(--bg); }
.g-nfr u.on::after { left: 11px; }
.g-nfr em { font-style: normal; font-weight: 700; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Manrope', sans-serif; }

/* 叫朋友讀書小卡：橫的手機放在頭像旁邊 */
.pk-pop.side-r::before, .pk-pop.side-l::before { top: var(--ay, 50%); left: -7px; transform: translateY(-50%) rotate(-45deg); }
.pk-pop.side-l::before { left: auto; right: -7px; transform: translateY(-50%) rotate(135deg); }

/* =====================================================
 * v64 國定假日、週末顏色
 * ===================================================== */
:root { --rest-text: #C4473A; --rest-bg: rgba(196, 71, 58, 0.065); }
[data-theme="dark"] { --rest-text: #EF8572; --rest-bg: rgba(239, 133, 114, 0.085); }
.cal-hol { font-size: 10px; line-height: 1; margin-top: -2px; max-width: 100%; overflow: hidden; white-space: nowrap; color: var(--rest-text); font-weight: 600; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; letter-spacing: -0.2px; }
.cal-cell.work .cal-hol { color: var(--muted); }
.cal-cell.past .cal-hol { opacity: 0.6; }
.day-hol { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; vertical-align: 2px; background: var(--rest-bg); color: var(--rest-text); }
.day-hol.work { background: var(--surface-2); color: var(--muted); }
/* 週末和國定假日：數字和「六、日」用紅字（補班日照平常） */
.cal-weekdays .we { color: var(--rest-text); }
.cal-cell.rest:not(.today):not(.exam):not(.imp-day) .cal-num { color: var(--rest-text); }
.cal-cell.rest.past:not(.today) .cal-num { opacity: 0.55; }
@media (min-width: 768px) {
    .cal-hol { display: none; }
    .cal-titles span.hol { background: var(--rest-bg); color: var(--rest-text); font-weight: 600; }
    .cal-titles span.hol.work { background: var(--surface-2); color: var(--muted); }
}
@media (max-width: 767px) {
    /* 有假日名稱的那一列比較高：整個月每一列一樣高，格子才不會參差 */
    .cal-grid { grid-auto-rows: 1fr; }
    .cal-cell.hol, .cal-cell.work { gap: 3px; }
    .cal-cell.hol .cal-dots, .cal-cell.work .cal-dots { margin-top: 1px; }
}
.g-cal span.we { color: var(--rest-text); }
/* 標題多了假日標籤也不會把「＋ 新增」擠成兩行 */
#addOnDayBtn { flex-shrink: 0; white-space: nowrap; }
#selDayTitle { min-width: 0; }
/* v67：AI 排計畫暫時隱藏（app.js 的 AI_ON 改成 true 就會出現） */
html:not(.ai-on) #aiPlanBtn, html:not(.ai-on) .ai-only { display: none !important; }

/* =====================================================
 * v68 全螢幕時鐘（B 方案：三張小卡）、電腦專注畫面放大、還在讀嗎
 * ===================================================== */
.sb-mid { --ring: min(80vw, 50dvh, 600px); }
.sb-cards { display: flex; gap: 10px; width: min(88vw, 480px); transition: opacity .5s; }
.sb-card { flex: 1 1 0; min-width: 0; padding: 12px 6px 11px; border-radius: 18px; text-align: center; background: rgba(var(--card-rgb), .5); border: 1px solid var(--line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.sb-card[hidden] { display: none; }
.sb-card b { display: block; font: 800 clamp(20px, min(5.6vw, 3dvh), 30px)/1.15 'Manrope', -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; color: var(--text); white-space: nowrap; }
.sb-card b small { font-size: .58em; font-weight: 700; margin-left: 2px; font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.sb-card span { display: block; margin-top: 3px; font: 600 clamp(11.5px, 1.5dvh, 14px) -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.standby.idle .sb-cards { opacity: .85; }
.sb-ctrl { flex-wrap: nowrap; }
.sb-ctrl .sb-btn { white-space: nowrap; }
/* 橫的螢幕（電腦、平板、手機橫放）：左邊大圓圈，右邊科目、小卡、按鈕 */
@media (orientation: landscape) and (min-width: 900px), (orientation: landscape) and (max-height: 540px) {
    .sb-mid { --ring: min(76dvh, 46vw, 680px); display: grid; grid-template-columns: auto auto; grid-template-areas: "ring head" "ring cards" "ring task" "ring ctrl"; grid-template-rows: 1fr auto auto 1fr; column-gap: clamp(28px, 6vw, 110px); row-gap: clamp(12px, 2.6dvh, 26px); align-items: center; justify-items: center; }
    .sb-ring { grid-area: ring; }
    .sb-head { grid-area: head; align-self: end; flex-direction: row; }
    .sb-cards { grid-area: cards; width: clamp(300px, 34vw, 500px); }
    .sb-task { grid-area: task; max-width: 34vw; }
    .sb-ctrl { grid-area: ctrl; align-self: start; flex-wrap: nowrap; max-width: none; }
}
@media (orientation: landscape) and (min-width: 900px) and (min-height: 541px) {
    .sb-subj { min-height: clamp(46px, 6dvh, 58px); font-size: clamp(20px, 2.8dvh, 28px); padding: 0 24px 0 18px; border-radius: 30px; }
    .sb-now { font-size: clamp(20px, 2.8dvh, 28px); }
    .sb-card { padding: clamp(12px, 2dvh, 20px) 8px; border-radius: 22px; }
    .sb-card b { font-size: clamp(24px, 4dvh, 40px); }
    .sb-card span { font-size: clamp(12px, 1.7dvh, 16px); }
    .sb-task { font-size: clamp(15px, 2dvh, 19px); }
    .sb-btn { min-height: clamp(50px, 6.4dvh, 70px); padding: 0 clamp(24px, 2.4vw, 36px); font-size: clamp(15px, 2dvh, 20px); border-radius: 36px; }
    .sb-exit { width: clamp(50px, 6.4dvh, 70px); }
    .sb-exit svg { width: clamp(20px, 2.4dvh, 26px); height: clamp(20px, 2.4dvh, 26px); }
}
@media (orientation: landscape) and (max-height: 540px) {
    .sb-mid { --ring: min(80dvh, 44vw); row-gap: 10px; }
    .sb-cards { width: min(44vw, 340px); gap: 8px; }
    .sb-card { padding: 7px 4px; border-radius: 14px; }
    .sb-card b { font-size: 18px; }
    .sb-card span { font-size: 11px; }
    .sb-btn { min-height: 44px; padding: 0 18px; font-size: 14px; }
    .sb-exit { width: 44px; }
}

/* 電腦、平板橫放：開始專注後的計時頁放大，左邊大圓圈、右邊科目、資訊和按鈕，整組置中 */
@media (min-width: 1000px) and (min-height: 620px) and (orientation: landscape) {
    body.focus-mode .timer-wrap.focus-wrap {
        position: relative; max-width: 1240px; display: grid; grid-template-columns: auto minmax(340px, min(32vw, 460px));
        grid-template-areas: "ring ." "ring head" "ring tip" "ring task" "ring dots" "ring btns" "ring extra" "ring .";
        grid-template-rows: 1fr auto auto auto auto auto auto 1fr;
        column-gap: clamp(56px, 7vw, 130px); row-gap: clamp(10px, 1.8dvh, 20px); align-content: center; justify-content: center; align-items: center;
    }
    body.focus-mode .focus-wrap .timer-head { grid-area: head; width: 100%; padding: 0; }
    body.focus-mode .focus-wrap .min-tip { grid-area: tip; justify-self: end; margin: -4px 0 0; }
    body.focus-mode .focus-wrap .chip-subj { min-height: clamp(48px, 5.6dvh, 58px); font-size: clamp(19px, 2.3dvh, 24px); padding: 0 22px 0 17px; border-radius: 30px; }
    body.focus-mode .focus-wrap .chip-subj .sdot { width: 12px; height: 12px; border-radius: 6px; }
    body.focus-mode .focus-wrap .timer-head .label { font-size: clamp(13px, 1.6dvh, 16px); }
    body.focus-mode .focus-wrap .ring-wrap { grid-area: ring; width: min(68dvh, 46vw, 640px); margin: 0; }
    body.focus-mode .focus-wrap .ring-time { font-size: clamp(92px, 12.5dvh, 150px); }
    body.focus-mode .focus-wrap .ring-sub { font-size: clamp(15px, 1.9dvh, 20px); }
    body.focus-mode .focus-wrap .task-line { grid-area: task; margin: 0; font-size: clamp(16px, 2.1dvh, 22px); text-align: center; }
    body.focus-mode .focus-wrap .round-dots { grid-area: dots; margin: 0; transform: scale(1.15); }
    body.focus-mode .focus-wrap .focus-btns { grid-area: btns; margin: 0; flex-wrap: nowrap; gap: 14px; }
    body.focus-mode .focus-wrap .focus-btns .btn-big { min-height: clamp(58px, 6.8dvh, 74px); min-width: 0; flex: 1 1 0; max-width: 210px; font-size: clamp(16px, 2.1dvh, 21px); border-radius: 40px; }
    body.focus-mode .focus-wrap .focus-extra { grid-area: extra; margin: 0; gap: clamp(12px, 1.8dvh, 18px); }
    body.focus-mode .focus-wrap .focus-tools { flex-wrap: nowrap; }
    body.focus-mode .focus-wrap .tool-btn { min-height: clamp(42px, 4.8dvh, 52px); font-size: clamp(13.5px, 1.65dvh, 16px); padding: 0 clamp(14px, 1.3vw, 20px); border-radius: 30px; white-space: nowrap; }
    body.focus-mode .focus-wrap .tool-btn svg { width: clamp(16px, 2dvh, 20px); height: clamp(16px, 2dvh, 20px); }
    body.focus-mode .focus-wrap .end-link { font-size: clamp(13px, 1.6dvh, 16px); }
    body.focus-mode .focus-wrap .focus-extra .hint { font-size: clamp(12px, 1.4dvh, 14px); }
}
/* 手機橫放：工具按鈕維持一排 */
@media (orientation: landscape) and (max-height: 540px) {
    .focus-wrap .focus-tools { flex-wrap: nowrap; gap: 6px; }
    .focus-wrap .tool-btn { padding: 0 10px; font-size: 12.5px; white-space: nowrap; }
}
/* 全螢幕時鐘的「縮小」按鈕：圓形，不受其他按鈕的左右留白影響 */
.standby .sb-btn.sb-exit { padding: 0; flex-shrink: 0; }
.tool-btn.on { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: var(--accent-soft); color: var(--accent-text); }

/* 小螢幕（iPhone SE 等）：暫停、提早完成維持同一排；下面那排按鈕縮小一點 */
@media (max-width: 360px) {
    .focus-wrap .focus-btns { flex-wrap: nowrap; gap: 10px; }
    .focus-wrap .focus-btns .btn-big { min-width: 0; flex: 1 1 0; max-width: 150px; padding-left: 10px; padding-right: 10px; }
    .focus-tools { gap: 6px; }
    .focus-tools .tool-btn { padding: 0 11px; font-size: 12.5px; }
}

/* v70 下一屆學測還沒公布：日期旁邊標「預估日期」 */
.cd-est { font-style: normal; font-size: 11.5px; font-weight: 700; margin-left: 6px; padding: 2px 7px; border-radius: 8px; background: var(--surface-2); color: var(--muted); vertical-align: 1px; white-space: nowrap; }
/* v70「我的倒數」：已結束的收起來 */
.cdm-endrow { list-style: none; }
.cdm-endbtn { display: flex; align-items: center; gap: 6px; width: 100%; min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--muted); font: 600 13.5px -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; cursor: pointer; }
.cdm-endbtn svg { width: 16px; height: 16px; transition: transform .2s; }
.cdm-endbtn[aria-expanded="true"] svg { transform: rotate(180deg); }

/* =====================================================
 * v73 公告（最上面的一條）、管理者的入口
 * ===================================================== */
.ann-bar { display: flex; align-items: center; gap: 10px; max-width: 520px; margin: 0 auto 14px; padding: 10px 8px 10px 14px; border-radius: 16px;
    background: var(--accent-soft); color: var(--text); border: 1px solid rgba(var(--accent-rgb), .35); font: 14px/1.5 -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.ann-bar[hidden] { display: none; }
.ann-bar .ann-ic { width: 30px; height: 30px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px; background: var(--accent); color: var(--on-accent); }
.ann-bar .ann-ic svg { width: 17px; height: 17px; }
.ann-bar .ann-tx { flex: 1; min-width: 0; word-break: break-word; }
.ann-bar .ann-x { width: 34px; height: 34px; flex-shrink: 0; display: grid; place-items: center; border: none; border-radius: 17px; background: none; color: var(--muted); }
.ann-bar .ann-x svg { width: 16px; height: 16px; }
.ann-bar.ann-warn { background: var(--exam-soft); border-color: rgba(217, 45, 45, .3); }
.ann-bar.ann-warn .ann-ic { background: var(--exam); color: #fff; }
.ann-bar.ann-fix { background: var(--mark-yellow-bg); border-color: rgba(245, 158, 11, .35); }
.ann-bar.ann-fix .ann-ic { background: #F59E0B; color: #1B1206; }
@media (min-width: 900px) { .ann-bar { margin-top: 4px; } }
.adm-badge { display: inline-block; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--exam); color: #fff; font: 700 11px/18px Manrope, sans-serif; text-align: center; vertical-align: 1px; }
.icon-btn.spin svg { animation: admSpin .8s linear infinite; }
@keyframes admSpin { to { transform: rotate(360deg); } }
.ann-bar .ann-go { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; height: 32px; padding: 0 12px; border-radius: 16px; border: none; background: var(--text); color: var(--bg); font: 700 13px/1 -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; white-space: nowrap; }
.ann-bar .ann-go[hidden] { display: none; }
/* v73 檢舉聊天訊息、封鎖 */
.rep-quote { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font: 14px/1.6 -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; color: var(--muted); word-break: break-word; }
.rep-quote b { color: var(--text); }
.rep-list { display: grid; gap: 6px; margin-bottom: 14px; }
.rep-list button { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: none; color: var(--text); text-align: left; font: 15px -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.rep-list button i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--faint); flex-shrink: 0; }
.rep-list button[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.rep-list button[aria-checked="true"] i { border: 5.5px solid var(--accent); }
.pk-block { display: block; margin: 8px auto 0; border: none; background: none; color: var(--muted); font: 12.5px -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; text-decoration: underline; text-underline-offset: 3px; padding: 4px 8px; }
/* v73 天空：天氣（雨、雷、霧）和真實月相 */
:root { --moon-lit: rgba(250, 247, 232, .95); --moon-dark: rgba(170, 180, 205, .18); }
.b-orb.moon { background: radial-gradient(circle, rgba(235, 240, 255, .25) 0 30%, transparent 70%); }
.b-orb.moon svg { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px; filter: drop-shadow(0 0 6px rgba(240, 240, 255, .55)); }
[data-theme="light"] .b-orb.moon { --moon-lit: rgba(255, 255, 255, .95); --moon-dark: rgba(120, 130, 160, .16); }
.b-wx { inset: 0; pointer-events: none; }
.b-wx.wx-rain::before, .b-wx.wx-storm::before { content: ''; position: absolute; inset: -60px 0 0; opacity: .55;
    background-image: linear-gradient(100deg, transparent 47%, rgba(200, 215, 235, .55) 48%, transparent 49%), linear-gradient(100deg, transparent 47%, rgba(200, 215, 235, .4) 48%, transparent 49%);
    background-size: 37px 60px, 23px 44px; background-position: 0 0, 11px 17px; animation: wxRain .55s linear infinite; }
[data-theme="light"] .b-wx.wx-rain::before, [data-theme="light"] .b-wx.wx-storm::before { opacity: .5; background-image: linear-gradient(100deg, transparent 47%, rgba(90, 110, 140, .4) 48%, transparent 49%), linear-gradient(100deg, transparent 47%, rgba(90, 110, 140, .28) 48%, transparent 49%); }
@keyframes wxRain { to { transform: translate(-10px, 60px); } }
.b-wx.wx-storm::after { content: ''; position: absolute; inset: 0; background: rgba(235, 240, 255, .55); opacity: 0; }
.b-wx.wx-storm.flash::after { animation: wxFlash 1.1s ease-out; }
@keyframes wxFlash { 0% { opacity: 0; } 6% { opacity: .9; } 12% { opacity: .1; } 18% { opacity: .7; } 100% { opacity: 0; } }
.b-wx.wx-fog { background: linear-gradient(180deg, transparent 30%, rgba(225, 228, 232, .55) 75%, rgba(225, 228, 232, .75)); }
[data-theme="dark"] .b-wx.wx-fog { background: linear-gradient(180deg, transparent 30%, rgba(60, 65, 75, .45) 75%, rgba(60, 65, 75, .6)); }
@media (prefers-reduced-motion: reduce) { .b-wx::before { animation: none !important; } }
.bg-sky-acts { padding: 0 14px 14px; display: grid; gap: 8px; }
.bg-sky-acts .sky-row { border: 1px solid var(--line); border-radius: 16px; min-height: 58px; padding: 10px 14px; }
.bg-sky-acts .sky-row { align-items: center; }
.bg-sky-acts .nf-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.bg-sky-acts .nf-tx b { font-size: 14.5px; font-weight: 600; line-height: 1.3; }
.bg-sky-acts .nf-tx small { font-size: 12.5px; color: var(--muted); line-height: 1.3; margin: 0; }
.sky-loc { display: flex; gap: 8px; }
.sky-loc[hidden] { display: none; }
.sky-loc .field { margin: 0; flex: 1; min-width: 0; height: 44px; line-height: normal; padding: 0 38px 0 14px; font-size: 15px; background-position: right 12px center; }
.sky-loc .btn { flex-shrink: 0; height: 44px; min-height: 44px; font-size: 13.5px; display: inline-flex; align-items: center; justify-content: center; }
/* =====================================================
 * v73 文字選取：手機、平板上長按或連點時，按鈕、標題、數字這些介面上的字不會被選起來（像 App 一樣）
 *   輸入框、聊天訊息選單裡的訊息、錯誤紀錄還是可以選；電腦上只有按鈕、分頁這些不能選，內容文字照常可以複製
 * ===================================================== */
@media (hover: none), (pointer: coarse) {
    body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
    input, textarea, select, [contenteditable="true"], .adm-err pre, .rep-quote { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
}
button, .btn, [role="tab"], .tab-btn, .chip, .seg, .seg *, .acct-row, .bg-opt, .accent-opt, .nf-row, .lunch-wheel-box, .adm-tabs, .adm-seg, .ann-bar, .tabbar, .topbar,
.cd-days, .cd-hms, .num { -webkit-user-select: none; user-select: none; }
/* =====================================================
 * v73 外觀與主題（整頁設定）
 * ===================================================== */
.acct-swatch + .acct-chev { margin-left: 6px; }
.th-body .nf-sec > h3 { display: flex; align-items: baseline; gap: 8px; }
.th-cur { margin-left: auto; margin-right: 6px; font-weight: 600; letter-spacing: 0; color: var(--accent-text); font-size: 12.5px; }
.th-card { padding: 14px 0 0; }
.th-card .accent-grid { padding: 0 14px 14px; }
.th-card .bg-grid { padding: 0 14px 14px; }
.th-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.th-modes button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 8px 10px; border-radius: 18px; border: 1.5px solid var(--line); background: var(--surface);
    color: var(--muted); font: 600 13.5px -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.th-modes button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-soft); }
.th-mode-pic { position: relative; width: 100%; max-width: 92px; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; gap: 5px; padding: 0 12px; }
.th-mode-pic i { display: block; height: 6px; border-radius: 3px; }
.th-mode-pic i:nth-child(1) { width: 45%; height: 9px; }
.th-mode-pic i:nth-child(3) { width: 65%; }
.m-light { background: #F7F6F2; } .m-light i { background: rgba(22, 20, 15, .22); } .m-light i:nth-child(1) { background: var(--accent); }
.m-dark { background: #0B0C10; } .m-dark i { background: rgba(242, 240, 233, .22); } .m-dark i:nth-child(1) { background: var(--accent); }
.m-auto { background: linear-gradient(135deg, #F7F6F2 50%, #0B0C10 50%); } .m-auto i { background: rgba(127, 127, 127, .45); } .m-auto i:nth-child(1) { background: var(--accent); }
.guide-body > .nf-sec { margin-left: auto; margin-right: auto; }   /* 電腦上通知、外觀設定頁置中 */
.accent-opt { white-space: nowrap; }
@media (max-width: 359px) { .accent-grid { gap: 6px; } .accent-opt { gap: 4px; font-size: 12px; letter-spacing: -.02em; } .accent-opt i { width: 11px; height: 11px; } }
/* v73 很窄的手機（iPhone SE）：計時頁「讀書房間」「讀書統計」字不會被切成「讀書…」 */
@media (max-width: 359px) { .go-row { gap: 8px; } .go-btn { padding-left: 10px; padding-right: 8px; gap: 8px; } .go-ic { width: 30px; height: 30px; border-radius: 10px; } .go-ic svg { width: 17px !important; height: 17px !important; } .go-arrow { display: none; } .go-tx b { font-size: 14px; white-space: nowrap; } }
/* v73 看大圖時的「儲存照片」 */
.img-save { position: absolute; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 20px;
    border-radius: 22px; border: 1px solid rgba(255, 255, 255, .25); background: rgba(0, 0, 0, .55); color: #fff; font: 600 14.5px -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.img-save svg { width: 18px; height: 18px; }
.img-save:active { transform: translateX(-50%) scale(.96); }
/* v73 照片背景：計時頁「讀書房間」「讀書統計」也用同樣的毛玻璃，不會太淡 */
html[data-bg="photo"] .go-btn { background: linear-gradient(rgba(var(--accent-rgb), .3), rgba(var(--accent-rgb), .3)), rgba(var(--card-rgb), .6); border-color: rgba(var(--accent-rgb), .6);
    -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4); box-shadow: 0 6px 18px rgba(0, 0, 0, .08); }
html[data-bg="photo"] .go-btn.room { background: linear-gradient(color-mix(in srgb, var(--mark-green) 26%, transparent), color-mix(in srgb, var(--mark-green) 26%, transparent)), rgba(var(--card-rgb), .6); border-color: color-mix(in srgb, var(--mark-green) 60%, transparent); }


/* =====================================================
 * v74
 * ===================================================== */
/* 毛玻璃：分段選單、倒數上面的考試、月曆、課表。背景比較花（照片、天空、花瓣…）時底色更不透明，字和框線才看得清楚 */
.seg, #tab-countdown .chip { background: rgba(var(--card-rgb), .42); -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4); border-color: rgba(255, 255, 255, .7); }
html[data-theme="dark"] .seg, html[data-theme="dark"] #tab-countdown .chip { border-color: rgba(255, 255, 255, .1); }
#tab-countdown .chip.active { background: linear-gradient(var(--accent-soft), var(--accent-soft)), rgba(var(--card-rgb), .42); border-color: var(--accent); }
html:not([data-bg="glow"]):not([data-bg="plain"]):not([data-bg="grid"]):not([data-bg="stars"]) .seg,
html:not([data-bg="glow"]):not([data-bg="plain"]):not([data-bg="grid"]):not([data-bg="stars"]) #tab-countdown .chip:not(.active) { background: rgba(var(--card-rgb), .62); }
html:not([data-bg="glow"]):not([data-bg="plain"]):not([data-bg="grid"]):not([data-bg="stars"]) .cal-panel,
html:not([data-bg="glow"]):not([data-bg="plain"]):not([data-bg="grid"]):not([data-bg="stars"]) .tt {
    padding: 4px 6px 8px; border-radius: 18px; background: rgba(var(--card-rgb), .62); border: 1px solid rgba(255, 255, 255, .7);
    -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4);
}
html[data-theme="dark"]:not([data-bg="glow"]):not([data-bg="plain"]):not([data-bg="grid"]):not([data-bg="stars"]) .cal-panel,
html[data-theme="dark"]:not([data-bg="glow"]):not([data-bg="plain"]):not([data-bg="grid"]):not([data-bg="stars"]) .tt { border-color: rgba(255, 255, 255, .1); }
/* 手機月曆：多天行程的橫條放在小圓點下面，不會疊在一起 */
@media (max-width: 767px) {
    .cal-cell { padding-bottom: 10px; }
    .cal-bar { bottom: 2px; height: 3px; }
}

/* 訪客 */
.acct-guest { margin-top: 8px; min-height: 46px; border-radius: 23px; }
.acct-guest[hidden] { display: none; }

/* 意見回饋 */
.fb-sheet h2 { margin-bottom: 4px; }
.fb-sub { margin: 0 0 14px; color: var(--muted); font: 13.5px/1.6 -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.fb-kind { margin-bottom: 12px; }
.fb-text { margin-bottom: 4px; min-height: 120px; }
.fb-count { text-align: right; color: var(--faint); font: 500 12px Manrope, sans-serif; margin-bottom: 10px; }
.fb-contact[hidden] { display: none; }
.fb-note { margin: 0 0 4px; color: var(--faint); font: 12px/1.6 -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.fb-mine { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.fb-mine[hidden] { display: none; }
.fb-mine h3 { margin: 0 0 10px; font: 700 12.5px -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; color: var(--muted); letter-spacing: .06em; }
.fb-item { padding: 10px 0; border-bottom: 1px solid var(--line); font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; }
.fb-item:last-child { border-bottom: none; }
.fb-top { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.fb-tag { padding: 2px 8px; border-radius: 9px; background: var(--surface-2); color: var(--text); font-weight: 600; }
.fb-tag.k-bug { background: color-mix(in srgb, var(--exam) 16%, transparent); color: var(--exam-text); }
.fb-tag.k-idea { background: var(--accent-soft); color: var(--accent-text); }
.fb-st { margin-left: auto; color: var(--faint); }
.fb-st.ok { color: var(--mark-green); font-weight: 700; }
.fb-item p { margin: 6px 0 0; font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.fb-reply { margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.fb-reply b { display: block; font-size: 12px; color: var(--accent-text); margin-bottom: 2px; }
/* v75 新名字 Stride：英文用 Manrope */
#tourTitle, .guide-hero h1 { font-family: Manrope, -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; font-weight: 800; letter-spacing: 0; }
#splash span { font-family: Manrope, -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', sans-serif; font-weight: 800; }
/* v75：換頁動畫只用位移，不再淡入（淡入時毛玻璃會先不透明、動畫結束才變模糊，看起來很卡）；
   照片、天空這類背景整頁有很多毛玻璃，換頁就不做動畫，直接固定顯示 */
@keyframes pageIn { from { transform: translateY(12px); } to { transform: none; } }
html:not([data-bg="glow"]):not([data-bg="plain"]):not([data-bg="grid"]):not([data-bg="stars"]) .tab.active,
html:not([data-bg="glow"]):not([data-bg="plain"]):not([data-bg="grid"]):not([data-bg="stars"]) .home-mod,
html:not([data-bg="glow"]):not([data-bg="plain"]):not([data-bg="grid"]):not([data-bg="stars"]) .hero.swap { animation: none; }
/* 待辦的輸入框和選日期按鈕也是毛玻璃 */
#tab-todo .text-input, #tab-todo .todo-date-btn { background: rgba(var(--card-rgb), .42); -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4); border-color: rgba(255, 255, 255, .7); }
html[data-theme="dark"] #tab-todo .text-input, html[data-theme="dark"] #tab-todo .todo-date-btn { border-color: rgba(255, 255, 255, .1); }
html:not([data-bg="glow"]):not([data-bg="plain"]):not([data-bg="grid"]):not([data-bg="stars"]) #tab-todo .text-input,
html:not([data-bg="glow"]):not([data-bg="plain"]):not([data-bg="grid"]):not([data-bg="stars"]) #tab-todo .todo-date-btn { background: rgba(var(--card-rgb), .62); }
#tab-todo .text-input:focus { border-color: var(--accent); }

/* =====================================================
 * v80 跟 iOS 系統一樣的設定清單、表單視窗、行事曆
 * ===================================================== */
:root { --g-bg: #F2F2F7; --g-cell: #FFFFFF; --g-sep: rgba(60, 60, 67, .18); --g-sub: #8A8A8E; --g-chev: #C4C4C7; --g-press: #E5E5EA; }
[data-theme="dark"] { --g-bg: #000000; --g-cell: #1C1C1E; --g-sep: rgba(84, 84, 88, .55); --g-sub: #8E8E93; --g-chev: #5A5A5F; --g-press: #2C2C2E; }

/* --- 個人設定（iOS 設定 App） --- */
.acct-sheet { background: var(--g-bg); gap: 0; padding: 14px 16px calc(22px + env(safe-area-inset-bottom)); }
.acct-sheet .acct-top { margin-bottom: 8px; }
.acct-group { border: none; border-radius: 26px; background: var(--g-cell); margin-top: 20px; }
.acct-top + .acct-group { margin-top: 6px; }
.acct-row { min-height: 52px; padding: 0 16px; gap: 14px; position: relative; font-size: 17px; }
.acct-row + .acct-row { border-top: none; }
.acct-row + .acct-row::before { content: ''; position: absolute; top: 0; right: 0; left: 60px; height: .5px; background: var(--g-sep); }
.acct-row[hidden] + .acct-row::before { display: none; }
button.acct-row:hover, a.acct-row:hover { background: none; }
button.acct-row:active, a.acct-row:active { background: var(--g-press); }
.acct-ic { width: 30px; height: 30px; border-radius: 7.5px; background: var(--ic, #8E8E93); color: #fff; }
.acct-ic svg { width: 18px; height: 18px; }
.acct-label { font-weight: 400; }
.acct-group .acct-value, .acct-swatch { display: none !important; }
.acct-chev { width: 15px; height: 15px; color: var(--g-chev); }
.acct-user { min-height: 76px; padding: 12px 16px; }
.acct-user + .acct-sync::before { left: 16px; }
.acct-sync { min-height: 44px; font-size: 14px; }
.acct-hint { margin: 8px 16px 0; font-size: 13px; color: var(--g-sub); }
.acct-login, .acct-guest { margin-top: 20px; }
.acct-del { margin-top: 18px; }

/* --- 訊息與通知（iOS 設定） --- */
#notifScreen .nf-card { border: none; border-radius: 26px; background: var(--g-cell); }
.nf-row { min-height: 52px; padding: 8px 16px; gap: 14px; }
.nf-card > * + .nf-row { border-top: none; }
.nf-card > * + .nf-row::before { content: ''; position: absolute; top: 0; right: 0; left: 60px; height: .5px; background: var(--g-sep); }
.nf-ic { width: 30px; height: 30px; border-radius: 7.5px; background: var(--ic, #8E8E93); color: #fff; }
.nf-ic svg { width: 18px; height: 18px; }
.nf-tx b { font-size: 17px; font-weight: 400; }
.nf-row input:checked + .nf-sw { background: #34C759; border-color: #34C759; }
.nf-row input:checked + .nf-sw::after { background: #fff; }
.nf-sw { width: 51px; height: 31px; border-radius: 16px; border: none; background: rgba(120, 120, 128, .16); }
[data-theme="dark"] .nf-sw { background: rgba(120, 120, 128, .32); }
.nf-sw::after { top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 14px; background: #fff; opacity: 1; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.08); }
.nf-row input:checked + .nf-sw::after { transform: translateX(20px); }
.nf-sec > h3 { font-size: 13px; font-weight: 400; color: var(--g-sub); letter-spacing: 0; margin: 0 0 7px 16px; }
.nf-foot { margin: 7px 16px 0; font-size: 13px; color: var(--g-sub); }
.nf-sub { padding-left: 60px; }
.nf-dev { padding: 14px 16px; }
.nf-test { margin-top: 12px; }

/* --- 表單視窗（iOS 系統的新增行程那種） --- */
.fm-sheet { background: var(--g-bg); padding: 0 0 calc(22px + env(safe-area-inset-bottom)) !important; border: none; }
.fm-sheet { overflow-x: hidden !important; }
.fm-sheet > *:not(.fm-head) { margin-left: 16px !important; margin-right: 16px !important; max-width: calc(100% - 32px); box-sizing: border-box; }
.fm-sheet > input, .fm-sheet > textarea, .fm-sheet > select, .fm-sheet > .field { width: calc(100% - 32px); }
.fm-head { position: sticky; top: 0; z-index: 3; display: grid; grid-template-columns: minmax(76px, auto) 1fr minmax(76px, auto); align-items: center; gap: 8px;
    padding: 14px 16px 12px; margin: 0 0 18px; background: var(--g-cell); border-bottom: .5px solid var(--g-sep); }
.fm-head h2 { margin: 0 !important; padding-top: 6px; text-align: center; font-size: 17px; font-weight: 600; line-height: 1.25; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbtn { height: 44px; min-width: 76px; padding: 4px 18px 0;   /* 中文字的字形會偏上，往下補一點 才會看起來置中 */ border-radius: 22px; font-size: 17px; font-weight: 400; line-height: 1; white-space: nowrap;
    display: inline-flex; align-items: center; justify-content: center; justify-self: start;
    background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(246,246,248,.92)); color: var(--text);
    border: .5px solid rgba(0,0,0,.08); box-shadow: 0 2px 10px rgba(0,0,0,.07), inset 0 1px 0 rgba(255,255,255,.9); }
[data-theme="dark"] .hbtn { background: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.08)); border-color: rgba(255,255,255,.14); box-shadow: 0 2px 10px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.12); }
.hbtn.prim { justify-self: end; font-weight: 600; background: var(--accent); color: var(--on-accent); border-color: transparent; box-shadow: 0 3px 12px rgba(var(--accent-rgb), .35), inset 0 1px 0 rgba(255,255,255,.35); }
.hbtn.prim:disabled { background: #B8B8BD; color: rgba(255,255,255,.9); box-shadow: none; }
[data-theme="dark"] .hbtn.prim:disabled { background: #3A3A3C; color: rgba(255,255,255,.5); }
.hbtn.ghost { visibility: hidden; justify-self: end; }
.hbtn:active { transform: scale(.95); }
.fm-sheet .field-label { font-size: 13px; color: var(--g-sub); margin: 0 0 7px 16px; }
.fm-sheet .field { background: var(--g-cell); border: 1px solid transparent; border-radius: 26px; height: 52px; padding: 0 20px; font-size: 17px; margin-bottom: 20px; }
.fm-sheet textarea.field { height: auto; border-radius: 22px; padding: 14px 20px; }
.fm-sheet select.field { padding-right: 44px; background-position: right 18px center; }
.fm-sheet .field:focus { border-color: var(--accent); }
.fm-sheet .toggle-row { background: var(--g-cell); border-radius: 26px; min-height: 52px; padding: 0 20px; font-size: 17px; }
.fm-sheet .seg { margin-bottom: 18px; }
.fm-sheet .sheet-sub, .fm-sheet p.note, .fm-sheet .sub { color: var(--g-sub); font-size: 13px; }
.fm-dels { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.fm-del { height: 52px; padding: 0 0 2px; border: none; border-radius: 26px; background: var(--g-cell); color: var(--exam); font-size: 17px; }
.fm-del[hidden] { display: none; }
.fm-del:active { background: var(--g-press); }
@media (max-width: 899px) { .modal.fm .sheet.fm-sheet { border-radius: 38px 38px 0 0; max-height: 94vh; } }
@media (min-width: 900px) { .modal.fm .sheet.fm-sheet { border-radius: 26px; overflow: hidden auto; } }
/* 詳細資訊 */
.fm-body .fm-group { background: var(--g-cell); border-radius: 26px; margin-bottom: 20px; overflow: hidden; }
.fm-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; padding: 0 20px; font-size: 17px; position: relative; }
.fm-row + .fm-row::before { content: ''; position: absolute; top: 0; left: 20px; right: 0; height: .5px; background: var(--g-sep); }
.fm-val { color: var(--g-sub); text-align: right; min-width: 0; }
.fm-row > span:first-child { flex-shrink: 0; white-space: nowrap; }
.fm-row { padding-top: 8px; padding-bottom: 8px; }
.fm-foot { margin: -12px 20px 16px; font-size: 13px; color: var(--g-sub); }
.cdt-head { display: flex; align-items: center; gap: 14px; padding: 16px 20px; }
.cdt-head i { width: 4px; align-self: stretch; border-radius: 2px; flex-shrink: 0; }
.cdt-head b { display: block; font-size: 20px; font-weight: 600; word-break: break-word; }
.cdt-head small { display: block; font-size: 14px; color: var(--g-sub); margin-top: 2px; }

/* --- 上方的「＋」（行事曆、待辦） --- */
.top-add { display: none; }
body[data-tab="tab-calendar"]:not(.cal-tt) .top-add, body[data-tab="tab-todo"] .top-add { display: inline-flex; }
body.sub .top-add { display: none; }
#calFab, #addOnDayBtn, #tab-calendar .legend, #tab-todo .input-row { display: none !important; }
#tab-calendar { padding-bottom: 0; }

/* --- 倒數大數字：柔和光暈（任何背景都看得清楚） --- */
.days { text-shadow: 0 1px 2px rgba(0,0,0,.18), 0 4px 22px rgba(0,0,0,.28); }
[data-theme="light"] .days { text-shadow: 0 1px 1px rgba(255,255,255,.9), 0 2px 18px rgba(255,255,255,.75); }

/* --- 行事曆 B：每一週一列，日期下面放彩色橫條 --- */
.cal-grid.cal-b { display: block; }
.cal-week { position: relative; border-top: .5px solid var(--line); }
.cal-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-b .cal-cell { min-height: 108px; padding: 6px 0 0; justify-content: flex-start; align-items: center; gap: 0; border: none !important; border-radius: 0; background: none !important; }
.cal-b .cal-num { width: 32px; height: 32px; border-radius: 16px; font-size: 17px; font-weight: 500; border: none; outline: none !important; }
.cal-b .cal-cell.rest .cal-num { color: var(--rest-text); }
.cal-b .cal-cell.past .cal-num { color: var(--faint); }
.cal-b .cal-cell.selected .cal-num { background: var(--text); color: var(--bg); }
.cal-b .cal-cell.today .cal-num { background: var(--accent); color: var(--on-accent); }
.cal-b .cal-hol { position: absolute; top: 40px; left: 0; right: 0; text-align: center; }
.cal-ev { position: absolute; top: calc(44px + var(--lane) * 21px); height: 19px; z-index: 1;
    left: calc(var(--c0) * 100% / 7 + 3px); width: calc(var(--span) * 100% / 7 - 6px);
    border: none; padding: 0 6px; border-radius: 5px; text-align: left; cursor: pointer;
    background: color-mix(in srgb, var(--ev) 26%, transparent); color: color-mix(in srgb, var(--ev) 72%, var(--text));
    font-size: 12px; font-weight: 600; line-height: 19px; overflow: hidden; }
.cal-ev span { display: block; white-space: nowrap; overflow: hidden; text-overflow: clip; }   /* 跟 iPhone 行事曆一樣直接切掉，不用「…」，小格子才看得到 2-3 個字 */
@media (max-width: 480px) { .cal-ev { padding: 0 4px; } }
.cal-week.has-more .cal-cell { min-height: 126px; }
.cal-ev:not(.head) { border-top-left-radius: 0; border-bottom-left-radius: 0; left: calc(var(--c0) * 100% / 7); width: calc(var(--span) * 100% / 7 - 3px); }
.cal-ev:not(.tail) { border-top-right-radius: 0; border-bottom-right-radius: 0; width: calc(var(--span) * 100% / 7 - 3px); }
.cal-ev:not(.head):not(.tail) { width: calc(var(--span) * 100% / 7); }
.cal-ev.t-exam { background: color-mix(in srgb, var(--exam) 30%, transparent); color: color-mix(in srgb, var(--exam) 80%, var(--text)); }
.cal-ev:active { filter: brightness(.9); }
.cal-ev::before { content: ''; position: absolute; inset: -2px 0; }   /* 點的範圍大一點 */
.cal-more { position: absolute; top: calc(44px + 3 * 21px); left: calc(var(--c0) * 100% / 7); width: calc(100% / 7); text-align: center; font-size: 11px; color: var(--muted); pointer-events: none; }
@media (min-width: 768px) {
    .cal-b .cal-cell { min-height: 124px; }
    .cal-ev { height: 21px; line-height: 21px; top: calc(46px + var(--lane) * 24px); font-size: 12.5px; }
    .cal-more { top: calc(46px + 3 * 24px); }
    .cal-week.has-more .cal-cell { min-height: 142px; }
}
/* 本月行程 */
.ml-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 4px; border: none; background: none; text-align: left; border-radius: 12px; }
.ml-row:active { background: var(--surface); }
.ml-bar { width: 4px; height: 34px; border-radius: 2px; flex-shrink: 0; }
.ml-date { width: 96px; flex-shrink: 0; display: flex; flex-direction: column; line-height: 1.25; }
.ml-date b { font-size: 14px; font-weight: 600; white-space: nowrap; }
.ml-date small { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.ml-title { flex: 1; min-width: 0; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml-tag { font-size: 11.5px; color: var(--muted); flex-shrink: 0; }
#upcomingList li + li .ml-row { border-top: .5px solid var(--line); border-radius: 0; }
/* v80 看大圖 */
.img-modal { padding: 0 !important; background: rgba(0, 0, 0, calc(.96 * var(--iv-a, 1))) !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
.iv-stage { position: absolute; left: 0; right: 0; top: calc(env(safe-area-inset-top) + 72px); bottom: calc(env(safe-area-inset-bottom) + 16px); display: flex; align-items: center; justify-content: center;
    touch-action: none; transition: top .3s cubic-bezier(.2,.8,.2,1), bottom .3s cubic-bezier(.2,.8,.2,1); overflow: hidden; }
.img-modal.full .iv-stage { top: 0; bottom: 0; }
.img-modal .iv-stage img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 0; user-select: none; -webkit-user-drag: none; will-change: transform; }
.iv-bar { position: absolute; left: 0; right: 0; top: calc(env(safe-area-inset-top) + 14px); padding: 0 16px; display: flex; align-items: center; transition: opacity .25s; z-index: 2; }
.img-modal.full .iv-bar { opacity: 0; pointer-events: none; }
.iv-btn { width: 44px; height: 44px; border-radius: 22px; display: flex; align-items: center; justify-content: center; color: #fff;
    background: linear-gradient(180deg, rgba(255,255,255,.2), rgba(255,255,255,.08)); border: .5px solid rgba(255,255,255,.22);
    box-shadow: 0 4px 14px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.18); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.iv-btn svg { width: 20px; height: 20px; }
.iv-btn:active { transform: scale(.94); }
/* v80 拖動排序：按住那一列浮起來（放大一點＋陰影） */
.cdm-row.dragging, .he-row.dragging { background: var(--g-cell) !important; scale: 1.03; box-shadow: 0 14px 34px rgba(0, 0, 0, .22), 0 2px 6px rgba(0,0,0,.08); transition: scale .18s cubic-bezier(.2,.8,.2,1), box-shadow .18s; }
[data-theme="dark"] .cdm-row.dragging, [data-theme="dark"] .he-row.dragging { background: #2C2C2E !important; box-shadow: 0 14px 34px rgba(0, 0, 0, .6); }
/* v80 小螢幕（320）表單：日期不被切、「標記為重要」不換行 */
.fm-sheet .toggle-row .tr-l { white-space: nowrap; }
.fm-sheet .toggle-row .imp-hint { flex: 1; min-width: 0; text-align: right; line-height: 1.3; padding: 6px 0; }
@media (max-width: 360px) {
    .fm-sheet .field { padding: 0 14px; font-size: 16px; }
    .fm-sheet .event-dates input.field { padding: 0 10px; font-size: 15px; }
    .fm-sheet .toggle-row { padding: 0 16px; gap: 10px; }
}
/* v80 導覽：新版行事曆的小插圖 */
.g-calb { position: relative; height: 62px; border-top: .5px solid var(--line); }
.g-calb-d { display: grid; grid-template-columns: repeat(7, 1fr); }
.g-calb-d span { height: 24px; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 600; }
.g-calb-d span.we { color: var(--rest-text); }
.g-calb-d span.today { color: var(--on-accent); }
.g-calb-d span.today::before { content: ''; position: absolute; width: 17px; height: 17px; border-radius: 50%; background: var(--accent); z-index: -1; }
.g-calb-d span { position: relative; z-index: 0; }
.g-calb i { position: absolute; top: calc(26px + var(--lane) * 15px); height: 13px; left: calc(var(--c0) * 100% / 7 + 2px); width: calc(var(--span) * 100% / 7 - 4px);
    border-radius: 3px; padding: 0 3px; font-style: normal; font-size: 7.5px; font-weight: 700; line-height: 13px; white-space: nowrap; overflow: hidden;
    background: color-mix(in srgb, var(--ev) 26%, transparent); color: color-mix(in srgb, var(--ev) 72%, var(--text)); }
.fm-del svg { display: none; }   /* iOS 的刪除鈕只有字；原本按鈕裡的垃圾桶圖示不要被放大 */
/* v81 標題下面的小字（例如課表的上課時間） */
.fm-head h2 .fm-sub { display: block; margin-top: 2px; font-size: 12.5px; font-weight: 500; color: var(--g-sub); letter-spacing: 0; }
.fm-head h2:has(.fm-sub) { white-space: normal; line-height: 1.2; }
/* v81 蘋方（iPhone、iPad、Mac）本來就置中，不用往下補；上面的補值只給 Noto／正黑體這類字型 */
html.apple .hbtn { padding-top: 0; }
html.apple .fm-head h2 { padding-top: 0; }
html.apple .fm-del { padding-bottom: 0; }
/* v81 首頁每一區標題前的彩色圖示、清單分隔線（跟 App 一樣） */
/* 只用線條、跟著深淺色變（淺色深灰、深色淺灰），沒有底色，不搶眼 */
.mod-ic { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-right: 8px; flex-shrink: 0;
    background: none; color: var(--muted); }
.mod-ic svg { width: 19px; height: 19px; }
#homeMods .sec-head h3, #homeMods h3.mod-title { display: flex; align-items: center; }
#homeMods .sec-head { align-items: center; }
#todayList .check-item { position: relative; }
#todayList .check-item + .check-item::before { content: ''; position: absolute; top: 0; left: 34px; right: 0; height: .5px; background: var(--line-strong, var(--line)); }
#homeUpcoming .hu-row { border-bottom-width: .5px; }
.he-ic { width: 30px; height: 30px; border-radius: 7.5px; background: var(--ic, var(--accent)); color: #fff; }
.he-ic svg { width: 18px; height: 18px; }
/* v82 自己選頭像：名字或照片 */
.me-avseg { margin-bottom: 12px; }
.me-photo[hidden], .me-colors[hidden], .field-label[hidden] { display: none; }
.me-photo { margin-bottom: 16px; }
.me-photo .btn { width: 100%; height: 48px; border-radius: 24px; }
.me-photo-note { margin: 8px 4px 0; font-size: 12.5px; color: var(--muted); }
/* 照片頭像不要字 */
.av-photo { color: transparent !important; }
/* v84 Apple 登入按鈕（照 Apple 規定：淺色黑底白字、深色白底黑字） */
.acct-apple { min-height: 50px; border-radius: 25px; display: flex; align-items: center; justify-content: center; gap: 8px; background: #000 !important; color: #fff !important; border-color: #000 !important; margin-top: 10px; font-weight: 600; }
.acct-apple svg { width: 18px; height: 18px; margin-top: -2px; }
.acct-apple[hidden] { display: none !important; }
[data-theme="dark"] .acct-apple { background: #fff !important; color: #000 !important; border-color: #fff !important; }
