:root {
  --bg: #1b1530; --panel: #271f45; --panel2: #322857; --line: #44397a;
  --text: #f5f0ff; --muted: #b3a9d6; --gold: #ffd25e; --pink: #ff8fb8;
  --green: #6be3a4; --red: #ff6b7d; --blue: #7cc4ff; --purple: #b58cff;
  --up: #ff6b7d; --down: #4fd18b; /* 台股習慣：紅漲綠跌 */
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, "PingFang TC", "Noto Sans TC", sans-serif; }
/* 捲動容器從狀態列下緣開始：內容不會從時間底下透出，也不用在頂端放固定遮罩（iOS 26 會對頂端固定元素加模糊邊緣效果） */
html { height: 100%; overflow: hidden; }
body { position: fixed; top: env(safe-area-inset-top); left: 0; right: 0; bottom: 0; overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; padding: 0 0 calc(72px + env(safe-area-inset-bottom)); }
#app { max-width: 520px; margin: 0 auto; padding: 0 14px; }
.tab { display: none; animation: fade .25s; } .tab.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 14px 2px 8px; }
.topbar [data-back] + .pet-name { margin-right: auto; }
.pet-name { font-size: 22px; font-weight: 800; letter-spacing: 1px; }
.sub { color: var(--muted); font-size: 13px; }
.center { text-align: center; }
.lv { background: var(--gold); color: #3a2a00; font-weight: 900; padding: 4px 12px; border-radius: 999px; }

.stage-box { position: relative; height: 280px; border-radius: 22px; overflow: hidden;
  background: radial-gradient(circle at 50% 30%, #3d3270, #241c42 70%); border: 2px solid var(--line); }
.ground { position: absolute; bottom: 0; left: 0; right: 0; height: 46px;
  background: repeating-linear-gradient(90deg, #2f6b4f 0 14px, #34775a 14px 28px); border-top: 4px solid #4c9c74; }
.pet { position: absolute; left: 50%; bottom: 30px; width: 170px; height: 170px; transform: translateX(-50%); }
.pet svg { width: 100%; height: 100%; overflow: visible; }
.pet .body-grp { position: relative; width: 100%; height: 100%; transform-origin: 50% 90%; animation: bounce 1.8s ease-in-out infinite; }
.pet-shadow { position: absolute; left: 50%; bottom: 4px; width: 60%; height: 12px; transform: translateX(-50%); border-radius: 50%; background: rgba(92,59,30,.18); }
.pet-img { position: relative; width: 100%; height: 100%; object-fit: contain; object-position: bottom center; display: block; pointer-events: none; }
.pet-fx { position: absolute; inset: 0; pointer-events: none; }
.pet.sad .body-grp { animation-duration: 3.2s; }
.pet.happy .body-grp { animation: hop 1s ease-in-out infinite; }
.pet .eye { animation: blink 4s infinite; transform-origin: center; transform-box: fill-box; }
@keyframes bounce { 0%,100% { transform: scale(1,1); } 50% { transform: scale(1.04,.95); } }
@keyframes hop { 0%,100% { transform: translateY(0); } 40% { transform: translateY(-14px) scale(.97,1.03); } }
@keyframes blink { 0%,94%,100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
.pet.tap .body-grp { animation: wiggle .5s; }
@keyframes wiggle { 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }

.bubble { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); max-width: 86%;
  background: #fff; color: #2b2150; padding: 8px 14px; border-radius: 16px; font-size: 14px; font-weight: 600;
  box-shadow: 0 4px 0 rgba(0,0,0,.25); }
.bubble::after { content: ""; position: absolute; bottom: -8px; left: 50%; border: 8px solid transparent; border-top-color: #fff; border-bottom: 0; transform: translateX(-50%); }
.hidden { display: none !important; }

.bars { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 12px 2px; }
.bar { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.bar span { width: 32px; color: var(--muted); }
.track { flex: 1; height: 12px; background: #120d22; border-radius: 6px; border: 2px solid var(--line); overflow: hidden; }
.fill { height: 100%; width: 0; transition: width .6s; }
.fill.hunger { background: var(--gold); } .fill.mood { background: var(--pink); }
.fill.health { background: var(--green); } .fill.xp { background: var(--blue); }

.card { background: var(--panel); border: 2px solid var(--line); border-radius: 18px; padding: 14px; margin: 12px 0; }
.card .label { color: var(--muted); font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.networth .big { font-size: 32px; font-weight: 900; color: var(--gold); letter-spacing: .5px; }
.up { color: var(--up); } .down { color: var(--down); }

.btn { display: inline-flex; justify-content: center; align-items: center; gap: 6px; border: 0; cursor: pointer;
  background: var(--panel2); color: var(--text); font-weight: 800; font-size: 15px; padding: 12px 16px; border-radius: 14px;
  box-shadow: 0 4px 0 #15102a; margin: 4px 4px 4px 0; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #15102a; }
.btn.primary { background: linear-gradient(#ffcf55, #f6a823); color: #3a2400; box-shadow: 0 4px 0 #a86a08; }
.btn.small { padding: 8px 12px; font-size: 14px; }
.actions .btn { width: 100%; }
.danger .btn { background: #5a2436; }

.chart svg { width: 100%; height: 120px; }
.alloc-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 14px; }
.alloc-row .track { height: 14px; }
.alloc-row .name { width: 64px; } .alloc-row .pct { width: 52px; text-align: right; color: var(--muted); }

.group-title { margin: 16px 2px 6px; font-weight: 800; color: var(--muted); }
.item { display: flex; justify-content: space-between; align-items: center; background: var(--panel);
  border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; margin: 6px 0; }
.item .n { font-weight: 800; } .item .s { color: var(--muted); font-size: 12px; }
.item .r { text-align: right; } .item .v { font-weight: 800; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

textarea, input, select { width: 100%; background: #120d22; color: var(--text); border: 2px solid var(--line);
  border-radius: 12px; padding: 10px; font-size: 16px; font-family: inherit; }
.field { display: block; font-size: 13px; color: var(--muted); font-weight: 700; margin: 8px 0; }
.field input, .field select { margin-top: 4px; }
.help ol { margin: 6px 0 6px 18px; padding: 0; line-height: 1.6; font-size: 14px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 2px; font-size: 14px; }
.seg input { width: auto; }
#parseResult table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
#parseResult td, #parseResult th { padding: 4px; border-bottom: 1px solid var(--line); }
#parseResult input { padding: 6px; font-size: 14px; }
#parseResult .warn { color: var(--gold); font-size: 12px; }

.obs { margin: 4px 0 0; padding-left: 18px; line-height: 1.6; font-size: 15px; }
.obs li { margin: 6px 0; }
.obs .tag { display: inline-block; font-size: 11px; font-weight: 800; padding: 1px 6px; border-radius: 6px; margin-right: 4px; background: var(--panel2); color: var(--gold); }
.news-hero { border-color: var(--gold); }
details.card summary { cursor: pointer; list-style: none; font-weight: 800; }
details.card summary::after { content: " ▾"; color: var(--muted); }
details.card[open] summary::after { content: " ▴"; }
.sec-lines { font-size: 13px; line-height: 1.7; white-space: pre-wrap; word-break: break-all; margin-top: 6px; }
.sec-lines a { color: var(--blue); }
.recent-day { margin: 10px 0; } .recent-day b { color: var(--gold); }
.news-peek #newsPeekText { font-size: 14px; line-height: 1.6; margin-bottom: 6px; }

.tabbar { position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: space-around;
  background: #140f26; border-top: 2px solid var(--line); padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); }
.tabbar button { background: none; border: 0; color: var(--muted); font-size: 22px; display: flex; flex-direction: column; align-items: center; }
.tabbar button span { font-size: 11px; font-weight: 700; margin-top: 2px; }
.tabbar button.active { color: var(--gold); }

dialog { background: var(--panel); color: var(--text); border: 2px solid var(--line); border-radius: 20px; width: min(92vw, 420px); }
dialog::backdrop { background: rgba(0,0,0,.6); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 4px; margin-top: 10px; }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--gold); color: #3a2400;
  padding: 10px 18px; border-radius: 999px; font-weight: 800; box-shadow: 0 4px 0 #a86a08; z-index: 9; }

/* ===================================================================== 手遊風介面 */
body { font-family: -apple-system, "PingFang TC", "Noto Sans TC", sans-serif; }
.hud { display: flex; align-items: center; gap: 10px; padding: 12px 0 8px; }
.avatar-ring { position: relative; width: 62px; height: 62px; border-radius: 50%; flex: none;
  background: conic-gradient(#7cc4ff var(--xp, 0%), #2b2350 0); padding: 5px; box-shadow: 0 3px 0 #0e0a1c; }
.avatar { width: 100%; height: 100%; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff6cf, #ffd25e 60%, #e09b10);
  display: grid; place-items: center; font-size: 28px; border: 3px solid #1b1530; }
.lvtag { position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%); background: linear-gradient(#ffe27a, #f6a823);
  color: #3a2400; font-weight: 900; font-size: 12px; padding: 1px 8px; border-radius: 999px; border: 2px solid #1b1530; white-space: nowrap; }
.hud-name { flex: 1; min-width: 0; }
.hud-name #petName { font-size: 20px; font-weight: 900; text-shadow: -1px -1px 0 #0e0a1c, 1px -1px 0 #0e0a1c, -1px 1px 0 #0e0a1c, 1px 1px 0 #0e0a1c, 0 2px 0 #0e0a1c; }
.hud-stage { display: inline-block; margin-top: 3px; font-size: 11px; font-weight: 800; padding: 1px 8px; border-radius: 6px; background: #3b2f6e; color: #d9ccff; }
.res { display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }
.pill { display: flex; align-items: center; gap: 4px; min-width: 96px; justify-content: space-between; padding: 2px 10px 2px 4px;
  border-radius: 999px; background: #120d22; border: 2px solid #3b2f6e; box-shadow: inset 0 2px 0 rgba(0,0,0,.4); }
.pill i { font-style: normal; font-size: 16px; } .pill b { font-size: 14px; font-weight: 900; }
.pill.gold b { color: var(--gold); } .pill.fire b { color: #ff9d5c; }

/* 場景 */
.scene { position: relative; height: 330px; border-radius: 26px; overflow: hidden; border: 3px solid #0e0a1c;
  box-shadow: 0 6px 0 #0e0a1c, inset 0 0 0 3px rgba(255,255,255,.12); }
.sky { position: absolute; inset: 0; background: linear-gradient(#5ec8ff, #b9ecff 70%); transition: background 1s; }
.scene.dusk .sky { background: linear-gradient(#ff8a6b, #ffcf8f 60%, #ffe6b8); }
.scene.night .sky { background: linear-gradient(#0d1035, #2a2466 70%); }
.stars { position: absolute; inset: 0; opacity: 0; transition: opacity 1s;
  background-image: radial-gradient(2px 2px at 20% 20%, #fff, transparent), radial-gradient(2px 2px at 70% 15%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 45% 35%, #fff, transparent), radial-gradient(1.5px 1.5px at 85% 40%, #fff, transparent),
    radial-gradient(2px 2px at 10% 45%, #fff, transparent), radial-gradient(1.5px 1.5px at 60% 8%, #fff, transparent); }
.scene.night .stars { opacity: 1; animation: twinkle 3s infinite alternate; }
@keyframes twinkle { to { opacity: .55; } }
.sun { position: absolute; top: 26px; right: 34px; width: 54px; height: 54px; border-radius: 50%;
  background: radial-gradient(circle, #fff7c2, #ffd25e 70%); box-shadow: 0 0 30px 10px rgba(255,220,90,.55); }
.scene.dusk .sun { top: 120px; background: radial-gradient(circle, #ffe3b0, #ff8a4c 70%); }
.scene.night .sun { background: radial-gradient(circle at 35% 35%, #fffbe8, #e9e4c8 70%); box-shadow: 0 0 24px 6px rgba(255,255,220,.3); }
.cloud { position: absolute; height: 22px; background: #fff; border-radius: 22px; opacity: .9; animation: drift linear infinite; }
.cloud::before, .cloud::after { content: ""; position: absolute; background: #fff; border-radius: 50%; }
.cloud::before { width: 30px; height: 30px; top: -14px; left: 12px; } .cloud::after { width: 22px; height: 22px; top: -9px; left: 36px; }
.c1 { width: 80px; top: 50px; animation-duration: 38s; } .c2 { width: 64px; top: 100px; animation-duration: 52s; animation-delay: -20s; }
.c3 { width: 96px; top: 24px; animation-duration: 64s; animation-delay: -40s; }
.scene.night .cloud { opacity: .18; }
@keyframes drift { from { transform: translateX(-140px); } to { transform: translateX(560px); } }
.hill { position: absolute; border-radius: 50%; }
.h1 { width: 420px; height: 200px; left: -120px; bottom: -110px; background: #5fc77e; }
.h2 { width: 380px; height: 180px; right: -140px; bottom: -100px; background: #4fb56e; }
.scene.night .h1 { background: #2e5f4a; } .scene.night .h2 { background: #274f3e; }
.grass { position: absolute; left: 0; right: 0; bottom: 0; height: 54px;
  background: repeating-linear-gradient(90deg, #6bd68a 0 16px, #62cc81 16px 32px); border-top: 5px solid #8be6a2; }
.scene.night .grass { background: repeating-linear-gradient(90deg, #335f4b 0 16px, #2f5846 16px 32px); border-top-color: #3f7a60; }
.scene .pet { bottom: 34px; width: 180px; height: 180px; z-index: 2; }
.scene .bubble { top: 16px; z-index: 3; }
.fx { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.float { position: absolute; font-size: 22px; animation: floatUp 1.8s ease-out forwards; }
@keyframes floatUp { from { transform: translateY(0) scale(.6); opacity: 0; } 20% { opacity: 1; transform: translateY(-20px) scale(1); }
  to { transform: translateY(-140px) scale(1.1); opacity: 0; } }

/* 兩側浮動按鈕 */
.side { position: absolute; top: 64px; display: flex; flex-direction: column; gap: 12px; z-index: 5; }
.side.left { left: 10px; } .side.right { right: 10px; }
.sbtn { position: relative; width: 56px; height: 58px; border-radius: 16px; border: 3px solid #0e0a1c; cursor: pointer;
  background: linear-gradient(#fff 0 6%, #ffe08a 6%, #f6b737); box-shadow: 0 4px 0 #0e0a1c; font-size: 22px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0; }
.sbtn span { font-size: 11px; font-weight: 900; color: #3a2400; margin-top: 1px; }
.sbtn:active { transform: translateY(3px); box-shadow: 0 1px 0 #0e0a1c; }
.sbtn:disabled { filter: grayscale(.7) brightness(.85); }
.dot { position: absolute; top: -6px; right: -6px; width: 16px; height: 16px; border-radius: 50%; background: #ff3b5c;
  border: 2px solid #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { transform: scale(1.25); } }

/* 狀態條 */
.statbars { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 14px 0 4px; }
.sbar { display: flex; align-items: center; gap: 6px; }
.sbar-col { flex: 1; min-width: 0; }
.sbar-col small { display: block; font-size: 11px; font-weight: 800; color: var(--muted); margin-bottom: 2px; }
.sbar i { font-style: normal; font-size: 18px; width: 28px; height: 28px; flex: none; display: grid; place-items: center; background: #120d22;
  border-radius: 50%; border: 2px solid #3b2f6e; }
.sbar .track { height: 14px; border-radius: 8px; border: 2px solid #0e0a1c; background: #120d22; }
.fill { background-image: linear-gradient(rgba(255,255,255,.35) 0 35%, transparent 35%); }

/* 面板 */
.panel { position: relative; background: linear-gradient(#352a66, #2a2152); border: 3px solid #0e0a1c; border-radius: 20px;
  padding: 22px 14px 14px; margin: 18px 0; box-shadow: 0 5px 0 #0e0a1c, inset 0 2px 0 rgba(255,255,255,.12); }
.panel-title { position: absolute; top: -13px; left: 14px; background: linear-gradient(#b58cff, #7d55e0); color: #fff; font-weight: 900;
  font-size: 13px; padding: 3px 14px; border-radius: 10px; border: 2px solid #0e0a1c; box-shadow: 0 2px 0 #0e0a1c; }
.panel .big { font-size: 34px; font-weight: 900; color: var(--gold); text-shadow: -1px -1px 0 #3a2400, 1px -1px 0 #3a2400, -1px 1px 0 #3a2400, 1px 1px 0 #3a2400, 0 3px 0 #0e0a1c; }
.evo { margin-top: 10px; } .evo .track { height: 12px; border-radius: 8px; border: 2px solid #0e0a1c; }
.evo-fill { background-color: #ff8fb8; }
.card { border: 3px solid #0e0a1c; box-shadow: 0 4px 0 #0e0a1c; }

/* 按鈕 */
.btn { border: 3px solid #0e0a1c; box-shadow: 0 4px 0 #0e0a1c; font-weight: 900; text-shadow: 0 1px 0 rgba(0,0,0,.25); }
.btn.primary { background: linear-gradient(#fff2a8 0 8%, #ffd25e 8%, #f6a823); box-shadow: 0 4px 0 #0e0a1c; text-shadow: none; }
.btn.wide { width: 100%; margin-top: 10px; }

/* 底部導覽 */
.tabbar { background: linear-gradient(#2a2152, #160f2c); border-top: 3px solid #0e0a1c; }
.tabbar button { position: relative; flex: 1; }
.tabbar button.center b { display: grid; place-items: center; width: 62px; height: 62px; margin-top: -30px; border-radius: 50%; font-size: 28px;
  background: linear-gradient(#fff2a8 0 8%, #ffd25e 8%, #f6a823); border: 3px solid #0e0a1c; box-shadow: 0 4px 0 #0e0a1c; }
.tabbar .dot { top: 0; right: calc(50% - 22px); }

/* 遊戲對話框 */
.game-dlg { border: 3px solid #0e0a1c; border-radius: 24px; background: linear-gradient(#3d3075, #2a2152); padding: 34px 18px 18px;
  box-shadow: 0 6px 0 #0e0a1c; overflow: visible; }
.ribbon { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); background: linear-gradient(#ff8fb8, #e0457a); color: #fff;
  font-weight: 900; font-size: 18px; padding: 6px 26px; border-radius: 12px; border: 3px solid #0e0a1c; white-space: nowrap; box-shadow: 0 3px 0 #0e0a1c; }

/* 升級彩帶 */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 20; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 2px; animation: fall 1.8s ease-in forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ===================================================================== 族群地圖 */
.map-mode, .lands { justify-content: center; }
.chip { border: 3px solid #0e0a1c; border-radius: 999px; background: #2a2152; color: var(--muted); font-weight: 900; font-size: 13px;
  padding: 6px 12px; box-shadow: 0 3px 0 #0e0a1c; cursor: pointer; }
.chip.active { background: linear-gradient(#fff2a8 0 8%, #ffd25e 8%, #f6a823); color: #3a2400; }
.world { position: relative; border-radius: 26px; padding: 16px 10px; border: 3px solid #0e0a1c; box-shadow: 0 6px 0 #0e0a1c;
  background: radial-gradient(circle at 20% 15%, #3aa0d8 0 2px, transparent 3px) 0 0/46px 46px,
              radial-gradient(circle at 70% 60%, #3aa0d8 0 2px, transparent 3px) 0 0/58px 58px,
              linear-gradient(#2a7fc0, #1d5e99); }
.island { position: relative; margin: 14px 2px 22px; padding: 26px 10px 12px; border-radius: 34px 26px 38px 24px;
  background: linear-gradient(#f3e3a6, #e6cf86); border: 3px solid #0e0a1c; box-shadow: 0 6px 0 rgba(0,0,0,.35), inset 0 0 0 6px rgba(120,200,110,.55); }
.island:nth-child(even) { border-radius: 26px 38px 24px 34px; }
.island-name { position: absolute; top: -15px; left: 16px; font-weight: 900; font-size: 13px; color: #fff; padding: 3px 12px;
  border-radius: 10px; border: 2px solid #0e0a1c; box-shadow: 0 2px 0 #0e0a1c; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tile { position: relative; border: 3px solid #0e0a1c; border-radius: 16px; padding: 8px 4px 6px; text-align: center; cursor: pointer;
  box-shadow: 0 4px 0 #0e0a1c; color: #1b1530; min-height: 86px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.tile:active { transform: translateY(3px); box-shadow: 0 1px 0 #0e0a1c; }
.tile .em { font-size: 26px; line-height: 1; }
.tile .nm { font-size: 11px; font-weight: 900; margin-top: 3px; line-height: 1.15; }
.tile .vl { font-size: 13px; font-weight: 900; margin-top: 2px; }
.tile .flags { position: absolute; top: -9px; right: -6px; display: flex; gap: 2px; }
.tile .flags span { background: #fff; border: 2px solid #0e0a1c; border-radius: 9px; font-size: 10px; font-weight: 900; padding: 0 4px; }
.tile.mine::after { content: "★"; position: absolute; top: -10px; left: -6px; background: var(--gold); border: 2px solid #0e0a1c;
  border-radius: 50%; width: 20px; height: 20px; font-size: 12px; display: grid; place-items: center; }

/* 族群分析頁 */
.sec-hero { display: flex; align-items: center; gap: 12px; }
.sec-hero .em { font-size: 44px; } .sec-hero .nm { font-size: 22px; font-weight: 900; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kv div { background: #120d22; border: 2px solid #3b2f6e; border-radius: 12px; padding: 8px 6px; text-align: center; }
.kv b { display: block; font-size: 17px; font-weight: 900; } .kv small { color: var(--muted); font-size: 11px; font-weight: 700; }
.flowbar { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 13px; font-weight: 800; }
.flowbar .lbl { width: 72px; color: var(--muted); }
.flowbar .axis { flex: 1; position: relative; height: 16px; background: #120d22; border-radius: 8px; border: 2px solid #0e0a1c; overflow: hidden; }
.flowbar .axis::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: #3b2f6e; }
.flowbar .bar { position: absolute; top: 0; bottom: 0; }
.flowbar .val { width: 72px; text-align: right; }
.rank-spark svg { width: 100%; height: 70px; }
.mlist .item { padding: 8px 10px; }
.warn-box { background: #4a2a14; border: 2px solid #ff9d5c; border-radius: 12px; padding: 8px 10px; font-size: 13px; margin-top: 8px; }

/* ===================================================================== 帳本 */
#tab-ledger .topbar { justify-content: space-between; }
.cat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 10px 0; }
.cat { border: 3px solid #0e0a1c; border-radius: 14px; background: #2a2152; color: var(--text); padding: 6px 2px; text-align: center;
  font-size: 11px; font-weight: 800; cursor: pointer; box-shadow: 0 3px 0 #0e0a1c; }
.cat i { display: block; font-style: normal; font-size: 22px; }
.cat.active { background: linear-gradient(#fff2a8 0 8%, #ffd25e 8%, #f6a823); color: #3a2400; }
.big-amt { font-size: 28px !important; font-weight: 900; text-align: center; margin: 8px 0; }
#ledgerDlg input, #tradeDlg input, #recurDlg input, #recurDlg select { margin: 6px 0; }
.seg.kind { justify-content: center; }
.donut-wrap { display: flex; justify-content: center; } .donut-wrap svg { width: 180px; height: 180px; }
.catrow { display: flex; align-items: center; gap: 8px; margin: 7px 0; font-size: 14px; }
.catrow .ic { width: 26px; text-align: center; font-size: 18px; } .catrow .nm { width: 44px; font-weight: 800; }
.catrow .track { flex: 1; height: 12px; border-radius: 7px; border: 2px solid #0e0a1c; }
.catrow .am { width: 74px; text-align: right; font-weight: 800; } .catrow .cmp { width: 54px; text-align: right; font-size: 12px; }
.budget { margin: 8px 0; } .budget .top { display: flex; justify-content: space-between; font-size: 13px; font-weight: 800; }
.budget .track { height: 16px; border-radius: 9px; border: 2px solid #0e0a1c; margin-top: 3px; }
.trend { display: flex; align-items: flex-end; gap: 8px; height: 140px; padding-top: 10px; }
.trend .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.trend .bars { display: flex; align-items: flex-end; gap: 3px; height: 100%; }
.trend .b { width: 12px; border-radius: 5px 5px 0 0; border: 2px solid #0e0a1c; border-bottom: 0; }
.trend .m { font-size: 11px; color: var(--muted); margin-top: 4px; font-weight: 800; }
.dayhead { margin: 12px 2px 4px; font-size: 12px; font-weight: 800; color: var(--muted); display: flex; justify-content: space-between; }
.spend { color: #ff9d5c; } .earn { color: #7cc4ff; }

/* ===================================================================== 手遊首頁版面（原創美術） */
.home { --ink: #0b0820; }
.topres { display: flex; gap: 6px; padding-top: 10px; }
.rbar { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 6px 10px; border-radius: 12px; cursor: pointer;
  background: linear-gradient(#141033, #221a4d); border: 3px solid var(--ink); box-shadow: inset 0 2px 0 rgba(255,255,255,.08); }
.rbar small { font-size: 10px; font-weight: 800; color: var(--muted); line-height: 1.2; }
.rbar b { font-size: 15px; font-weight: 900; color: #fff; text-shadow: 0 2px 0 var(--ink); line-height: 1.25; }
.rbar b.up { color: #ff8b9a; } .rbar b.down { color: #6ff0a6; }
.rico { position: absolute; left: -6px; top: 50%; transform: translateY(-50%); font-size: 26px; filter: drop-shadow(0 2px 0 var(--ink)); }
.rplus { margin-left: 4px; color: #fff; font-weight: 900; font-size: 18px; cursor: pointer; }

.banner-row { display: flex; gap: 8px; margin: 12px 0 8px; align-items: stretch; }
.profile { flex: 1.25; position: relative; display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 8px; border-radius: 18px;
  padding-left: 12px; background: linear-gradient(100deg, #ff7a59, #ff4f8b 60%, #b84bff); border: 3px solid var(--ink);
  box-shadow: 0 4px 0 var(--ink); }
.profile .avatar-ring { width: 58px; height: 58px; }
.pinfo { flex: 1; min-width: 0; }
.pinfo #petName { font-size: 19px; font-weight: 900; color: #fff; text-shadow: -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink), 1px 1px 0 var(--ink), 0 2px 0 var(--ink); }
.pstage { display: inline-block; margin-top: 3px; font-size: 11px; font-weight: 900; color: #fff; background: rgba(11,8,32,.45); padding: 1px 8px; border-radius: 6px; }
.medal { width: 46px; height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 40% 30%, #fff6c9, #ffcc3d 55%, #d48a00); border: 3px solid var(--ink); border-radius: 50% 50% 46% 46%;
  box-shadow: 0 3px 0 var(--ink); color: #3a2400; line-height: 1; }
.medal span { font-size: 10px; font-weight: 900; } .medal b { font-size: 18px; font-weight: 900; }
.right-col { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.sq-row { display: flex; gap: 6px; justify-content: flex-end; }
.sq { position: relative; width: 44px; height: 44px; border-radius: 10px; font-size: 22px; cursor: pointer;
  background: linear-gradient(#4d63e6, #2c3fb0); border: 3px solid var(--ink); box-shadow: 0 3px 0 var(--ink), inset 0 2px 0 rgba(255,255,255,.3); }
.pass { position: relative; border-radius: 12px; padding: 4px 8px 6px; cursor: pointer;
  background: linear-gradient(#ffe48a, #f5b632); border: 3px solid var(--ink); box-shadow: 0 3px 0 var(--ink); }
.pass-title { font-size: 12px; font-weight: 900; color: #6b3d00; }
.pass-bar { display: flex; align-items: center; gap: 6px; }
.pass-bar .track { flex: 1; height: 14px; border-radius: 8px; border: 2px solid var(--ink); background: #5a3600; }
.pass-bar span { font-size: 12px; font-weight: 900; color: #3a2400; }

/* 中央舞台（聚光燈） */
.arena { position: relative; height: 360px; border-radius: 26px; overflow: hidden; border: 3px solid var(--ink); box-shadow: 0 6px 0 var(--ink);
  background: var(--bg); } /* 場景由 scenery.js 載入後才畫上去；載入前先用頁面底色，不露出舊紫粉漸層 */
.arena.night { filter: saturate(.85) brightness(.85); }
.spot { position: absolute; top: -40px; width: 120px; height: 420px; background: linear-gradient(rgba(255,255,255,.35), transparent 80%); filter: blur(6px); }
.spot.s1 { left: 18%; transform: rotate(18deg); animation: sweep 6s ease-in-out infinite alternate; }
.spot.s2 { right: 18%; transform: rotate(-18deg); animation: sweep 7s ease-in-out infinite alternate-reverse; }
@keyframes sweep { to { transform: rotate(-6deg); } }
.pedestal { position: absolute; left: 50%; bottom: 46px; width: 220px; height: 64px; transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(ellipse at 50% 35%, #8a7bff, #4a33c9 60%, #2a1d80); border: 4px solid var(--ink); box-shadow: 0 8px 0 var(--ink); }
.arena .pet { bottom: 76px; width: 190px; height: 190px; z-index: 2; }
.arena .bubble { top: 14px; z-index: 6; max-width: 84%; font-size: 14px; }
.nameplate { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 3; padding: 6px 26px; border-radius: 12px;
  font-size: 22px; font-weight: 900; color: #fff; text-shadow: -1.5px -1.5px 0 var(--ink), 1.5px -1.5px 0 var(--ink), -1.5px 1.5px 0 var(--ink), 1.5px 1.5px 0 var(--ink), 0 3px 0 var(--ink);
  background: linear-gradient(#ffe48a, #f0a91f); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink); white-space: nowrap;
  clip-path: polygon(6% 0, 94% 0, 100% 50%, 94% 100%, 6% 100%, 0 50%); }
.arena .side { top: 28px; gap: 14px; }
.rbtn { position: relative; width: 64px; height: 64px; border-radius: 50%; font-size: 28px; cursor: pointer; display: flex; flex-direction: column;
  align-items: center; justify-content: center; background: radial-gradient(circle at 40% 30%, #9fd8ff, #3a8ef0 55%, #1d4fb0);
  border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink), inset 0 0 0 3px rgba(255,255,255,.35); }
.rbtn span { position: absolute; bottom: -16px; font-size: 11px; font-weight: 900; color: #fff; white-space: nowrap;
  text-shadow: -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink), 1px 1px 0 var(--ink), 0 2px 0 var(--ink); }
.rbtn:active, .sq:active, .act-main:active, .act-card:active, .act-ticket:active { transform: translateY(3px); }

/* 大按鈕列 */
.action-row { display: flex; align-items: stretch; gap: 8px; margin: 12px 0 8px; filter: drop-shadow(0 4px 0 var(--ink)); }
.act-main { flex: 1; height: 62px; border: 3px solid var(--ink); border-radius: 18px; cursor: pointer; font-size: 24px; font-weight: 900; color: #fff;
  text-shadow: -1.5px -1.5px 0 var(--ink), 1.5px -1.5px 0 var(--ink), -1.5px 1.5px 0 var(--ink), 1.5px 1.5px 0 var(--ink), 0 3px 0 var(--ink); letter-spacing: 2px;
  background: linear-gradient(#fff3a6 0 10%, #ffcf3a 10%, #f2a10f); box-shadow: inset 0 -6px 0 rgba(150,80,0,.35); }
.act-ticket { width: 88px; border-radius: 18px; background: linear-gradient(#4d63e6, #2c3fb0); border: 3px solid var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 22px; cursor: pointer; }
.act-card small, .act-ticket small { font-size: 11px; font-weight: 900; color: #fff; text-shadow: -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink), 1px 1px 0 var(--ink), 0 1px 0 var(--ink); }

/* 底部導覽列：圖示磚 */
.tabbar { padding: 0 0 env(safe-area-inset-bottom); background: #2b3e8f; border-top: 3px solid var(--ink, #0b0820); }
.tabbar button { height: 64px; justify-content: center; font-size: 30px; border-right: 2px solid rgba(0,0,0,.25);
  background: linear-gradient(#3e56b8, #2b3e8f); filter: saturate(.8); }
.tabbar button span { display: none; }
.tabbar button.active { filter: none; background: linear-gradient(#6f8cff, #3e56b8); transform: translateY(-6px); border-radius: 12px 12px 0 0; }
.tabbar button.active span { display: block; color: #fff; text-shadow: -1px -1px 0 #0b0820, 1px -1px 0 #0b0820, -1px 1px 0 #0b0820, 1px 1px 0 #0b0820, 0 2px 0 #0b0820; }
.tabbar button.center b { width: 58px; height: 58px; margin-top: -26px; }
.tabbar button.center span { display: block; color: #fff; }
/* 調整：不暗化舞台 */
.arena.night { filter: none; }
.arena { height: 290px; }
.arena .pet { bottom: 60px; width: 165px; height: 165px; }
.pedestal { bottom: 36px; width: 190px; height: 52px; }
.event { margin-top: 10px; }
.action-row { margin-top: 10px; }
.banner-row { margin: 10px 0 8px; }

/* ===================================================================== 底部功能切換（圖示＋文字永遠清楚） */
.swipe-nav { display: flex; padding: 0 0 env(safe-area-inset-bottom); background: #24357f; border-top: 3px solid #0b0820; gap: 0; }
.swipe-nav button { position: relative; flex: 1; height: 66px; padding: 4px 0; border: 0; border-right: 2px solid #1a2766; cursor: pointer;
  background: linear-gradient(#3d55b5, #2a3c8f); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  transition: flex .2s, background .2s; filter: none; transform: none; border-radius: 0; }
.swipe-nav button b { font-size: 26px; line-height: 1; filter: drop-shadow(0 2px 0 #0b0820); transition: transform .2s; }
.swipe-nav button span { display: block; font-size: 11px; font-weight: 800; color: #cfe0ff; }
.swipe-nav button.active { flex: 1.25; background: linear-gradient(#7a95ff, #4560c9); transform: none; border-radius: 0; }
.swipe-nav button.active b { transform: scale(1.1); }
.swipe-nav button.active span { font-size: 12px; font-weight: 900; color: #fff;
  text-shadow: -1px -1px 0 #0b0820, 1px -1px 0 #0b0820, -1px 1px 0 #0b0820, 1px 1px 0 #0b0820, 0 2px 0 #0b0820; }
.swipe-nav .dot { top: 6px; right: 10px; }

/* 頁面滑入動畫 */
.tab.slide-left { animation: inFromRight .28s ease-out; }
.tab.slide-right { animation: inFromLeft .28s ease-out; }
@keyframes inFromRight { from { transform: translateX(40%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes inFromLeft { from { transform: translateX(-40%); opacity: 0; } to { transform: none; opacity: 1; } }
html, body { overflow-x: hidden; }

/* 右上快報方塊（主要快報入口）＋更新倒數 */
.news-sq { width: auto !important; padding: 0 12px; display: flex; align-items: center; gap: 4px; font-size: 18px !important;
  background: linear-gradient(#5a74ff, #3346c4) !important; }
.news-sq span { font-size: 13px; font-weight: 900; color: #fff; }
.news-sq small { position: absolute; bottom: -16px; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 800; color: var(--muted);
  white-space: nowrap; text-shadow: none; }
.sq-row { margin-bottom: 14px; }
.ledger-add { width: 100%; border-radius: 16px; height: 58px; font-size: 22px; margin: 4px 0 6px; box-shadow: 0 4px 0 #0b0820; }
.statbars { grid-template-columns: 1fr 1fr; }
.subs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.sub-add { display: flex; gap: 6px; align-items: center; }
.sub-add button { white-space: nowrap; flex: none; }
.hits button { width: 100%; display: flex; justify-content: space-between; gap: 8px; text-align: left; color: var(--text); font: inherit; margin: 4px 0; }
.gauges { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin: 10px 0; text-align: center; }
.gauge svg { width: 100%; max-width: 130px; } .gauge text { font-size: 19px; font-weight: 900; fill: currentColor; }
.gauge b { display: block; font-size: 12px; } .gauge small { color: var(--muted); font-size: 11px; }
.vix-tag { display: inline-block; padding: 1px 6px; border-radius: 6px; color: #1b1530; font-weight: 900; font-size: 10px; }
.pnl-chart svg { width: 100%; height: 90px; } .pnl-chart line { stroke: var(--muted); stroke-width: .5; }
.pnl-chart rect.up { fill: var(--up); } .pnl-chart rect.down { fill: var(--down); }
/* 大陸：不規則海岸線的一整塊陸地，區域畫在上面 */
.continent { position: relative; margin: 6px 0; padding: 34px 6px 18px; border: 4px solid #6b3f1d; background: #d9c98a;
  border-radius: 90px 40px 110px 55px / 60px 90px 50px 100px; box-shadow: 0 0 0 7px rgba(255,255,255,.35), 0 10px 0 7px rgba(0,0,0,.18); }
.world.us .continent { border-radius: 45px 110px 50px 120px / 90px 55px 110px 60px; background: #d8b98a; }
.land-name { position: absolute; top: 8px; left: 0; right: 0; text-align: center; font-weight: 900; color: #4a2a0a; }
.continent .island { margin: 20px 4px 14px; }
#mapQ { width: 100%; box-sizing: border-box; margin-bottom: 8px; padding: 10px 14px; border-radius: 14px; border: 2px solid #6b3f1d; font-size: 16px; background: #fff8e6; color: #3a2208; }
#mapHits:not(:empty) { margin-bottom: 10px; max-height: 50vh; overflow-y: auto; }
#mapHits button { display: block; width: 100%; text-align: left; line-height: 1.6; }
.stock-price { font-size: 30px; font-weight: 900; margin-top: 6px; }
.stock-price small { font-size: 16px; }
.stock-chart { width: 100%; background: #fff8e6; border-radius: 12px; margin-top: 8px; }
.stock-chart text { font-size: 10px; fill: #6b3f1d; }
table.inst { width: 100%; border-collapse: collapse; margin: 6px 0 10px; font-size: 14px; }
table.inst th, table.inst td { text-align: right; padding: 4px 2px; border-bottom: 1px solid rgba(0,0,0,.12); }
.item[data-stock] { cursor: pointer; }
.blk-row { display: flex; gap: 8px; justify-content: space-between; margin: 4px 0; }
#blockDlg .subs { flex-wrap: wrap; margin: 6px 0; }
#blkHits button { display: block; width: 100%; text-align: left; }
#secEditCodes, #secEditHits { max-height: 28vh; overflow-y: auto; }
#secEditHits button:disabled { opacity: .55; cursor: default; }
.sec-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
#kline.kchip { height: 660px; }
.kl-read { font-size: 12px; line-height: 1.55; padding: 8px 10px; margin-top: 8px; background: #fff; border-radius: 12px; color: #5a4636; min-height: 4.6em; font-variant-numeric: tabular-nums; }
.kl-read .up { color: #e0334c; font-weight: 700; } .kl-read .down { color: #1d9e55; font-weight: 700; }
.kl-read .m5 { color: #e8891c; } .kl-read .m20 { color: #7a5cd6; } .kl-read .m60 { color: #2f6fe0; } .kl-read .sub-ind { color: #8a7a6a; }
#kline { height: 380px; background: #fff; border-radius: 12px; margin: 6px 0 8px; touch-action: none; }
.ocr-pick { display: block; text-align: center; margin: 8px 0 4px; }
.ico { width: 1.2em; height: 1.2em; vertical-align: -0.22em; display: inline-block; flex: none; filter: url(#icoSoft); }
/* iOS WebKit 會把套 SVG 濾鏡的元素用 1x 光柵化，Retina 上整排圖示變糊；iOS 上關掉濾鏡 */
@supports (-webkit-touch-callout: none) { .ico { filter: none; } }
.avatar .ico { width: 72%; height: 72%; }
.sq .ico { width: 24px; height: 24px; vertical-align: middle; }
.news-sq .ico { width: 20px; height: 20px; }
.sbar i .ico { width: 19px; height: 19px; }
.act-ticket .ico { width: 26px; height: 26px; }
.swipe-nav button b .ico { width: 27px; height: 27px; display: block; }
.stage-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 10px; }
.stage-row { display: flex; align-items: center; gap: 8px; }
.stage-row img { width: 32px; height: 32px; object-fit: contain; flex: none; background: rgba(255,255,255,.55); border-radius: 10px; padding: 2px; }
.stage-amt { width: 46px; font-size: 12px; opacity: .75; text-align: right; flex: none; }
.stage-row input { flex: 1; min-width: 0; padding: 7px 10px; border-radius: 10px; border: 1.5px solid rgba(107,63,29,.35); background: rgba(255,255,255,.85); color: inherit; font: inherit; }
.profile { cursor: pointer; }
.avatar img, .avatar svg { width: 84%; height: 84%; object-fit: contain; display: block; }
.pet-svg { position: relative; width: 100%; height: 100%; display: block; overflow: visible; }
.stage-row svg { width: 32px; height: 32px; flex: none; background: rgba(255,255,255,.55); border-radius: 10px; padding: 2px; }
.farm-yard { position: absolute; inset: 0; pointer-events: none; }
.farm-buddy { position: absolute; pointer-events: auto; cursor: pointer; background: none; border: 0; padding: 0; }
.farm-buddy .art { display: block; width: 100%; height: 100%; transform-origin: 50% 90%; }
.farm-buddy img, .farm-buddy svg { width: 100%; height: 100%; object-fit: contain; display: block; }
.pet-pick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 8px; }
.pet-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 8px; border-radius: 16px; border: 2px solid rgba(94,58,34,.24); background: rgba(255,251,245,.62); color: inherit; font: inherit; cursor: pointer; text-align: center; }
.pet-card img, .pet-card svg { width: 68px; height: 68px; object-fit: contain; display: block; }
.pet-card b { font-size: 14px; font-weight: 900; }
.pet-card small { font-size: 11px; opacity: .78; line-height: 1.25; }
.pet-card .farm-tag { font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 999px; background: #dcebd5; color: #36693a; }
.pet-card .farm-tag.locked { background: rgba(94,58,34,.11); color: #7e6354; }
.pet-card.active { border-color: #5e3a22; background: #f6e2a6; box-shadow: 0 3px 0 #d5c3b2; }
.cat i .ico { width: 24px; height: 24px; }
.tile .em .ico { width: 28px; height: 28px; }
.sec-hero .em .ico { width: 42px; height: 42px; }

/* ── 走動農場（farm.js 控制位置與大小） ── */
.arena .actor { transform: translateX(-50%); transition-property: left, bottom; transition-timing-function: linear; cursor: pointer; }
.arena .pedestal { display: none; }
.turn { position: relative; display: block; width: 100%; height: 100%; transform-origin: 50% 75%; transition: transform .18s ease-out; }
.actor.left .turn { transform: scaleX(-1); }
.actor.walking .turn { transform: rotate(5deg); }
.actor.left.walking .turn { transform: scaleX(-1) rotate(5deg); }
.actor.walking .art, .arena .actor.walking .body-grp { animation: waddle .44s ease-in-out infinite; }
.actor.jump .art, .arena .actor.jump .body-grp { animation: fjump .7s ease-out; }
.actor.nap .art, .arena .actor.nap .body-grp { animation: nap 2.4s ease-in-out infinite; }
.actor.munch .art, .arena .actor.munch .body-grp { animation: munch .35s ease-in-out infinite; }
@keyframes waddle { 0%, 100% { transform: translateY(0) rotate(-5deg); } 50% { transform: translateY(-6px) rotate(5deg); } }
@keyframes fjump { 0%, 100% { transform: translateY(0) scale(1); } 20% { transform: scale(1.1, .88); } 55% { transform: translateY(-22px) scale(.95, 1.07); } }
@keyframes nap { 0%, 100% { transform: scale(1.04, .9); } 50% { transform: scale(1.07, .86); } }
@keyframes munch { 0%, 100% { transform: rotate(0) scale(1); } 50% { transform: rotate(7deg) scale(1.05, .92); } }
.emote { position: absolute; left: 50%; bottom: 96%; transform: translateX(-50%); white-space: nowrap; pointer-events: none;
  background: #fffbf5; color: #4d3120; border: 2px solid #5e3a22; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 800; }
.food { position: absolute; width: 24px; height: 24px; transform: translateX(-50%); pointer-events: none; animation: fjump .6s ease-out; }
.food svg { width: 100%; height: 100%; }
.arena .bubble { z-index: 300; pointer-events: none; }
.arena .nameplate, .arena .side { z-index: 301; }
.arena .fx { z-index: 302; }
@media (prefers-reduced-motion: reduce) { .arena .actor .art, .arena .actor .body-grp, .food { animation: none; } }

/* ── 時段場景（scenery.js）：只在繪本主題顯示 ── */
.tod-sky, .tod-land, .tod-glow { display: none; }
.kawaii .tod-sky, .kawaii .tod-land, .kawaii .tod-glow, .village .tod-sky, .village .tod-land, .village .tod-glow { display: block; position: absolute; inset: 0; pointer-events: none; }
.tod-sky { z-index: 0; background: linear-gradient(var(--s1), var(--s2) 55%, var(--s3)); transition: background 1s; overflow: hidden; }
.tod-land { z-index: 1; filter: brightness(var(--bri)) saturate(var(--sat)); }
.tod-land svg { width: 100%; height: 100%; display: block; }
.tod-glow { z-index: 2; background: var(--glow); }
.arena .farm-yard { z-index: 3; }
.tod-sun, .tod-moon { position: absolute; border-radius: 50%; border: 2px solid #5e3a22; transition: all 1s; }
.tod-sun { width: 46px; height: 46px; left: var(--sx); top: var(--sy); opacity: var(--sunO);
  background: radial-gradient(circle at 36% 32%, #fffbe6 0, var(--sunc) 58%, color-mix(in srgb, var(--sunc) 80%, #e8863c) 100%); }
/* 陽光：柔和的漸層光暈＋模糊的放射光芒（取代原本硬邊的圓環） */
.tod-sun::before { content: ""; position: absolute; inset: -95%; border-radius: 50%; z-index: -1; pointer-events: none;
  background: radial-gradient(circle, var(--halo) 0, var(--halo) 22%, transparent 68%); filter: blur(5px); }
.tod-sun::after { content: ""; position: absolute; inset: -80%; border-radius: 50%; z-index: -1; pointer-events: none; opacity: .75;
  background: repeating-conic-gradient(from 0deg, var(--halo) 0 9deg, transparent 9deg 30deg);
  -webkit-mask: radial-gradient(circle, transparent 28%, #000 36%, transparent 72%); mask: radial-gradient(circle, transparent 28%, #000 36%, transparent 72%);
  filter: blur(3px); animation: sunspin 90s linear infinite; }
@keyframes sunspin { to { transform: rotate(360deg); } }
.tod-moon { width: 34px; height: 34px; left: 74%; top: 12%; background: #fdf3c9; box-shadow: inset -8px -3px 0 #e8d79a, 0 0 18px rgba(255,244,200,.55); opacity: var(--moonO); }
.tod-stars { position: absolute; inset: 0; opacity: var(--starO); transition: opacity 1s; }
.tod-stars i { position: absolute; width: 3px; height: 3px; background: #fff7d6; border-radius: 50%; animation: twinkle 2.4s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .25; transform: scale(.7); } }
.tod-cloud { position: absolute; height: 18px; border-radius: 99px; background: var(--cloud); border: 2px solid #8e7460; opacity: .95; animation: drift 60s linear infinite; }
.tod-cloud::before { content: ""; position: absolute; left: 14px; top: -12px; width: 24px; height: 20px; border-radius: 50%; background: var(--cloud); border: 2px solid #8e7460; border-bottom: 0; }
.tod-cloud.c1 { width: 64px; top: 38%; left: 14%; }
.tod-cloud.c2 { width: 50px; top: 30%; left: 52%; animation-duration: 80s; animation-delay: -30s; transform: scale(.85); }
.tod-cloud.c2::before { left: 6px; width: 20px; height: 16px; }
.tod-cloud.c2::after { content: ""; position: absolute; right: 6px; top: -9px; width: 16px; height: 14px; border-radius: 50%; background: var(--cloud); border: 2px solid #8e7460; border-bottom: 0; }
.tod-cloud.c3 { width: 56px; top: 44%; left: 64%; animation-duration: 95s; animation-delay: -55s; opacity: .8; }
.tod-cloud.c3::before { left: 28px; width: 22px; height: 18px; }
@keyframes drift { from { translate: -12px 0; } to { translate: 40px 0; } }
.smoke { animation: puff 3s ease-in-out infinite; }
@keyframes puff { 50% { transform: translateY(-4px); opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .tod-cloud, .tod-stars i, .smoke, .tod-sun::after { animation: none; } }

.tod-dawn    { --s1:#9fb7e0; --s2:#f4c2c4; --s3:#fde6c4; --far:#b9a8cf; --mid:#cfd9b0; --near:#c6dca8; --leaf1:#a8c58c; --leaf2:#e3a9b6; --leaf3:#c9dca6; --water:#f3cfd2; --win:#ffe6a0; --bri:.97; --sat:.95; --glow:rgba(255,190,170,.14); --sx:12%; --sy:46%; --sunc:#ffd9a0; --halo:rgba(255,217,160,.5); --sunO:1; --moonO:0; --starO:0; --cloud:#ffe9e4; }
.tod-morning { --s1:#8ccbe6; --s2:#c7e8ef; --s3:#fdf5dc; --far:#b4cbd8; --mid:#bfe0a8; --near:#b6dc9a; --leaf1:#92c885; --leaf2:#f0adbc; --leaf3:#bfe2a4; --water:#a9dbe8; --win:#e9f3f5; --bri:1.02; --sat:1.05; --glow:rgba(255,255,255,0); --sx:5%; --sy:34%; --sunc:#ffe587; --halo:rgba(255,229,135,.45); --sunO:1; --moonO:0; --starO:0; --cloud:#fff; }
.tod-noon    { --s1:#6fc0ea; --s2:#a9dcf2; --s3:#e6f6fb; --far:#9fc0d8; --mid:#b2dc94; --near:#a5d684; --leaf1:#82c46f; --leaf2:#f2a5b4; --leaf3:#b2e096; --water:#8fd3ea; --win:#dff0f6; --bri:1.05; --sat:1.12; --glow:rgba(255,255,255,0); --sx:80%; --sy:9%; --sunc:#fff0a0; --halo:rgba(255,240,160,.5); --sunO:1; --moonO:0; --starO:0; --cloud:#fff; }
.tod-golden  { --s1:#8fbfe0; --s2:#f7dfaa; --s3:#ffe9b8; --far:#c4b6a6; --mid:#d4d98e; --near:#c8d482; --leaf1:#b4c474; --leaf2:#f0a98a; --leaf3:#d8dc8e; --water:#f5d596; --win:#ffe49a; --bri:1; --sat:1.08; --glow:rgba(255,196,110,.16); --sx:80%; --sy:30%; --sunc:#ffc872; --halo:rgba(255,200,114,.45); --sunO:1; --moonO:0; --starO:0; --cloud:#fff1d2; }
.tod-dusk    { --s1:#4d4d99; --s2:#d77c8f; --s3:#ffb77c; --far:#8a7aa8; --mid:#9aa57e; --near:#8a9c6c; --leaf1:#7d9a66; --leaf2:#c98a96; --leaf3:#a7b583; --water:#e0968c; --win:#ffd36a; --bri:.82; --sat:.95; --glow:rgba(255,120,110,.16); --sx:84%; --sy:56%; --sunc:#ff9a6c; --halo:rgba(255,154,108,.45); --sunO:1; --moonO:.35; --starO:.35; --cloud:#f3b4b0; }
.tod-night   { --s1:#0f1b3f; --s2:#27396f; --s3:#4a5c93; --far:#51608f; --mid:#4c6a6f; --near:#3f5e5f; --leaf1:#3d6354; --leaf2:#6a5578; --leaf3:#547968; --water:#2d4a86; --win:#ffd36a; --bri:.62; --sat:.85; --glow:rgba(30,40,110,.18); --sx:50%; --sy:120%; --sunc:#fff; --halo:transparent; --sunO:0; --moonO:1; --starO:1; --cloud:#8c9bc6; }
.tod-night .tod-land .smoke { opacity: .5; }
.arena.tod-night { filter: none; }

/* 階段名牌移到左上角，不再擋住地板 */
.arena .nameplate { left: 10px !important; top: 10px; bottom: auto !important; transform: none !important; padding: 3px 12px !important; font-size: 13px !important; box-shadow: 0 2px 0 rgba(94,58,34,.18) !important; }

/* ── 水晶森林主題：地景與各時段色票 ── */
.crystal .tod-sky, .crystal .tod-land, .crystal .tod-glow, .arctic .tod-sky, .arctic .tod-land, .arctic .tod-glow, .desert .tod-sky, .desert .tod-land, .desert .tod-glow, .tropic .tod-sky, .tropic .tod-land, .tropic .tod-glow { display: block; position: absolute; inset: 0; pointer-events: none; }
.cglow { filter: drop-shadow(0 0 6px var(--cglow)); }
.tod-dawn, .tod-morning, .tod-noon, .tod-golden, .tod-dusk, .tod-night { --cry1: #cbb8f5; --cry2: #9d86d8; --cglow: rgba(190,160,255,.5); --path: #e8dcf4; --glowc: #ff9ad8; }
.crystal .tod-dawn    { --s1:#a9a6e6; --s2:#f0bfe0; --s3:#ffe2d4; --far:#b7a6dc; --mid:#c6d6c6; --near:#c3dcc0; --leaf1:#b4a6e6; --leaf3:#d8cff4; --water:#f0cfe8; --cry1:#f0c4f0; --cry2:#c493dc; --glow:rgba(255,180,220,.16); --cloud:#ffe8f4; }
.crystal .tod-morning { --s1:#9cc4f0; --s2:#cfe0fa; --s3:#f3eaff; --far:#b0b8e6; --mid:#bfe0c8; --near:#b4dcc0; --leaf1:#a8a0e6; --leaf3:#d0e8d2; --water:#a8dcec; --cry1:#cbb8f5; --cry2:#9d86d8; --glow:rgba(255,255,255,0); --cloud:#fff; }
.crystal .tod-noon    { --s1:#82b4f2; --s2:#b9d6fa; --s3:#e9f0ff; --far:#a4acee; --mid:#b4dcc4; --near:#a6d6b6; --leaf1:#9a90e6; --leaf3:#c8e6cc; --water:#94d4ec; --cry1:#c2b0fa; --cry2:#8f78e0; --glow:rgba(255,255,255,0); --cloud:#fff; }
.crystal .tod-golden  { --s1:#a4a8e4; --s2:#f6d6c4; --s3:#ffe8bf; --far:#c0a8c8; --mid:#d0d6a4; --near:#c4d49a; --leaf1:#c0a8d8; --leaf3:#e0dcaa; --water:#f2d2a8; --cry1:#f3c4ec; --cry2:#d296d0; --glow:rgba(255,190,130,.16); --cloud:#fff0dc; }
.crystal .tod-dusk    { --s1:#4a3f94; --s2:#b3629f; --s3:#ff9a8a; --far:#7a68a8; --mid:#8a9890; --near:#7e9082; --leaf1:#8a78b0; --leaf3:#a89cc0; --water:#d28aa4; --cry1:#f0a4e0; --cry2:#b865b8; --cglow:rgba(255,150,230,.6); --glow:rgba(255,110,150,.16); --cloud:#f0a8c0; }
.crystal .tod-night   { --s1:#150f3a; --s2:#2f2468; --s3:#5a4a9a; --far:#4e4686; --mid:#3f5a70; --near:#33505c; --leaf1:#4a4488; --leaf3:#6a64a8; --water:#2e3f88; --cry1:#9be8f8; --cry2:#5ab4e0; --cglow:rgba(120,230,255,.85); --path:#6a5ea0; --glowc:#7ff5ff; --glow:rgba(40,30,120,.2); --cloud:#7c78b8; }
.crystal .tod-night .cglow { filter: drop-shadow(0 0 10px var(--cglow)) brightness(1.25); }
.crystal .tod-night .tod-land { filter: brightness(.8) saturate(1.1); }

/* ── 寒帶／沙漠／海島：地景色票（掛在 .tod-land 上，整天不變，由亮度與光暈做時段變化） ── */
.arctic .tod-land { --far:#c4d8ec; --mid:#e4eff8; --near:#f4f9fd; --leaf1:#5f9a86; --water:#bfe6f4; }
.desert .tod-land { --far:#d98d62; --mid:#ecc588; --near:#f1d49c; --leaf1:#7fb08a; --leaf2:#5f9a70; --leaf3:#e0a468; --water:#6cc8c4; }
.tropic .tod-land { --sea:#7fd0e0; --far:#6ab890; --mid:#bfe8b0; --near:#f6e2b0; --leaf1:#4fa86f; --water:#8fdcec; }
.arctic .tod-night .tod-sky::after { content: ""; position: absolute; inset: 0 0 45% 0; background: linear-gradient(100deg, transparent 10%, rgba(120,255,200,.45) 35%, rgba(150,140,255,.4) 60%, transparent 85%); filter: blur(10px); animation: aurora 7s ease-in-out infinite alternate; }
@keyframes aurora { from { transform: translateX(-8%) skewX(-6deg); opacity: .6; } to { transform: translateX(8%) skewX(6deg); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .arctic .tod-night .tod-sky::after { animation: none; } }

.mote { animation: mote 5s ease-in-out infinite; opacity: .8; }
@keyframes mote { 0%, 100% { transform: translateY(0); opacity: .2; } 50% { transform: translateY(-12px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .mote { animation: none; } }

/* 夥伴腳下的影子，和主角一致 */
.farm-buddy::before { content: ""; position: absolute; left: 50%; bottom: 3%; width: 54%; height: 9%; transform: translateX(-50%); border-radius: 50%; background: rgba(80,55,40,.2); }

/* 快報區塊：排名列、鍵值列、標籤，不再是一整串純文字 */
.sec-lines { white-space: normal; word-break: normal; overflow-wrap: anywhere; font-size: 14px; line-height: 1.5; margin-top: 8px; }
.sec-lines b.up, .sec-lines .spl.up { color: var(--up); } .sec-lines b.down, .sec-lines .spl.down { color: var(--down); }
.sl-note { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 2px 0 8px; }
.sl-head { font-size: 12px; font-weight: 800; color: var(--muted); margin: 10px 0 2px; }
.sl-kv { display: flex; flex-direction: column; }
.skv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; border-bottom: 1px dashed rgba(128,110,160,.28); }
.skv:last-child { border-bottom: 0; }
.skv .k { color: var(--muted); font-size: 13px; flex: none; }
.skv .v { font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.skv .v.wide { text-align: left; font-weight: 700; }
.spl { display: inline-block; margin-left: 5px; padding: 1px 8px; border-radius: 999px; background: rgba(128,110,160,.12); font-size: 12.5px; font-weight: 800; }
.sl-rank { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed rgba(128,110,160,.28); }
.sl-rank:last-child { border-bottom: 0; }
.sl-rank i { flex: none; width: 22px; height: 22px; border-radius: 50%; background: rgba(128,110,160,.16); font: 800 12px/22px inherit; font-style: normal; text-align: center; }
.sl-rank:nth-child(-n+3) i { background: var(--gold); color: #3a2a00; }
.sl-rank .rn { flex: 1; min-width: 0; }
.sl-rank .rn b { font-weight: 800; } .sl-rank .rn small { color: var(--muted); margin-left: 6px; font-size: 12px; }
.sl-rank .rv { flex: none; text-align: right; display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.sl-rank .rv .main { font-weight: 800; font-size: 15px; } .sl-rank .rv span:not(.main) { font-size: 12px; color: var(--muted); }
.sl-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 0; align-items: center; }
.sl-chips .hd { font-size: 12px; font-weight: 800; color: var(--muted); flex-basis: 100%; }
.chp { padding: 3px 9px; border-radius: 999px; background: rgba(128,110,160,.12); font-size: 13px; font-weight: 700; }
.chp b { margin-left: 4px; } .chp small { margin-left: 4px; color: var(--muted); font-size: 11.5px; font-weight: 600; }
.sl-news { display: block; padding: 8px 0; border-bottom: 1px dashed rgba(128,110,160,.28); color: inherit; text-decoration: none; font-weight: 700; line-height: 1.45; }
.sl-news:last-child { border-bottom: 0; }
.tg { display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: 6px; font-size: 11px; font-weight: 800; background: var(--panel2); color: var(--gold); vertical-align: 1px; }
.sl-plain { padding: 6px 0; }
.sec-lines b { display: inline; font-size: inherit; }
.skv .v { white-space: nowrap; } .skv .v.wide { white-space: normal; }
.skv .v .spl { margin-left: 4px; }

/* 自選股 */
.watch-btn { margin-top: 8px; }
.watch-btn.on { background: #f5dc88; color: #4d3120; }
#mapWatch .panel { margin: 10px 0; }

/* 快報：左右滑動的每日分頁 */
.news-strip { position: relative; display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; }
.news-strip::-webkit-scrollbar { display: none; }
.news-strip .chip { flex: none; }
.news-days { position: relative; display: flex; align-items: flex-start; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; margin: 0 -2px; }
.news-days::-webkit-scrollbar { display: none; }
.news-day { flex: 0 0 100%; min-width: 0; scroll-snap-align: start; scroll-snap-stop: always; padding: 0 2px; box-sizing: border-box; }
.day-tag { display: inline-block; margin: 2px 0 10px; padding: 4px 12px; border-radius: 999px; background: var(--gold); color: #3a2a10; font-weight: 900; font-size: 14px; }
.news-day .news-hero { margin-top: 0; }
.news-day .ico-wrap .ico { width: 18px; height: 18px; vertical-align: -3px; }

/* 加權指數卡 */
.taiex { margin-bottom: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(0,0,0,.04); }
.tx-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tx-name { font-weight: 800; font-size: 13px; color: var(--muted); }
.tx-val { font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.15; }
.tx-chg { font-weight: 800; font-size: 14px; }
.tx-spark { flex: 1; min-width: 0; max-width: 55%; height: 56px; }
.taiex .sub { margin-top: 6px; }
.us-title { margin: 12px 0 6px; }
.usidx { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ux { padding: 8px 10px; border-radius: 12px; background: rgba(255,255,255,.55); min-width: 0; }
.ux .tx-name { font-size: 12px; }
.ux-val { font-size: 17px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.2; }
.ux-chg { font-size: 12px; font-weight: 800; }
.ux .tx-spark { display: block; width: 100%; max-width: none; height: 26px; margin-top: 4px; }

/* 家園成長之路說明、快報預覽可點、帳本摺疊區 */
.pass-sub { font-size: 10px; font-weight: 800; color: #6b3d00; margin-top: 2px; line-height: 1.3; }
.kawaii .pass-sub { color: #6a4a35; }
.news-peek { cursor: pointer; position: relative; padding-right: 36px; }
.news-peek .peek-go { position: absolute; right: 10px; top: 50%; width: 20px; height: 20px; margin-top: -10px; opacity: .6; }
.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-height: 22px; }
.fold > summary::-webkit-details-marker { display: none; }
.fold-hint { font-size: 12px; font-weight: 800; color: var(--muted); }
.fold-chev { width: 16px; height: 16px; display: inline-block; transition: transform .2s; }
.fold-chev svg { width: 100%; height: 100%; }
.fold[open] .fold-chev { transform: rotate(90deg); }
.fold[open] > summary { margin-bottom: 10px; }

/* 右上列補滿：快報鈕撐開到與成長之路同寬，左邊不再留洞 */
.sq-row { justify-content: stretch; }
.news-sq { flex: 1; justify-content: center; }

/* 右欄固定寬度：快報鈕不會被拉得過長（右欄只留剛好夠用的寬度），多出的寬度全給左邊個人卡 */
.profile { flex: 1 1 0; min-width: 0; }
.right-col { flex: 0 0 auto; width: min(172px, 50%); }

/* 頁首：返回鈕與標題藥丸同高，不再一大一小 */
.topbar .btn.small, .topbar .pet-name { box-sizing: border-box; height: 42px; display: inline-flex; align-items: center; justify-content: center; }
.topbar .btn.small { padding-top: 0; padding-bottom: 0; }
.topbar .pet-name { padding-top: 0; padding-bottom: 0; font-size: 20px; line-height: 1; }


/* 底部分頁列要壓在 K 線圖畫布（自帶 z-index）上面，不然捲動時圖會透過分頁列露出來 */
.tabbar { z-index: 70; }
