:root {
  --bg: #e9f1fa;
  --panel: #ffffff;
  --panel-2: #f3f7fc;
  --line: #d6e2ef;
  --ink: #2c3a4f;
  --ink-2: #6b7a90;
  --blue: #4f8fe0;
  --blue-dark: #2f6cc0;
  --pink: #f27a9b;
  --gold: #e9a93a;
  --common: #a9b4c2;
  --rare: #4aa3f0;
  --epic: #b27af0;
  --ok: #46b06a;
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft JhengHei UI", "PingFang TC", "Segoe UI", sans-serif;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  user-select: none;
}

/* ---------- GPT 圖示 ---------- */
.ic { display: inline-block; vertical-align: middle; object-fit: contain; margin-right: 4px; flex-shrink: 0; }
.brand, .region-badge, .currency, .tabs button, .btn, .section-title, .books span, .sname, .stats dt, .job-line b, .buffs span { display: inline-flex; align-items: center; }
.tabs button { pointer-events: auto; }
.tabs button .ic { pointer-events: none; }

/* ---------- 上方列 ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  background: linear-gradient(180deg, #5fa2ec 0%, #3f80d6 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(30, 70, 130, 0.25);
}
.brand { font-size: 18px; font-weight: 800; letter-spacing: 1px; }
.region-badge {
  background: rgba(255, 255, 255, 0.22);
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 13px;
}
.spacer { flex: 1; }
.buffs { font-size: 13px; }
.currency {
  background: rgba(0, 0, 0, 0.18);
  padding: 4px 12px;
  border-radius: 99px;
  min-width: 96px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

main {
  flex: 1;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr); /* 右欄不會被不換行的字撐開（撐開就會被視窗切掉） */
  gap: 14px;
  padding: 14px;
  min-height: 0;
}

/* ---------- 角色卡 ---------- */
.hero-card {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: 0 2px 10px rgba(40, 80, 140, 0.08);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: auto;
}
.hero-stage {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 520 / 400;
  flex-shrink: 0;
  background: #cfe6f5;
}
.hero-stage canvas { width: 100%; height: 100%; display: block; }
.stage-env {
  position: absolute; top: 8px; right: 8px;
  display: inline-flex; align-items: center;
  background: rgba(255, 255, 255, 0.82); color: var(--ink);
  font-size: 12px; font-weight: bold; padding: 2px 9px 2px 6px; border-radius: 99px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.now-line { display: flex; flex-direction: column; gap: 1px; margin-top: -2px; }
.now-line b { font-size: 14px; color: var(--ink); }
.now-line small { font-size: 12px; color: #c28a16; }
.mini-title { font-size: 12px; color: var(--ink-2); font-weight: bold; margin-bottom: -4px; }
.slot .slot-count {
  position: absolute; right: 3px; bottom: 2px;
  font-size: 11px; font-weight: bold; color: var(--ink);
  background: rgba(255, 255, 255, 0.9); padding: 0 4px; border-radius: 6px; line-height: 15px;
}
.last-diary {
  text-align: left; border: 1px solid var(--line); background: var(--panel-2);
  border-radius: 10px; padding: 8px 10px; cursor: pointer; font: inherit; font-size: 13px; color: var(--ink); line-height: 1.5;
}
.last-diary:hover { border-color: #9cc4ee; }
.last-diary span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.last-diary small { color: var(--ink-2); margin-right: 6px; }
.trip-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.trip-chips span { font-size: 12px; color: var(--ink-2); background: var(--panel-2); padding: 2px 8px; border-radius: 99px; }
.tryon {
  position: absolute;
  bottom: 8px; left: 50%; transform: translateX(-50%);
  background: var(--pink);
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 99px;
}
.slots { display: flex; gap: 6px; justify-content: center; }
.slot {
  width: 60px; height: 60px;
  border-radius: 12px;
  border: 2px dashed var(--line);
  background: var(--panel-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
  padding: 0;
}
.slot.filled { border-style: solid; }
.slot .slot-label {
  position: absolute; bottom: -7px;
  font-size: 10px; background: #fff; color: var(--ink-2);
  padding: 0 4px; border-radius: 4px; white-space: nowrap; max-width: 76px; overflow: hidden; text-overflow: ellipsis;
}
.slot .icon { width: 44px; height: 44px; }
.slot-plus { font-size: 22px; color: var(--ink-2); }
.pack-slots-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pack-slots-mini .slot { width: auto; }
.stats {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  font-size: 13px;
}
.stats dt { color: var(--ink-2); }
.stats dd { margin: 0; text-align: right; font-weight: bold; font-variant-numeric: tabular-nums; }
.job-line { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; }
.job-line span { color: var(--ink-2); font-size: 13px; }
.expbar { height: 6px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
#expFill { height: 100%; width: 0; background: linear-gradient(90deg, #7ad1ff, #b48cff); }

/* ---------- 職業頁 ---------- */
.classes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.cls {
  border-radius: 14px; border: 2px solid var(--line); background: var(--panel-2);
  padding: 10px; display: flex; flex-direction: column; gap: 4px; align-items: center; text-align: center;
}
.cls.current { border-color: var(--pink); background: #fff3f6; }
.cls.locked { opacity: 0.55; }
.cls .emoji { font-size: 28px; }
.cls .growth { font-size: 11.5px; color: var(--ink-2); min-height: 30px; }
.cls .btn { width: 100%; margin-top: auto; }
.books { display: flex; gap: 14px; font-size: 13px; color: var(--ink-2); }
.books b { color: var(--ink); }
.skill-list { display: grid; gap: 8px; margin-bottom: 16px; }
.skill {
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center;
  background: var(--panel-2); border-radius: 12px; padding: 8px 12px;
}
.skill.passive { background: #fff7e6; border: 1px solid #f3d9a4; }
.skill .sname { font-weight: bold; }
.skill .sdesc { font-size: 12px; color: var(--ink-2); }
.skill .slv { font-weight: bold; color: var(--blue-dark); min-width: 52px; text-align: right; }
/* ---------- 鍛造 ---------- */
.forge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 12px; margin-bottom: 16px; }
.forge-card {
  border-radius: 14px; border: 2px solid var(--common); background: var(--panel-2);
  padding: 10px 12px; display: grid; gap: 8px;
  align-content: start; /* 同一列卡片高度不同時，內容一律靠上，按鈕位置才會對齊 */
}
.forge-card.rare { border-color: var(--rare); }
.forge-card.epic { border-color: var(--epic); }
.forge-card.owned { background: #f2fbf4; }
.forge-card .head { display: flex; gap: 10px; align-items: center; min-height: 52px; }
.forge-card .head .icon { width: 48px; height: 48px; font-size: 26px; margin: 0; flex-shrink: 0; }
.forge-card .head > div:not(.icon) { min-width: 0; flex: 1; } /* 圖示固定 48px，不能被撐大 */
/* 名稱和標籤可以換行，按鈕永遠留在格子裡 */
.forge-card .head b { display: flex; align-items: center; gap: 4px 6px; flex-wrap: wrap; }
.forge-card .head .btn { min-width: 64px; flex-shrink: 0; justify-content: center; white-space: nowrap; }
.forge-card .gstats { font-size: 12px; color: var(--ok); font-weight: bold; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.forge-card > small { color: var(--ink-2); }
/* 需求材料：兩欄對齊排列，上面一條細分隔線 */
.req {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 10px; font-size: 12px;
  border-top: 1px dashed rgba(0, 0, 0, 0.12); padding-top: 8px;
}
.req span { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; min-width: 0; }
.req .lack { color: #d04a4a; }
.req .ok { color: var(--ink-2); }
.src { font-size: 10px; padding: 0 4px; border-radius: 4px; color: #fff; margin-left: 2px; }
.src.drag { background: #3f8fd6; }
.src.chest { background: var(--gold); }
.ic-missing:empty { display: none; } /* 圖示還沒產生時不佔位置 */
.src.boss { background: #d04a4a; }

.notice { background: #fff0f0; border: 1px solid #f3c2c2; color: #b34a4a; border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; font-size: 13px; }

/* ---------- 按鈕 ---------- */
.btn {
  font: inherit;
  border: 0;
  border-radius: 10px;
  padding: 7px 12px;
  background: var(--blue);
  color: #fff;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--blue-dark);
  transition: transform 0.05s;
}
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 1px 0 var(--blue-dark); }
.btn:disabled { background: #b8c4d3; box-shadow: 0 2px 0 #9aa7b8; cursor: default; }
.btn.gold { background: var(--gold); box-shadow: 0 2px 0 #b97f1c; }
.btn.pink { background: var(--pink); box-shadow: 0 2px 0 #c95375; }
.btn.ghost { background: var(--panel-2); color: var(--ink); box-shadow: 0 2px 0 var(--line); }
/* 停用狀態要蓋過 gold / pink / ghost 的顏色 */
.btn.gold:disabled, .btn.pink:disabled, .btn.ghost:disabled { background: #b8c4d3; box-shadow: 0 2px 0 #9aa7b8; color: #fff; }
.btn.small { padding: 4px 10px; font-size: 12px; }

/* ---------- 分頁 ---------- */
.panel {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: 0 2px 10px rgba(40, 80, 140, 0.08);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.tabs { display: flex; gap: 2px; padding: 10px 8px 0; border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden;  flex-shrink: 0; }
.tabs button { white-space: nowrap; padding-left: 10px !important; padding-right: 10px !important; }
.tabs button {
  font: inherit;
  border: 0;
  background: transparent;
  padding: 9px 16px;
  border-radius: 10px 10px 0 0;
  color: var(--ink-2);
  cursor: pointer;
  font-weight: bold;
}
.tabs button.active { background: var(--pink); color: #fff; }
.tabs[hidden] { display: none; }
.tab-body { flex: 1; overflow: auto; padding: 14px; }
.section-title { font-weight: 800; margin: 4px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-title small { font-weight: normal; color: var(--ink-2); }
.empty { color: var(--ink-2); text-align: center; padding: 40px 0; }

/* ---------- 物品格 ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.cell {
  position: relative;
  border-radius: 12px;
  background: var(--panel-2);
  border: 2px solid var(--common);
  padding: 8px 4px 6px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.08s;
}
.cell:hover { transform: translateY(-2px); }
.cell.rare { border-color: var(--rare); }
.cell.epic { border-color: var(--epic); }
.cell.selected { box-shadow: 0 0 0 3px rgba(242, 122, 155, 0.5); }
.cell.locked { opacity: 0.55; }
.cell .name { font-size: 12px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell .count {
  position: absolute; right: 6px; top: 4px;
  font-size: 11px; font-weight: bold; color: var(--ink-2);
}
.cell .tag {
  position: absolute; left: 6px; top: 4px;
  font-size: 10px; background: var(--ok); color: #fff; padding: 0 5px; border-radius: 6px;
}
.icon { width: 56px; height: 56px; margin: 0 auto; display: grid; place-items: center; font-size: 34px; }
.icon img, .icon canvas { width: 100%; height: 100%; object-fit: contain; image-rendering: auto; }

.filters { display: flex; gap: 6px; margin-bottom: 12px; }
.chip {
  font: inherit; font-size: 12px; border: 1px solid var(--line); background: #fff;
  padding: 4px 12px; border-radius: 99px; cursor: pointer; color: var(--ink-2);
}
.chip.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.filters { flex-wrap: wrap; }
.filters.sub { margin-top: -4px; }
.chip.small { font-size: 11px; padding: 2px 10px; }
.filters.sub .chip.active { background: var(--ink-2); border-color: var(--ink-2); }

/* 小故事：依地區收合 */
.story-group { border: 1px solid var(--line); border-radius: 12px; background: #fff; margin-bottom: 8px; }
.story-group-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; cursor: pointer; user-select: none; }
.story-group-head:hover { background: rgba(0,0,0,.03); border-radius: 12px; }
.story-group-head .caret { width: 12px; color: var(--ink-2); }
.story-group-head .going-tag { color: #e07b00; }
.group-bar { width: 120px; height: 8px; background: #eee; border-radius: 99px; overflow: hidden; }
.group-bar div { height: 100%; background: linear-gradient(90deg, #ffd34d, #ff9f43); }
.group-count { min-width: 44px; text-align: right; }
.story-group.open .story-grid { padding: 0 10px 10px; }

/* 倉庫：帶出門的效果 */
.pack-effect { display: flex; align-items: center; gap: 4px; font-size: 12px; color: #8a5a00; margin-top: 4px; }
.pack-effect.story { color: #d98a00; }
.mini-link { display: inline-block; font-size: 11.5px; color: var(--ink-2); margin-top: 4px; text-decoration: underline; }

/* 角色卡下面的委託、今天的小事（窄欄） */
.side-box { display: flex; flex-direction: column; gap: 8px; }
.side-box .today { margin-bottom: 0; padding: 7px 8px; }
.side-box .today-title { font-size: 12.5px; }
.today-title.clickable { cursor: pointer; user-select: none; }
.today-title.clickable:hover { color: #c9762e; }
.today-title .caret { width: 10px; color: var(--ink-2); font-size: 11px; }
.side-box .today-row { padding: 5px 6px; gap: 6px; align-items: flex-start; }
.side-box .today-text small.wrap { white-space: normal; }
.req-foot { display: flex; align-items: center; gap: 4px; margin-top: 3px; }
.req-foot > small:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req-foot .ok { color: var(--ok); font-weight: bold; }
.side-box .routine-sum { font-size: 12px; line-height: 1.55; }
.side-box .routine-list { max-height: 260px; font-size: 12px; }

/* 今天的小事 */
.today { border: 1px solid #f1d9a0; background: #fffaf0; border-radius: 12px; padding: 8px 10px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 6px; }
.today-title { display: flex; align-items: center; gap: 6px; font-weight: bold; font-size: 13px; }
.today-row { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 5px 8px; }
.today-row.ready { border-color: #9fd8a8; background: #f2fbf3; }
.today-row .npc-face { height: 26px; width: auto; }
.today-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.today-text small { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.muted { color: var(--ink-2); font-size: 11px; }
.gift-line { font-size: 12px; color: #d0577d; margin-top: 2px; }
.got-line { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.got-item { display: inline-flex; align-items: center; gap: 2px; color: var(--ink); }
.got-item.rare { color: #2f7fd0; font-weight: bold; }
.got-item.epic { color: #9a4fd0; font-weight: bold; }
.diary-entry.special { background: #fff1f6; border-color: #f4c2d4; }
.diary-entry.away { background: #f3f6fb; }
.diary-entry.routine { background: #f7f8fb; border-style: dashed; cursor: pointer; }
.diary-entry.routine:hover { background: #f0f3f9; }
.today .routine-sum { margin: 0; font-size: 12.5px; line-height: 1.6; }
.today .routine-list { max-height: 380px; overflow-y: auto; }
.routine-list { margin-top: 6px; border-top: 1px dashed var(--line); padding-top: 6px; font-size: 12.5px; color: var(--ink-2); }
.routine-list p { margin: 0 0 3px; }
.furn-card small.shop-tag { display: inline; color: #8a6a3a; }
.shop-tag { margin-left: 6px; font-size: 10px; font-weight: normal; background: #f3efe6; color: #8a6a3a; padding: 0 6px; border-radius: 99px; }
.south-tag { background: linear-gradient(90deg, #ffe3a8, #ffd0e0); border-radius: 10px; padding: 4px 10px; margin-bottom: 8px; font-weight: bold; font-size: 12px; }

/* 圖鑑 */
.codex-cell { position: relative; }
.codex-cell.clickable { cursor: pointer; }
.codex-cell.clickable:hover, .codex-cell.picked { border-color: #f08aa8; box-shadow: 0 0 0 2px rgba(240, 138, 168, .25); }
.codex-cell .badge { position: absolute; top: 4px; right: 4px; font-size: 10px; background: #e0503c; color: #fff; padding: 0 5px; border-radius: 6px; }
.hearts { display: flex; justify-content: center; gap: 2px; margin-top: 2px; }
.hearts i { width: 9px; height: 9px; background: #e6dfe3; clip-path: path('M4.5 8.5 L0.8 4.6 A2.2 2.2 0 0 1 4.5 1.6 A2.2 2.2 0 0 1 8.2 4.6 Z'); }
.hearts i.on { background: #f06292; }
.person { margin-top: 12px; border: 1px solid #f4c2d4; background: #fff7fa; border-radius: 12px; padding: 10px 12px; }
.person-head { display: flex; gap: 12px; align-items: center; margin-bottom: 6px; }
.person-head > div { display: flex; flex-direction: column; gap: 2px; }
.person-head small { color: var(--ink-2); }
.codex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.codex-grid.wide { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.codex-cell { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 6px; text-align: center; }
.codex-cell .pic { height: 72px; display: grid; place-items: center; overflow: hidden; }
.codex-grid.wide .pic { height: 90px; }
/* 等比例縮進格子，不裁切（grid 裡的百分比高度會失效，所以用固定的最大高度） */
.codex-cell .pic img, .codex-cell .pic canvas { width: auto; height: auto; max-width: 100%; max-height: 72px; object-fit: contain; }.codex-grid.wide .pic img { width: 100%; height: 90px; max-height: none; object-fit: cover; border-radius: 6px; }
.codex-cell .pic .icon { width: 64px; height: 64px; }
.codex-cell .pic > span { font-size: 30px; color: var(--ink-2); }
.codex-cell .name { font-size: 12px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.codex-cell.unknown .pic { filter: brightness(0) opacity(.22); }
.codex-cell.unknown .name { color: var(--ink-2); }

.detail {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: flex;
  gap: 14px;
  align-items: center;
}
.detail .icon { width: 72px; height: 72px; font-size: 44px; }
.detail .info { flex: 1; }
.detail .info b { font-size: 16px; }
.detail .info p { margin: 4px 0 0; color: var(--ink-2); font-size: 13px; }
.detail .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.rarity { font-size: 11px; padding: 1px 6px; border-radius: 6px; color: #fff; margin-left: 6px; vertical-align: middle; }
.rarity.common { background: var(--common); }
.rarity.rare { background: var(--rare); }
.rarity.epic { background: var(--epic); }

/* ---------- 商店 ---------- */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.card {
  border-radius: 14px;
  background: var(--panel-2);
  border: 2px solid var(--common);
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}
.card.rare { border-color: var(--rare); }
.card.epic { border-color: var(--epic); }
.card .icon { width: 72px; height: 72px; font-size: 44px; }
.card .desc { font-size: 12px; color: var(--ink-2); min-height: 32px; }
.card .btn { width: 100%; }

/* ---------- 地圖 ---------- */
.regions { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.region {
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid var(--line);
  background: var(--panel-2);
}
.region.current { border-color: var(--pink); }
.region.locked { filter: grayscale(0.8); opacity: 0.7; }
.region .art { height: 96px; background-size: cover; background-position: center; position: relative; }
.region .art .range {
  position: absolute; right: 8px; bottom: 6px;
  background: rgba(0, 0, 0, 0.45); color: #fff; font-size: 11px; padding: 1px 8px; border-radius: 99px;
}
.region .body { padding: 10px 12px; display: grid; gap: 6px; }
.region .title { font-weight: 800; display: flex; justify-content: space-between; align-items: center; }
.region .mons, .region .loot { font-size: 12px; color: var(--ink-2); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.mini-icon { width: 22px; height: 22px; display: inline-grid; place-items: center; font-size: 16px; }
.mini-icon img, .mini-icon canvas { width: 100%; height: 100%; object-fit: contain; }

.setting { margin-top: 16px; display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 13px; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  background: rgba(30, 40, 60, 0.9);
  color: #fff;
  padding: 8px 18px;
  border-radius: 99px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: rgba(190, 60, 80, 0.92); }

/* ---------- 日記 ---------- */
.diary-head { display: flex; gap: 12px; align-items: stretch; margin-bottom: 10px; }
.diary-head .rep { flex: 1; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; }
.rep-line { display: flex; align-items: center; gap: 6px; }
.rep-line small { margin-left: auto; color: var(--ink-2); }
.cur-title { display: flex; align-items: center; gap: 6px; background: #fff8e6; border: 1px solid #f1d9a0; border-radius: 12px; padding: 8px 14px; white-space: nowrap; }
.cur-title b { color: #b07a12; }
.diary-day { margin: 14px 0 6px; font-weight: bold; color: var(--ink-2); font-size: 13px; border-bottom: 1px dashed var(--line); padding-bottom: 4px; }
.diary-entry { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; background: #fffdf8; border: 1px solid #efe6d6; margin-bottom: 6px; }
.diary-entry.story { background: #fff8e6; border-color: #f1d9a0; }
.diary-entry p { margin: 3px 0 0; line-height: 1.6; overflow-wrap: anywhere; }
.diary-text { flex: 1; min-width: 0; }
.diary-meta { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.story-tag { margin-left: 4px; background: #f6c453; color: #5a3d00; border-radius: 999px; padding: 0 8px; font-size: 11px; font-weight: bold; }
.got-title { margin-top: 4px; font-size: 12px; color: #b07a12; font-weight: bold; display: flex; align-items: center; gap: 4px; }
.npc-face { width: auto; object-fit: contain; flex-shrink: 0; filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); }

.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; align-content: start; align-items: start; }
.story-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.story-card.going { background: #fff8e6; border-color: #f1d9a0; }
.story-card.done { background: #effaf2; border-color: #bfe6cb; }
.story-card.new { opacity: 0.85; }
.story-top { display: flex; gap: 10px; align-items: center; }
.story-top small { color: var(--ink-2); display: block; line-height: 1.4; }
.story-icon { width: 40px; height: 40px; display: grid; place-items: center; flex-shrink: 0; }
.story-icon img { max-width: 40px; max-height: 40px; }
.pips { display: flex; gap: 4px; margin: 3px 0; }
.pips i { width: 14px; height: 5px; border-radius: 3px; background: #d6e2ef; }
.pips i.on { background: var(--gold); }
.story-card.done .pips i.on { background: var(--ok); }
.story-reward { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.story-reward span { display: inline-flex; align-items: center; gap: 3px; opacity: 0.6; }
.story-reward span.ok { opacity: 1; color: var(--ok); font-weight: bold; }
.story-reward span.new-region { opacity: 1; color: #d98a00; font-weight: bold; font-size: 11px; justify-content: flex-end; }
.conds { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.cond { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; padding: 1px 7px; border-radius: 99px; background: #eee; color: var(--ink-2); }
.cond.ok { background: #e3f6e3; color: var(--ok); font-weight: bold; }
.cond.lock { background: #f1ecf5; color: #7a6a8a; }
.story-card.blocked { opacity: .62; filter: grayscale(.5); }
.story-reward span.trigger { opacity: 1; color: var(--ink); font-weight: bold; background: #f3efe6; padding: 2px 8px; border-radius: 99px; }
.story-log { border-top: 1px dashed var(--line); padding-top: 6px; font-size: 12.5px; line-height: 1.6; color: var(--ink); }
.story-log p { margin: 0 0 4px; }
.story-log.clamp p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 3.2em; }
.story-log p.muted { color: var(--ink-2); }
.story-log .more { font-size: 11px; color: var(--ink-2); text-align: right; min-height: 17px; }
.story-card.clickable { cursor: pointer; }
.story-card.clickable:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.story-card .story-hint { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.story-card .conds { flex-wrap: nowrap; overflow: hidden; }
.story-card .conds .cond { white-space: nowrap; }
.story-card.expanded .conds { flex-wrap: wrap; }
.story-card.expanded .story-hint { white-space: normal; }
.cond.tip { background: #fff1d6; color: #b07400; font-weight: normal; }
.cond.tip.ok { background: #ffe2a8; color: #8a5a00; font-weight: bold; }

.title-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.title-card { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: #fff8e6; border: 1px solid #f1d9a0; }
.title-card small { display: block; color: var(--ink-2); }
.title-card.locked { background: var(--panel-2); border-color: var(--line); opacity: 0.7; }
.title-card.wearing { box-shadow: 0 0 0 2px var(--gold); }
.region.locked { opacity: 0.75; }
.diary-entry.bad { background: #f2f6fb; border-color: #cfdbea; }
.lost-line { margin-top: 3px; font-size: 12px; color: #c0504d; }
/* 角色卡的體力條（稱號和紀錄中間） */
.stamina { display: flex; align-items: center; gap: 6px; margin: 2px 0 8px; font-size: 13px; color: var(--ink-2); }
.stamina .label { white-space: nowrap; }
.stamina .track { flex: 1; height: 10px; border-radius: 5px; background: #e3ebf4; overflow: hidden; box-shadow: inset 0 0 0 1px #d6e2ef; }
#staminaFill { height: 100%; width: 100%; background: linear-gradient(90deg, #7ed957, #b9ea6e); transition: width 0.3s; }
.stamina.low #staminaFill { background: linear-gradient(90deg, #ff9f43, #ffd34d); }
.stamina.resting #staminaFill { background: linear-gradient(90deg, #6fb7ff, #b5dcff); }
.stamina b { min-width: 64px; text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
/* ---------- 行囊 ---------- */
.pack-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 6px; }
.pack-slot { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px; border-radius: 12px; background: #fff8e6; border: 1.5px solid #f1d9a0; cursor: pointer; }
.pack-slot.empty { background: var(--panel-2); border: 1.5px dashed var(--line); color: var(--ink-2); justify-content: center; min-height: 84px; cursor: default; }
.pack-slot small { color: var(--ink-2); }
.pack-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.pack-card { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.pack-card.in { background: #fff8e6; border-color: #f1d9a0; }
.pack-card.none { opacity: 0.6; }
.pdesc { font-size: 12px; color: var(--ink-2); line-height: 1.5; }
/* ---------- 小屋 ---------- */
.room { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: linear-gradient(180deg, #e8c99a 0 66%, #b9875a 66%); background-size: cover; background-position: center; border: 1px solid var(--line); }
/* 小屋：固定的擺放位置 */
.slot-box { position: absolute; display: flex; align-items: flex-end; justify-content: center; cursor: pointer; border-radius: 8px; }
.slot-box img { width: 100%; height: 100%; object-fit: contain; object-position: bottom center; filter: drop-shadow(0 2px 2px rgba(0,0,0,.25)); pointer-events: none; }
.slot-box.t-hang img { object-position: top center; }
.slot-box.empty { border: 2px dashed rgba(255,255,255,.55); background: rgba(255,255,255,.12); align-items: center; opacity: .55; }
.slot-box.empty .plus { color: #fff; font-size: 18px; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.slot-box.empty:hover, .slot-box.filled:hover { opacity: 1; outline: 2px solid rgba(255,211,77,.8); outline-offset: 2px; }
.slot-box.picked { opacity: 1; outline: 3px solid #ffd34d; outline-offset: 2px; }
.room .visitor { position: absolute; left: 51%; bottom: 5%; height: 30%; filter: drop-shadow(0 2px 2px rgba(0,0,0,.3)); transform: scaleX(-1); }
.room.locked { filter: none; background-color: #d9d3c8; }
.room-lock { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: rgba(40,30,20,.55); color: #fff; text-align: center; padding: 0 20%; }
.room-lock small { color: #f2e6d4; }
.room-lock .muted { color: #f2e6d4; }
.area-info { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.area-info small { color: var(--ink-2); }
.picker { margin-top: 10px; border: 1px solid #f1d9a0; background: #fffaf0; border-radius: 12px; padding: 8px 10px; }
.picker-title { display: flex; align-items: center; gap: 8px; font-weight: bold; font-size: 13px; margin-bottom: 6px; }
.picker-list { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 92px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font: inherit; }
.pick img { width: 64px; height: 48px; object-fit: contain; }
.pick b { font-size: 12px; }
.pick small { font-size: 10px; color: var(--ink-2); }
.pick.on { border-color: #ffd34d; background: #fff6d6; }
.shelf { position: absolute; top: 18%; left: 30%; width: 40%; display: grid; grid-template-columns: repeat(6, 1fr); gap: 2%; padding: 0 2% 1.2%; border-bottom: 8px solid #8a5a34; border-radius: 0 0 3px 3px; box-shadow: 0 6px 0 -2px rgba(0,0,0,.15); }
.shelf-slot { aspect-ratio: 1; display: grid; place-items: end center; }
.shelf-slot .mini-icon { width: 100%; height: 100%; }
.shelf-slot .mini-icon img { width: 100%; height: 100%; object-fit: contain; }
.furn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.furn-card { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.furn-card img { width: 56px; height: 48px; object-fit: contain; }
.furn-card small { display: block; color: var(--ok); }
.furn-card.owned { background: #effaf2; border-color: #bfe6cb; }

/* ===== 營地左側：地區膠囊（跟右上的天氣膠囊一樣的白色霧面）===== */
.stage-region, .stage-env {
  background: rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.7);
}
.stage-region {
  position: absolute; top: 8px; left: 8px;
  display: inline-flex; align-items: center; gap: 3px;
  color: var(--ink); font-size: 12px; font-weight: bold;
  padding: 2px 9px 2px 6px; border-radius: 99px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  max-width: 55%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* 稱號 + 探索聲望 */
.title-row {
  display: flex; align-items: center; gap: 8px; width: 100%;
  border: 1px solid var(--line); background: var(--panel-2); border-radius: 10px;
  padding: 5px 8px; cursor: pointer; font: inherit; color: var(--ink);
}
.title-row:hover { border-color: #f4c2d4; }
.title-cap {
  display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0;
  background: #fff1f6; border: 1px solid #f4c2d4; color: #c4406b;
  font-size: 12px; font-weight: bold; padding: 1px 8px 1px 5px; border-radius: 99px;
  max-width: 58%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rep-mini { flex: 1; display: flex; align-items: center; gap: 4px; min-width: 0; }
.rep-track { flex: 1; height: 7px; border-radius: 4px; background: #e3ebf4; overflow: hidden; }
.rep-track > span { display: block; height: 100%; background: linear-gradient(90deg, #ffd34d, #ff9f43); }
.rep-mini b { font-size: 12px; font-variant-numeric: tabular-nums; }
.chip-req {
  font: inherit; font-size: 12px; font-weight: bold; color: #fff; background: var(--pink);
  border: 0; padding: 2px 9px; border-radius: 99px; cursor: pointer;
}
/* 頁籤的提示點 */
.tabs button { position: relative; }
.tabs button.dot::after {
  content: ''; position: absolute; top: 5px; right: 4px; width: 8px; height: 8px;
  border-radius: 50%; background: #e0503c; box-shadow: 0 0 0 2px #fff;
}

/* ===== 日記：按天摺疊 ===== */
.diary-daygroup { border: 1px solid var(--line); border-radius: 12px; background: #fff; margin-bottom: 8px; overflow: hidden; }
.diary-dayhead {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; user-select: none;
  font-size: 13px; color: var(--ink);
}
.diary-dayhead:hover { background: #f7f9fc; }
.diary-dayhead .caret { width: 10px; color: var(--ink-2); font-size: 11px; }
.diary-dayhead .muted { color: var(--ink-2); }
.day-badges { display: inline-flex; gap: 2px; }
.day-peek { flex: 1; min-width: 0; color: var(--ink-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.diary-daybody { padding: 0 10px 8px; }
/* 日記左邊固定大小的圖框 */
.entry-pic {
  width: 48px; height: 48px; flex-shrink: 0; border-radius: 10px;
  background: #f3efe6; display: grid; place-items: center; overflow: hidden;
}
.entry-pic img, .entry-pic .icon { max-width: 44px !important; max-height: 44px !important; width: auto !important; height: auto !important; object-fit: contain; }
.entry-pic.big { width: 64px; height: 64px; }
.entry-pic.big img { max-width: 60px !important; max-height: 60px !important; }
/* 今天的瑣事（虛線框，點一下展開） */
.chores { border: 1px dashed #d8cdb8; border-radius: 10px; background: #fbfaf6; padding: 6px 10px; cursor: pointer; }
.chores:hover { background: #f7f4ec; }
.chores-head { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.chores-head .caret { width: 10px; color: var(--ink-2); font-size: 11px; }
.chores-head small { color: var(--ink-2); }
.chores .routine-sum { margin: 3px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--ink-2); }
.chores .routine-list { max-height: 320px; overflow-y: auto; }

/* ===== 圖鑑：人物 ===== */
.codex-sub { display: flex; align-items: center; gap: 6px; font-weight: bold; font-size: 14px; margin: 4px 0 8px; }
.codex-sub small { color: var(--ink-2); font-weight: normal; }
.friends { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; }
.friend-list { width: 190px; flex-shrink: 0; display: flex; flex-direction: column; gap: 4px; max-height: 420px; overflow-y: auto; }
.friend-row {
  position: relative; display: flex; align-items: center; gap: 8px; width: 100%;
  border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 4px 8px 4px 4px;
  cursor: pointer; font: inherit; color: var(--ink); text-align: left;
}
.friend-row:hover:not(:disabled) { border-color: #f4c2d4; }
.friend-row.picked { border-color: #f08aa8; background: #fff7fa; box-shadow: 0 0 0 2px rgba(240, 138, 168, .2); }
.friend-row.unknown { cursor: default; color: var(--ink-2); }
.friend-row.unknown .friend-face img { filter: brightness(0) opacity(.22); }
.friend-face { width: 36px; height: 36px; flex-shrink: 0; border-radius: 8px; background: #f3efe6; display: grid; place-items: center; overflow: hidden; }
.friend-face img { max-width: 34px; max-height: 34px; object-fit: contain; }
.friend-name { display: flex; flex-direction: column; align-items: flex-start; font-size: 13px; font-weight: bold; min-width: 0; }
.friend-name .hearts { justify-content: flex-start; }
.friend-row .dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: #e0503c; }
.friends .person { flex: 1; margin-top: 0; position: sticky; top: 0; min-height: 200px; }
.person-req { display: flex; align-items: center; gap: 4px; width: 100%; margin: 4px 0 6px; font: inherit; font-size: 12.5px; text-align: left;
  border: 1px solid #f1d9a0; background: #fffaf0; border-radius: 8px; padding: 4px 8px; cursor: pointer; color: var(--ink); }
.codex-cell .badge.friend { left: 4px; right: auto; background: #4caf7a; }

/* ===== 資訊面板：稱號/名字、聲望、體力（圖示和進度條對齊，數字在滑鼠提示裡）===== */
.stat-rows { display: flex; flex-direction: column; gap: 6px; }
.name-row {
  display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0;
  border: 0; background: none; padding: 0; cursor: pointer; font: inherit; color: var(--ink); text-align: left;
}
.name-row .hero-name { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.name-row:hover .title-cap { border-color: #f08aa8; }
.stat-row {
  display: flex; align-items: center; gap: 8px; width: 100%; margin: 0;
  border: 0; background: none; padding: 0; font: inherit; cursor: default;
}
button.stat-row { cursor: pointer; }
.stat-row .stat-ic { position: relative; width: 34px; height: 24px; flex-shrink: 0; display: grid; place-items: center; }
.stat-row .track { flex: 1; height: 10px; border-radius: 5px; background: #e3ebf4; overflow: hidden; box-shadow: inset 0 0 0 1px #d6e2ef; }
.stat-row .track > span { display: block; height: 100%; width: 0; transition: width 0.3s; }
#repFill { background: linear-gradient(90deg, #ffd34d, #ff9f43); }
.stat-row.stamina { margin: 0; }
.stat-row .bolt { position: absolute; right: -2px; top: -3px; width: 10px; height: 14px; fill: #ffd34d; stroke: #8a5a00; stroke-width: 1; display: none; }
.stat-row.stamina.resting .bolt { display: block; animation: boltBlink 1s ease-in-out infinite alternate; }
@keyframes boltBlink { from { opacity: .45; } to { opacity: 1; } }
/* 「現在」固定兩行高 */
.now-line { min-height: 38px; }
.now-line small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-line small.muted { color: var(--ink-2); }
.story-tag-now { display: inline-flex !important; align-items: center; gap: 3px; align-self: flex-start; max-width: 100%;
  background: #fff8e6; border: 1px solid #f1d9a0; color: #b07a12 !important; border-radius: 99px; padding: 0 8px 0 5px; }
.trip-chips span, .trip-chips button { white-space: nowrap; }
.trip-chips { gap: 4px; }

/* ===== 故事卡：日記一次一則、固定高度 ===== */
.story-card { height: 100%; }
.story-grid { align-items: stretch; }
.story-log.paged { display: flex; flex-direction: column; gap: 2px; }
.story-log .log-page { height: 3.2em; overflow-y: auto;  }
.story-log .log-page p { margin: 0; }
.story-log .pager { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-height: 14px; line-height: 14px; font-size: 11px; }
.story-log .pager small { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.story-log .pg { width: 22px; height: 20px; border-radius: 6px; border: 1px solid var(--line); background: #fff; cursor: pointer; font: inherit; line-height: 1; color: var(--ink); padding: 0; }
.story-log .pg:disabled { opacity: .35; cursor: default; }
.story-log .pg:not(:disabled):hover { border-color: #f1b85a; }
/* 委託卡（跟故事卡同一個樣子） */
.req-card .story-icon .entry-pic { width: 44px; height: 44px; }
.req-card.ready { border-color: #9fd8a8; background: #f2fbf3; }
.req-bar { height: 6px; border-radius: 3px; background: #efe3c6; overflow: hidden; margin: 4px 0 3px; max-width: 160px; }
.req-bar > span { display: block; height: 100%; background: linear-gradient(90deg, #f1b85a, #f08a4b); }
.req-card.ready .req-bar > span { background: var(--ok); }
.req-reward { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; color: #8a6a1c; background: #fff3d6; border-radius: 99px; padding: 1px 8px 1px 5px; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.req-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: auto; }

/* ===== 頁籤：圖示在上、字在下的小按鈕（10 個一排放得下）===== */
.tabs { gap: 2px; padding: 8px 6px 0; }
.tabs button {
  flex: 1 1 0; min-width: 52px; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 5px 2px 4px !important; font-size: 12px; line-height: 1.2;
}
.tabs button .ic, .tabs button i { margin: 0 !important; }
/* 圖鑑的朋友那格：愛心、可以點 */
.codex-cell .hearts { margin-top: 1px; }
.codex-cell.clickable { cursor: pointer; }
.title-group { margin-bottom: 14px; }

/* ===== 故事卡：預設收起來，點開的那張佔滿整排、列出整段故事 ===== */
.story-card { height: auto; }
.story-card.expanded { grid-column: 1 / -1; }
.story-card.expanded .story-hint { white-space: normal; }
.story-card.expanded .conds { flex-wrap: wrap; }
.story-log.full p { margin: 0 0 6px; }
/* 日記：只看某個人 */
.diary-filter { margin: -4px 0 10px; }
.filter-tag { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13px; font-weight: bold; cursor: pointer;
  background: #fff1f6; border: 1px solid #f4c2d4; color: #c4406b; border-radius: 99px; padding: 2px 10px 2px 3px; }
.filter-tag .npc-face { border-radius: 50%; }
.filter-tag .x { margin-left: 2px; font-size: 15px; opacity: .7; }
.filter-tag:hover .x { opacity: 1; }
.entry-pic.clickable { cursor: pointer; }
.entry-pic.clickable:hover { box-shadow: 0 0 0 2px #f4c2d4; }
.person-diary { margin-top: 6px; }

/* ===== 朋友詳細欄：固定版面（每行預留位置、頭像貼底置中）===== */
.friends .person { display: flex; flex-direction: column; gap: 6px; min-height: 0; height: 330px; }
.person-head { display: flex; gap: 12px; align-items: flex-end; margin-bottom: 2px; }
.person-face { width: 96px; height: 96px; flex-shrink: 0; border-radius: 12px; background: #f3efe6; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; }
.person-face img { max-width: 90px; max-height: 88px; height: auto !important; width: auto; object-fit: contain; margin-bottom: 2px; }
.person-title { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding-bottom: 4px; }
.person-title b { font-size: 17px; }
.person-title .hearts { justify-content: flex-start; }
.person-row { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; min-height: 20px; }
.person-row.tall { height: 3.4em; }
.pr-label { width: 34px; flex-shrink: 0; color: var(--ink-2); font-weight: bold; line-height: 20px; }
.pr-val { flex: 1; min-width: 0; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.person-row.tall .pr-val { white-space: normal; display: block; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.6; }
.pr-val .muted { color: #b3aab0; }
.aff-bar { width: 120px; height: 8px; border-radius: 4px; background: #f3dde6; overflow: hidden; flex-shrink: 0; }
.aff-bar > span { display: block; height: 100%; background: linear-gradient(90deg, #f7a1bf, #f06292); }
.link-btn { font: inherit; border: 0; background: none; padding: 0; color: #b07a12; cursor: pointer; text-decoration: underline; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-foot { margin-top: auto; }
.friend-face { align-items: end; display: flex !important; justify-content: center; }
.friend-face img { margin-bottom: 1px; }

/* 朋友詳細欄：窄的時候不要被撐出去；文字換行（固定兩行高），不再被切掉 */
.friends .person { min-width: 0; height: auto; min-height: 360px; }
.friend-list { width: 168px; }
.person-row { min-height: 0; }
.person-row.wrap { height: 2.9em; }
.person-row.wrap .pr-val { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.45; }
.person-row.tall { height: 3.2em; }
.pr-val .aff-bar { flex-shrink: 1; min-width: 50px; }
.pr-val small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.link-btn { white-space: normal; text-align: left; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.person-face { margin-left: 0; }

/* 左側資訊欄：名字 / 稱號跟下面兩排對齊同一條欄線 */
.name-row { gap: 8px; }
.name-row .stat-ic { width: 34px; height: 34px; }
.name-stack { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.name-stack .hero-name { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.name-stack .title-text { font-size: 12px; color: #c4406b; font-weight: bold; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.name-row:hover .title-text { text-decoration: underline; }
/* 最近的日記：固定三行高，字多字少下面都不會跳 */
.last-diary { height: calc(3 * 1.5em + 18px); flex-shrink: 0; overflow: hidden; }
.statue-boost { flex-basis: 100%; display: flex; align-items: center; gap: 4px; font-size: 12px; color: #8a6a1c; background: #fff6dc; border-radius: 8px; padding: 3px 8px; }

/* ===== 世界地圖：GPT 畫的大陸 + 雲霧 ===== */
.worldmap { position: relative; width: 100%; aspect-ratio: 1280 / 853; border-radius: 14px; overflow: hidden; margin-bottom: 16px; box-shadow: 0 2px 10px rgba(40, 80, 140, 0.15); }
.wm-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.wm-fog { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; animation: fogBreath 6s ease-in-out infinite alternate; }
@keyframes fogBreath { from { opacity: 0.94; } to { opacity: 1; } }
.wm-spot { position: absolute; transform: translate(-50%, -50%); border: 0; background: none; cursor: pointer; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; font: inherit; }
.wm-name { font-size: 12.5px; font-weight: bold; color: #fff; background: rgba(40, 30, 20, 0.62); border-radius: 99px; padding: 1px 9px; white-space: nowrap; text-shadow: 0 1px 1px rgba(0,0,0,.4); }
.wm-spot.locked .wm-name { background: rgba(90, 100, 120, 0.5); color: #eef2f8; }
.wm-spot.here .wm-name, .wm-spot.picked .wm-name { background: #f27a9b; }
.wm-spot:hover .wm-name { transform: scale(1.08); }
.wm-hero { width: 40px; height: 40px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px #f27a9b, 0 2px 6px rgba(0,0,0,.3); display: grid; place-items: center; overflow: hidden; animation: heroBob 1.2s ease-in-out infinite alternate; }
@keyframes heroBob { to { transform: translateY(-4px); } }
.wm-card { position: absolute; width: 250px; background: rgba(255, 255, 255, 0.96); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; box-shadow: 0 4px 14px rgba(0,0,0,.18); display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; z-index: 2; }
.wm-card[hidden] { display: none; }
.wm-card-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.wm-card-head b { font-size: 15px; }
.wm-card .mons, .wm-card .loot { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; color: var(--ink-2); }
.wm-hint { color: var(--ink-2); line-height: 1.5; }
.gift-tier { margin-right: 8px; color: var(--ink-2); } .gift-tier.got { color: #c4406b; }
.person-row.gifts { height: 4.4em; } .person-row.gifts .pr-val { -webkit-line-clamp: 3; } .person-row.gifts .gift-tier { display: block; }

/* 倉庫 / 衣櫃的物品詳細：按鈕由上而下排成一欄、一樣寬，文字區不會被擠成細細一條 */
.detail .info { min-width: 0; }
.detail .actions { flex-direction: column; flex-wrap: nowrap; align-items: stretch; justify-content: flex-start; width: 200px; flex-shrink: 0; gap: 6px; }
.detail .actions > .btn { width: 100%; justify-content: center; white-space: nowrap; }

/* 好感度：5 顆星 */
.hearts { gap: 1px; }
.hearts i { width: 11px; height: 11px; background: #e6dfe3;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.hearts i.on { background: #ffbf2e; }
.person-row.gifts { height: 7.4em; }
.person-row.gifts .pr-val { -webkit-line-clamp: 5; }
.friends .person { min-height: 430px; }

/* 故事卡：條件標籤放在右邊一欄（地區下面），往下排，卡片矮一點 */
.story-reward { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; max-width: 46%; flex-shrink: 0; }
.conds.side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-wrap: nowrap; overflow: visible; }
.conds.side .cond { white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.story-card .new-region { display: inline-block; margin-top: 2px; font-size: 11px; }
.statue-note { display: flex; gap: 4px; align-items: flex-start; font-size: 12px; color: #8a6a1c; background: #fff6dc; border-radius: 8px; padding: 4px 8px; line-height: 1.5; }

/* 故事卡右欄固定兩行：上面地區、下面條件（排成一行，放不下用…，滑鼠移上去看全部） */
.story-reward { max-width: 52%; min-width: 0; }
.story-reward .trigger { display: inline-flex; align-items: center; gap: 3px; max-width: 100%; min-width: 0; white-space: nowrap; }
.story-reward .trig-text { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.conds.side { flex-direction: row; justify-content: flex-end; flex-wrap: nowrap; overflow: hidden; max-width: 100%; gap: 3px; }
.conds.side .cond { flex-shrink: 1; min-width: 0; }
.story-card .new-region { margin: 0 0 0 6px; font-size: 11px; font-weight: bold; vertical-align: middle; }

/* 好感度：5 顆愛心（粉紅色） */
.hearts i { width: 11px; height: 11px; background: #ecdde3;
  clip-path: path('M5.5 10.4 L1 5.6 A2.7 2.7 0 0 1 5.5 2 A2.7 2.7 0 0 1 10 5.6 Z'); }
.hearts i.on { background: #f06292; }
.codex-note { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-2); margin: -4px 0 8px; }
/* 頭像統一：跟圖鑑格子一樣，圖完整縮進框裡、左右上下置中（不貼底、不固定高度、不被撐歪） */
.person-face, .friend-face, .entry-pic { display: grid !important; place-items: center !important; }
.person-face img, .friend-face img, .entry-pic img, .entry-pic .icon {
  width: auto !important; height: auto !important; max-width: 92% !important; max-height: 92% !important;
  object-fit: contain; margin: 0 !important; flex-shrink: 1 !important; }

/* 頭像：百分比的最大高度在格子裡不一定算得出來（圖會超出框被切掉）→ 每種框直接給像素上限，圖完整縮進去 */
.friend-face img { max-width: 32px !important; max-height: 32px !important; }
.person-face img { max-width: 88px !important; max-height: 88px !important; }
.entry-pic img, .entry-pic .icon { max-width: 44px !important; max-height: 44px !important; }
.entry-pic.big img { max-width: 60px !important; max-height: 60px !important; }
.req-card .story-icon .entry-pic img { max-width: 40px !important; max-height: 40px !important; }

/* 左側資訊欄：不能捲動（捲軸會吃掉人物畫面、擠窄下面的排版）。視窗矮的時候只有人物畫面縮小（裁切，不變形） */
.hero-card { overflow: hidden; }
.hero-card > * { flex-shrink: 0; }
.hero-card > .hero-stage { flex-shrink: 1; min-height: 120px; }
.hero-stage canvas { object-fit: cover; }
/* 最下面的小標籤固定一排 */
.trip-chips { flex-wrap: nowrap; overflow: hidden; gap: 4px; }
.trip-chips span, .trip-chips button { font-size: 11px; padding: 2px 7px; flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* iOS 風格捲軸：細細圓圓、半透明，平常幾乎看不到，滑鼠移上去或捲動時才浮現 */
::-webkit-scrollbar { width: 8px; height: 8px; background: transparent; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
::-webkit-scrollbar-thumb { background: transparent; border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; transition: background-color .3s; }
*:hover::-webkit-scrollbar-thumb, .scrolling::-webkit-scrollbar-thumb { background-color: rgba(60, 70, 90, 0.32); }
::-webkit-scrollbar-thumb:hover { background-color: rgba(60, 70, 90, 0.55) !important; }
/* 人物畫面變矮時裁掉上面的天空，腳下保留 */
.hero-stage canvas { object-position: 50% 100%; }

.preview-notice { flex-shrink:0; padding:5px 18px; font-size:12px; line-height:1.6; color:#45566b; background:#fff5db; border-bottom:1px solid #ead9ad; }
