/* 毛寶小鎮：樣式。3D 場景鋪滿整個視窗；手機是直式、清單從下面滑上來，寬螢幕的清單在右邊一欄。
   配色取自產品盒（白、藍）和素材庫的家（淺橡木、米色、粉藍色的碗）。 */
:root {
  --bg: #fbf5ea;
  --card: #ffffff;
  --ink: #2c2a27;
  --navy: #0c3f7a;
  --blue: #1e73be;
  --blue-soft: #e3eef8;
  --muted: #7b7468;
  --line: #ecdfc9;
  --oak: #c99a62;
  --coral: #f0625f;
  --coral-soft: #fde6e3;
  --gold: #f1b33c;
  --ok: #2f9a68;
  --radius: 16px;
  --shadow: 0 6px 20px rgba(92, 64, 24, .10);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Heiti TC", system-ui, sans-serif;
  font-size: 15px; line-height: 1.5;
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid rgba(30, 115, 190, .45); outline-offset: 2px; }
img { display: block; max-width: 100%; }
.ic { width: 1em; height: 1em; fill: currentColor; flex: none; vertical-align: -0.12em; }
.ic.heart { color: var(--coral); }
.num { font-variant-numeric: tabular-nums; }

/* ── 版面：3D 場景鋪滿整個視窗，其他東西浮在上面 ──
   手機（直式）：上面是愛心和晚安儀式，下面是場景鈕和分頁列；清單從下面滑上來（.app.panel-open）。
   電腦（寬 900px 以上）：清單在右邊，可以收合。 */
html, body { overflow: hidden; }
.app { position: fixed; inset: 0; --nav-h: 60px; --sheet-h: 54vh; --sheet-h: 54dvh; --drawer-w: 400px; --safe-t: env(safe-area-inset-top, 0px); }
.scene { position: absolute; inset: 0; overflow: hidden; background: #e9f3f8; user-select: none; -webkit-user-select: none; }
.world { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; outline: none; }
.world:active { cursor: grabbing; }
.world.pixel { image-rendering: crisp-edges; image-rendering: pixelated; }     /* 像素畫風（實驗）：畫小再放大，不柔化 */
/* 四個角落稍微壓暗，視線會集中在中間的場景 */
.scene::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 45%, rgba(0, 0, 0, 0) 58%, rgba(40, 26, 10, .15) 100%); }
.scene.no3d::after { display: none; }
.scene.no3d { background: #d9c8ad url(../img/scene_rest.webp) center / cover; cursor: pointer; }
.scene.no3d .world { display: none; }

/* 上面一排：左邊愛心，右邊晚安儀式和幾顆圓鈕 */
.hud { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: calc(10px + var(--safe-t)) 12px 0; pointer-events: none; z-index: 5; transition: right .25s ease; }
.hud > * { pointer-events: auto; }
.hud .hud-left { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; pointer-events: none; }
.hud-left > * { pointer-events: auto; }
.wallet { display: flex; align-items: center; gap: 8px; padding: 4px 14px 4px 4px; border-radius: 999px; background: rgba(255, 255, 255, .92); box-shadow: 0 3px 12px rgba(0, 0, 0, .14); min-width: 0; }
/* 照顧的三顆圓鈕：外圈是碗裡還剩多少；空了一閃一閃、右上角有紅點；買了自動設備外圈是綠色 */
.care { display: flex; gap: 7px; padding-left: 2px; }
.care-btn { position: relative; width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, .93); display: inline-flex; align-items: center; justify-content: center; font-size: 19px; box-shadow: 0 3px 10px rgba(0, 0, 0, .14); }
.care-btn .ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.care-btn .ring circle { fill: none; stroke-width: 3; }
.care-btn .track { stroke: #efe6d6; }
.care-btn .bar { stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.care-btn .ic { position: relative; }
#care-food { color: #b5732c; } #care-food .bar { stroke: #e3a043; }
#care-water { color: var(--blue); } #care-water .bar { stroke: #4fa3e0; }
#care-bath { color: #5d9fc4; } #care-bath .bar { stroke: #8fcbe6; }
.care-btn.auto .bar { stroke: var(--ok); }
.care-btn.need { animation: needPulse 1.6s ease-in-out infinite; }
.care-btn.need::after { content: ""; position: absolute; top: -1px; right: -1px; width: 11px; height: 11px; border-radius: 50%; background: var(--coral); border: 2px solid #fff; }
.care-btn:active { transform: scale(.93); }
/* 一日時間軸（2026-11-13）：左邊午夜、右邊下一個午夜，顏色是一天的天色（凌晨深藍、清晨粉橘、白天天藍、傍晚橘紅、夜晚靛藍），
   6、12、18 點各一道細白線；小圓點是遊戲裡現在的時間，白天是太陽、晚上是月亮。寬度和上面三顆照顧按鈕對齊 */
.daybar { position: relative; flex: none; width: 134px; height: 20px; margin-left: 2px; padding: 0; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .92); box-shadow: 0 3px 10px rgba(0, 0, 0, .14); cursor: pointer; }
.daybar-track { position: absolute; left: 8px; right: 8px; top: 6px; bottom: 6px; border-radius: 999px;
  background: linear-gradient(90deg, #1c2552 0%, #232f60 12.5%, #3a4680 20%, #f0a58c 25%, #f6d29a 31%, #a9d8f4 37.5%, #7cc3f2 50%, #92cbee 62.5%, #f4c070 70.8%, #e9805a 76%, #5b4f8e 81%, #2f3a72 87.5%, #1c2552 100%); }
.daybar-track::after { content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(90deg, transparent 24.6%, rgba(255, 255, 255, .75) 24.6% 25.4%, transparent 25.4% 49.6%, rgba(255, 255, 255, .75) 49.6% 50.4%, transparent 50.4% 74.6%, rgba(255, 255, 255, .75) 74.6% 75.4%, transparent 75.4%); }
.daybar-knob { position: absolute; top: 50%; left: calc(8px + (100% - 16px) * var(--t, .5)); width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); display: flex; align-items: center; justify-content: center; transition: left .6s ease; }
.daybar-knob .ic { width: 12px; height: 12px; color: var(--gold); }
.daybar.night .daybar-knob .ic { color: #4a55a0; }
.daybar:active { transform: scale(.97); }
@keyframes needPulse { 0%, 100% { box-shadow: 0 3px 10px rgba(0, 0, 0, .14), 0 0 0 0 rgba(240, 98, 95, .55); } 50% { box-shadow: 0 3px 10px rgba(0, 0, 0, .14), 0 0 0 7px rgba(240, 98, 95, 0); } }
.wallet img { border-radius: 50%; flex: none; }
.wallet-main { display: flex; align-items: center; gap: 5px; font-size: 19px; font-weight: 800; color: var(--navy); line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wallet-main .ic { font-size: 15px; }
.wallet-sub { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1.2; }
.hud-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.hud-btn { width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, .92); color: var(--navy); display: inline-flex; align-items: center; justify-content: center; font-size: 19px; box-shadow: 0 3px 12px rgba(0, 0, 0, .14); }
.hud-btn[hidden], .wide-only { display: none; }
.ritual-pill {
  display: inline-flex; align-items: center; gap: 5px; height: 40px; padding: 0 14px; border-radius: 999px;
  background: rgba(255, 255, 255, .92); color: var(--navy); font-size: 13.5px; font-weight: 700; box-shadow: 0 3px 12px rgba(0, 0, 0, .16); white-space: nowrap;
}
.ritual-pill.ready { background: var(--navy); color: #fff; animation: glow 2.2s ease-in-out infinite; }
.ritual-pill.done { background: rgba(255, 255, 255, .8); color: var(--muted); font-weight: 600; }
@keyframes glow { 0%, 100% { box-shadow: 0 2px 10px rgba(0, 0, 0, .18), 0 0 0 0 rgba(255, 255, 255, .55); } 50% { box-shadow: 0 2px 10px rgba(0, 0, 0, .18), 0 0 0 7px rgba(255, 255, 255, 0); } }
.scene-text { position: absolute; left: 14px; top: calc(142px + var(--safe-t)); max-width: calc(100% - 28px); padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, .7); color: var(--navy); font-size: 12px; font-weight: 700; pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; z-index: 4; }

/* 場景上的東西：往上飄的小字、自家毛孩的名牌 */
.floaters { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.floater {
  position: absolute; transform: translate(-50%, -50%); color: #fff; font-weight: 800; font-size: 18px; white-space: nowrap;
  text-shadow: 0 1px 0 var(--coral), 0 2px 8px rgba(0, 0, 0, .5); animation: floatUp .9s ease-out forwards; font-variant-numeric: tabular-nums;
}
.floater .ic { color: #ff8e8a; margin-right: 2px; }
.floater.big { font-size: 22px; }
.floater.mini { font-size: 15px; animation-duration: 1.3s; }
.floater.mini .ic { margin: 0; color: var(--coral); filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .3)); }
.floater.zzz { font-size: 15px; font-style: italic; color: #fff; text-shadow: 0 1px 4px rgba(20, 30, 60, .8); animation-duration: 1.8s; }
/* 像素畫風（實驗）：飄字加一圈實心的深色外框，像老遊戲的字，在網點、顏色變少的畫面上也看得清楚（2026-11-15 你說像素模式看不清）。圖示是 SVG，用 drop-shadow 描邊 */
.floaters[data-style="4"] .floater {
  text-shadow: 2px 0 #2b1d17, -2px 0 #2b1d17, 0 2px #2b1d17, 0 -2px #2b1d17, 2px 2px #2b1d17, -2px 2px #2b1d17, 2px -2px #2b1d17, -2px -2px #2b1d17, 0 4px rgba(43, 29, 23, .45);
}
.floaters[data-style="4"] .floater .ic { filter: drop-shadow(2px 0 #2b1d17) drop-shadow(-2px 0 #2b1d17) drop-shadow(0 2px #2b1d17) drop-shadow(0 -2px #2b1d17); }
/* 水墨畫風（實驗）：白紙一樣的畫面上白字會淡掉，加一圈柔和的墨色外框 */
.floaters[data-style="3"] .floater { text-shadow: 0 0 1px #24211e, 0 0 2px #24211e, 0 0 3px #24211e, 0 0 3px #24211e, 0 2px 6px rgba(20, 18, 16, .45); }
.floaters[data-style="3"] .floater .ic { filter: drop-shadow(0 0 1px #24211e) drop-shadow(0 0 2px #24211e); }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.7); } 15% { opacity: 1; transform: translate(-50%, -70%) scale(1.08); } 100% { opacity: 0; transform: translate(-50%, -330%) scale(1); } }
.tags { position: absolute; inset: 0; pointer-events: none; }
.tag { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 4px; padding: 2px 8px 2px 2px; border-radius: 999px; background: rgba(255, 255, 255, .92); box-shadow: 0 2px 8px rgba(0, 0, 0, .2); font-size: 11.5px; font-weight: 700; color: var(--navy); white-space: nowrap; will-change: transform; }
.tag img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
/* 佈置分頁裡小屋的陳設：往右縮一點，買了的寫「已擺好」 */
.row.item.sub { margin-left: 22px; }
.own-tag { flex: none; font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 0 8px; white-space: nowrap; }
/* 雨絲（2026-11-16）：蓋在 3D 場景上面的兩層細線（一層近、粗一點，一層遠、細一點），整層斜 10 度，往下捲（捲一張圖的高度剛好接回來）。濃淡由 world.js 設（opacity） */
.rain { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.rain i { position: absolute; left: -25%; top: -60%; width: 150%; height: 220%; transform: rotate(10deg); }
.rain i::before { content: ''; position: absolute; inset: -400px 0 0 0; background-repeat: repeat; will-change: transform;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cpath stroke='%23fff' stroke-opacity='.62' stroke-width='1.4' stroke-linecap='round' d='M12 8v24M57 96v28M88 30v20M131 150v26M170 62v22M203 190v28M225 14v20M34 170v24M110 210v22M150 110v18M190 120v24M70 200v20M20 100v16M215 100v18'/%3E%3C/svg%3E");
  background-size: 240px 240px; animation: rainFall .46s linear infinite; }
.rain i + i::before { background-size: 380px 380px; animation: rainFall2 .62s linear infinite; opacity: .55; }
@keyframes rainFall { to { transform: translateY(240px); } }
@keyframes rainFall2 { to { transform: translateY(380px); } }
@media (prefers-reduced-motion: reduce) { .rain i::before { animation: none; opacity: .35; } }
/* 小屋、涼亭頭上的小牌子（2026-11-16）：可以點（鏡頭飛過去、或問要不要整修）；還沒整修的是虛線框、灰一點 */
.tag.hut { pointer-events: auto; cursor: pointer; padding: 3px 10px; font-family: inherit; border: 0; }
.tag.hut.locked { background: rgba(255, 250, 240, .86); color: #7a6a58; outline: 1.5px dashed #c9b89a; outline-offset: -1.5px; font-weight: 600; }
/* 風車磨坊門口有磨好的點心可以領：牌子換成金色（和完成任務的通知同一種金） */
.tag.hut.ready { background: linear-gradient(90deg, #e9a21f, #f1b33c); color: #3d2a00; font-weight: 700; }
.tag span { padding-left: 4px; }
.tag img + span { padding-left: 0; }

/* 下面一排：左邊場景鈕，右邊「摸摸」。手機上清單打開時先收起來 */
.dock { position: absolute; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b) + 12px); display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; padding: 0 12px; pointer-events: none; z-index: 5; transition: opacity .2s, transform .25s, right .25s ease; }
.dock > * { pointer-events: auto; }
.app.panel-open .dock { opacity: 0; transform: translateY(14px); }
.app.panel-open .dock > * { pointer-events: none; }
.places { display: flex; gap: 6px; flex-wrap: wrap; }
.place { display: inline-flex; align-items: center; gap: 4px; height: 38px; padding: 0 14px; border-radius: 999px; background: rgba(255, 255, 255, .92); color: var(--navy); font-size: 13.5px; font-weight: 700; box-shadow: 0 3px 10px rgba(0, 0, 0, .15); }
.place.on { background: var(--blue); color: #fff; }
.place.locked { background: rgba(255, 255, 255, .76); color: var(--muted); }
/* 正要走過去的地點：毛孩還在路上，先只亮外框；走到了才整顆變藍（.on） */
.place.going { box-shadow: 0 3px 10px rgba(0, 0, 0, .15), inset 0 0 0 2px var(--blue); }
.place small { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.place .ic { font-size: 11px; }
.place small .ic { color: var(--coral); }
.pet-btn { flex: none; display: inline-flex; align-items: center; gap: 5px; height: 38px; padding: 0 14px; border-radius: 999px; background: #fff; color: #b23b38; font-weight: 700; font-size: 13.5px; font-variant-numeric: tabular-nums; white-space: nowrap; box-shadow: 0 3px 10px rgba(0, 0, 0, .15); }
.pet-btn:active { transform: scale(.96); }
.dock-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.dock-right > * { pointer-events: auto; }
.act-btn { width: 42px; height: 42px; border-radius: 50%; background: rgba(255, 255, 255, .94); color: var(--navy); display: inline-flex; align-items: center; justify-content: center; font-size: 20px; box-shadow: 0 3px 10px rgba(0, 0, 0, .15); }
.act-btn.ball { color: #e8483a; }     /* 2026-11-14 和新的珊瑚紅球同色（原本網球的黃綠色） */
.act-btn:active { transform: scale(.93); }
.flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 60; animation: flash .5s ease-out; }
@keyframes flash { 0% { opacity: .85; } 100% { opacity: 0; } }
.coats { display: flex; gap: 8px; flex-wrap: wrap; }
.coat { width: 34px; height: 34px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1.5px var(--line); }
.coat[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--blue); }
.look { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }

/* 清單：手機是從下面滑上來的一張紙（分頁列一直在最下面），電腦是右邊的一欄 */
.panel { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column-reverse; background: var(--card); border-radius: 20px 20px 0 0; box-shadow: 0 -6px 24px rgba(60, 40, 10, .16); z-index: 6; padding-bottom: var(--safe-b); }
.tabs { display: flex; flex: none; height: var(--nav-h); padding: 4px 6px; }
.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-weight: 700; font-size: 12px; border-radius: 14px; position: relative; }
.tabs button .ic { font-size: 22px; }
.tabs button[aria-selected="true"] { color: var(--blue); background: var(--blue-soft); }
.tabs button .dot { position: absolute; top: 7px; right: calc(50% - 20px); width: 9px; height: 9px; border-radius: 50%; background: var(--coral); border: 2px solid #fff; }
.tab-body { height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 12px; transition: height .26s ease, padding .26s ease; }
.app.panel-open .tab-body { height: var(--sheet-h); padding: 26px 12px 12px; border-bottom: 1px solid var(--line); --tb-top: 26px; }
.sheet-close { position: absolute; top: 0; left: 0; right: 0; height: 24px; display: none; align-items: center; justify-content: center; z-index: 3; }
.sheet-close::before { content: ""; width: 44px; height: 5px; border-radius: 3px; background: #dfd3be; }
.app.panel-open .sheet-close { display: flex; }

/* ── 共用元件 ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 12px; font-weight: 700; background: var(--blue); color: #fff; min-height: 42px; text-decoration: none; }
.btn:disabled { background: #d9d5cd; color: #fff; }
.btn.ghost { background: var(--blue-soft); color: var(--navy); }
.btn.plain { background: #f3ede2; color: var(--ink); }
.btn.danger { background: var(--coral); }
.btn.block { display: flex; width: 100%; }
.btn.small { padding: 7px 12px; min-height: 34px; font-size: 13px; border-radius: 10px; }
.seg { display: inline-flex; background: #f3ede2; border-radius: 10px; padding: 3px; }
.seg button { padding: 5px 13px; border-radius: 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.seg button[aria-pressed="true"] { background: #fff; color: var(--navy); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 2px 10px; }
.list-head p { margin: 0; font-size: 13px; color: var(--muted); }
.section-title { margin: 18px 2px 8px; font-size: 14px; font-weight: 800; color: var(--navy); display: flex; align-items: baseline; gap: 8px; }
.section-title:first-child { margin-top: 2px; }
.section-title small { font-weight: 500; color: var(--muted); font-size: 12px; }
.note { font-size: 12px; color: var(--muted); margin: 6px 2px 0; }

/* ── 夥伴 ── */
.row { display: flex; align-items: center; gap: 11px; padding: 10px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 8px; background: #fffdf9; }
.row.new { border-style: dashed; background: #fff; }
.row .pic { width: 58px; height: 58px; border-radius: 14px; object-fit: cover; flex: none; background: var(--blue-soft); }
.row.new .pic { filter: grayscale(.85) opacity(.7); }
.row .info { flex: 1; min-width: 0; }
.row .name { font-weight: 800; color: var(--ink); display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.row .lv { font-size: 12px; font-weight: 700; color: var(--blue); background: var(--blue-soft); border-radius: 999px; padding: 0 8px; white-space: nowrap; }
.row .line { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .prod { font-size: 12.5px; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .bar { height: 5px; border-radius: 3px; background: #f1e8d8; margin-top: 5px; overflow: hidden; }
.row .bar i { display: block; height: 100%; background: linear-gradient(90deg, #f7b6a8, var(--coral)); border-radius: 3px; }
.buy { flex: none; width: 94px; padding: 7px 6px; border-radius: 12px; background: var(--blue); color: #fff; text-align: center; line-height: 1.25; transition: transform .08s; }
.buy:active:not(:disabled) { transform: scale(.96); }
.buy b { display: block; font-size: 13px; }
.buy span { display: flex; align-items: center; justify-content: center; gap: 3px; font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.buy .ic { color: #ffc1bd; font-size: 11px; }
.buy:disabled { background: #efe9df; color: #a79f92; }
.buy:disabled .ic { color: #d6b7b3; }
.buy.owned { background: #e6f4ec; color: var(--ok); }

/* ── 佈置 ── */
.item .emoji { width: 58px; height: 58px; border-radius: 14px; background: #f8f0e2; display: flex; align-items: center; justify-content: center; font-size: 30px; flex: none; }
.item.owned { background: #f7fbf8; border-color: #d7ecdf; }
.item .desc { font-size: 12.5px; color: var(--muted); }

/* ── 圖鑑 ── */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.kcard { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #fffdf9; text-align: left; display: block; width: 100%; }
.kcard .thumb { height: 84px; background: var(--blue-soft); }
.kcard .thumb img { width: 100%; height: 100%; object-fit: cover; }
.kcard .thumb img.contain { object-fit: contain; padding: 6px; }
.kcard .t { padding: 7px 10px 9px; font-weight: 700; font-size: 13.5px; color: var(--navy); }
.kcard.locked { background: #f7f1e6; }
/* 知識影片卡（2026-11-16）：圖鑑縮圖左下角是長度、右下角播放鍵；播放器是深色的彈窗，畫面照比例（直式 9:16、橫式 16:9），控制列在畫面底下不擋字幕 */
.kcard .thumb { position: relative; }
.kcard .kplay { position: absolute; right: 7px; bottom: 7px; width: 28px; height: 28px; border-radius: 50%; background: rgba(12, 63, 122, .88); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }
.kcard .kplay .ic { margin-left: 2px; }
.kcard .kdur { position: absolute; left: 7px; bottom: 7px; padding: 1px 7px; border-radius: 999px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.modal-back.vmodal { align-items: center; background: rgba(8, 10, 16, .78); z-index: 61; }     /* 疊在提示訊息（#toasts，60）上面：播影片時不會被「金肉球變成彩虹肉球」這類提示蓋住 */
.modal.vmodal { max-width: 1040px; background: #161a23; color: #f4f1ea; border-radius: 20px; padding: 12px 14px calc(14px + var(--safe-b)); }
.modal.vmodal h2 { color: #fff; font-size: 17px; margin: 4px 44px 10px 4px; }
.modal.vmodal .x { background: rgba(255, 255, 255, .14); color: #fff; }
.modal.vmodal .actions { display: none; }
.vstage { position: relative; margin: 0 auto; background: #000; border-radius: 12px; overflow: hidden; }
.vstage.landscape { aspect-ratio: 16 / 9; width: min(100%, calc((100vh - 200px) * 16 / 9)); width: min(100%, calc((100dvh - 200px) * 16 / 9)); }
.vstage.portrait { aspect-ratio: 9 / 16; height: min(calc(100vh - 200px), calc((100vw - 60px) * 16 / 9)); height: min(calc(100dvh - 200px), calc((100vw - 60px) * 16 / 9)); }
.vstage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.vcover { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .12); }
.vcover[hidden] { display: none; }
.vbig { width: 66px; height: 66px; border-radius: 50%; background: rgba(255, 255, 255, .93); color: var(--navy); display: flex; align-items: center; justify-content: center; font-size: 30px; box-shadow: 0 4px 18px rgba(0, 0, 0, .35); }
.vbig .ic[aria-hidden] { margin-left: 3px; }
.vmsg { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 10px 16px; border-radius: 12px; background: rgba(0, 0, 0, .66); color: #fff; font-size: 14px; white-space: nowrap; }
.vmsg[hidden] { display: none; }
.vctrl { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.vbtn { width: 40px; height: 40px; flex: none; border-radius: 50%; background: rgba(255, 255, 255, .15); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.vbar { position: relative; flex: 1; height: 26px; cursor: pointer; touch-action: none; background: linear-gradient(rgba(255, 255, 255, .24), rgba(255, 255, 255, .24)) center / 100% 4px no-repeat; }
.vbar i { position: absolute; left: 0; top: 50%; height: 4px; margin-top: -2px; width: 0; border-radius: 2px; background: #ffcf6e; }
.vtime { flex: none; min-width: 74px; text-align: right; font-size: 12.5px; color: rgba(255, 255, 255, .8); font-variant-numeric: tabular-nums; }
.modal.vmodal .vnote { margin: 8px 4px 0; font-size: 13px; color: rgba(255, 255, 255, .72); }
.kcard.locked .thumb { display: flex; align-items: center; justify-content: center; color: #c9bda8; font-size: 26px; background: #efe6d6; }
.kcard.locked .t { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.mile { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid #f3eadb; }
.mile:last-child { border-bottom: 0; }
.mile .mark { width: 28px; height: 28px; border-radius: 50%; background: #f1e8d8; color: #c9bda8; display: flex; align-items: center; justify-content: center; font-size: 15px; flex: none; }
.mile.done .mark { background: var(--gold); color: #fff; }
.mile .mt { font-weight: 700; font-size: 14px; }
.mile .md { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mile:not(.done) .mt { color: var(--muted); }

/* ── 手冊（2026-11-17）：主線的章、每一項任務、散步筆記 ── */
.hb-note { margin: 0 2px 10px; }
.section-title.sub { font-size: 13px; margin-top: 12px; }
.ch { border: 1px solid var(--line); border-radius: 14px; margin-bottom: 8px; background: #fffdf9; overflow: hidden; }
.ch.done { background: #f6fbf7; border-color: #d5eadc; }
.ch-head { display: flex; align-items: center; gap: 9px; width: 100%; padding: 11px 12px 8px; text-align: left; }
.ch-no { flex: none; font-size: 12px; font-weight: 800; color: #fff; background: var(--navy); border-radius: 999px; padding: 2px 9px; }
.ch.done .ch-no { background: var(--ok); }
.ch-name { flex: 1; min-width: 0; font-weight: 800; font-size: 15px; color: var(--ink); display: flex; flex-direction: column; line-height: 1.3; }
.ch-name small { font-weight: 500; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-prog { flex: none; font-size: 13px; font-weight: 800; color: var(--blue); font-variant-numeric: tabular-nums; }
.ch-done { flex: none; display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; font-weight: 800; color: var(--ok); }
.ch-bar { height: 4px; margin: 0 12px 9px; border-radius: 999px; background: #f1e8d8; overflow: hidden; }
.ch-bar i { display: block; height: 100%; width: calc(var(--p, 0) * 100%); border-radius: inherit; background: var(--blue); }
.ch.done .ch-bar i { background: var(--ok); }
.ch-body { padding: 0 12px 11px; border-top: 1px solid #f3eadb; }
.ch-gift { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: #fdf1d6; color: #8a5a0a; font-size: 12.5px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.ch-gift.got { background: #e6f4ec; color: var(--ok); }
.ch-gift-t { flex: 1; min-width: 0; line-height: 1.45; }
.ch-gift-t small { display: block; font-size: 12px; font-weight: 600; opacity: .9; }
.ch-gift .btn { flex: none; }
.qbox { border: 1px solid var(--line); border-radius: 14px; background: #fffdf9; padding: 0 12px; margin-bottom: 8px; }
.q { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f3eadb; }
.q:last-child { border-bottom: 0; }
.q.next { margin: 0 -12px; padding-left: 9px; padding-right: 12px; border-left: 3px solid var(--blue); background: #f4f9fd; }
.qm { position: relative; flex: none; width: 24px; height: 24px; margin-top: 1px; border-radius: 50%; border: 2px solid #e2d6c0; display: flex; align-items: center; justify-content: center; font-size: 13px; color: #fff; }
.q.done .qm { background: var(--ok); border-color: var(--ok); }
.qm.paw { border-radius: 8px; border-style: dashed; }
.q.done .qm.paw { background: var(--coral); border-color: var(--coral); border-style: solid; transform: rotate(-8deg); }
.q.has-img .qm { width: 34px; height: 34px; margin-top: 0; border: 0; border-radius: 50%; background: var(--blue-soft); transform: none; }
.q.has-img .qm img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.q.has-img.done .qm .ic { position: absolute; right: -5px; bottom: -4px; width: 19px; height: 19px; padding: 3px; border-radius: 6px; background: var(--coral); border: 2px solid #fff; transform: rotate(-8deg); }
.qi { flex: 1; min-width: 0; }
.qn { font-weight: 700; font-size: 14px; color: var(--ink); display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.qp { font-size: 12px; font-weight: 700; color: var(--blue); background: var(--blue-soft); border-radius: 999px; padding: 0 8px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.qx { font-size: 11px; font-weight: 700; color: #fff; background: var(--blue); border-radius: 999px; padding: 0 7px; white-space: nowrap; }
.qh { font-size: 12.5px; color: #55504a; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.qc { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; color: #b23b38; font-variant-numeric: tabular-nums; white-space: nowrap; }
.qc .ic { font-size: 11px; }
.qt { font-size: 12px; color: var(--muted); }
.qb { font-size: 12px; color: #a47a35; display: flex; align-items: center; gap: 4px; }
.q.done .qn { color: var(--muted); font-weight: 600; }
.q.done .qh, .q.wait .qh { color: var(--muted); }
.q.wait .qn { color: var(--muted); }
.qr { flex: none; display: inline-flex; align-items: center; gap: 3px; margin-top: 1px; padding: 2px 9px; border-radius: 999px; background: #fdf1d6; color: #9a6508; font-size: 12px; font-weight: 800; white-space: nowrap; }
.q.done .qr { background: #e6f4ec; color: var(--ok); }
/* 手冊最上面那一排切換：往下捲的時候留在最上面。--tb-top 是清單頂端的留白（手機 26px、寬螢幕 12px）：固定的位置從留白的上緣算起，
   這一塊自己也多墊這麼高的白底，底下的內容才不會從那一段留白露出來 */
.hb-top { position: sticky; top: calc(-1 * var(--tb-top, 0px)); z-index: 2; margin: calc(-1 * var(--tb-top, 0px)) -12px 4px; padding: var(--tb-top, 0px) 12px 6px; background: var(--card); border-radius: 20px 20px 0 0; }
.seg.hb { display: flex; width: 100%; margin: 0; }
.seg.hb button { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 6px 2px; line-height: 1.2; }
.seg.hb small { font-size: 10.5px; font-weight: 600; opacity: .8; font-variant-numeric: tabular-nums; }
/* 左上那一條的「下一個目標」（2026-11-17）：和場景說明（.scene-text）疊在同一個位置，一次只顯示一個（ui.js 的 renderGoal）。
   字太長的時候後面用「…」收掉 */
.goal { position: absolute; left: 14px; top: calc(140px + var(--safe-t)); max-width: calc(100% - 28px); display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px 0 8px; border-radius: 999px; background: rgba(255, 255, 255, .95); color: var(--navy); font-size: 12.5px; font-weight: 700; white-space: nowrap; box-shadow: 0 3px 10px rgba(0, 0, 0, .13); z-index: 4; }
.goal[hidden] { display: none; }
.goal:active { transform: scale(.97); }
.goal > .ic { flex: none; color: var(--blue); font-size: 15px; }
.goal-k { flex: none; font-size: 11px; color: #fff; background: var(--blue); border-radius: 999px; padding: 1px 7px; }
.goal-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goal-p { margin-left: 5px; font-size: 11.5px; color: var(--blue); font-variant-numeric: tabular-nums; }
.goal-c { margin-left: 5px; color: #b23b38; font-variant-numeric: tabular-nums; }
.goal-c .ic { font-size: 11px; margin-right: 2px; vertical-align: -1px; }
.goal-m { flex: none; font-size: 11px; font-weight: 600; color: var(--muted); }

/* 小鎮大合照（2026-11-17）：右下角的按鈕、倒數的大數字、手冊封面的照片 */
.group-btn { flex: none; display: inline-flex; align-items: center; gap: 5px; height: 36px; padding: 0 13px; border-radius: 999px; background: var(--gold); color: #5a3d00; font-weight: 800; font-size: 13px; white-space: nowrap; box-shadow: 0 3px 10px rgba(0, 0, 0, .16); }
.group-btn[hidden] { display: none; }
.group-btn:active { transform: scale(.96); }
.count { position: absolute; left: 50%; top: 36%; transform: translate(-50%, -50%); font-size: 96px; line-height: 1; font-weight: 900; color: #fff; text-shadow: 0 4px 0 var(--coral), 0 6px 18px rgba(0, 0, 0, .45); pointer-events: none; z-index: 6; font-variant-numeric: tabular-nums; }
.count[hidden] { display: none; }
.count.pop { animation: countPop .7s ease-out; }
@keyframes countPop { 0% { transform: translate(-50%, -50%) scale(1.7); opacity: 0; } 25% { opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1); opacity: .92; } }
.hb-cover { display: block; width: 100%; margin: 0 0 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--blue-soft); }

/* ── 我的 ── */
.pets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pet { position: relative; border-radius: 14px; border: 1px solid var(--line); background: #fffdf9; padding: 8px 6px 7px; text-align: center; width: 100%; }
.pet .ph { width: 100%; aspect-ratio: 1; border-radius: 12px; object-fit: cover; background: var(--blue-soft); }
.pet .ph.empty { display: flex; align-items: center; justify-content: center; color: #9db9d2; font-size: 34px; }
.pet .pn { margin-top: 5px; font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pet.is-star { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(241, 179, 60, .35); }
.pet .badge { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--gold); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.pet.add { border-style: dashed; color: var(--blue); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 118px; font-weight: 700; font-size: 13px; }
.pet.add .ic { font-size: 26px; }
.stack { display: grid; gap: 8px; }
.stack.two { grid-template-columns: 1fr 1fr; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 2px; border-bottom: 1px solid #f3eadb; font-size: 13.5px; }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--muted); }
.kv span:last-child { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.about { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 14px; background: var(--blue-soft); }
.about img.box { width: 74px; flex: none; filter: drop-shadow(0 4px 8px rgba(12, 63, 122, .25)); }
.about p { margin: 0 0 8px; font-size: 13.5px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 2px; }
.switch input { width: 46px; height: 26px; appearance: none; -webkit-appearance: none; background: #d9d5cd; border-radius: 999px; position: relative; cursor: pointer; transition: background .15s; margin: 0; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.switch input:checked { background: var(--blue); }
.switch input:checked::after { transform: translateX(20px); }

/* ── 對話窗 ── */
.modal-back { position: fixed; inset: 0; background: rgba(34, 24, 10, .48); display: flex; align-items: flex-end; justify-content: center; z-index: 50; animation: fadeIn .15s ease-out; }
.modal { width: 100%; max-width: 480px; max-height: 92vh; max-height: 92dvh; overflow-y: auto; background: var(--card); border-radius: 22px 22px 0 0; padding: 18px 18px calc(18px + var(--safe-b)); animation: slideUp .2s ease-out; position: relative; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(24px); opacity: .4; } }
.modal h2 { margin: 0 34px 10px 0; font-size: 19px; color: var(--navy); }
.modal p { margin: 0 0 10px; }
.modal .x { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; background: #f3ede2; display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--muted); }
.modal .actions { display: grid; gap: 8px; margin-top: 14px; }
.modal .actions.two { grid-template-columns: 1fr 1fr; }
.modal .fine { font-size: 12px; color: var(--muted); margin-top: 10px; }
.modal .big { font-size: 30px; font-weight: 800; color: var(--navy); display: flex; align-items: center; gap: 8px; justify-content: center; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.modal .center { text-align: center; }
.modal .hero { width: 100%; height: 170px; border-radius: 16px; object-fit: cover; background: var(--blue-soft); margin-bottom: 12px; }
.modal .hero.contain { object-fit: contain; padding: 10px; }
.modal .hero.round { width: 150px; height: 150px; border-radius: 50%; margin: 6px auto 12px; border: 5px solid #fff; box-shadow: var(--shadow); }
.steps { display: flex; gap: 6px; justify-content: center; margin-bottom: 12px; }
.steps i { width: 26px; height: 5px; border-radius: 3px; background: #eadfcb; }
.steps i.on { background: var(--navy); }
.stamp { width: 132px; height: 132px; margin: 4px auto 10px; border-radius: 50%; border: 5px solid var(--coral); color: var(--coral); display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; transform: rotate(-9deg); animation: stampIn .35s cubic-bezier(.2, 1.6, .4, 1); background: var(--coral-soft); }
.stamp b { font-size: 30px; line-height: 1.1; letter-spacing: .1em; }
.stamp span { font-size: 12.5px; }
@keyframes stampIn { from { transform: rotate(-9deg) scale(2.2); opacity: 0; } }
.field { display: block; width: 100%; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 12px; font: inherit; background: #fffdf9; color: var(--ink); }
textarea.field { min-height: 86px; resize: vertical; font-size: 13px; word-break: break-all; }
.qr-wrap { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 10px; width: min(100%, 300px); margin: 0 auto 10px; }
.qr-wrap canvas { width: 100%; height: auto; display: block; image-rendering: pixelated; }
.warn { background: #fff4d9; border: 1px solid #f3d590; color: #6d5310; border-radius: 12px; padding: 9px 11px; font-size: 13px; margin-bottom: 10px; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.compare > div { border: 1px solid var(--line); border-radius: 14px; padding: 10px; background: #fffdf9; }
.compare > div.in { border-color: var(--blue); background: #f4f9fd; }
.compare h3 { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.compare .kv { font-size: 12.5px; padding: 4px 0; }
.cropper { position: relative; width: min(100%, 300px); aspect-ratio: 1; margin: 0 auto 10px; border-radius: 50%; overflow: hidden; background: #eee; touch-action: none; cursor: grab; box-shadow: 0 0 0 4px #fff, 0 0 0 5px var(--line); }
.cropper canvas { width: 100%; height: 100%; display: block; }
input[type="range"] { width: 100%; accent-color: var(--blue); }
.scan video { width: 100%; border-radius: 14px; background: #000; aspect-ratio: 4 / 3; object-fit: cover; }

.toasts { position: fixed; left: 0; right: 0; top: calc(62px + env(safe-area-inset-top, 0px)); display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 60; pointer-events: none; padding: 0 12px; }
.toast { background: rgba(28, 44, 68, .94); color: #fff; padding: 9px 15px; border-radius: 999px; font-size: 13.5px; font-weight: 600; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); animation: toastIn .2s ease-out; max-width: 100%; text-align: center; }
.toast.gold { background: linear-gradient(90deg, #e9a21f, #f1b33c); color: #3d2a00; }
.toast.out { opacity: 0; transition: opacity .3s; }
/* 拍照時蓋在畫面中間的「顯影中」（畫面凍結、拉到最高畫質拍一張的那一兩秒） */
.develop { position: fixed; left: 50%; top: 46%; transform: translate(-50%, -50%); z-index: 90; display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 999px;
  background: rgba(28, 44, 68, .9); color: #fff; font-size: 15px; font-weight: 700; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); pointer-events: none; }
@keyframes toastIn { from { transform: translateY(-10px); opacity: 0; } }

/* ── 寬螢幕：清單在右邊一欄，場景還是鋪滿整個視窗（鏡頭會避開清單，把場景擺在剩下的地方中間） ── */
@media (min-width: 900px) {
  .wide-only { display: inline-flex; }
  .hud { padding: 14px 16px 0; }
  .app.panel-open .hud { right: calc(var(--drawer-w) + 14px); }
  .wallet { padding: 5px 18px 5px 5px; }
  .wallet img { width: 46px; height: 46px; }
  .wallet-main { font-size: 24px; }
  .wallet-main .ic { font-size: 19px; }
  .wallet-sub { font-size: 12.5px; }
  .hud-btn { width: 44px; height: 44px; }
  .ritual-pill { height: 44px; font-size: 14.5px; padding: 0 18px; }
  .scene-text { top: 162px; left: 20px; font-size: 13.5px; }
  .goal { top: 160px; left: 20px; height: 31px; font-size: 13.5px; }
  .daybar { width: 148px; height: 22px; }
  .daybar-track { top: 7px; bottom: 7px; }
  .care-btn { width: 44px; height: 44px; font-size: 21px; }
  .care { gap: 8px; }
  .dock { bottom: 18px; padding: 0 18px; }
  .app.panel-open .dock { opacity: 1; transform: none; right: calc(var(--drawer-w) + 14px); }
  .app.panel-open .dock > * { pointer-events: auto; }
  .place, .pet-btn { height: 42px; font-size: 14.5px; padding: 0 18px; }
  .panel { left: auto; right: 12px; top: 12px; bottom: 12px; width: var(--drawer-w); flex-direction: column; border-radius: 20px; box-shadow: 0 8px 30px rgba(60, 40, 10, .2); padding-bottom: 0; transition: transform .25s ease; transform: translateX(calc(100% + 24px)); }
  .app.panel-open .panel { transform: none; }
  .sheet-close, .app.panel-open .sheet-close { display: none; }
  .tabs { height: auto; padding: 6px 8px 0; border-bottom: 1px solid var(--line); }
  .tabs button { flex-direction: row; gap: 6px; font-size: 15px; padding: 9px 4px 10px; border-radius: 0; border-bottom: 3px solid transparent; margin-bottom: -1px; }
  .tabs button .ic { font-size: 17px; }
  .tabs button[aria-selected="true"] { background: none; border-bottom-color: var(--blue); }
  .tabs button .dot { top: 6px; right: calc(50% - 36px); border: 0; width: 8px; height: 8px; }
  .tab-body, .app.panel-open .tab-body { height: auto; flex: 1; min-height: 0; padding: 12px 12px 20px; border-bottom: 0; transition: none; --tb-top: 12px; }
  .floater { font-size: 21px; }
  .floater.big { font-size: 26px; }
  .tag { font-size: 12.5px; }
  .tag img { width: 28px; height: 28px; }
  .modal-back { align-items: center; }
  .modal { border-radius: 22px; padding-bottom: 18px; }
}
/* ── 新手教學：聚光（畫面變暗、只亮要點的地方，四塊透明板子擋住其他地方） ── */
.coach { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
.coach[hidden] { display: none; }
.coach-block { position: absolute; pointer-events: auto; }
.coach-hole { position: absolute; border-radius: 999px; pointer-events: none; box-shadow: 0 0 0 3px rgba(255, 255, 255, .95), 0 0 0 200vmax rgba(10, 22, 42, .58); }
.coach-hole::after { content: ""; position: absolute; inset: -3px; border-radius: inherit; animation: holeRing 1.5s ease-out infinite; }
.coach.free .coach-hole { box-shadow: 0 0 0 200vmax rgba(10, 22, 42, .45); }
.coach.free .coach-hole::after { display: none; }
@keyframes holeRing { from { box-shadow: 0 0 0 0 rgba(255, 255, 255, .75); } to { box-shadow: 0 0 0 16px rgba(255, 255, 255, 0); } }
.coach-hand { position: absolute; left: 0; top: 0; width: 44px; height: 44px; fill: #fff; stroke: var(--navy); stroke-width: 1.3px; stroke-linejoin: round; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .35)); pointer-events: none; }
.coach-hand use { animation: tapHint 1.1s ease-in-out infinite; transform-origin: 50% 20%; }
@keyframes tapHint { 0%, 100% { transform: translateY(4px); } 50% { transform: translateY(-2px) scale(.92); } }
.coach-tip { position: absolute; left: 16px; right: 16px; max-width: 380px; margin: 0 auto; background: #fff; border-radius: 16px; padding: 13px 14px 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, .32); pointer-events: auto; animation: tipIn .25s ease-out; }
.coach-tip p { margin: 0 0 8px; font-size: 15px; font-weight: 700; color: var(--navy); line-height: 1.55; }
.coach-tip [hidden] { display: none !important; }
.coach-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 34px; }
.coach-skip { font-size: 12.5px; color: var(--muted); padding: 6px 2px; text-decoration: underline; text-underline-offset: 2px; }
@keyframes tipIn { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) {
  .coach-hand use, .coach-hole::after, .care-btn.need { animation: none; }
  .ritual-pill.ready { animation: none; }
  .floater { animation-duration: .5s; }
  .modal, .modal-back, .stamp, .toast { animation: none; }
}

/* 佈置：買了的可以移動、收起來（2026-11-14）；擺放時下面那一條 */
.own-ctl { flex: none; width: 94px; display: flex; flex-direction: column; gap: 5px; }
.own-ctl .btn.small { min-height: 30px; padding: 5px 8px; }
.row.item.stowed .emoji, .row.item.stowed .name, .row.item.stowed .desc { opacity: .5; }
.stow-note { font-size: 12px; color: #8a8174; margin-top: 3px; line-height: 1.35; }
.app.placing #dock { visibility: hidden; }
.place-bar { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-b) + 76px); z-index: 30; width: min(calc(100% - 32px), 440px);
  background: var(--card); border-radius: 16px; box-shadow: 0 8px 28px rgba(60, 40, 10, .22); padding: 12px 14px; }
.place-bar p { margin: 0 0 10px; font-weight: 700; font-size: 14px; color: var(--ink); text-align: center; line-height: 1.4; }
.place-actions { display: flex; gap: 8px; }
.place-actions .btn { flex: 1; min-height: 40px; }

/* 2026-11-14：有些手機（螢幕窄、或系統字體放大）左上角第二行「每秒…・照顧…」會超出白色底框——
   原本這一行不換行、白框卻可以被擠窄。現在白框跟著字的寬度，真的太窄時第二行換行（框變高），字也稍微小一點 */
.wallet { min-width: auto; }
.wallet > div { min-width: 0; }
.wallet-sub { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 380px) { .wallet-main { font-size: 17px; } .wallet-sub { font-size: 10.5px; } }

/* 愛心的代號（2026-11-14）：數字＋代號，圖示跟著代號換。肉球（t1）跟著原本愛心的顏色、金肉球（t2）金色，
   彩虹、星空、銀河肉球（t3～t5）是漸層，顏色寫在 index.html 的圖示裡 */
svg.ic.t2 { color: #eba526; }
.buy:disabled svg.ic.t2 { color: #dcc38c; }
.buy:disabled svg.ic.t3, .buy:disabled svg.ic.t4, .buy:disabled svg.ic.t5 { opacity: .5; }
.amt { white-space: nowrap; }
.amt .unit { font-size: .78em; }
.modal .big .unit { font-size: .62em; }
.wallet { cursor: pointer; transform-origin: 20px 50%; }
.wallet-main .unit { font-size: .66em; margin-left: -1px; }
.pet-btn .unit { font-size: .86em; }
.buy .unit { font-size: 10.5px; line-height: 1.15; opacity: .9; }
.toast .ic.t0, .toast .ic.t1 { color: var(--coral); }
.toast.tier-up, .toast.tier-help { display: flex; flex-direction: column; align-items: center; gap: 3px; border-radius: 18px; padding: 10px 18px; }
.toast.tier-up b { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.toast.tier-up b .ic { font-size: 20px; padding: 4px; background: #fff; border-radius: 50%; box-sizing: content-box; }
.toast.tier-up span { font-size: 12.5px; font-weight: 600; }
.toast.tier-help span { font-size: 13px; }
.wallet.pop { animation: walletPop 1s ease-out; }
@keyframes walletPop { 0% { transform: scale(1); } 22% { transform: scale(1.1); box-shadow: 0 0 0 7px rgba(241, 179, 60, .5), 0 3px 12px rgba(0, 0, 0, .14); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .wallet.pop { animation: none; } }
@media (prefers-reduced-motion: reduce) { .count.pop { animation: none; } }
/* 夥伴的每秒產量加了代號會變長：「Lv 25 ×2」移到進度條右邊；還沒來的夥伴那一行可以換行 */
.barrow { display: flex; align-items: center; gap: 7px; margin-top: 4px; }
.barrow .bar { flex: 1; margin-top: 0; }
.barrow span { font-size: 11px; font-weight: 700; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.row.new .prod { white-space: normal; }

/* ── 第一次打開的蓋板（2026-11-14）──
   只在這台裝置第一次打開時出現（index.html 開頭的小程式加上 html.booting，ui.js 的 boot 拿掉）。
   效能：不會動的部分是一張向量圖，只畫一次；會動的小東西各自一層，只改位置、大小、透明度（瀏覽器在另一條線程合成，
   3D 在後面算網格時也照樣順），不用模糊、濾鏡、陰影動畫。蓋著的時候 3D 不畫（world.js 的 boot），不會搶顯示卡。
   直的畫面（手機、平板直放）：圖在上、字在下；橫的畫面（電腦、平板橫放、手機橫放）：圖在左、字在右 */
.boot { display: none; }
html.booting body { overflow: hidden; }
html.booting .boot {
  position: fixed; inset: 0; z-index: 300; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(8px, 2.6vh, 26px); padding: max(20px, env(safe-area-inset-top)) 22px max(20px, env(safe-area-inset-bottom));
  overflow: hidden; transition: opacity .5s ease; -webkit-user-select: none; user-select: none;
}
.boot.out { opacity: 0; pointer-events: none; }
.boot.hold { cursor: pointer; }
.boot-bg, .boot-bg > div { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.boot-bg > div, .boot-art > svg.art, .boot-art > div { display: none; }
html.boot-a .bg-a, html.boot-b .bg-b, html.boot-c .bg-c, html.boot-a .art-a, html.boot-b .art-b, html.boot-c .art-c,
html.boot-a .fx-a, html.boot-b .fx-b, html.boot-c .fx-c { display: block; }
.boot-art { position: relative; flex: none; width: min(88vw, 46vh, 480px); aspect-ratio: 4 / 3; }
.boot-art > svg.art { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.boot-art > div { position: absolute; inset: 0; }
.boot .fx, .boot-bg i { position: absolute; display: block; }
.boot .fx { aspect-ratio: 1; }
.boot .fx svg, .boot-bg i svg { display: block; width: 100%; height: 100%; fill: currentColor; overflow: visible; }
.boot-text { position: relative; flex: none; width: min(86vw, 400px); text-align: center; }
.boot-title { margin: 0; display: flex; align-items: center; justify-content: center; gap: .32em; font-size: clamp(26px, 4.4vh, 44px); font-weight: 800; letter-spacing: .1em; line-height: 1.2; }
.boot-title img { width: 1.1em; height: 1.1em; border-radius: 24%; flex: none; }
.boot-sub { margin: .55em 0 1.4em; font-size: clamp(13px, 1.9vh, 16.5px); line-height: 1.6; }
.boot-bar { position: relative; height: 12px; }
.boot-clip { position: absolute; inset: 0; border-radius: 99px; overflow: hidden; }
#boot-fill { position: absolute; inset: 0; border-radius: 99px; transform: translateX(-96%); transition: transform .45s ease-out; }
.boot-mark { position: absolute; left: 0; right: 0; top: 50%; height: 0; transform: translateX(4%); transition: transform .45s ease-out; }
.boot-knob { position: absolute; left: -15px; top: -15px; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0, 0, 0, .18); animation: bootHop .9s ease-in-out infinite; }
.boot-knob svg { width: 17px; height: 17px; fill: currentColor; }
.boot-stage { margin: 14px 0 0; display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; font-weight: 700; }
.boot-stage b { font-variant-numeric: tabular-nums; }
.boot-note { margin: 8px 0 0; font-size: 12px; }
@media (min-aspect-ratio: 1/1) {
  html.booting .boot { flex-direction: row; gap: clamp(18px, 4.5vw, 72px); }
  .boot-art { width: auto; height: min(64vh, 44vw, 540px); }
  .boot-text { width: min(36vw, 430px); text-align: left; }
  .boot-title { justify-content: flex-start; font-size: clamp(26px, 6vh, 52px); }
  .boot-sub { font-size: clamp(13px, 2.3vh, 18px); }
  .boot-stage { font-size: clamp(13px, 1.9vh, 15.5px); }
  .boot-note { font-size: clamp(11.5px, 1.6vh, 13.5px); }
  .boot-bar { height: clamp(10px, 1.6vh, 14px); }
}
@media (min-aspect-ratio: 1/1) and (max-height: 500px) {             /* 手機橫放：矮 */
  .boot-sub { margin: .35em 0 .9em; }
  .boot-stage { margin-top: 10px; }
  .boot-note { display: none; }
}
/* a 午後小屋：暖暖的午後天空、藍屋頂的小屋，窗邊的橘貓、門口搖尾巴的瑪爾濟斯，煙囪冒煙、一排腳印走向門口 */
html.boot-a .boot { color: var(--navy); background: radial-gradient(120vmax 80vmax at 12% 0%, #ffe0b3 0%, rgba(255, 224, 179, 0) 55%), linear-gradient(180deg, #ffecd2 0%, #fff6ea 55%, #fbf5ea 100%); }
html.boot-a .boot-sub { color: #8a6f55; }
html.boot-a .boot-note { color: #a8927c; }
html.boot-a .boot-clip { background: #f1e2c9; }
html.boot-a #boot-fill { background: linear-gradient(90deg, #f9b56a, #f0625f); }
html.boot-a .boot-knob { background: #fff; color: #f0625f; }
.fx-a .rays { opacity: .85; animation: bootSpin 40s linear infinite; }
.fx-a .smoke { border-radius: 50%; background: #fff; opacity: 0; animation: bootSmoke 3.6s ease-out infinite both; }
.fx-a .s2 { animation-delay: 1.2s; } .fx-a .s3 { animation-delay: 2.4s; }
.boot .step { color: #c09a6a; opacity: 0; animation: bootStep 3.4s ease-in-out infinite both; }
.fx-a .step { transform: rotate(22deg); }
.boot .t2 { animation-delay: .35s; } .boot .t3 { animation-delay: .7s; } .boot .t4 { animation-delay: 1.05s; } .boot .t5 { animation-delay: 1.4s; } .boot .t6 { animation-delay: 1.75s; }
.fx-a .tail { transform-origin: 18% 92%; animation: bootWag .42s ease-in-out infinite alternate; }     /* 夾在地面和狗中間（狗是另一張圖），根部藏在身體後面 */
.fx-a .bfly-path { animation: bootFlit 7s ease-in-out infinite; }
.fx-a .bfly { display: block; width: 100%; height: 100%; animation: bootFlap .18s ease-in-out infinite alternate; }
.bg-a .cloud { left: 0; width: clamp(90px, 16vmax, 210px); aspect-ratio: 12 / 5; opacity: .92; animation: bootDrift 70s linear -20s infinite; }
.bg-a .c1 { top: 8%; }
.bg-a .c2 { top: 20%; width: clamp(70px, 11vmax, 150px); opacity: .7; animation-duration: 95s; animation-delay: -62s; }
/* b 夕陽（傍晚 17～20 點、清晨 5 點半～6 點半）：紫色到橘色的夕陽天空，白色大腳掌（遊戲圖示的樣子），肉球上的愛心在跳，旁邊飄小愛心、第一顆星星，
   紫色的山丘上一排腳印。字是白的，下面的天空偏亮，加一點淡淡的字影 */
html.boot-b .boot { color: #fff; background: linear-gradient(180deg, #34478f 0%, #7a5aa3 34%, #d9738a 66%, #f6a865 100%); text-shadow: 0 1px 3px rgba(70, 30, 70, .38); }
html.boot-b .boot-title img { display: none; }
html.boot-b .boot-sub { color: rgba(255, 255, 255, .94); }
html.boot-b .boot-note { color: rgba(255, 255, 255, .84); }
html.boot-b .boot-clip { background: rgba(255, 255, 255, .26); }
html.boot-b #boot-fill { background: linear-gradient(90deg, #ffe08a, #fff); }
html.boot-b .boot-knob { background: #fff; color: #f0625f; text-shadow: none; }
.fx-b .beat { color: #f0625f; animation: bootBeat 1.5s ease-in-out infinite; }
.fx-b .rise { color: #ffd0c4; opacity: 0; animation: bootRise 3.2s ease-out infinite both; }
.fx-b .r2 { color: #fff; animation-delay: .8s; } .fx-b .r3 { color: #ffd36b; animation-delay: 1.6s; } .fx-b .r4 { animation-delay: 2.4s; }
.boot .spark { color: #fff; animation: bootTwinkle 2.4s ease-in-out infinite both; }
.fx-b .k2 { animation-delay: .8s; } .fx-b .k3 { animation-delay: 1.6s; }
.bg-b .wave { left: 0; right: 0; bottom: 0; height: 32vh; }
.bg-b .wave path:first-child { fill: #6a4a93; }
.bg-b .wave path:last-child { fill: #43316f; }
.bg-b .step { width: clamp(16px, 2.6vmax, 26px); aspect-ratio: 1; color: rgba(255, 255, 255, .85); transform: rotate(90deg); }
/* c 晚安星空：深藍夜空、月亮和一閃一閃的星星，窗戶亮著燈，橘貓在窗邊睡覺冒 z、瑪爾濟斯在門口睡著，螢火蟲、偶爾一顆流星 */
html.boot-c .boot { color: #fff7e6; background: radial-gradient(90vmax 60vmax at 80% 0%, rgba(80, 110, 190, .35), rgba(80, 110, 190, 0) 60%), linear-gradient(180deg, #0b1d44 0%, #15306a 60%, #24467f 100%); }
html.boot-c .boot-sub { color: #c4cfe8; }
html.boot-c .boot-note { color: #8e9dc4; }
html.boot-c .boot-clip { background: rgba(255, 255, 255, .16); }
html.boot-c #boot-fill { background: linear-gradient(90deg, #ffcf6e, #f7a35c); }
html.boot-c .boot-knob { background: #fff7e6; color: #2f4f86; }
.fx-c .halo { background: radial-gradient(circle, rgba(255, 207, 110, 0) 34%, rgba(255, 207, 110, .45) 44%, rgba(255, 207, 110, 0) 70%); animation: bootGlow 3.4s ease-in-out infinite; }
.fx-c .h2 { animation-delay: 1.2s; }
.fx-c .z { aspect-ratio: auto; color: #fff7e6; text-align: center; font: italic 800 clamp(10px, 2.4vmin, 20px)/1 system-ui, sans-serif; opacity: 0; animation: bootZ 3s ease-out infinite both; }
.fx-c .z2 { animation-delay: 1s; } .fx-c .z3 { animation-delay: 2s; }
.fx-c .fly { border-radius: 50%; background: radial-gradient(circle, #fff3a8 0%, rgba(255, 236, 140, .6) 35%, rgba(255, 236, 140, 0) 70%); animation: bootFly 3.6s ease-in-out infinite both; }
.fx-c .f2 { animation-delay: .9s; animation-duration: 4.2s; } .fx-c .f3 { animation-delay: 1.7s; } .fx-c .f4 { animation-delay: 2.5s; animation-duration: 3.2s; }
.bg-c .star { aspect-ratio: 1; color: #fff7e6; animation: bootTwinkle 3s ease-in-out infinite both; }
.bg-c .s1 { animation-delay: 0s; animation-duration: 3s; } .bg-c .s2 { animation-delay: -0.7s; animation-duration: 2.6s; } .bg-c .s3 { animation-delay: -1.5s; animation-duration: 3.4s; } .bg-c .s4 { animation-delay: -0.3s; animation-duration: 2.2s; } .bg-c .s5 { animation-delay: -2.1s; animation-duration: 3.2s; } .bg-c .s6 { animation-delay: -1.1s; animation-duration: 2.8s; } .bg-c .s7 { animation-delay: -2.6s; animation-duration: 3.6s; } .bg-c .s8 { animation-delay: -0.9s; animation-duration: 2.4s; } .bg-c .s9 { animation-delay: -1.8s; animation-duration: 3.1s; } .bg-c .s10 { animation-delay: -2.4s; animation-duration: 2.7s; } .bg-c .s11 { animation-delay: -0.5s; animation-duration: 3.3s; } .bg-c .s12 { animation-delay: -1.3s; animation-duration: 2.5s; }
.bg-c .shoot { left: 78%; top: 8%; animation: bootShoot 7s ease-in 2s infinite both; }
.bg-c .shoot i { width: 110px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, #fff, rgba(255, 255, 255, 0)); transform: rotate(-31deg); transform-origin: 0 50%; }
@keyframes bootHop { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes bootSpin { to { transform: rotate(360deg); } }
@keyframes bootSmoke { 0% { opacity: 0; transform: translate(0, 0) scale(.45); } 25% { opacity: .9; } 100% { opacity: 0; transform: translate(45%, -260%) scale(1.5); } }
@keyframes bootStep { 0%, 6% { opacity: 0; } 14%, 56% { opacity: .9; } 72%, 100% { opacity: 0; } }
@keyframes bootWag { from { transform: rotate(-18deg); } to { transform: rotate(14deg); } }
@keyframes bootFlap { from { transform: scaleX(1); } to { transform: scaleX(.25); } }
@keyframes bootFlit { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(-120%, -90%); } 50% { transform: translate(-40%, -170%); } 75% { transform: translate(60%, -80%); } }
@keyframes bootDrift { from { transform: translateX(-40vw); } to { transform: translateX(140vw); } }
@keyframes bootBeat { 0%, 100% { transform: scale(1); } 14% { transform: scale(1.16); } 28% { transform: scale(1); } 42% { transform: scale(1.1); } 70% { transform: scale(1); } }
@keyframes bootRise { 0% { opacity: 0; transform: translateY(0) scale(.6); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(-260%) scale(1.05); } }
@keyframes bootTwinkle { 0%, 100% { opacity: .25; transform: scale(.6); } 50% { opacity: 1; transform: scale(1); } }
@keyframes bootGlow { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
@keyframes bootZ { 0% { opacity: 0; transform: translate(0, 0) scale(.6); } 25% { opacity: .95; } 100% { opacity: 0; transform: translate(120%, -240%) scale(1.15); } }
@keyframes bootFly { 0%, 100% { opacity: .2; transform: translate(0, 0); } 50% { opacity: 1; transform: translate(70%, -90%); } }
@keyframes bootShoot { 0%, 88% { opacity: 0; transform: translate(0, 0); } 90% { opacity: 1; } 100% { opacity: 0; transform: translate(-220px, 132px); } }
@media (prefers-reduced-motion: reduce) {
  .boot .fx, .boot-bg i, .boot-knob, .fx-a .bfly { animation: none !important; }
  .boot .step, .fx-b .rise, .fx-c .z, .fx-a .smoke { opacity: .8; }
  .bg-c .shoot, .fx-a .bfly-path { display: none; }
}
