/* DayDay 正式版：全站一欄（最寬 460 px），畫面：場景、日記（月曆）、寫字頁，以及底部按鈕列切過去的「我的」。
   內容超過一個畫面時整頁往下捲；固定位置的只有寫字頁頂部那一列（sticky）與場景、「我的」共用的底部按鈕列（fixed）。 */
:root {
  --font: "LXGW WenKai TC", "Hiragino Mincho ProN", "Songti TC", "Noto Serif TC", "PMingLiU", serif;
  --col: 460px;
  --ink: #4a3b2e;
  --sub: #85705a;
  --accent: #b4553b;
  --accent-on-dark: #f0a77f;
  --bar-bg: rgba(46, 33, 24, .82);
  --list-bg: #f4e8d4;
  --gutter: 20px;
}

html, body { margin: 0; }
body {
  min-height: 100dvh; background: #2a211a; color: var(--ink);
  font-family: var(--font); -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* 寬螢幕的兩側：同一張場景圖放大、模糊、調暗。sticky 加負的下邊距，貼在視窗上又不佔高度 */
.bg { display: none; }
@media (min-width: 461px) {
  .bg {
    display: block; position: sticky; top: 0; height: 100dvh; margin-bottom: -100dvh; overflow: hidden; z-index: 0;
  }
  .bg img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    filter: blur(26px) brightness(.5) saturate(1.05); transform: scale(1.15);
  }
}

/* 一欄 */
.app { position: relative; z-index: 1; max-width: var(--col); margin: 0 auto; min-height: 100dvh; background: #2a211a; }
@media (min-width: 461px) { .app { box-shadow: 0 0 40px rgba(10, 6, 3, .45); } }

/* ---------- 0. 歡迎畫面 ---------- */
/* 滿版一張直式插圖（填滿、多的裁掉；三張輪流，選圖在 index.html 開頭），上方三分之一是天空（b 是深色木牆）：字放在那裡，後面墊一層很淡的漸層。
   兩種字色：亮的圖（a）用深棕色字與淡米色漸層；偏暗的圖（b、c）用米白色字與淡深棕漸層。
   「進屋」在下方的路面上。只有淡入淡出，沒有彈跳或縮放 */
html.is-welcome .screen-welcome { display: block !important; }            /* 腳本接手前就先蓋住房間，不閃 */
html.is-welcome .screen-scene, html.is-welcome .tabbar { display: none !important; }
.screen-welcome {
  --w-ink: #4f3423; --w-sub: #6a4a33; --w-glow: rgba(255, 250, 240, .75); --w-shade: 255, 248, 236;
  position: relative; height: 100dvh; overflow: hidden; cursor: pointer; background: #d9c7a8;
  user-select: none; -webkit-user-select: none;
}
.screen-welcome[data-tone="dark"] { --w-ink: #fff6e6; --w-sub: #f5e6cc; --w-glow: rgba(40, 22, 12, .6); --w-shade: 34, 20, 12; }
.welcome-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; display: block; }
.welcome-shade {
  position: absolute; left: 0; right: 0; top: 0; height: 42%; pointer-events: none;
  background: linear-gradient(to bottom, rgba(var(--w-shade), .5), rgba(var(--w-shade), .3) 55%, rgba(var(--w-shade), 0));
}
.welcome-text {
  position: absolute; left: var(--gutter); right: var(--gutter); top: calc(env(safe-area-inset-top) + 10.5dvh);
  text-align: center; color: var(--w-ink); text-shadow: 0 1px 3px var(--w-glow), 0 0 14px var(--w-glow);
  animation: welcome-in .9s ease-out both;
}
.welcome-title { margin: 0; font-size: clamp(34px, 6.4dvh, 50px); font-weight: 700; line-height: 1.15; letter-spacing: .1em; padding-left: .1em; }
.welcome-line { margin: 1.4dvh 0 0; font-size: clamp(16px, 2.5dvh, 20px); line-height: 1.5; letter-spacing: .14em; padding-left: .14em; }
.welcome-date { margin: 1dvh 0 0; font-size: clamp(13px, 1.8dvh, 15px); line-height: 1.5; letter-spacing: .06em; color: var(--w-sub); white-space: nowrap; }
.welcome-enter {
  position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 5.5dvh); transform: translateX(-50%);
  padding: 11px 40px 11px calc(40px + .4em); cursor: pointer; white-space: nowrap;
  font-size: 17px; letter-spacing: .4em; color: #4a3b2e;
  background: rgba(255, 250, 240, .92); border: 1px solid rgba(120, 90, 60, .35); border-radius: 999px;
  box-shadow: 0 4px 14px rgba(60, 35, 15, .22);
  animation: welcome-in .9s ease-out .15s both;
}
.welcome-enter:hover { background: #fffaf0; }
@keyframes welcome-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .welcome-text, .welcome-enter { animation: none; } }

/* ---------- 1. 場景 ---------- */
.screen-scene { position: relative; height: 100dvh; overflow: hidden; }
.scene { position: absolute; inset: 0; cursor: pointer; background: #c99a6b; }
/* 填滿、裁掉多的；主角與書桌（圖的 x 55%、y 50% 附近）在中間 */
.scene > img { width: 100%; height: 100%; object-fit: cover; object-position: 55% 50%; display: block; user-select: none; -webkit-user-select: none; }
/* 動態：一層跟場景圖同大（1080 × 1920）的座標，scene.js 用跟上面一樣的裁切方式縮放整層 */
.scene-layer { position: absolute; left: 0; top: 0; width: 1080px; height: 1920px; transform-origin: 0 0; pointer-events: none; }
.scene-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.scene-rig { position: absolute; inset: 0; }
.scene-piece { position: absolute; display: block; max-width: none; user-select: none; -webkit-user-select: none; }

/* 底部按鈕列：圖示在上、文字在下，目前所在的那顆是強調色；處理手機底部橫條的安全區。
   場景與「我的」共用，固定在這一欄的底部（日記與寫字頁藏起來，由 app.js 跟著畫面淡入淡出） */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; max-width: var(--col); margin: 0 auto;
  display: flex; justify-content: center;
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: var(--bar-bg); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 240, 220, .12);
}
.tab {
  flex: 0 1 96px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0 7px; background: none; border: 0; cursor: pointer;
  font-size: 12px; letter-spacing: .12em; color: rgba(255, 244, 228, .62);
}
.tab svg { width: 24px; height: 24px; }
.tab[aria-current] { color: var(--accent-on-dark); }

/* ---------- 共用：頂部一列、返回按鈕、縮圖 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 3;
  display: flex; align-items: center; min-height: 48px; box-sizing: border-box;
  padding: env(safe-area-inset-top) 8px 0;
}
.back, .paper-btn {
  background: none; border: 0; cursor: pointer; padding: 10px 12px;
  font-size: 16px; letter-spacing: .08em; white-space: nowrap;
}
.thumb { padding: 0; border: 0; cursor: pointer; }
button:focus-visible { outline: 2px solid rgba(180, 85, 59, .6); outline-offset: 2px; }

/* ---------- 2. 日記（月曆） ---------- */
/* 兩種版面：
   - 有日記：橫排的頁首（封面靠左、寬約這一欄的 34%；右邊由上到下是「寫新的一篇」與三張縮圖，在封面的高度內垂直置中）加月曆。
   - 還沒有任何日記（.is-empty）：不顯示月曆，封面約 78%，「封面、縮圖、寫新的一篇、提示文字」整組不超過第一個畫面（扣掉頂部那一列），
     超過就等比例縮小，並在畫面裡垂直置中。--rest 是封面以外那幾樣的高度（縮圖、按鈕、提示文字與它們之間的間距）。
   兩種版面之間的變化由 app.js 做（0.3 秒） */
.screen-list {
  --colw: min(100vw, var(--col)); --bar: calc(48px + env(safe-area-inset-top)); --rest: 185px;
  --cover-w: calc(var(--colw) * .34); --head-pad: 4px;
  min-height: 100dvh; background: var(--list-bg); padding-bottom: calc(32px + env(safe-area-inset-bottom));
}
.screen-list.is-empty {
  --cover-w: min(calc(var(--colw) * .78), calc((100dvh - var(--bar) - var(--rest) - 8px) * .8));
  --head-pad: max(4px, calc((100dvh - var(--bar) - var(--cover-w) * 1.25 - var(--rest)) / 2));
  padding-bottom: env(safe-area-inset-bottom);
}
.screen-list .topbar { background: rgba(244, 232, 212, .94); }

/* 頁首：三張封面的縮圖一直顯示；點縮圖換封面，點封面本身沒有作用 */
.list-head { display: flex; align-items: center; gap: 16px; padding: 6px var(--gutter) 4px; }
.head-side { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.screen-list.is-empty .list-head { flex-direction: column; gap: 12px; padding: var(--head-pad) var(--gutter) 0; }
.screen-list.is-empty .head-side { flex: none; flex-direction: column-reverse; gap: 20px; }   /* 大封面時縮圖在上、按鈕在下 */
.cover { position: relative; flex: none; width: var(--cover-w); max-width: 100%; aspect-ratio: 4 / 5; container-type: size; }
.cover-face { position: absolute; inset: 0; isolation: isolate; pointer-events: none; }
.cover-face::before { content: ""; position: absolute; inset: 0; z-index: -1; }
.cover-face.is-image::before { background: var(--cover-img) center / 100% 100% no-repeat; filter: drop-shadow(0 10px 16px rgba(60, 35, 15, .3)); }
.cover-face.is-block::before {
  inset: 3% 1.875%; border-radius: 3.4% / 2.2%;
  background: linear-gradient(to right, rgba(20, 10, 4, .34), rgba(20, 10, 4, .1) 4.5%, transparent 10%), linear-gradient(to bottom, #6a442d, #523321);
  box-shadow: inset 0 0 0 1.5px rgba(30, 16, 8, .45), 0 10px 18px rgba(60, 35, 15, .3);
}
/* 封面標題：寫在這張封面的標題區，字級跟著封面高度 */
.cover-title {
  position: absolute; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 8.6cqh; line-height: 1; letter-spacing: .32em; padding-left: .32em; box-sizing: border-box;
  color: var(--title-color); white-space: nowrap;
}
.cover-title.is-shaded { text-shadow: 0 1px 2px rgba(60, 32, 14, .55), 0 0 14px rgba(70, 38, 16, .45); }
.cover-face.is-block .cover-title { color: #f1dfbf; text-shadow: 0 1px 2px rgba(20, 10, 4, .4); }
.cover-pick { display: flex; gap: 12px; }
.cover-thumb {
  width: 48px; height: 60px; border-radius: 4px;
  background: #6a442d center / 106% auto no-repeat; box-shadow: 0 1px 4px rgba(40, 20, 8, .3); opacity: .85;
}
.cover-thumb[aria-pressed="true"] { opacity: 1; box-shadow: 0 0 0 2px #fffaf0, 0 0 0 4px var(--accent); }

.new-entry {
  display: block; margin: 0; padding: 10px 28px 10px 32px; cursor: pointer; white-space: nowrap;
  font-size: 16px; letter-spacing: .2em;
  background: #fffaf0; border: 1px solid rgba(120, 90, 60, .35); border-radius: 999px; box-shadow: 0 2px 8px rgba(80, 50, 20, .12);
}
.new-entry:hover { background: #fff; }

/* 那一篇用的信紙：一張小信紙（紙色加三道橫線） */
.swatch {
  flex: none; width: 16px; height: 21px; border-radius: 2px; box-sizing: border-box;
  background: repeating-linear-gradient(to bottom, transparent 0 5px, var(--sw-line) 5px 6px) 3px 3px / 8px 15px no-repeat, var(--sw-paper);
  box-shadow: 0 0 0 1px rgba(90, 60, 30, .28), 0 1px 2px rgba(60, 35, 15, .18);
}
/* 「還沒有日記」只在大封面時出現；月曆只在有日記時出現 */
.empty { text-align: center; color: var(--sub); margin: 28px var(--gutter) 0; line-height: 1.4; letter-spacing: .08em; }
.screen-list:not(.is-empty) .empty, .screen-list.is-empty .cal { display: none; }

/* 月曆：整頁不捲動。這個畫面排成直的一欄、撐滿畫面高，月曆佔掉頁首以下的高度；
   日期格固定保留六列的高度，下方那一塊從日期行一路佔到畫面底，放不下時只在這一塊裡捲。
   這一塊至少保留兩列（96 px）：畫面太矮放不下時，整頁才可以捲（這一頁唯一在固定高度的區塊裡捲的地方）。
   七欄等寬；每格：日 16 px、農曆小字 10.5 px、下緣的圓點與篇數，可點的高度 48 px */
.screen-list:not(.is-empty) { display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
.list-head { flex: none; }
.cal { flex: 1 1 0; display: flex; flex-direction: column; padding: 0 12px; }
.cal-bar { position: relative; display: flex; align-items: center; justify-content: center; min-height: 44px; }
.cal-prev, .cal-next {
  min-width: 44px; min-height: 44px; padding: 0; cursor: pointer;
  font-size: 24px; line-height: 1; color: var(--ink); background: none; border: 0;
}
.cal-prev:disabled, .cal-next:disabled { opacity: .25; cursor: default; }
.cal-title { margin: 0; min-width: 7.5em; text-align: center; font-size: 17px; font-weight: 400; letter-spacing: .06em; }
.cal-today {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%); min-height: 32px; padding: 4px 12px 4px calc(12px + .12em); cursor: pointer;
  font-size: 14px; letter-spacing: .12em; color: var(--accent);
  background: #fffaf0; border: 1px solid rgba(180, 85, 59, .45); border-radius: 999px;
}
.cal-today.is-off { visibility: hidden; }              /* 在本月、選著今天時不顯示（位置留著，月份列不會動） */
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-week { padding: 2px 0 4px; font-size: 12px; text-align: center; color: var(--sub); letter-spacing: .04em; }
.cal-grid-wrap { flex: none; position: relative; overflow: hidden; height: calc(6 * 48px + 5 * 2px); }
.cal-grid { grid-auto-rows: 48px; gap: 2px 2px; }
.cal-grid.is-leaving { position: absolute; left: 0; right: 0; top: 0; pointer-events: none; }
.cal-day {
  display: flex; flex-direction: column; align-items: center; min-width: 0; padding: 4px 0 0; cursor: pointer;
  background: none; border: 0; border-radius: 10px;
}
.cal-day:hover:not([aria-pressed="true"]) { background: rgba(255, 250, 240, .6); }
.cal-num { font-size: 16px; line-height: 19px; }
.cal-lunar { font-size: 10.5px; line-height: 12px; color: var(--sub); white-space: nowrap; }
.cal-mark { display: flex; align-items: center; gap: 2px; height: 9px; margin-top: 2px; font-size: 10px; line-height: 9px; color: var(--accent); }
.cal-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.cal-day[aria-current="date"] { box-shadow: inset 0 0 0 1.5px var(--accent); }
.cal-day[aria-pressed="true"] { color: #fff; background: var(--accent); }
.cal-day[aria-pressed="true"] :is(.cal-lunar, .cal-mark) { color: #fff6ec; }
.cal-day[aria-pressed="true"][aria-current="date"] { box-shadow: inset 0 0 0 2px var(--accent), inset 0 0 0 3.5px #fffaf0; }
.cal-detail { flex: 1 1 0; display: flex; flex-direction: column; padding: 0 8px; }
/* 下方那一塊的第一行：那天的日期 · 農曆 · N 篇；或「最近寫的」 */
.day-head {
  flex: none; margin: 8px 0 0; padding-bottom: 6px; border-bottom: 1px solid rgba(120, 90, 60, .25);
  font-size: 13px; font-weight: 400; letter-spacing: .04em; color: var(--sub);
}
/* 選到沒寫的那天時是兩行：那天的日期 · 這天沒有寫，下一行「最近寫的」（13 px 一行放不下，390 寬也差約 24 px） */
.recent-label { display: block; color: var(--ink); letter-spacing: .12em; }
.dt + .recent-label { margin-top: 3px; }
.rows { list-style: none; margin: 0; padding: 0; }
.cal-rows {
  flex: 1 1 0; min-height: calc(2 * 48px); overflow-y: auto; overscroll-behavior: contain;
}
.cal-rows.has-more { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent); }
/* 一列：色塊、標題一行（太長用「…」截斷）、右邊是時間（那天的日記）或日期（最近寫的）；高 48 px */
.mini-row {
  display: flex; align-items: center; gap: 12px; width: 100%; height: 48px; box-sizing: border-box; padding: 0 4px; cursor: pointer;
  text-align: left; background: none; border: 0; border-bottom: 1px dashed rgba(120, 90, 60, .18);
}
.mini-row:hover { background: rgba(255, 250, 240, .5); }
.mini-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.mini-title.is-untitled { color: var(--sub); }
.mini-time { flex: none; font-size: 13px; color: var(--sub); font-variant-numeric: tabular-nums; }

/* 日期：西元、「·」、農曆。一行放不下時農曆整段換到下一行，行尾不留「·」：
   「·」畫在農曆前面的間距裡；農曆換到行首時，那段間距落在左邊界外、被裁掉 */
.day-head, .w-date { overflow: hidden; }
.dt { display: flex; flex-wrap: wrap; margin-left: -1.2em; }
.dt-part { position: relative; margin-left: 1.2em; white-space: nowrap; }
.dt-part:is(.is-lunar, .is-note)::before { content: "·"; position: absolute; right: 100%; width: 1.2em; text-align: center; }

/* ---------- 3. 寫字頁：整個畫面是一張信紙 ---------- */
.screen-write {
  --paper: #f8efd9; --line: rgba(160, 125, 70, .3); --ink: #4a3b2e; --sub: #80694f;
  background: var(--paper); color: var(--ink); min-height: 100dvh;
}
.write-bar { flex-wrap: wrap; background: var(--paper); box-shadow: 0 1px 0 var(--line); }
.write-bar .back, .write-bar .paper-btn { color: var(--ink); }
.status { flex: 1; text-align: center; font-size: 13px; color: var(--sub); letter-spacing: .1em; min-width: 0; }
.status.is-error { color: #c0392b; }
.screen-write .status.is-error { background: #fff3ee; border-radius: 4px; padding: 2px 6px; }

/* 換紙：各款信紙的縮圖（紙色、橫線、頁首的圖） */
.paper-pick { flex-basis: 100%; display: flex; justify-content: center; gap: 10px; padding: 4px 0 12px; }
.paper-thumb {
  position: relative; width: 56px; height: 72px; border-radius: 4px; overflow: hidden;
  background:
    var(--sw-img) top center / 100% auto no-repeat,
    repeating-linear-gradient(to bottom, transparent 0 9px, var(--sw-line) 9px 10px) 0 30px / 100% 100% no-repeat,
    var(--sw-paper);
  box-shadow: 0 0 0 1px rgba(90, 60, 30, .25), 0 1px 4px rgba(40, 20, 8, .2);
}
.paper-thumb[aria-pressed="true"] { box-shadow: 0 0 0 2px #fffaf0, 0 0 0 4px var(--accent); }
.paper-thumb-name { position: absolute; left: 0; right: 0; bottom: 3px; font-size: 11px; line-height: 1.2; color: var(--sw-ink); text-align: center; }

/* 信紙：頁首的圖、日期、標題、內文（高度跟著內容長，至少讓信紙佔滿一個畫面）、頁尾的圖、刪除 */
.sheet { display: flex; flex-direction: column; min-height: calc(100dvh - 48px - env(safe-area-inset-top)); }
.deco { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; pointer-events: none; }
.deco-top { aspect-ratio: 1080 / 360; }
.deco-bottom { aspect-ratio: 1080 / 420; margin-top: 8px; }
.deco.is-missing { display: none; }                         /* 圖沒有到：只剩紙色與橫線 */
.deco-top.is-missing + .w-date { margin-top: 28px; }
.w-date { margin: 0 var(--gutter); font-size: 14px; color: var(--sub); }
.w-title, .w-body {
  display: block; box-sizing: border-box; width: calc(100% - 2 * var(--gutter)); margin: 0 var(--gutter);
  border: 0; border-radius: 0; outline: none; background: none; color: var(--ink); font-family: inherit;
  -webkit-appearance: none; appearance: none;
}
.w-title { margin-top: 10px; padding: 6px 0; font-size: 20px; line-height: 1.5; border-bottom: 1px solid var(--line); }
/* 內文 17 px、行高 1.8；橫線由程式畫，一行一條，落在每一行的底部 */
.w-body {
  flex: 1 0 auto; margin-top: 14px; padding: 0; min-height: calc(1.8em * 6);
  font-size: 17px; line-height: 1.8; resize: none; overflow: hidden;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(1.8em - 1px), var(--line) calc(1.8em - 1px), var(--line) 1.8em);
}
.w-title::placeholder, .w-body::placeholder { color: var(--sub); opacity: .7; }
.w-delete {
  align-self: center; margin: 12px 0 calc(28px + env(safe-area-inset-bottom)); padding: 8px 22px; cursor: pointer;
  font-size: 15px; letter-spacing: .12em; color: var(--sub);
  background: none; border: 1px solid var(--line); border-radius: 999px;
}
.w-delete.is-armed { color: #fff; background: #b4553b; border-color: #b4553b; }
.w-delete:disabled { opacity: .4; cursor: default; }

/* ---------- 4. 我的 ---------- */
/* 和日記頁同一套：米色底、白色圓角的卡片、膠囊形按鈕。底部留出按鈕列的高度 */
.screen-me {
  min-height: 100dvh; box-sizing: border-box; background: var(--list-bg);
  padding: calc(env(safe-area-inset-top) + 12px) var(--gutter) calc(84px + env(safe-area-inset-bottom));
}
.me-title { margin: 10px 0 20px; text-align: center; font-size: 20px; font-weight: 400; letter-spacing: .32em; padding-left: .32em; }
.me-card {
  margin: 0 0 14px; padding: 18px 18px 16px; background: #fffaf0;
  border: 1px solid rgba(120, 90, 60, .2); border-radius: 14px; box-shadow: 0 2px 8px rgba(80, 50, 20, .08);
}
.me-lead { margin: 0 0 16px; font-size: 16px; line-height: 1.75; letter-spacing: .06em; }
.me-ready { margin: 0; text-align: center; font-size: 15px; letter-spacing: .12em; color: var(--sub); }
.me-small { margin: 14px 0 0; font-size: 13px; letter-spacing: .06em; color: var(--sub); }
.me-import .me-small { margin: 0 0 12px; }
.me-action { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.me-hint { font-size: 13px; letter-spacing: .08em; color: var(--sub); }
.me-btn {
  display: block; margin: 0; padding: 10px 28px; cursor: pointer; white-space: nowrap;
  font-size: 16px; letter-spacing: .16em; color: var(--ink);
  background: #fffaf0; border: 1px solid rgba(120, 90, 60, .35); border-radius: 999px; box-shadow: 0 2px 8px rgba(80, 50, 20, .12);
}
.me-btn:hover:not(:disabled) { background: #fff; }
.me-btn.is-primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.me-btn.is-primary:hover:not(:disabled) { background: #a24a32; }
.me-btn:disabled, .me-link:disabled { opacity: .45; cursor: default; box-shadow: none; }
.me-logout { margin-top: 8px; }
.me-alert { margin: 0 0 14px; padding: 10px 14px; font-size: 14px; letter-spacing: .06em; color: #a03a24; background: #fff3ee; border: 1px solid rgba(180, 85, 59, .3); border-radius: 10px; }
/* 已登入：頭像（照片，沒有時是名字第一個字）與名字 */
.me-profile { display: flex; align-items: center; gap: 14px; }
.me-avatar {
  position: relative; flex: none; width: 56px; height: 56px; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 24px;
}
.me-avatar-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.me-avatar.has-img .me-avatar-img { opacity: 1; }
.me-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 19px; letter-spacing: .06em; }
/* 三個數字 */
.me-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 18px 0 14px; padding: 12px 0; border-top: 1px solid rgba(120, 90, 60, .18); border-bottom: 1px solid rgba(120, 90, 60, .18); text-align: center; }
.me-stat { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.me-stat + .me-stat { border-left: 1px dashed rgba(120, 90, 60, .22); }
.me-stat-num { font-size: 19px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.me-stat-num { line-height: 1.3; }
.me-stat-num.is-date { font-size: 15px; line-height: calc(19px * 1.3); letter-spacing: .02em; }   /* 日期比數字長：縮小，360 寬也放得進一格 */
.me-stat-label { font-size: 12px; letter-spacing: .1em; color: var(--sub); }
/* 同步狀態一行：文字，需要時右邊一顆小按鈕（再試一次、重新登入） */
.me-sync { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 32px; font-size: 14px; letter-spacing: .06em; color: var(--sub); }
.me-sync-text { min-width: 0; }
.me-link {
  flex: none; min-height: 32px; padding: 4px 12px 4px calc(12px + .12em); cursor: pointer;
  font-size: 14px; letter-spacing: .12em; color: var(--accent);
  background: #fffaf0; border: 1px solid rgba(180, 85, 59, .45); border-radius: 999px;
}
.me-confirm .me-lead { margin-bottom: 14px; font-size: 15px; }
.me-confirm-btns { display: flex; justify-content: center; gap: 12px; }
.me-confirm-btns .me-btn { padding: 10px 20px; }
