/* 心動小鎮五星圖鑑 樣式表
 * 依功能分成數個區塊，後面的區塊會覆蓋前面相同的設定，請勿隨意調換順序。 */

/* ======== 基本樣式：版面、側邊導覽、表格、按鈕、篩選器等 ======== */
:root {
  /* ===== 全站顏色變數（v1.3.1 起，頁面上的顏色都從這裡取）=====
   * 這裡是預設配色「森林綠」。其他配色寫在 css/themes.css，只覆蓋下方【主題色】。
   * 改顏色時：要所有配色一起變 → 改用到它的元件；只改某個配色 → 改 themes.css。
   * 字級：26 頁面標題、20 區塊標題、16 卡片標題、14 內文、13 次要、12 小字、11 最小；字重只用 400／600／700 */

  /* 【主題色】底色（由淺到深） */
  --bg: #f5f5ee;            /* 頁面背景 */
  --paper: #fffefb;         /* 卡片、面板、輸入框（白） */
  --soft: #f5f7f0;          /* 表頭、篩選區、說明框 */
  --pale: #eaf0e7;          /* 帶主色的淺底：已完成列、選取、hover */
  --pale-strong: #dcebdd;   /* 比 --pale 再深一階：比較表強調列 */
  --track: #e8ecdf;         /* 進度條底槽、標籤底 */
  /* 【主題色】線條 */
  --line: #e4e8df;          /* 一般框線、分隔線 */
  --line-strong: #d9e1d4;   /* 較明顯的框線、捲軸 */
  --accent-line: #9fc1ae;   /* 焦點外框、選取中的框線 */
  /* 【主題色】主色 */
  --green: #34654f;         /* 主色：按鈕、選取中的分頁、強調文字（名稱沿用舊版，所有配色都叫 --green） */
  --deep: #244e3e;          /* 深主色：按鈕 hover、深色強調字 */
  --on-accent: #ffffff;     /* 主色底上的文字 */
  --on-accent-soft: #d6e3d7;/* 主色底上的次要文字（例如選中分類的數量） */
  --bar-from: #93c2a2;      /* 進度條漸層起點（終點是 --green） */
  /* 【主題色】文字（由深到淺） */
  --ink: #293b33;           /* 標題、主要文字 */
  --text: #526748;          /* 內文 */
  --sub: #576954;           /* 次要內文、說明（＝內文 55% 混次要字，v1.3.1） */
  --muted: #5e6b62;         /* 次要文字、標籤（v1.3.1 加深到 5.5:1，原 #7c867c） */
  --faint: #6e796b;         /* 最淡：提示、說明小字、placeholder（v1.3.1 加深到 4.5:1，原 #9aa18f） */
  /* 【主題色】五星金 */
  --gold: #ba954c;          /* 星星、金色裝飾 */
  --gold-ink: #87682b;      /* 金色文字（五星、活動、成就獎勵；v1.3.1 微調到 4.6:1） */
  --gold-soft: #fff0d8;     /* 金色淺底（活動、限定、五星標籤） */

  /* 【狀態色】固定語意，所有配色共用，themes.css 不覆蓋 */
  --danger: #c9434e;        /* 刪除、喜歡 */
  --danger-ink: #a34d42;    /* 虧損、負數、錯誤文字 */
  --danger-soft: #fbf1f1;   /* 錯誤、刪除 hover 淺底 */
  --danger-line: #f0d4d6;   /* 錯誤框線 */
  --warn-ink: #9a6338;      /* 限定材料、備份提醒 */
  --warn-soft: #fff8e9;     /* 缺少資料提示淺底 */
  --info-ink: #245a8a;      /* 「當前」活動徽章 */
  --info-soft: #e1efff;
  --info-line: #accbea;
  --past-ink: #574c66;      /* 「過往」活動徽章（v1.3.1 加深） */
  --past-soft: #ece8f2;
  --past-line: #d8d0e4;
  --slate-ink: #566384;     /* 狗、料理 B 標籤 */
  --slate-soft: #e6eaf4;
  --purple-ink: #7d578a;    /* 花色、彩虹（v1.3.1 加深，原 #9675a1） */
  --purple-soft: #f0e9f2;
  --neutral-ink: #555c56;   /* 舊「日常」徽章色，保留給其他中性文字 */
  --sun-ink: #95590a;       /* 天氣「晴」 */
  --rain-ink: #2e6aa1;      /* 天氣「雨」（彩虹日用 --purple-ink） */
  /* 分類標籤（v1.3.1）：每一類固定一個色相，不跟主題色走；框線由文字色與底色混出 */
  --daily-ink: #3d4548;     /* 「日常」 */
  --daily-soft: #e9ecee;
  --crop-ink: #4c5f1c;      /* 「作物」 */
  --crop-soft: #eaf2dc;
  --cat-ink: #8a4a12;       /* 寵物「貓」 */
  --cat-soft: #fdebd9;
  --dog-ink: #3d4a70;       /* 寵物「狗」 */
  --dog-soft: #e4e9f5;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    14px/1.65 "Segoe UI",
    "Microsoft JhengHei",
    sans-serif;
}
button,
input,
select {
  font: inherit;
  border-radius: 8px;
}
button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  transition: background 0.15s;
}
a {
  color: var(--green);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--accent-line);
  outline-offset: 3px;
}
button {
  color: inherit;
}
button:disabled {
  cursor: not-allowed;
}
button:hover {
  filter: brightness(0.97);
}
[hidden] {
  display: none !important;
}
.menu-toggle {
  display: none;
}
.side-panel {
  display: contents;
}
.sidebar {
  width: 238px;
  position: fixed;
  inset: 0 auto 0 0;
  border-right: 1px solid var(--line-strong);
  display: flex;
  flex-direction: column;
  z-index: 2;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  font-weight: 700;
}
.brand small {
  display: block;
  font-size: 9px;
  letter-spacing: 1.7px;
  margin-top: 3px;
  color: var(--faint);
}
nav {
  display: grid;
}
.nav-item {
  width: 100%;
  border: 1px solid transparent;
  background: none;
  padding: 14px 13px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 13px;
}
.nav-item.active {
  background: var(--green);
  color: var(--on-accent);
}
.nav-item:not(.active):hover {
  background: var(--track);
}
.nav-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
svg {
  width: 24px;
  height: 24px;
}
.nav-name {
  font-weight: 600;
  font-size: 14px;
}
.nav-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.active .nav-count {
  color: var(--on-accent-soft);
}
.page {
  margin-left: 238px;
}
.topbar {
  padding: 0 42px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}
.topbar span:not(#save-state) {
  margin: 0 12px;
  color: var(--faint);
}
.tools {
  display: flex;
  align-items: center;
  gap: 9px;
}
#save-state {
  font-size: 11px;
  margin-right: 10px;
  color: var(--sub);
}
.button {
  border: 1px solid var(--line-strong);
  background: var(--paper);
  padding: 7px 13px;
}
.primary {
  background: var(--green);
  color: var(--on-accent);
  border-color: var(--green);
}
.icon-button {
  border: 1px solid var(--line);
  background: transparent;
  width: 29px;
  height: 29px;
  border-radius: 50%;
  padding: 0;
}
main {
  max-width: 1550px;
  margin: auto;
  padding: 39px 42px 24px;
}
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
h1 {
  font-family: "Microsoft JhengHei", sans-serif;
  font-size: 32px;
  letter-spacing: 2px;
  margin: 0;
  font-weight: 600;
}
/* 首頁進度區的標題：外觀同 h1，但一頁只保留一個 h1（SEO） */
.hero-title {
  font-family: "Microsoft JhengHei", sans-serif;
  font-size: 32px;
  letter-spacing: 2px;
  margin: 0;
  font-weight: 600;
}
h1 span {
  color: var(--faint);
  margin-left: 17px;
  font-size: 25px;
}
.lead {
  margin: 8px 0 0;
  color: var(--faint);
  font-size: 13px;
}
.total-card {
  display: flex;
  align-items: center;
}
.total-card strong {
  font-weight: 600;
  line-height: 1.4;
}
.total-card #total-count {
  color: var(--faint);
  margin-left: 7px;
}
.ring {
  --progress: 0%;
  width: 55px;
  height: 55px;
  margin-left: auto;
  background: conic-gradient(var(--green) var(--progress), var(--pale-strong) 0);
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.ring span {
  width: 46px;
  height: 46px;
  background: var(--pale);
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 11px;
}
.collection {
  border: 1px solid var(--line);
  background: var(--paper);
  overflow: hidden;
}
.collection-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.title-group {
  display: flex;
  align-items: center;
}
.category-icon {
  display: grid;
  place-items: center;
  color: var(--green);
}
.category-icon svg {
  width: 28px;
  height: 28px;
}
h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 1px;
}
.title-group p {
  font-size: 11px;
  color: var(--faint);
  margin: 4px 0 0;
}
.category-progress {
  width: 180px;
  text-align: right;
  flex-shrink: 0;
}
.bar {
  height: 5px;
  border-radius: 6px;
  background: var(--track);
  margin-top: 9px;
  overflow: hidden;
}
.bar i {
  height: 100%;
  display: block;
  background: var(--green);
  border-radius: 6px;
}
.filters {
  border: 1px solid var(--track);
}
.filter-top {
  display: flex;
  justify-content: space-between;
}
.search-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 4px 12px;
  width: 100%;
  color: var(--faint);
}
.search-wrap span {
  font-size: 26px;
  line-height: 1;
}
.search-wrap input {
  width: 100%;
  border: 0;
  outline: 0;
  background: none;
  font-size: 12px;
  padding: 5px 0;
  color: var(--ink);
}
input::placeholder {
  color: var(--faint);
}
.segments {
  display: flex;
  background: var(--track);
  border-radius: 7px;
  padding: 3px;
}
.segments button {
  border: 0;
  background: none;
  font-size: 11px;
  color: var(--sub);
  border-radius: 5px;
}
.segments button.active {
  background: var(--paper);
  color: var(--green);
  box-shadow: 0 1px 3px #243a3314;
}
.filter-grid label {
  font-size: 11px;
  color: var(--muted);
  min-width: 0;
}
.filter-grid select {
  border: 1px solid var(--line-strong);
  background: var(--paper);
  font-size: 12px;
  color: var(--text);
  text-overflow: ellipsis;
}
.filter-foot {
  font-size: 10px;
  color: var(--faint);
  display: flex;
  align-items: center;
}
.text-button {
  border: 0;
  background: none;
  color: var(--sub);
  font-size: 11px;
  white-space: nowrap;
  padding: 0;
}
.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}
.list-toolbar b {
  font-weight: 600;
}
.list-toolbar #result-note {
  color: var(--faint);
  font-size: 11px;
  margin-left: 12px;
}
.list-toolbar label {
  color: var(--faint);
  font-size: 11px;
}
.list-toolbar select {
  border: 0;
  background: none;
  color: var(--text);
  padding: 4px;
  font-size: 11px;
}
.table-wrap {
  overflow: auto;
}
/* 表格的左右捲軸改細，顏色跟著版面（Chrome／Edge／Firefox） */
.table-wrap,
.calc-table-scroll {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.list {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  min-width: 780px;
  table-layout: fixed;
}
.list thead {
  font-size: 10px;
  color: var(--faint);
  background: var(--soft);
}
.list th {
  font-weight: 400;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
}
.list td {
  padding: 15px 12px;
  border-bottom: 1px solid var(--line); /* v1.3.1：原 --pale，和已完成列底色相同會消失 */
  vertical-align: middle;
  font-size: 12px;
}
.list th:first-child,
.list td:first-child {
  width: 74px;
}
.list th:nth-child(2) {
  width: 22%;
}
.list th:last-child {
  width: 65px;
}
.list th:nth-child(3) {
  width: 80px;
}
.list tbody tr.item:hover {
  background: var(--paper);
}
/* 已完成列之間的分隔線用卡片色（淡底上的一條白線），--line 在淡底上看不出來；夜間見 themes.css */
.list tbody tr.item.complete > td,
.collection > .table-wrap > .list > tbody > tr.item.complete {
  border-bottom-color: var(--paper);
}
/* 已完成列裡的一般標籤（作物、花卉等，只有 .badge）改用卡片底，否則和列底同色看不到 */
.item.complete .badge[class="badge"] {
  background: var(--paper);
}
.item.complete,
.list tbody tr.item.complete:hover {
  background: var(--pale); /* v1.3.1：原本 --soft 和卡片幾乎一樣，改用帶主色的淡底（夜間見 themes.css） */
}
.item.complete .item-name {
  color: var(--muted); /* v1.3.1：原本 --faint 太淡；已完成仍比一般名稱淡 */
}
.check-label {
  display: inline-grid;
  place-items: center;
  position: relative;
  cursor: pointer;
}
.check-label input {
  appearance: none;
  width: 23px;
  height: 23px;
  border: 1.5px solid var(--line-strong);
  border-radius: 7px;
  cursor: pointer;
  background: var(--paper);
  margin: 0;
}
.check-label input:checked {
  background: var(--green);
  border-color: var(--green);
}
.check-label input:disabled {
  background: var(--bg);
  border-style: dashed;
  cursor: not-allowed;
}
.check-label span {
  position: absolute;
  pointer-events: none;
  font-size: 14px;
  color: transparent;
  line-height: 1;
}
.check-label input:checked + span {
  color: var(--on-accent);
}
.item-name {
  font-weight: 600;
  color: var(--deep);
  display: block;
}
.item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 10px;
  color: var(--faint);
}
.badge {
  border-radius: 4px;
  padding: 1px 5px;
  background: var(--pale);
  color: var(--text); /* v1.3.1：原本 --faint 太淡（約 2.3:1） */
}
.badge.event {
  background: var(--gold-soft);
  color: var(--gold-ink);
}
.badge.limited {
  background: var(--gold-soft);
  color: var(--gold-ink);
}
.badge.station {
  background: var(--gold-soft);
  color: var(--gold-ink);
}
.badge.color {
  background: var(--purple-soft);
  color: var(--purple-ink);
}
.badge.unknown {
  background: var(--gold-soft);
  color: var(--gold-ink);
}
.number {
  font-size: 10px;
}
.level-badge {
  display: inline-block;
  border: 1px solid var(--line-strong); /* v1.3.1：原 --track 太淡 */
  border-radius: 5px;
  padding: 1px 7px;
}
.info-text {
  line-height: 1.8;
}
.weather-symbols {
  display: flex;
  gap: 6px;
  margin-top: 3px;
  font-size: 10px;
  color: var(--text); /* v1.3.1：晴、雨用內文色（原本 --faint 太淡）；彩虹日另用紫色 */
}
.weather-symbols span {
  white-space: nowrap;
}
.weather-symbols .sunny {
  color: var(--sun-ink);
}
.weather-symbols .rainy {
  color: var(--rain-ink);
}
.weather-symbols .rainbow {
  color: var(--purple-ink);
}
.row-detail {
  border: 0;
  background: none;
  padding: 5px;
  /* 「資料 ＋」「詳情 ＋」不換行 */
  white-space: nowrap;
}
.detail-row td {
  padding: 17px 28px !important;
  background: var(--soft);
}
.raw-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px 20px;
}
.raw-pair {
  border-bottom: 1px solid var(--track);
  padding: 4px 0;
}
.raw-pair dt {
  color: var(--faint);
  font-size: 10px;
}
.raw-pair dd {
  margin: 2px 0;
  font-size: 11px;
  overflow-wrap: anywhere;
}
.detail-source {
  font-size: 10px;
  color: var(--faint);
  margin-top: 12px;
}
.empty {
  text-align: center;
  padding: 45px;
  color: var(--faint);
}
.empty > span {
  font-size: 37px;
}
.empty h3 {
  font-size: 16px;
  color: var(--sub);
}
.empty p {
  font-size: 12px;
}
.source-footer {
  gap: 8px 16px;
  justify-content: space-between;
  flex-wrap: wrap;
  margin: 21px 2px 0;
}
.source-footer a {
  color: var(--sub);
  text-decoration: none;
}
.source-footer p {
  width: 100%;
  margin: 0;
  font-size: 10px;
  color: var(--faint);
}
.toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--deep);
  color: var(--on-accent);
  padding: 12px 23px;
  border-radius: 9px;
  box-shadow: 0 5px 25px #0002;
  z-index: 10;
  font-size: 12px;
  max-width: 90vw;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 15px;
  max-width: 650px;
  width: 90vw;
  padding: 27px;
  color: var(--ink);
  box-shadow: 0 20px 90px #243b3330;
}
dialog::backdrop {
  background: #273c3455;
  backdrop-filter: blur(3px);
}
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}
.dialog-heading h2 {
  font-size: 20px;
}
.help-content {
  font-size: 13px;
  color: var(--sub);
  max-height: 65vh;
  overflow: auto;
  margin: 18px 0;
}
.help-content h3 {
  font-size: 13px;
  color: var(--green);
  margin-top: 22px;
}
.help-content ul {
  padding-left: 20px;
}
.help-content li {
  margin: 7px 0;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 25px;
}
#import-dialog p {
  font-size: 13px;
  color: var(--sub);
}
@media (min-width: 1500px) {
  .list th:nth-child(2) {
    width: 23%;
  }
  .list td {
    padding-top: 18px;
    padding-bottom: 18px;
  }
}
@media (max-width: 1150px) {
  .sidebar {
    width: 195px;
    padding-left: 17px;
    padding-right: 17px;
  }
  .page {
    margin-left: 195px;
  }
  .topbar {
    padding: 0 25px;
  }
  main {
    padding: 30px 25px;
  }
  .brand {
    font-size: 18px;
  }
    .total-card {
    min-width: 250px;
    padding: 16px;
    gap: 13px;
  }
  .hero .hero-title {
    font-size: 28px;
  }
  .raw-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 800px) {
  .sidebar {
    border-right: 0;
    align-content: start;
  }
  .brand {
    font-size: 18px;
  }
  .brand small {
    font-size: 8px;
  }
    nav {
    display: flex;
    gap: 5px;
  }
  .nav-item {
    padding: 8px 10px;
    gap: 6px;
    justify-content: center;
  }
  .nav-count {
    display: none;
  }
  .nav-name {
    font-size: 12px;
  }
  .nav-icon svg {
    width: 20px;
  }
  .page {
    margin-left: 0;
  }
  .topbar {
    height: auto;
    min-height: 65px;
    gap: 10px;
  }
  .topbar > div:first-child {
    display: none;
  }
  .tools {
    width: 100%;
    justify-content: flex-end;
  }
  #save-state {
    margin-right: auto;
  }
  main {
    padding: 25px 16px;
  }
  .hero {
    gap: 20px;
  }
  .title-group p {
    font-size: 10px;
  }
  .filter-top {
    flex-direction: column;
  }
  .search-wrap {
    max-width: none;
  }
  .location-filter {
    grid-column: span 2;
  }
  .filter-foot {
    align-items: flex-start;
  }
  .list-toolbar #result-note {
    display: block;
  }
    .raw-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .source-footer {
    line-height: 1.9;
  }
  .nav-icon {
    width: 19px;
  }
  .category-icon {
    width: 38px;
    height: 38px;
  }
  .title-group {
    gap: 10px;
  }
  .title-group h2 {
    font-size: 18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
/* Compact collection view */
.sidebar {
  background: var(--soft);
  padding: 28px 22px;
}
.brand {
  font-size: 18px;
  letter-spacing: 0;
  white-space: nowrap;
}
nav {
  margin-top: 30px;
  gap: 6px;
}
.nav-item.active {
  box-shadow: none;
}
.topbar {
  background: var(--paper);
  justify-content: flex-end;
}
.topbar > .tools {
  display: flex;
}
.hero {
  margin-bottom: 18px;
  gap: 14px;
}
.hero .hero-title {
  font-size: 21px;
  letter-spacing: 0;
}
.total-card {
  min-width: 0;
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  gap: 6px;
}
.total-card strong {
  font-size: 22px;
}
.total-card #total-count {
  font-size: 14px;
  margin: 0 8px 0 0;
}
.total-card #total-percent {
  font-size: 13px;
  color: var(--text);
}
main {
  padding-top: 24px;
}
.collection {
  border-radius: 8px;
  box-shadow: none;
}
.category-icon {
  background: none;
  width: 26px;
  height: 26px;
  border-radius: 0;
}
.title-group {
  gap: 10px;
}
.title-group h2 {
  font-size: 19px;
  letter-spacing: 0;
}
.filters {
  border-radius: 6px;
}
.filter-grid label,
.list-toolbar label {
  font-size: 12px;
  color: var(--sub);
}
.filter-grid select,
.search-wrap input {
  font-size: 13px;
}
.list td {
  padding-top: 12px;
  padding-bottom: 12px;
}
.list th {
  font-size: 12px;
  color: var(--sub);
}
.item-name {
  font-size: 14px;
}
.info-text {
  font-size: 12px;
  color: var(--sub);
}
.number {
  color: var(--muted);
}
.item-meta,
.weather-symbols {
  font-size: 12px; /* v1.3.1：原 11px，晴雨太小 */
}
.badge {
  font-size: 10px;
}
.level-badge {
  font-size: 11px;
  color: var(--text);
}
.row-detail {
  font-size: 11px;
  color: var(--text);
}
.category-progress {
  font-size: 12px;
  color: var(--sub);
}
.source-footer {
  margin-top: 15px;
}
.button {
  font-size: 12px;
}
@media (max-width: 1150px) and (min-width: 801px) {
  .brand {
    font-size: 16px;
  }
  .sidebar {
    padding-left: 15px;
    padding-right: 15px;
  }
}
@media (max-width: 800px) {
  nav {
    margin-top: 15px;
  }
  .hero {
    flex-direction: row;
    align-items: center;
  }
  .total-card {
    padding: 0;
  }
  .topbar > .tools {
    display: flex;
  }
}
.flower-toggle {
  border: 0;
  background: none;
  padding: 0;
  text-align: left;
  color: var(--green);
  cursor: pointer;
}
.flower-colors {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin: 14px 0;
}
.flower-color {
  padding: 13px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.flower-color.collected {
  background: var(--pale);
}
.flower-color label {
  display: flex;
  gap: 10px;
  align-items: center;
  cursor: pointer;
}
.flower-color input {
  width: 20px;
  height: 20px;
  accent-color: var(--green);
}
.flower-color small {
  display: block;
  color: var(--muted);
}
.five-star-filter {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 15px 0 0;
  color: var(--green);
}
.five-star-filter input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}
.five-star-note {
  font-size: 11px;
  color: var(--muted);
  margin: 5px 0 0;
}
.dish-list th:nth-child(2) {
  width: 20%;
}
.dish-list th:nth-child(4) {
  width: 24%;
}
.dish-list th:nth-child(5) {
  width: 29%;
}
.dish-cost {
  font-size: 12px;
  margin-bottom: 6px;
}
.gain {
  color: var(--green);
}
.loss {
  color: var(--danger-ink);
}
.list-toolbar {
  flex-wrap: wrap;
  gap: 10px;
}
.bird-five-info {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line-strong);
}
.bird-five-info strong {
  font-size: 12px;
  color: var(--gold-ink); /* v1.3.1：五星標題用五星金，不用主色（主色在部分配色下和白色標題放一起很突兀） */
}
.sidebar .brand {
  white-space: normal;
}
.hero {
  flex-wrap: wrap;
}
@media (max-width: 800px) {
  .hero .hero-title {
    font-size: 19px;
  }
}

#location option {
  font-weight: 400;
}
#location option[value="all"] {
  font-weight: 700;
}

/* 星級售價：放得下就排一行，寬度不夠時自動換行（不出現橫向捲軸） */
.raw-grid.fish-prices {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 24px;
  margin: 0;
  overflow-x: visible;
}
.fish-prices .raw-pair {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-shrink: 0;
  border: 0;
  padding: 0;
  white-space: nowrap;
}
.fish-prices dt {
  font-size: 12px;
}
.fish-prices dd {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Clickable sorting headers */
.column-sort {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 4px 0;
  border: 0;
  background: transparent;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.column-sort span {
  flex-shrink: 0;
  color: var(--faint);
  font-size: 12px;
}
.column-sort:hover {
  color: var(--green);
}
th[aria-sort="ascending"],
th[aria-sort="descending"] {
  color: var(--green);
  background: var(--pale);
}

.dish-economics-detail {
  max-width: 560px;
}
.dish-economics-detail h4 {
  margin: 0 0 10px;
}
/* 子料理材料明細（料理詳情內，可展開） */
.sub-dish-detail {
  margin: 4px 0 10px;
}
.sub-dish-detail summary {
  cursor: pointer;
}
.sub-dish-detail ul {
  margin: 6px 0 0;
  padding-left: 1.2em;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.dish-price-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper);
}
.dish-price-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-variant-numeric: tabular-nums;
}
.list .dish-price-table tr > th,
.list .dish-price-table tr > td {
  width: 25%;
  padding: 11px 16px !important;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: right;
  font-size: 12px;
  white-space: nowrap;
}
.list .dish-price-table tr > :first-child {
  text-align: left;
}
.list .dish-price-table thead th {
  background: var(--pale);
  color: var(--muted);
  font-weight: 400;
}
.list .dish-price-table tbody th {
  font-weight: 400;
}
.list .dish-price-table tbody tr:last-child > * {
  border-bottom: 0;
}
.dish-ingredients {
  max-width: none;
  margin-top: 14px;
}
.dish-ingredients h4 {
  margin: 0 0 8px;
}
.dish-ingredients ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.dish-ingredients li {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  white-space: nowrap;
}
.dish-ingredients b {
  font-weight: 400;
  color: var(--muted);
  margin-left: 6px;
}
/* Consistent spacing for filters and collection results. */
.collection-heading {
  padding: 24px;
}
.filters {
  margin: 0 24px;
}
.search-wrap {
  max-width: none;
  flex: 1;
  min-width: 0;
}
.search-wrap input {
  min-width: 0;
}
.segments {
  align-items: stretch;
}
.segments button {
  padding: 6px 18px;
}
.filter-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.filter-grid label {
  line-height: 1.5;
}
.filter-foot {
  border-top: 1px solid var(--line);
}
.filter-foot .text-button {
  padding: 4px 0;
}
.list-toolbar {
  padding: 18px 24px;
  min-height: 56px;
}
.list-toolbar > div {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
}
.list-toolbar #result-note {
  margin: 0;
}
.five-star-note {
  line-height: 1.8;
}
.list th:first-child,
.list td:first-child {
  padding-left: 24px;
}
@media (max-width: 1150px) {
  .filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .location-filter {
    grid-column: span 2;
  }
}
@media (max-width: 800px) {
  nav {
    flex-wrap: wrap;
  }
  .nav-item {
    width: auto;
    flex: 1 0 28%;
    white-space: nowrap;
  }
  .collection-heading {
    padding: 18px 16px;
  }
  .filters {
    margin: 0 16px;
  }
  .search-wrap {
    flex: auto;
    width: 100%;
  }
  .segments button {
    padding: 6px 10px;
  }
  .list-toolbar {
    padding: 16px;
  }
  .list-toolbar #result-note {
    margin: 0;
  }
  .tools {
    flex-wrap: wrap;
  }
  .list th:first-child,
  .list td:first-child {
    padding-left: 16px;
  }
}
.list .dish-price-table tr > * + * {
  border-left: 1px solid var(--line);
}
.list .dish-price-table tbody tr:nth-child(even) {
  background: var(--paper);
}
.list .dish-price-table tbody td:last-child {
  font-weight: 600;
}
.dish-ingredients li.limited-material {
  color: var(--warn-ink);
  font-weight: 700;
}
/* Align the table with the filter panel, without adding another frame. */
.collection > .table-wrap {
  margin: 0 24px 24px;
}
@media (max-width: 800px) {
  .collection > .table-wrap {
    margin: 0 16px 16px;
  }
}

/* Public release v1.0.0 */
.topbar > div.tools:first-child {
  display: flex;
}
.release-notice {
  background: var(--pale);
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--green);
  padding: 14px 18px;
  margin: 0 0 20px;
  border-radius: 8px;
  color: var(--text);
}
.release-notice p {
  margin: 4px 0;
  font-size: 13px;
}
.release-notice a {
  font-size: 12px;
}
.storage-note {
  font-size: 12px;
  color: var(--text);
  margin: 0 0 16px;
}
.storage-note p {
  margin: 4px 0;
}
.backup-due {
  color: var(--warn-ink);
  font-weight: 600;
}
.filter-foot {
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}
.filter-actions {
  flex-wrap: wrap;
}
#filter-summary {
  flex: 1 1 100%;
  color: var(--text);
  font-size: 12px;
  overflow-wrap: anywhere;
}
#time-context {
  color: var(--text);
  font-size: 12px;
}
.release-log {
  margin-top: 24px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--text);
  font-size: 14px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}
.release-log summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
}
.release-log h3 {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.8;
  margin: 16px 0 8px;
}
.release-log p {
  font-size: 14px;
  line-height: 1.8;
  margin: 10px 0;
}
.release-log ul {
  font-size: 14px;
  line-height: 1.8;
  margin: 10px 0;
  padding-left: 22px;
}
.release-log li {
  font-size: inherit;
  margin: 6px 0;
}
.table-hint {
  margin: 0 24px 8px;
  color: var(--text);
  font-size: 12px;
}
.report-field {
  width: 100%;
  min-height: 190px;
  padding: 10px;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.tools {
  flex-wrap: wrap;
}
.topbar {
  height: auto;
  min-height: 61px;
  padding-top: 10px;
  padding-bottom: 10px;
}
dialog {
  max-height: 85dvh;
  overflow-y: auto;
}
button.row-detail,
.column-sort {
  min-height: 36px;
}
.check-label {
  min-width: 36px;
  min-height: 36px;
}
@media (max-width: 800px) {
  .release-notice {
    padding: 12px;
  }
  .topbar {
    padding: 10px 16px;
  }
  .tools {
    gap: 8px;
  }
  .button,
  .icon-button,
  .text-button {
    min-height: 40px;
  }
  .icon-button {
    width: 40px;
  }
  .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    scroll-snap-type: none;
  }
  .filter-grid select,
  .search-wrap input {
    font-size: 16px;
    min-height: 44px;
  }
  .collection-heading {
    flex-wrap: wrap;
  }
  .category-progress {
    width: 100%;
    text-align: left;
  }
  .table-hint {
    margin-left: 16px;
  }
  .source-footer {
    overflow-wrap: anywhere;
  }
}
#help-dialog[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 85dvh;
}
#help-dialog .dialog-heading,
#help-dialog > button {
  flex-shrink: 0;
}
#help-dialog > button {
  align-self: flex-start;
}
#help-dialog .help-content {
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
}
body:has(dialog[open]) {
  overflow: hidden;
}
.home-intro {
  background: var(--pale);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  column-gap: 20px;
}
.home-intro h1 {
  font-size: 28px;
}
.home-intro p {
  color: var(--sub);
}
.home-summary {
  display: flex;
  align-items: center;
}
.home-summary strong {
  color: var(--green);
}
.home-summary .bar {
  width: 210px;
  height: 8px;
}
.home-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.home-card {
  border: 1px solid var(--line);
  background: var(--paper);
  text-align: left;
  border-radius: 12px;
  min-width: 0;
}
.home-card-title {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 16px;
  font-weight: 600;
}
.home-card p {
  font-size: 12px;
  color: var(--sub);
  min-height: 40px;
}
.home-card strong {
  font-size: 23px;
}
.home-card small {
  color: var(--sub);
}
.home-guide {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.home-guide ol {
  padding-left: 22px;
}
.home-actions {
  display: flex;
  flex-wrap: wrap;
}
.home-nav {
  margin-top: 24px;
}
.home-nav + nav {
  margin-top: 6px;
}
@media (max-width: 800px) {
  .home-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .home-intro h1 {
    font-size: 23px;
  }
  .home-nav {
    margin-top: 12px;
  }
}
@media (max-width: 420px) {
  .home-grid {
    grid-template-columns: 1fr;
  }
  .home-card p {
    min-height: 0;
  }
  .home-summary {
    flex-wrap: wrap;
  }
}
.home-goal {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.home-goal > span {
  font-size: 14px;
  color: var(--sub);
}

/* Keep all visible desktop filters on one row. */
.badge.kind-daily {
  background: var(--daily-soft);
  color: var(--daily-ink);
  border: 1px solid color-mix(in srgb, var(--daily-ink) 18%, var(--daily-soft));
}
.badge.kind-current {
  background: var(--info-soft);
  color: var(--info-ink);
  border: 1px solid var(--info-line);
}
.badge.kind-past {
  background: var(--past-soft);
  color: var(--past-ink);
  border: 1px solid var(--past-line);
}
.filters {
  padding: 20px;
  background: var(--soft);
}
.filter-top {
  gap: 16px;
  margin-bottom: 18px;
  align-items: center;
}
.search-wrap {
  height: 42px;
}
.segments {
  min-height: 42px;
  flex-shrink: 0;
}
.filter-scroll {
  min-width: 0;
  max-width: 100%;
  overflow: visible;
  padding: 4px;
  margin: -4px -4px 4px;
}
.filter-grid {
  display: flex;
  flex-wrap: nowrap;
  overflow: visible;
  gap: 14px;
  width: 100%;
  min-width: 0;
  padding-bottom: 0;
}
.filter-grid > label {
  flex: 1 1 0;
  min-width: 0;
  white-space: nowrap;
  font-size: 12px;
  line-height: 20px;
}
.filter-grid > label.location-filter {
  flex: 1.3 1 0;
}
.filter-grid > label[hidden] {
  display: none;
}
.filter-grid select {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 42px;
  margin-top: 6px;
  border-radius: 6px;
  padding: 0 28px 0 12px;
  cursor: pointer;
}
.availability-options {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  min-height: 32px;
}
#availability-filter {
  margin-left: auto;
}
.availability-options .five-star-filter {
  margin: 0;
  white-space: nowrap;
  font-size: 13px;
  gap: 8px;
  min-height: 32px;
  cursor: pointer;
}
.availability-options input {
  margin: 0;
  flex-shrink: 0;
}
#bird-five-star-note {
  margin: 4px 0 0;
  line-height: 1.7;
  color: var(--sub);
}
.filter-foot {
  margin-top: 16px;
  padding-top: 12px;
}
.filter-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.filter-actions .text-button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
  line-height: 20px;
  border-radius: 5px;
  white-space: nowrap;
}
#use-current-time {
  margin-right: auto;
  padding-left: 0;
}
#clear-filters {
  margin-left: auto;
  background: var(--pale);
}
#reset-filters {
  border: 1px solid var(--line-strong);
  background: transparent;
}
.filter-actions .text-button:hover {
  background: var(--track);
}
.filter-scroll-hint {
  display: none;
  margin: 3px 0 0;
  font-size: 11px;
  color: var(--sub);
}
@media (max-width: 800px) {
  .filters {
    padding: 16px;
  }
  .filter-top {
    gap: 12px;
    margin-bottom: 16px;
    align-items: stretch;
  }
  .search-wrap,
  .segments {
    width: 100%;
  }
  .segments button {
    flex: 1;
    min-height: 40px;
  }
  .filter-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-line) var(--pale);
    padding: 4px 4px 10px;
    margin-bottom: 0;
  }
  .filter-grid {
    gap: 12px;
  }
  .filter-grid::after {
    content: "";
    flex: 0 0 8px;
  }
  .filter-grid > label {
    flex: 0 0 calc((100% - 12px) / 2);
    min-width: 0;
    scroll-snap-align: none;
  }
  .filter-grid > label.location-filter {
    flex: 0 0 calc((100% - 12px) / 2);
  }
  .filter-grid select {
    height: 44px;
    font-size: 16px;
    padding: 0 26px 0 8px;
  }
  .filter-scroll-hint {
    display: block;
  }
  .availability-options {
    margin-top: 10px;
  }
  .filter-actions {
    gap: 8px;
    flex-wrap: wrap;
  }
  .filter-actions .text-button {
    font-size: 12px;
    min-height: 40px;
    padding: 8px;
  }
  #use-current-time {
    flex-basis: 100%;
    margin: 0;
    padding-left: 0;
    text-align: left;
  }
  #clear-filters {
    margin-left: auto;
  }
  #bird-five-star-note {
    font-size: 11px;
    line-height: 1.8;
  }
}

.release-pages {
  padding: 18px 20px;
  background: var(--paper);
}
.release-section-heading h2 {
  margin: 0 0 10px;
  font-size: 16px;
  color: var(--deep);
}
.release-pages .release-batch h3 {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 400;
  color: var(--sub);
}
.release-pages .release-batch p {
  margin: 6px 0;
  font-size: 13px;
  line-height: 1.8;
}
.release-pages .release-bullets {
  padding-left: 20px;
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.85;
}
.release-pages .release-bullets li {
  margin: 5px 0;
}
.release-bullets strong {
  font-weight: 600;
  color: var(--text);
}
.release-pagination {
  display: flex;
  align-items: center;
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  width: 100%;
  justify-content: center;
  gap: 20px;
}
.release-pagination .button {
  font-size: 12px;
  border: 0;
  background: transparent;
  box-shadow: none;
  min-height: 36px;
}
.release-pagination .button:disabled {
  filter: none;
  opacity: 0.35;
}
.release-pagination > span {
  font-size: 12px;
  white-space: nowrap;
  color: var(--sub);
}
.release-source-notes {
  margin-top: 12px;
}
.release-source-notes h3 {
  font-size: 12px;
  font-weight: 400;
  color: var(--sub);
}
.source-footer .release-source-notes p {
  font-size: 12px;
  line-height: 1.8;
}
@media (max-width: 800px) {
  .release-pages {
    padding: 16px;
  }
  .release-pagination .button {
    font-size: 11px;
    padding: 6px 8px;
  }
}
.source-footer .site-update-note {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 12px;
}
.site-tagline {
  text-align: center;
  margin: 24px 0 8px;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.8;
  color: var(--muted);
}
.site-author {
  text-align: center;
  margin: 4px 0 8px;
  font-size: 12px;
  color: var(--muted);
}
.site-update-note time {
  font-variant-numeric: tabular-nums;
}
.site-update-note span {
  white-space: nowrap;
}
.release-pages .release-count-line {
  margin: 4px 0 10px;
  color: var(--sub);
  font-size: 12px;
}
.release-count-line strong {
  font-weight: 600;
  color: var(--text);
}
.release-pagination .button {
  padding: 6px 8px;
  color: var(--text);
}
.release-pagination .button:hover:not(:disabled) {
  background: var(--pale);
}
@media (max-width: 800px) {
  .release-pagination {
    gap: 16px;
  }
  .release-pagination .button {
    min-height: 40px;
  }
}
.source-footer .release-source-notes {
  width: 100%;
}
.release-source-notes h3 {
  margin: 0 0 6px;
}
.source-footer .release-source-notes p {
  margin: 4px 0;
  color: var(--sub);
}
main > .site-update-note {
  text-align: center;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 12px;
}
/* Modest home spacing, preserving the original layout. */
.home-intro {
  padding: 20px 24px;
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}
.home-intro h1 {
  grid-column: 1 / -1;
  margin: 0 0 8px;
}
.home-summary {
  margin: 8px 0;
  gap: 22px;
}
.home-summary strong {
  font-size: 36px;
}
#home-continue {
  justify-self: end;
}
.home-grid {
  gap: 12px;
  margin: 12px 0 18px;
}
/* 寬螢幕一排 4 張（8 張剛好兩排），首頁不用捲動就看得到最後一排 */
@media (min-width: 1180px) {
  .home-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.home-card {
  padding: 16px 18px;
}
.home-card-title {
  margin-bottom: 12px;
}
.home-guide {
  padding: 16px 20px;
  margin-bottom: 14px;
}
.home-guide ol {
  margin: 10px 0;
}
.home-guide li {
  margin: 7px 0;
}
.home-actions {
  justify-content: flex-end;
  gap: 8px;
}
@media (max-width: 800px) {
  .home-intro {
    padding: 16px 18px;
    column-gap: 12px;
  }
  .home-summary {
    gap: 12px;
    flex-wrap: wrap;
  }
  .home-summary strong {
    font-size: 30px;
  }
  .home-summary .bar {
    width: 120px;
  }
  .home-guide {
    padding: 14px 16px;
  }
}
@media (max-width: 420px) {
  .home-intro {
    grid-template-columns: minmax(0, 1fr);
  }
  .home-intro h1 {
    font-size: 22px;
  }
  #home-continue {
    margin-top: 6px;
  }
  .home-card {
    padding: 14px 16px;
  }
}
/* Consistent footer typography and spacing. */
.source-footer {
  display: block;
  color: var(--muted); /* v1.3.1：頁尾說明原本用 --faint 太淡 */
}
.source-footer .release-source-notes {
  margin: 0 0 8px;
}
.source-footer .release-source-notes h3,
.source-footer .release-source-notes p,
.source-footer > p {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  letter-spacing: 0;
  font-weight: 400;
  margin: 4px 0;
}

.calculator-heading p {
  margin: 0;
  line-height: 1.75;
}
.calculator-controls {
  display: grid;
  grid-template-columns: minmax(240px, 2fr) minmax(120px, 1fr);
  gap: 8px;
  margin: 12px 0;
}
.calculator-controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}
.calculator-view select,
.calculator-view input {
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}
.calc-card h2 {
  margin: 0 0 14px;
  font-size: 18px;
}
.calc-note {
  color: var(--muted);
}
.calc-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}
/* 側欄：成就、寵物接在圖鑑分類後，成本計算機固定放最下方；每一項間距都和分類之間一樣是 6px */
#categories + .panel-nav {
  margin-top: 6px;
}
.panel-nav ~ .panel-nav,
.panel-nav ~ .calculator-nav {
  margin-top: 6px;
}
.kind-filter {
  border: 0;
  padding: 0;
  margin: 0;
  flex: 1.5 1 0;
  min-width: max-content;
  color: var(--muted);
  font-size: 11px;
  position: relative;
  z-index: 5;
}
.kind-filter legend {
  padding: 0;
}
.kind-toggle {
  display: block;
  width: 100%;
  height: 42px;
  margin-top: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--paper);
  padding: 0 12px;
  text-align: left;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.kind-menu {
  position: fixed;
  z-index: 1000;
  top: 0;
  left: 0;
  min-width: 190px;
  width: max-content;
  max-width: min(260px, calc(100vw - 16px));
  max-height: min(280px, calc(100vh - 24px));
  overflow: auto;
  padding: 8px;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 8px 24px #33402a26;
}
.kind-menu[hidden] {
  display: none;
}
.kind-menu > label,
.kind-all-row label {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 8px;
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}
.kind-menu input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--green);
}
.kind-all-row {
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid var(--line-strong);
}
.kind-all-row label {
  font-weight: 600;
}
.filter-grid > .kind-filter {
  flex: 1.5 1 0;
}
@media (max-width: 650px) {
  .calculator-view {
    margin: 14px 8px;
    padding: 16px;
  }
  .calculator-controls {
    grid-template-columns: 1fr;
  }
    }

.calc-select-controls {
  grid-template-columns: minmax(220px, 1.5fr) minmax(220px, 1.5fr) minmax(110px, 0.7fr);
}
.calc-recipe-grid {
  display: grid;
}
.calc-recipe-grid > .calc-card {
  min-width: 0;
}
.calc-material-table,
.calc-star-table,
.calc-comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.calc-material-table th,
.calc-material-table td,
.calc-star-table th,
.calc-star-table td,
.calc-comparison-table th,
.calc-comparison-table td {
  padding: 9px 7px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: middle;
}
.calc-material-table th:first-child,
.calc-material-table td:first-child,
.calc-star-table th:first-child,
.calc-star-table td:first-child {
  text-align: left;
}
.calc-material-table thead,
.calc-star-table thead,
.calc-comparison-table thead {
  color: var(--muted);
  background: var(--pale);
}
.calc-material-table input {
  /* 最寬 78px；卡片變窄時跟著欄位縮小，用量和單價的框才不會黏在一起 */
  width: 100%;
  max-width: 78px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
}
.calc-row-name {
  text-align: left;
}
.calc-row-name small {
  display: block;
  color: var(--warn-ink);
}
.calc-recipe-summary {
  justify-content: space-between;
  flex-wrap: wrap;
}
.calc-star-table {
  margin-top: 12px;
}
.calc-comparison-table th,
.calc-comparison-table td {
  text-align: center;
}
.calc-comparison-table td {
  font-variant-numeric: tabular-nums;
}
.calc-positive {
  color: var(--text);
}
.calc-negative {
  color: var(--danger-ink);
}
.calc-add-remove {
  padding: 4px 8px;
  font-size: 12px;
}
@media (max-width: 700px) {
  .calc-select-controls {
    grid-template-columns: 1fr;
  }
  .calc-material-table {
    min-width: 490px;
  }
  .calc-table-scroll {
    overflow-x: auto;
  }
  .calc-star-table,
  .calc-comparison-table {
    font-size: 11px;
  }
  .calc-star-table th,
  .calc-star-table td,
  .calc-comparison-table th,
  .calc-comparison-table td {
    padding: 7px 4px;
  }
}

.calc-empty-material-entry {
  display: grid;
  grid-template-columns: minmax(150px, 2fr) minmax(86px, 0.7fr) minmax(96px, 0.8fr) auto;
  gap: 8px;
  align-items: end;
  margin: 14px 18px 0;
  padding: 12px;
  background: var(--soft);
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
}
.calc-empty-material-entry label {
  display: grid;
  gap: 5px;
  color: var(--sub);
  font-size: 12px;
}
.calc-empty-material-entry input {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 6px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--paper);
  font: inherit;
}
.calc-empty-material-entry .calc-add-material-button {
  height: 36px;
  min-height: 36px;
  white-space: nowrap;
}
@media (max-width: 650px) {
  .calc-empty-material-entry {
    grid-template-columns: 1fr 1fr;
  }
  .calc-empty-material-entry label:first-child {
    grid-column: 1/-1;
  }
  .calc-empty-material-entry .calc-add-material-button {
    grid-column: 2;
    justify-self: end;
  }
}
/* Cost calculator visual hierarchy */
.calculator-view {
  max-width: 1180px;
  margin: 24px auto;
  padding: clamp(18px, 3vw, 34px);
  background: linear-gradient(145deg, var(--paper) 0%, var(--paper) 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 12px 34px #31402a10;
}
.calculator-heading {
  margin: 0 0 22px;
  border-bottom: 1px solid var(--pale);
}
.calc-kicker {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--sub);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}
.calculator-heading h1 {
  margin: 0 0 8px;
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: 0.02em;
}
.calculator-heading p {
  max-width: 720px;
  color: var(--sub);
}
.calc-select-controls {
  padding: 11px 12px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 12px 0 16px;
}
.calculator-controls label {
  font-size: 12px;
  font-weight: 600;
  color: var(--sub);
}
.calculator-view select,
.calculator-view input {
  border-color: var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 1px 2px #34422a08;
}
.calculator-view select:focus,
.calculator-view input:focus {
  outline: 2px solid var(--accent-line);
  outline-offset: 1px;
}
.calc-recipe-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}
.calc-recipe-grid:not(.compare-active) {
  grid-template-columns: minmax(0, 1fr);
}
.calc-card {
  padding: 0;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: 0 4px 14px #34422a08;
}
.calc-card-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  background: var(--soft);
  border-bottom: 1px solid var(--pale);
}
.calc-card-heading h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
  color: var(--ink);
}
.calc-recipe-badge {
  flex: none;
  padding: 5px 9px;
  border-radius: 20px;
  background: var(--track);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.calc-recipe-badge-b {
  background: var(--slate-soft);
  color: var(--slate-ink);
}
.calc-card > #calc-materials-a,
.calc-card > #calc-materials-b,
.calc-card > #calc-summary-a,
.calc-card > #calc-summary-b,
.calc-card > #calc-stars-a,
.calc-card > #calc-stars-b,
.calc-card > .calc-actions {
  margin-left: 18px;
  margin-right: 18px;
}
.calc-card > #calc-materials-a,
.calc-card > #calc-materials-b {
  margin-top: 14px;
}
.calc-table-scroll {
  overflow-x: auto;
  border-radius: 8px;
}
.calc-material-table,
.calc-star-table {
  font-size: 12px;
}
.calc-material-table th,
.calc-star-table th {
  font-weight: 600;
}
.calc-material-table thead th,
.calc-star-table thead th {
  padding: 10px 8px;
  background: var(--soft);
  color: var(--sub);
}
.calc-material-table tbody tr:nth-child(even) {
  background: var(--paper);
}
.calc-material-table tbody tr:hover {
  background: var(--soft);
}
.calc-material-table td {
  padding: 9px 8px;
}
.calc-material-table {
  table-layout: fixed;
}
.calc-material-table th:first-child,
.calc-material-table td:first-child {
  width: 42%;
  text-align: left;
}
.calc-material-table th:nth-child(2),
.calc-material-table td:nth-child(2),
.calc-material-table th:nth-child(3),
.calc-material-table td:nth-child(3) {
  width: 18%;
  text-align: center;
}
.calc-material-table th:last-child,
.calc-material-table td:last-child {
  width: 22%;
  text-align: right;
}
.calc-material-table input {
  height: 34px;
  padding: 5px 7px;
  background: var(--paper);
  text-align: right;
}
.calc-row-name {
  min-width: 110px;
}
.calc-row-name small {
  margin-top: 3px;
  font-size: 10px;
}
.calc-recipe-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0 10px;
  padding: 13px 15px;
  background: var(--soft);
  border: 1px solid var(--track);
  border-radius: 10px;
}
.calc-recipe-summary > div + div {
  padding-left: 12px;
  border-left: 1px solid var(--line-strong);
}
.calc-recipe-summary span {
  font-size: 11px;
  color: var(--sub);
}
.calc-recipe-summary strong {
  display: inline-block;
  margin-top: 3px;
  color: var(--deep);
  font-size: 19px;
  font-variant-numeric: tabular-nums;
}
.calc-star-table {
  margin: 0 0 16px;
}
.calc-star-table td {
  font-variant-numeric: tabular-nums;
}
.calc-dish-slots {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-column: 1/-1;
  align-items: start;
  gap: 8px;
}
.calc-dish-picker {
  grid-column: 1;
  position: relative;
}
.calc-dish-picker > label {
  display: grid;
  gap: 4px;
}
.calc-dish-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 260px;
  overflow: auto;
  padding: 6px;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 8px 24px #34422a20;
}
.calc-dish-results[hidden] {
  display: none;
}
.calc-dish-option {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  background: var(--paper);
  text-align: left;
  color: var(--deep);
  font: inherit;
  cursor: pointer;
}
.calc-dish-option:hover,
.calc-dish-option:focus {
  background: var(--pale);
  outline: 0;
}
.calc-dish-empty {
  padding: 9px 10px;
  color: var(--sub);
  font-size: 13px;
}
.calc-dish-slots label {
  display: grid;
  gap: 6px;
}
.calc-dynamic-add {
  height: 38px;
  min-height: 38px;
  white-space: nowrap;
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  align-self: end;
}
.calculator-view .calc-dish-select {
  height: 38px;
  min-height: 38px;
  padding: 6px 10px;
}
.calc-empty-materials {
  margin: 14px 0;
  color: var(--sub);
  font-size: 12px;
}
.calc-card-dynamic {
  min-width: 0;
}
.calc-card-dynamic .calc-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}
.calc-card-dynamic .calc-actions label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.calc-card-dynamic .calc-actions input {
  width: 100%;
  min-width: 0;
}
.calc-add-material-button {
  height: 38px;
  min-height: 38px;
  white-space: nowrap;
}
.calc-card-dynamic > div[id^="calc-materials-"] {
  margin: 14px 18px 0;
}
.calc-card-dynamic > div[id^="calc-summary-"],
.calc-card-dynamic > div[id^="calc-stars-"] {
  margin-left: 18px;
  margin-right: 18px;
}
.calc-positive {
  font-weight: 700;
}
.calc-negative {
  font-weight: 700;
}
.calc-actions {
  padding: 12px 0 16px;
  border-top: 1px solid var(--pale);
}
.calc-actions label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--sub);
  font-size: 12px;
}
.calc-actions select {
  min-width: 180px;
  height: 36px;
}
.calc-compare-section {
  margin-top: 20px;
  padding: 0 18px 16px;
  background: var(--soft);
}
.calc-compare-section h2 {
  margin: 0 -18px 12px;
  padding: 15px 18px;
  background: var(--pale);
  border-bottom: 1px solid var(--track);
}
.calc-comparison-table {
  min-width: 720px;
  font-size: 12px;
  border-collapse: separate;
  border-spacing: 0;
}
.calc-comparison-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}
.calc-comparison-table thead th:first-child {
  text-align: center;
}
.calc-comparison-table tbody tr:hover {
  background: var(--soft);
}
.calc-comparison-table tbody th {
  position: sticky;
  left: 0;
  background: var(--soft);
  text-align: center;
}
.calc-comparison-table tbody tr:hover th {
  background: var(--pale);
}
.calc-comparison-table th {
  white-space: nowrap;
}
.calc-comparison-table tbody tr:nth-child(even) {
  background: var(--paper);
}
.calc-comparison-table tbody tr:first-child {
  background: var(--soft);
}
#calc-missing {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--warn-soft);
  color: var(--warn-ink);
}
.calculator-view > .calc-note {
  line-height: 1.75;
}
.calc-note {
  font-size: 12px;
}
@media (max-width: 850px) {
  .calc-recipe-grid {
    grid-template-columns: 1fr;
  }
  .calc-select-controls {
    grid-template-columns: 1fr 1fr;
  }
  .calc-select-controls label:first-child {
    grid-column: 1/-1;
  }
}
@media (max-width: 560px) {
  .calculator-view {
    margin: 12px 6px;
    padding: 16px 12px;
    border-radius: 13px;
  }
  .calc-select-controls {
    grid-template-columns: 1fr;
  }
  .calc-select-controls label:first-child {
    grid-column: auto;
  }
  .calc-card-heading {
    padding: 13px 12px;
    gap: 8px;
  }
  .calc-card-heading h2 {
    font-size: 16px;
  }
  .calc-recipe-badge {
    font-size: 10px;
    padding: 5px 7px;
  }
  .calc-card > #calc-materials-a,
  .calc-card > #calc-materials-b,
  .calc-card > #calc-summary-a,
  .calc-card > #calc-summary-b,
  .calc-card > #calc-stars-a,
  .calc-card > #calc-stars-b,
  .calc-card > .calc-actions {
    margin-left: 12px;
    margin-right: 12px;
  }
  .calc-recipe-summary {
    padding: 11px 9px;
  }
  .calc-recipe-summary strong {
    font-size: 16px;
  }
  .calc-compare-section {
    padding: 0 10px 12px;
  }
  .calc-compare-section h2 {
    margin: 0 -10px 10px;
    padding: 13px 10px;
  }
  .calc-material-table {
    min-width: 455px;
  }
  .calc-comparison-table {
    min-width: 640px;
  }
  .calc-star-table {
    min-width: 340px;
  }
}

@media (min-width: 900px) {
  .calculator-view {
    padding: 16px 20px;
    margin: 12px auto;
  }
  .calculator-heading {
    margin-bottom: 10px;
    padding-bottom: 10px;
  }
  .calculator-heading h1 {
    font-size: 24px;
  }
  .calculator-heading p {
    line-height: 1.4;
  }
  .calc-select-controls {
    padding: 8px 10px;
    margin: 10px 0 12px;
  }
  .calc-recipe-grid {
    gap: 12px;
  }
  .calc-card-heading {
    padding: 10px 14px;
  }
  .calc-card-heading h2 {
    font-size: 16px;
  }
  .calc-card-dynamic > div[id^="calc-materials-"] {
    margin: 8px 12px 0;
  }
  .calc-card-dynamic > div[id^="calc-summary-"],
  .calc-card-dynamic > div[id^="calc-stars-"] {
    margin-left: 12px;
    margin-right: 12px;
  }
  .calc-card-dynamic .calc-actions {
    margin: 6px 12px;
    padding: 6px 0;
    gap: 6px;
  }
  .calc-material-table,
  .calc-star-table {
    font-size: 11px;
  }
  .calc-material-table thead th,
  .calc-star-table thead th {
    padding: 5px 6px;
  }
  .calc-material-table td,
  .calc-star-table th,
  .calc-star-table td {
    padding: 5px 6px;
  }
  .calc-material-table input {
    height: 30px;
    min-height: 30px;
    padding: 2px 5px;
  }
  .calc-row-name {
    min-width: 90px;
  }
  .calc-recipe-summary {
    grid-template-columns: 1fr;
    margin: 6px 0;
    padding: 8px 10px;
  }
  .calc-recipe-summary strong {
    font-size: 16px;
  }
  .calc-star-table {
    margin: 0 0 8px;
  }
}

/* ======== 比較表格的顏色 ======== */
/* Keep comparison rows and sticky name cells visually aligned. */
.calc-comparison-table {
  border: 1px solid var(--line-strong);
  background: var(--paper);
}
.calc-comparison-table thead th {
  background: var(--green);
  color: var(--on-accent);
  border-bottom-color: var(--deep);
}
.calc-comparison-table tbody tr {
  --comparison-row: var(--paper);
}
.calc-comparison-table tbody tr:nth-child(even) {
  --comparison-row: var(--pale);
}
.calc-comparison-table tbody tr:hover {
  --comparison-row: var(--pale-strong);
}
.calc-comparison-table tbody tr > th,
.calc-comparison-table tbody tr > td {
  background: var(--comparison-row);
  border-bottom-color: var(--line-strong);
  color: var(--ink);
}
.calc-comparison-table tbody tr > th {
  color: var(--deep);
}
.calc-comparison-table tbody tr:hover > th {
  background: var(--comparison-row);
}
.calc-comparison-table tbody tr > td.calc-positive {
  color: var(--green);
}
.calc-comparison-table tbody tr > td.calc-negative {
  color: var(--danger-ink);
}
.calc-compare-section > .calc-note {
  color: var(--sub);
}

/* ======== 穩定版面配置（避免載入時跳動） ======== */
/* Stack versions in one grid cell so pagination keeps the same position. */
#release-batches {
  display: grid;
}
#release-batches > .release-batch {
  grid-area: 1 / 1;
  min-width: 0;
  align-self: start;
  display: flow-root;
}
#release-batches > .release-batch[hidden] {
  display: flow-root !important;
  visibility: hidden;
  pointer-events: none;
}

/* ======== 成本計算機：說明區版面 ======== */
.calculator-heading {
  display: block;
  padding-bottom: 14px;
  margin-bottom: 16px;
}
.calc-intro {
  min-width: 0;
}
.calc-intro > p:last-child {
  font-size: 13px;
  line-height: 1.8;
  color: var(--sub);
  max-width: 32em;
}
.calc-quick-guide {
  min-width: 0;
  padding: 15px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--soft);
  color: var(--text);
}
.calc-quick-guide h2 {
  font-size: 14px;
  letter-spacing: 0.03em;
  margin: 0 0 10px;
  color: var(--deep);
}
.calc-quick-guide ol {
  list-style: none;
  counter-reset: calc-guide;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 9px;
}
.calc-quick-guide li {
  counter-increment: calc-guide;
  position: relative;
  padding-left: 30px;
  font-size: 12px;
  line-height: 1.7;
}
.calc-quick-guide li:before {
  content: counter(calc-guide);
  position: absolute;
  left: 0;
  top: 1px;
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: var(--on-accent);
  font-size: 11px;
  font-weight: 700;
}
.calc-quick-guide li strong {
  display: block;
  color: var(--deep);
}
.calc-quick-guide li span {
  color: var(--text);
}
.calc-guide-details {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line-strong);
  font-size: 12px;
}
.calc-guide-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--deep);
  padding: 3px 0;
}
.calc-guide-details p {
  font-size: 12px;
  line-height: 1.8;
  margin: 8px 0 0;
  color: var(--text);
}
#help-dialog .help-intro {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 13px;
}
#help-dialog .help-topic {
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  margin: 0 0 10px;
  overflow: hidden;
}
#help-dialog .help-topic > summary {
  padding: 12px 14px;
  background: var(--soft);
  color: var(--deep);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
}
#help-dialog .help-topic > div {
  padding: 3px 16px 13px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.85;
}
#help-dialog .help-topic ol,
#help-dialog .help-topic ul {
  padding-left: 22px;
  margin: 10px 0;
}
#help-dialog .help-topic li {
  margin: 6px 0;
}
#help-dialog .help-topic p {
  font-size: 13px;
  margin: 10px 0 0;
  line-height: 1.85;
}
#help-dialog .help-callout {
  padding: 1px 12px 10px;
  background: var(--soft);
  border-left: 3px solid var(--accent-line);
  border-radius: 4px;
}
.calc-guide-details summary:focus-visible,
#help-dialog .help-topic > summary:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: -2px;
}
@media (max-width: 1000px) {
  .calculator-heading {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
  .calc-intro > p:last-child {
    max-width: none;
  }
}
@media (max-width: 560px) {
  .calc-quick-guide {
    padding: 13px;
  }
    #help-dialog .help-topic > div {
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* ======== 料理表格：活動代幣欄位 ======== */
/* Cooking columns: collection, name, level, ingredients, profit, price, details. */
.list.dish-list {
  min-width: 780px;
  table-layout: fixed;
}
.list.dish-list > thead > tr > th:nth-child(1) {
  width: 7%;
}
.list.dish-list > thead > tr > th:nth-child(2) {
  width: 22%;
}
.list.dish-list > thead > tr > th:nth-child(3) {
  width: 8%;
}
.list.dish-list > thead > tr > th:nth-child(4) {
  width: 17%;
}
.list.dish-list > thead > tr > th:nth-child(5) {
  width: 16%;
}
.list.dish-list > thead > tr > th:nth-child(6) {
  width: 16%;
}
.list.dish-list > thead > tr > th:nth-child(7) {
  width: 14%;
}
.list.dish-list > thead > tr > th,
.list.dish-list > tbody > tr.item > td {
  padding: 12px 10px;
  vertical-align: middle;
}
.list.dish-list > thead > tr > th {
  white-space: nowrap;
}
.list.dish-list > thead > tr > th:is(:nth-child(1), :nth-child(3), :nth-child(7)),
.list.dish-list > tbody > tr.item > td:is(:nth-child(1), :nth-child(3), :nth-child(7)) {
  text-align: center;
}
.list.dish-list > thead > tr > th:is(:nth-child(5), :nth-child(6)),
.list.dish-list > tbody > tr.item > td:is(:nth-child(5), :nth-child(6)) {
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.list.dish-list > tbody > tr.item > td:nth-child(2),
.list.dish-list > tbody > tr.item > td:nth-child(4) {
  overflow-wrap: anywhere;
}
.list.dish-list .item-meta {
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.list.dish-list .item-meta .badge {
  max-width: 100%;
}
.list.dish-list .column-sort {
  gap: 4px;
}
.list.dish-list > tbody > tr.item > td:last-child .row-detail {
  white-space: nowrap;
}
.dish-currency-compact {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 400;
}
.list.dish-list > thead > tr > th:is(:nth-child(2), :nth-child(4)),
.list.dish-list > tbody > tr.item > td:is(:nth-child(2), :nth-child(4)) {
  text-align: left;
}
.list.dish-list > thead > tr > th:is(:nth-child(3), :nth-child(5), :nth-child(6)) .column-sort {
  width: 100%;
  justify-content: center;
  text-align: center;
}
.list.dish-list > tbody > tr.item > td:first-child .check-label {
  margin-inline: auto;
}

/* ======== 成本計算機：教學視窗 ======== */
.calc-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.calculator-heading .calc-title-row h1 {
  margin: 0;
}
.calc-title-row .icon-button {
  flex: none;
  width: 32px;
  height: 32px;
  min-height: 32px;
  color: var(--green);
  background: var(--paper);
  font-weight: 600;
}
#calc-help-dialog {
  width: min(620px, calc(100vw - 32px));
  max-height: 85dvh;
}
#calc-help-dialog[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 16px;
}
#calc-help-dialog .dialog-heading {
  margin: 0;
  flex-shrink: 0;
}
#calc-help-dialog .dialog-heading h2 {
  font-size: 18px;
  letter-spacing: 0;
}
#calc-help-dialog .calc-help-content {
  overflow-y: auto;
  min-height: 0;
  overscroll-behavior: contain;
}
#calc-help-dialog .calc-quick-guide {
  padding: 16px;
}
#calc-help-dialog .calc-quick-guide ol {
  gap: 16px;
}
#calc-help-dialog .calc-quick-guide li {
  font-size: 14px;
}
#calc-help-dialog .calc-guide-details,
#calc-help-dialog .calc-guide-details p {
  font-size: 13px;
}
#calc-help-dialog > button {
  align-self: flex-start;
  flex-shrink: 0;
}

/* ======== 手機版導覽列配置 ======== */
@media (max-width: 800px) {
  .sidebar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    inset: auto;
  }
  .sidebar .brand {
    grid-column: 1/-1;
    margin: 0 0 8px;
    font-size: 20px;
    line-height: 1.4;
    letter-spacing: 0;
    min-width: 0;
  }
  .sidebar .nav-item {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    flex: none;
    margin: 0;
    padding: 8px 4px;
    gap: 5px;
    justify-content: center;
    border-radius: 10px;
    line-height: 1.4;
    white-space: nowrap;
  }
  .sidebar .nav-item:not(.active) {
    background: var(--pale);
    color: var(--deep);
  }
  .sidebar .nav-item.active {
    background: var(--green);
    color: var(--on-accent);
  }
  .sidebar .nav-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    font-size: 20px;
    line-height: 1;
  }
  .sidebar .nav-icon svg {
    width: 20px;
    height: 20px;
  }
  .sidebar .nav-count {
  }
  .sidebar #nav-calculator,
  .sidebar .panel-nav {
    grid-column: span 2;
  }
}

/* ======== 資料載入完成前先隱藏畫面（避免先出現空殼再跳動） ======== */
/* app.js 載入資料成功後會在 <body> 加上 is-ready */
body:not(.is-ready) > :not(.load-error) {
  visibility: hidden;
}

/* ======== 資料載入失敗的提示 ======== */
.load-error {
  margin: 16px 42px;
  padding: 14px 18px;
  border: 1px solid var(--danger-line);
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger-ink);
}
.load-error p {
  margin: 6px 0 0;
}

/* ======== 手機版：固定底部導覽與單欄操作 ======== */
@media (max-width: 640px) {
  html { scroll-padding-top: 12px; }
  body { overflow-x: hidden; padding-bottom: calc(74px + env(safe-area-inset-bottom)); }

  .sidebar {
    position: fixed;
    z-index: 30;
    inset: auto 0 0;
    display: flex;
    align-items: stretch;
    gap: 4px;
    width: 100%;
    height: auto;
    min-height: 64px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    background: var(--paper);
    border: 0;
    border-top: 1px solid var(--line);
    box-shadow: 0 -5px 18px #263c2e12;
    scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .sidebar .brand { display: none; }
  .sidebar #categories { display: contents; }
  .sidebar .nav-item,
  .sidebar #nav-calculator,
  .sidebar .panel-nav {
    display: flex;
    flex: 1 0 62px;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    width: auto;
    min-width: 62px;
    min-height: 52px;
    margin: 0;
    padding: 5px 3px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    white-space: nowrap;
  }
  .sidebar .nav-item.active { background: var(--pale); color: var(--deep); }
  .sidebar .nav-icon,
  .sidebar .nav-icon svg {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    flex: none;
    font-size: 18px;
    line-height: 1;
  }
  .sidebar .nav-name { font-size: 10px; line-height: 1.2; font-weight: 600; }
  .sidebar .nav-count { display: none; }
  .sidebar #nav-calculator,
  .sidebar .panel-nav { flex-basis: 68px; }

  .page { width: 100%; margin: 0; }
  .topbar {
    position: relative;
    min-height: 52px;
    height: auto;
    padding: 6px 12px;
    border-bottom: 1px solid var(--line);
  }
  .topbar > .tools {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 6px;
    width: 100%;
  }
  #save-state { margin: 0 auto 0 0; font-size: 10px; white-space: nowrap; }
  .topbar .button { min-height: 38px; padding: 6px 9px; font-size: 11px; white-space: nowrap; }
  .topbar .icon-button { width: 38px; height: 38px; flex: none; }

  main { padding: 18px 12px 24px; }
  .hero {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 18px;
  }
  .hero .hero-title { font-size: 21px; letter-spacing: 0; line-height: 1.35; }
  .total-card { min-width: 0; width: 100%; padding: 10px 14px; gap: 10px; border-radius: 11px; }
  .total-card strong { font-size: 23px; }
  .ring { width: 44px; height: 44px; }
  .ring span { width: 36px; height: 36px; font-size: 10px; }

  .collection {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .collection-heading { padding: 8px 2px 14px; gap: 10px; }
  .title-group { gap: 9px; min-width: 0; }
  .category-icon { width: 36px; height: 36px; border-radius: 10px; }
  .category-icon svg { width: 22px; height: 22px; }
  .title-group h2 { font-size: 16px; letter-spacing: 0; }
  .category-progress { width: 96px; font-size: 10px; }

  .filters {
    margin: 0;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
  }
  .filter-top { gap: 9px; margin-bottom: 12px; }
  .search-wrap { min-height: 44px; padding: 4px 10px; border-radius: 9px; }
  .search-wrap input { font-size: 16px; }
  .segments { min-height: 42px; border-radius: 9px; }
  .segments button { min-height: 40px; padding: 6px 8px; font-size: 12px; }
  .filter-scroll { overflow: visible; padding: 0; margin: 0; }
  .filter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    overflow: visible;
  }
  .filter-grid::after { display: none; }
  .filter-grid > label,
  .filter-grid > label.location-filter {
    min-width: 0;
    flex: initial;
    white-space: normal;
    font-size: 11px;
    line-height: 1.4;
  }
  .filter-grid select {
    width: 100%;
    min-width: 0;
    height: 44px;
    margin-top: 5px;
    padding: 0 23px 0 9px;
    border-radius: 8px;
    font-size: 14px;
  }
  .filter-scroll-hint { display: none; }
  .availability-options { flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; }
  .availability-options .five-star-filter { min-height: 40px; font-size: 12px; }
  #availability-filter { margin-left: 0; }
  .five-star-note { font-size: 11px; }
  .filter-foot { margin-top: 8px; padding-top: 8px; }
  .filter-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
  .filter-actions .text-button {
    min-width: 0;
    min-height: 40px;
    padding: 6px 4px;
    white-space: normal;
    font-size: 11px;
    line-height: 1.35;
  }
  #use-current-time { grid-column: 1 / -1; margin: 0; text-align: left; }
  #clear-filters { margin: 0; }

  .list-toolbar { min-height: 50px; padding: 14px 2px 8px; gap: 8px; }
  .list-toolbar > div { gap: 3px 8px; }
  .list-toolbar #result-note { font-size: 10px; }
  .table-hint { margin: 0 2px 7px; font-size: 10px; }
  .collection > .table-wrap {
    max-width: 100%;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper);
    -webkit-overflow-scrolling: touch;
  }
  .list { min-width: 720px; }
  
  .home-intro { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 16px; }
  .home-intro h1 { font-size: 21px; letter-spacing: 0; }
  .home-summary { gap: 10px; }
  .home-summary strong { font-size: 28px; }
  #home-continue { justify-self: stretch; min-height: 44px; }
  .home-grid { grid-template-columns: 1fr; }
  .home-guide { padding: 15px; }
  .home-actions { display: grid; grid-template-columns: 1fr; }
  .home-actions .button { min-height: 42px; }

  .calculator-view { padding: 18px 12px 24px; }
  .calculator-heading { padding: 0; }
  .calc-title-row { gap: 8px; }
}

@media (max-width: 380px) {
  main { padding-inline: 10px; }
  .filters { padding: 11px; }
  .filter-grid { gap: 8px; }
  .sidebar { padding-inline: 5px; }
  .sidebar .nav-item,
  .sidebar #nav-calculator,
  .sidebar .panel-nav { min-width: 58px; flex-basis: 58px; }
  .topbar .button { padding-inline: 7px; }
}

/* ======== 手機版：網頁式展開分類選單（僅 800px 以下） ======== */
@media (max-width: 800px) {
  body { padding-bottom: 0; overflow-x: hidden; }
  html { scroll-padding-top: 0; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: block;
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 10px 14px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--paper) 97%, transparent);
    box-shadow: none;
    overflow: visible;
  }
  .sidebar .brand { display: none; }
  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--paper);
    color: var(--deep);
    font-size: 14px;
    font-weight: 700;
  }
  .side-panel { display: none; margin-top: 8px; }
  .sidebar.open .side-panel { display: block; }
  .sidebar #categories { display: grid; gap: 6px; margin: 0; }
  .sidebar .nav-item,
  .sidebar #nav-calculator,
  .sidebar .panel-nav {
    display: flex;
    flex: none;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    min-width: 0;
    min-height: 46px;
    margin: 0;
    padding: 10px 14px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: var(--paper);
    color: var(--ink);
    white-space: nowrap;
    box-shadow: none;
  }
  .sidebar .nav-item:not(.active):hover { background: var(--soft); }
  .sidebar .nav-item.active,
  .sidebar #nav-calculator.active,
  .sidebar .panel-nav.active { background: var(--green); color: var(--on-accent); }
  .sidebar .nav-icon,
  .sidebar .nav-icon svg { width: 20px; height: 20px; flex: none; font-size: 16px; line-height: 1; }
  .sidebar .nav-name { font-size: 14px; font-weight: 600; }
  .sidebar .nav-count { display: inline; margin-left: auto; font-size: 12px; color: var(--faint); }
  .sidebar .nav-item.active .nav-count { color: var(--on-accent-soft); }
  .sidebar #nav-calculator,
  .sidebar .panel-nav { margin-top: 6px; border-color: var(--line); }
  /* 下拉選單每一項上下距一致：首頁與釣魚之間、烹飪與成就之間都是 6px */
  .sidebar #categories { margin-top: 6px; }
  .sidebar #categories + .panel-nav { margin-top: 6px; }
}

/* 頁尾「資料來源與更新說明」：字級放大，較易閱讀（放在檔尾以覆蓋前面的設定） */
.source-footer {
  font-size: 11px;
  line-height: 1.85;
}
.source-footer .release-source-notes h3 {
  font-size: 12px;
  font-weight: 600;
}

/* ======== 成就與寵物：獨立頁面（外框沿用成本計算機的 .calculator-view） ======== */
.panel-empty {
  margin: 0;
  padding: 18px;
  color: var(--muted);
  font-size: 13px;
}
/* 用多欄排版：某組收合變矮時，後面的組會往上補位，不留空白 */
.achievement-groups {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.achievement-col {
  flex: 1 1 0;
  min-width: 0;
}
.achievement-groups .achievement-group {
  display: inline-block;
  width: 100%;
  margin: 0 0 16px;
  break-inside: avoid;
}
.achievement-group-count,
.pet-stats {
  margin-left: auto;
  font-size: 12px;
  color: var(--sub);
  font-variant-numeric: tabular-nums;
}
.achievement-info {
  padding: 12px 18px 4px;
  font-size: 13px;
}
.achievement-info p {
  margin: 0 0 6px;
}
.achievement-info b {
  display: inline-block;
  min-width: 5em;
  margin-right: 8px;
  color: var(--sub);
  font-size: 12px;
}
.achievement-reward {
  color: var(--gold-ink);
  font-weight: 700;
}
.achievement-badge {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--green);
  color: var(--on-accent);
  font-size: 11px;
  font-weight: 700;
}
.achievement-group.is-complete {
  border-color: var(--accent-line);
}
.achievement-foot {
  padding: 10px 18px 14px;
  border-top: 1px solid var(--pale);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}
.achievement-foot p {
  margin: 0 0 4px;
}
.achievement-list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
}
.achievement-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 18px;
  cursor: pointer;
}
.achievement-item:hover {
  background: var(--soft);
}
.achievement-item input {
  margin-top: 4px;
  accent-color: var(--green);
}
.achievement-item b {
  display: block;
  font-weight: 600;
}
.achievement-item small {
  display: block;
  color: var(--muted);
  line-height: 1.6;
}
.achievement-item.is-done b {
  color: var(--green);
}
.pet-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 14px;
  padding: 12px;
  margin: 0 0 14px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.pet-form label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--sub);
}
.pet-form input,
.pet-form select {
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
}
.pet-form input {
  width: min(220px, 60vw);
}
.pet-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}
.pet-tabs:empty {
  display: none;
}
.pet-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 600;
}
.pet-tab.active {
  border-color: var(--green);
  background: var(--green);
  color: var(--on-accent);
}
.pet-type-badge {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--gold-ink);
  font-size: 11px;
  font-weight: 700;
}
.pet-type-badge.pet-cat {
  background: var(--cat-soft);
  color: var(--cat-ink);
  border: 1px solid color-mix(in srgb, var(--cat-ink) 22%, var(--cat-soft));
}
.pet-type-badge.pet-dog {
  background: var(--dog-soft);
  color: var(--dog-ink);
  border: 1px solid color-mix(in srgb, var(--dog-ink) 22%, var(--dog-soft));
}
.pet-card .calc-card-heading {
  flex-wrap: wrap;
}
.pet-actions {
  display: flex;
  gap: 4px;
}
.pet-delete {
  color: var(--danger-ink);
}
.pet-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--pale);
}
.pet-toolbar .search-wrap {
  flex: 1 1 200px;
}
.calculator-view .pet-toolbar .search-wrap input {
  border: 0;
  box-shadow: none;
  outline: 0;
}
.pet-toolbar .segments {
  margin: 0;
}
.pet-food-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.pet-food {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--pale);
}
.pet-food:last-child {
  border-bottom: 0;
}
.pet-food.is-like {
  background: var(--danger-soft);
}
.pet-food.is-dislike {
  background: var(--soft);
}
.pet-food-name {
  flex: 1 1 auto;
  min-width: 0;
}
.pet-food-name small {
  display: block;
  color: var(--muted);
}
.pet-food.is-done .pet-food-name {
  color: var(--green);
}
.pet-pref {
  display: flex;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.pet-choice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.pet-choice span {
  font-size: 13px;
}
.pet-pref .pet-choice {
  border: 0;
  border-radius: 0;
}
.pet-pref .pet-choice + .pet-choice {
  border-left: 1px solid var(--line);
}
.pet-choice:hover {
  background: var(--pale);
}
.pet-none.active {
  background: var(--pale);
  color: var(--ink);
  font-weight: 600;
}
.pet-like.active {
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 600;
}
.pet-dislike.active {
  background: var(--line);
  color: var(--ink);
  font-weight: 600;
}
@media (max-width: 800px) {
  .achievement-groups {
    display: block;
  }
  .pet-food {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
  }
  .pet-food-name {
    flex-basis: 100%;
  }
  .pet-pref {
    flex: 1 1 100%;
  }
  .pet-pref .pet-choice {
    flex: 1 1 0;
    padding: 0 8px;
  }
}

/* 寵物食物：連到烹飪頁的料理名稱，以及跳轉後的短暫標示 */
.pet-food-link {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: var(--muted);
  text-underline-offset: 3px;
  cursor: pointer;
}
.pet-food-link:hover,
.pet-food-link:focus-visible {
  color: var(--green);
  text-decoration-color: currentColor;
}
.pet-food-link span {
  color: var(--muted);
  font-size: 0.85em;
}
#rows tr.jump-target > td {
  animation: jump-flash 2s ease-out;
}
@keyframes jump-flash {
  0%,
  40% {
    background: color-mix(in srgb, var(--green) 18%, transparent);
  }
  100% {
    background: transparent;
  }
}

/* 成就：點標題列展開／收合該大滿貫的勾選清單 */
.achievement-head {
  cursor: pointer;
  user-select: none;
  gap: 8px;
}
.achievement-head:hover {
  background: var(--pale);
}
.achievement-toggle {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.achievement-chevron {
  flex: 0 0 auto;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.achievement-group.is-collapsed .calc-card-heading {
  border-bottom: 0;
}
.achievement-body[hidden] {
  display: none;
}
.achievement-head h2 {
  flex: 1 1 auto;
  min-width: 0;
}
.achievement-head .achievement-group-count {
  margin-left: 0;
  white-space: nowrap;
}

/* =====================================================================
 * 成就與寵物：乾淨簡約風格
 * 只作用在 #achievements-view、#pets-view，不影響其他頁面
 * ===================================================================== */
#achievements-view,
#pets-view {
  /* 底色與線條跟其他頁面（列表、首頁卡片）一樣用米白 --paper、--line */
  --m-surface: var(--paper);
  --m-soft: var(--soft);
  --m-line: var(--line);
  --m-text: var(--ink);
  --m-sub: var(--sub);
  --m-faint: var(--faint);
  --m-accent: var(--green);
  --m-accent-soft: var(--pale);
  --m-like: var(--danger);
  --m-gold: var(--gold-ink);
  background: var(--m-surface);
  border-color: var(--m-line);
  box-shadow: none;
  color: var(--m-text);
}
#achievements-view .calculator-heading,
#pets-view .calculator-heading {
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--m-line);
}
#achievements-view .calc-kicker,
#pets-view .calc-kicker {
  margin-bottom: 4px;
  color: var(--m-faint);
  font-weight: 600;
  letter-spacing: 0.08em;
}
#achievements-view .calculator-heading h1,
#pets-view .calculator-heading h1 {
  margin-bottom: 6px;
  font-size: clamp(24px, 3vw, 30px);
  font-weight: 700;
  letter-spacing: 0;
  color: var(--m-text);
}
#achievements-view .calculator-heading p,
#pets-view .calculator-heading p {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--m-sub);
}
.achievement-meter {
  height: 4px;
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
  margin: 0 18px 4px;
}
.achievement-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 0.25s ease;
}

/* 卡片：白底、細線、無陰影；標題列不上底色 */
#achievements-view .calc-card,
#pets-view .calc-card {
  background: var(--m-surface);
  border: 1px solid var(--m-line);
  border-radius: 14px;
  box-shadow: none;
}
#achievements-view .calc-card-heading,
#pets-view .calc-card-heading {
  padding: 16px 18px 12px;
  background: none;
  border-bottom: 0;
}
#achievements-view .calc-card-heading h2,
#pets-view .calc-card-heading h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--m-text);
}

/* 成就：標題列 */
#achievements-view .achievement-head:hover {
  background: var(--m-soft);
}
#achievements-view .achievement-group-count {
  font-size: 13px;
  color: var(--m-sub);
}
#achievements-view .achievement-chevron {
  position: relative;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
}
#achievements-view .achievement-chevron::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  border-right: 1.6px solid var(--m-sub);
  border-bottom: 1.6px solid var(--m-sub);
  transform: translate(-50%, -70%) rotate(45deg);
  transition: transform 0.2s ease;
}
#achievements-view .is-collapsed .achievement-chevron::before {
  transform: translate(-50%, -30%) rotate(-135deg);
}
#achievements-view .achievement-head:hover .achievement-chevron {
  background: var(--m-line);
}
#achievements-view .achievement-badge {
  padding: 2px 8px;
  background: var(--m-accent-soft);
  color: var(--m-accent);
  font-weight: 600;
}
#achievements-view .achievement-group.is-complete {
  border-color: var(--line-strong);
}
#achievements-view .achievement-group.is-collapsed .achievement-meter {
  margin-bottom: 16px;
}

/* 成就：說明與清單 */
#achievements-view .achievement-info {
  margin: 12px 18px 4px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--m-soft);
  font-size: 13px;
  color: var(--m-sub);
}
#achievements-view .achievement-info p {
  display: flex;
  gap: 10px;
  margin: 0 0 4px;
  line-height: 1.6;
}
#achievements-view .achievement-info p:last-child {
  margin-bottom: 0;
}
#achievements-view .achievement-info b {
  flex: 0 0 4.5em;
  min-width: 0;
  margin: 0;
  color: var(--m-faint);
  font-weight: 400;
}
#achievements-view .achievement-reward {
  color: var(--m-gold);
  font-weight: 700;
}
#achievements-view .achievement-list {
  padding: 4px 0 8px;
}
#achievements-view .achievement-item {
  align-items: center;
  gap: 12px;
  padding: 9px 18px;
}
#achievements-view .achievement-item:hover {
  background: var(--m-soft);
}
#achievements-view .achievement-item input {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  display: grid;
  place-content: center;
  box-sizing: border-box;
  width: 20px;
  min-width: 20px;
  height: 20px;
  min-height: 20px;
  margin: 0;
  padding: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: 6px;
  background: var(--paper);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
#achievements-view .achievement-item input::before {
  content: "";
  width: 10px;
  height: 6px;
  border-left: 2px solid var(--paper);
  border-bottom: 2px solid var(--paper);
  transform: translateY(-1px) rotate(-45deg) scale(0);
  transition: transform 0.15s;
}
#achievements-view .achievement-item input:checked {
  border-color: var(--m-accent);
  background: var(--m-accent);
}
#achievements-view .achievement-item input:checked::before {
  transform: translateY(-1px) rotate(-45deg) scale(1);
}
#achievements-view .achievement-item input:focus-visible {
  outline: 2px solid var(--accent-line);
  outline-offset: 2px;
}
#achievements-view .achievement-item b {
  font-size: 14px;
  font-weight: 600;
  color: var(--m-text);
}
#achievements-view .achievement-item small {
  font-size: 12px;
  color: var(--m-sub);
}
#achievements-view .achievement-item.is-done b {
  color: var(--m-text);
}
#achievements-view .achievement-item.is-done small {
  color: var(--m-faint);
}
#achievements-view .achievement-foot {
  margin: 0 18px;
  padding: 10px 0 14px;
  border-top: 1px solid var(--m-line);
  font-size: 12px;
  color: var(--m-faint);
}

/* 寵物：新增表單 */
#pets-view .pet-form {
  padding: 0;
  margin-bottom: 16px;
  background: none;
  border: 0;
  border-radius: 0;
}
#pets-view .pet-form label {
  font-size: 12px;
  color: var(--m-sub);
}
#pets-view .pet-form input,
#pets-view .pet-form select {
  height: 40px;
  border: 1px solid var(--m-line);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: none;
}
#pets-view .pet-form .button.primary {
  height: 40px;
  padding: 0 16px;
  border-radius: 10px;
}

/* 寵物：寵物切換 */
#pets-view .pet-tabs {
  gap: 8px;
  margin-bottom: 16px;
}
#pets-view .pet-tab {
  padding: 6px 14px 6px 6px;
  border: 1px solid var(--m-line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--m-text);
  box-shadow: none;
}
#pets-view .pet-tab:hover {
  background: var(--m-soft);
}
#pets-view .pet-tab.active {
}
#pets-view .pet-type-badge.pet-cat {
  background: var(--cat-soft);
  color: var(--cat-ink);
}
#pets-view .pet-type-badge.pet-dog {
  background: var(--dog-soft);
  color: var(--dog-ink);
}
#pets-view .pet-tab.active .pet-type-badge {
  /* v1.3.1：原本半透明白底，部分配色對比不到 4.5:1，改用深主色實底 */
  background: var(--deep);
  color: var(--on-accent);
}

/* 寵物：寵物卡片 */
#pets-view .pet-stats {
  display: inline-flex;
  gap: 10px;
  font-size: 13px;
  color: var(--m-sub);
}
#pets-view .pet-stats b {
  color: var(--m-text);
  font-weight: 700;
}
#pets-view .pet-stats .is-like,
#pets-view .pet-stats .is-like b {
  color: var(--m-like);
}
#pets-view .pet-actions .text-button {
  color: var(--m-sub);
  font-size: 13px;
  transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}
#pets-view .pet-actions .pet-delete:hover {
  color: var(--m-like);
}
#pets-view .pet-toolbar {
  padding: 14px 18px;
  border-bottom: 1px solid var(--m-line);
}
#pets-view .pet-toolbar .search-wrap {
  border: 1px solid var(--m-line);
  border-radius: 10px;
  background: var(--m-soft);
  box-shadow: none;
}
#pets-view .pet-toolbar .search-wrap input {
  background: transparent;
}
#pets-view .pet-toolbar .segments {
  padding: 3px;
  border: 0;
  border-radius: 10px;
  background: var(--m-soft);
}
#pets-view .pet-toolbar .segments button {
  border-radius: 8px;
  color: var(--m-sub);
}
#pets-view .pet-toolbar .segments button.active {
  background: var(--paper);
  color: var(--m-text);
  box-shadow: 0 1px 2px #0000000f;
}

/* 寵物：食物列與三選一 */
#pets-view .pet-food {
  padding: 10px 18px;
  border-bottom: 1px solid var(--m-line);
  background: none;
}
#pets-view .pet-food:hover {
  background: var(--m-soft);
}
#pets-view .pet-food-name {
  font-size: 14px;
  color: var(--m-text);
}
#pets-view .pet-food.is-none .pet-food-name {
  color: var(--m-sub);
}
#pets-view .pet-food.is-like .pet-food-name,
#pets-view .pet-food.is-dislike .pet-food-name {
  color: var(--m-text);
  font-weight: 600;
}
#pets-view .pet-food-link {
  text-decoration-color: var(--line-strong);
}
#pets-view .pet-food-link:hover {
  color: var(--m-accent);
}
#pets-view .pet-pref {
  gap: 2px;
  padding: 3px;
  border: 0;
  border-radius: 10px;
  background: var(--m-soft);
}
#pets-view .pet-pref .pet-choice,
#pets-view .pet-pref .pet-choice + .pet-choice {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--m-faint);
  font-size: 13px;
  font-weight: 400;
}
#pets-view .pet-pref .pet-choice:hover {
  color: var(--m-text);
}
#pets-view .pet-pref .pet-choice.active {
  background: var(--paper);
  color: var(--m-text);
  font-weight: 600;
  box-shadow: 0 1px 2px #00000014;
}
#pets-view .pet-pref .pet-like.active {
  color: var(--m-like);
}
#pets-view .pet-pref .pet-none.active {
  color: var(--m-sub);
}
#pets-view .pet-meter {
  margin: 0 18px 14px;
}
#pets-view .pet-meter i {
  background: var(--m-like);
}

@media (max-width: 800px) {
  #pets-view .pet-food {
    padding: 12px 14px;
  }
  #pets-view .pet-pref .pet-choice,
  #pets-view .pet-pref .pet-choice + .pet-choice {
    flex: 1 1 0;
    padding: 0 6px;
  }
  #pets-view .pet-form label {
    flex: 1 1 140px;
  }
  #pets-view .pet-form input,
  #pets-view .pet-form select {
    width: 100%;
  }
  #pets-view .pet-form .button.primary {
    flex: 1 1 100%;
  }
  #pets-view .pet-stats {
    flex-basis: 100%;
    order: 5;
  }
}

/* 寵物：食物分組標題（河魚／湖魚／海魚、果醬、料理…） */

/* 寵物：魚類食物在名稱旁顯示出沒地點 */
.pet-food-name .pet-food-where {
  display: inline;
  margin-left: 8px;
  font-size: 12px;
  font-weight: 400;
  color: var(--faint);
}
@media (max-width: 800px) {
  .pet-food-name .pet-food-where {
    display: block;
    margin: 2px 0 0;
  }
}

/* 寵物：說明補充與每隻寵物的備註欄 */
#pets-view .calculator-heading .pet-hint {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--soft);
  font-size: 13px;
  color: var(--muted);
}
/* 寵物：每樣食物的備註（例如要餵幾隻） */
#pets-view .pet-food-note {
  flex: 0 1 180px;
  width: 180px;
  min-width: 0;
  height: 34px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  color: var(--m-text);
  box-shadow: none;
}
#pets-view .pet-food-note::placeholder {
  color: var(--faint);
}
#pets-view .pet-food:hover .pet-food-note,
#pets-view .pet-food-note.has-note {
  border-color: var(--m-line);
  background: var(--paper);
}
#pets-view .pet-food-note:focus {
  border-color: var(--accent-line);
  background: var(--paper);
  outline: 2px solid var(--accent-line);
  outline-offset: 0;
}
@media (max-width: 800px) {
  #pets-view .pet-food-note {
    flex: 1 1 100%;
    order: 3;
    width: 100%;
    height: 38px;
    border-color: var(--m-line);
    background: var(--paper);
    font-size: 16px;
  }
}

/* 寵物：卡片標題的名字可直接點擊修改 */
#pets-view .pet-name-head {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
}
#pets-view .pet-name-edit {
  width: 10em;
  max-width: 100%;
  height: 34px;
  min-height: 34px;
  margin: 0 0 0 -8px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  color: var(--m-text);
  cursor: text;
}
#pets-view .pet-name-edit:hover {
  border-color: var(--m-line);
  background: var(--m-soft);
}
#pets-view .pet-name-edit:focus {
  border-color: var(--accent-line);
  background: var(--paper);
  outline: 2px solid var(--accent-line);
  outline-offset: 0;
}

/* 寵物：每行最後的「+」，按下才展開備註欄 */
#pets-view .pet-note-add {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  color: var(--m-faint);
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
}
#pets-view .pet-note-add:hover,
#pets-view .pet-note-add:focus-visible {
  border-color: var(--m-line);
  background: var(--paper);
  color: var(--m-text);
}
#pets-view .pet-food-note {
  border-color: var(--m-line);
  background: var(--paper);
}
@media (max-width: 800px) {
  /* 手機：三選一和「+」同一行，備註欄展開時排到下一行 */
  #pets-view .pet-pref {
    flex: 1 1 0;
    min-width: 0;
  }
  #pets-view .pet-note-add {
    width: 38px;
    height: 38px;
  }
}
/* 寬螢幕：有備註時，備註欄換到下一行整行顯示；右側保留「+」的位置讓按鈕對齊 */
@media (min-width: 801px) {
  #pets-view .pet-food {
    flex-wrap: wrap;
  }
  #pets-view .pet-food-note {
    flex: 1 1 100%;
    order: 3;
    width: 100%;
  }
  #pets-view .pet-food:has(.pet-food-note) .pet-pref {
    margin-right: 44px;
  }
}
@media (max-width: 800px) {
  #pets-view .pet-food:has(.pet-food-note) .pet-pref {
    margin-right: 46px;
  }
}

/* =====================================================================
 * 手機版圖鑑列表：表格改成卡片，不用左右滑動就能看到地點、時段、食材等資訊
 * 第一行：勾選｜名稱＋類型｜等級｜詳情；下面幾行放原本在右邊的欄位
 * 只作用在 800px 以下，桌面版維持表格
 * ===================================================================== */
@media (max-width: 800px) {
  .collection > .table-wrap {
    overflow: visible;
  }
  .collection > .table-wrap > .list,
  .collection > .table-wrap > .list.dish-list {
    display: block;
    min-width: 0;
    width: 100%;
  }
  .collection > .table-wrap > .list > tbody {
    display: block;
  }

  /* 表頭改成一列排序按鈕 */
  .collection > .table-wrap > .list > thead {
    display: block;
    background: none;
  }
  .collection > .table-wrap > .list > thead > tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
  }
  .collection > .table-wrap > .list > thead > tr::before {
    content: "排序";
    margin-right: 2px;
    font-size: 12px;
    color: var(--faint);
  }
  .collection > .table-wrap > .list > thead > tr > th {
    display: block;
    width: auto;
    padding: 0;
    border: 0;
  }
  .collection > .table-wrap > .list > thead > tr > th:not(:has(.column-sort)) {
    display: none;
  }
  .collection > .table-wrap > .list > thead .column-sort {
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--paper);
    font-size: 12px;
    color: var(--ink);
  }
  /* 目前排序的按鈕：實心綠底白字；表頭格子本身不上底色（避免按鈕後面出現方框） */
  .collection > .table-wrap > .list > thead > tr > th[aria-sort] {
    background: none;
  }
  .collection > .table-wrap > .list > thead th[aria-sort="ascending"] .column-sort,
  .collection > .table-wrap > .list > thead th[aria-sort="descending"] .column-sort {
    border-color: var(--green);
    background: var(--green);
    color: var(--on-accent);
    font-weight: 600;
  }
  .collection > .table-wrap > .list > thead th[aria-sort="ascending"] .column-sort span,
  .collection > .table-wrap > .list > thead th[aria-sort="descending"] .column-sort span {
    color: var(--on-accent);
  }
  /* 手機版已有「排序」按鈕列，不需要「點選欄位標題可排序」的提示 */
  .collection > .table-hint {
    display: none;
  }

  /* 每一項：網格卡片 */
  .collection > .table-wrap > .list > tbody > tr.item {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto auto;
    column-gap: 8px;
    row-gap: 2px;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
  }
  .collection > .table-wrap > .list > tbody > tr.item > td {
    display: block;
    width: auto;
    min-width: 0;
    padding: 0;
    border: 0;
    text-align: left;
  }
  .collection > .table-wrap > .list > tbody > tr.item > td:first-child {
    grid-column: 1;
    grid-row: 1 / span 4;
    align-self: start;
    width: auto;
    padding: 0;
  }
  .collection > .table-wrap > .list > tbody > tr.item > td:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
  }
  .collection > .table-wrap > .list > tbody > tr.item > td:nth-child(2) .item-meta {
    display: inline-flex;
    margin: 0;
  }
  .collection > .table-wrap > .list > tbody > tr.item > td:nth-child(3) {
    grid-column: 3;
    grid-row: 1;
  }
  .collection > .table-wrap > .list > tbody > tr.item > td:last-child {
    grid-column: 4;
    grid-row: 1;
  }
  .collection > .table-wrap > .list > tbody > tr.item > td:nth-child(4) {
    grid-column: 2 / -1;
    grid-row: 2;
  }
  .collection > .table-wrap > .list > tbody > tr.item > td:nth-child(5):not(:last-child) {
    grid-column: 2 / -1;
    grid-row: 3;
  }
  .collection > .table-wrap > .list > tbody > tr.item .info-text,
  .collection > .table-wrap > .list > tbody > tr.item .number {
    font-size: 12px;
  }
  .collection > .table-wrap > .list > tbody > tr.item > td:nth-child(4) .number {
    display: inline;
    margin-left: 6px;
  }
  /* 烹飪：「解鎖：…」換到食材下一行 */
  .collection > .table-wrap > .list.dish-list > tbody > tr.item > td:nth-child(4) .number {
    display: block;
    margin: 2px 0 0;
  }
  .collection > .table-wrap > .list > tbody > tr.item > td:nth-child(4) .info-text {
    display: inline;
  }
  .collection > .table-wrap > .list > tbody > tr.item .weather-symbols {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px 6px;
    margin: 0 0 0 6px;
  }
  .collection > .table-wrap > .list > tbody > tr.item > td:nth-child(5) > .info-text {
    display: inline;
  }
  .collection > .table-wrap > .list > tbody > tr.item .row-detail {
    min-height: 30px;
    padding: 0 8px;
    white-space: nowrap;
  }

  /* 園藝：收集進度與生長週期放同一行 */
  .collection > .table-wrap > .list.flower-list > tbody > tr.item > td:nth-child(4) {
    grid-column: 2;
  }
  .collection > .table-wrap > .list.flower-list > tbody > tr.item > td:nth-child(5):not(:last-child) {
    grid-column: 3 / -1;
    grid-row: 2;
    text-align: right;
  }
  .collection > .table-wrap > .list.flower-list > tbody > tr.item > td:nth-child(5)::before {
    content: "生長 ";
    font-size: 11px;
    color: var(--faint);
  }

  /* 烹飪：食材一行，利潤與金額同一行 */
  .collection > .table-wrap > .list.dish-list > tbody > tr.item > td:nth-child(5):not(:last-child) {
    grid-column: 2;
    grid-row: 3;
  }
  .collection > .table-wrap > .list.dish-list > tbody > tr.item > td:nth-child(6) {
    grid-column: 3 / -1;
    grid-row: 3;
    text-align: right;
  }
  .collection > .table-wrap > .list.dish-list > tbody > tr.item > td:nth-child(5)::before {
    content: "1 星利潤 ";
    font-size: 11px;
    color: var(--faint);
  }
  .collection > .table-wrap > .list.dish-list > tbody > tr.item > td:nth-child(6)::before {
    content: "金額 ";
    font-size: 11px;
    color: var(--faint);
  }

  /* 觀鳥：一般／五星／鳥哨各縮成一行，標題換成短標籤 */
  .collection > .table-wrap > .list > tbody > tr.item :is(.bird-general-conditions, .bird-five-conditions, .bird-whistle-info) {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 6px;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
  }
  .collection > .table-wrap > .list > tbody > tr.item :is(.bird-general-conditions, .bird-five-conditions, .bird-whistle-info) > strong {
    flex: none;
    font-size: 0;
  }
  .collection > .table-wrap > .list > tbody > tr.item :is(.bird-general-conditions, .bird-five-conditions, .bird-whistle-info) > strong::before {
    display: inline-block;
    padding: 0 5px;
    border-radius: 4px;
    background: var(--pale);
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    color: var(--sub);
  }
  .collection > .table-wrap > .list > tbody > tr.item .bird-general-conditions > strong::before { content: "一般"; }
  .collection > .table-wrap > .list > tbody > tr.item .bird-five-conditions > strong::before { content: "五星"; background: var(--gold-soft); color: var(--gold-ink); }
  .collection > .table-wrap > .list > tbody > tr.item .bird-whistle-info > strong::before { content: "鳥哨"; }
  .collection > .table-wrap > .list > tbody > tr.item :is(.bird-general-conditions, .bird-five-conditions, .bird-whistle-info) .weather-symbols {
    margin: 0;
  }

  /* 展開的詳情：整行寬 */
  .collection > .table-wrap > .list > tbody > tr.detail-row:not([hidden]) {
    display: block;
  }
  .collection > .table-wrap > .list > tbody > tr.detail-row > td {
    display: block;
    width: 100%;
    padding: 14px 12px !important;
  }
}

/* 寵物：顏色改用網站主色綠（原本的黑色與其他頁面不一致） */
#pets-view .pet-tab.active {
  border-color: var(--green);
  background: var(--green);
  color: var(--on-accent);
}
#pets-view .pet-form .button.primary {
  border-color: var(--green);
  background: var(--green);
  color: var(--on-accent);
}
#pets-view .pet-form .button.primary:hover {
  filter: brightness(1.08);
}

/* 寵物：「改名」留在名字旁，「刪除」推到最右邊，避免誤觸 */
#pets-view .pet-actions {
  flex: 0 0 auto;
  margin-left: auto;
  justify-content: flex-end;
  align-items: center;
  gap: 0;
}
/* 改名與刪除之間：中間一條細分隔線，距離適中又不會誤觸 */
#pets-view .pet-actions .pet-delete {
  position: relative;
  margin-left: 25px;
}
#pets-view .pet-actions .pet-delete::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -13px;
  width: 1px;
  height: 14px;
  background: var(--m-line);
  transform: translateY(-50%);
}
/* 改名與刪除用同一種按鈕外觀與滑過效果，只差顏色：改名是綠色、刪除是紅色 */
#pets-view .pet-actions .text-button {
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
}
#pets-view .pet-actions [data-pet-rename]:hover,
#pets-view .pet-actions [data-pet-rename]:focus-visible {
  border-color: var(--line-strong);
  background: var(--m-accent-soft);
  color: var(--m-accent);
}
#pets-view .pet-actions .pet-delete:hover,
#pets-view .pet-actions .pet-delete:focus-visible {
  border-color: var(--danger-line);
  background: var(--danger-soft);
  color: var(--m-like);
}

/* =====================================================================
 * 手機版篩選區：統一字級（原本 11～16px 混在一起）
 * 16px：搜尋框、下拉選單、收錄類型（輸入元件，iPhone 低於 16px 會自動放大畫面）
 * 14px：完成狀態切換、勾選項
 * 13px：下方動作按鈕
 * 12px：欄位標題、說明文字
 * ===================================================================== */
@media (max-width: 800px) {
  .filters .kind-toggle {
    height: 44px;
    min-height: 44px;
    font-size: 16px;
  }
  .filters .filter-grid select,
  .filters .search-wrap input {
    font-size: 16px;
  }
  .filters .segments button {
    font-size: 14px;
  }
  .filters .five-star-filter {
    font-size: 14px;
  }
  .filters .filter-grid > label,
  .filters .filter-grid .kind-filter > legend {
    font-size: 12px;
    line-height: 1.4;
  }
  /* 收錄類型的框與旁邊下拉選單對齊（標題到框的距離一致） */
  .filters .filter-grid .kind-filter > .kind-toggle {
    margin-top: 5px;
  }
  .filters .filter-scroll-hint,
  .filters .five-star-note,
  .filters #bird-five-star-note {
    font-size: 12px;
  }
  .filters .button,
  .filters .text-button {
    font-size: 13px;
  }
}

/* 手機版篩選條件：641～800px 原本是一排要左右滑的欄位（收錄類型被壓窄、格子對不齊），
 * 改成和 640px 以下一樣的網格：641～800px 三欄、640px 以下兩欄；地點跨兩欄 */
@media (max-width: 800px) {
  .filters .filter-scroll {
    overflow: visible;
    padding: 0;
    margin: 0;
  }
  .filters .filter-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 12px;
    width: 100%;
    overflow: visible;
  }
  .filters .filter-grid::after {
    display: none;
  }
  .filters .filter-grid > label,
  .filters .filter-grid > label.location-filter,
  .filters .filter-grid > .kind-filter {
    flex: initial;
    min-width: 0;
    white-space: normal;
  }
  .filters .filter-grid > label.location-filter {
    grid-column: span 2;
  }
  .filters .filter-grid select {
    width: 100%;
    height: 44px;
    margin-top: 5px;
  }
  .filters .filter-scroll-hint {
    display: none;
  }
  /* 「僅五星」與「當前可獲取」靠左排在一起，不再一左一右 */
  .filters .availability-options {
    flex-wrap: wrap;
    gap: 6px 18px;
  }
  .filters #availability-filter {
    margin-left: 0;
  }
}
@media (max-width: 640px) {
  .filters .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* 沒有開啟 JavaScript 時的網站說明 */
.noscript-note {
  /* 畫面在資料載入前整頁隱藏（body:not(.is-ready)），這段說明不受影響 */
  visibility: visible;
  box-sizing: border-box;
  width: calc(100% - 32px);
  max-width: 720px;
  margin: 24px auto;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  line-height: 1.8;
}
.noscript-note h1 {
  margin: 0 0 8px;
  font-size: 24px;
}

/* 批量按鈕列：成就每組「全部完成／全部取消」、寵物「全部設為不喜歡」 */
.batch-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 10px 18px 4px;
  font-size: 12px;
  color: var(--muted);
}
.batch-bar .batch-button {
  min-height: 30px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
}
.batch-bar .text-button {
  font-size: 12px;
  color: var(--muted);
}
.batch-bar button:disabled {
  opacity: 0.45;
  cursor: default;
}
#pets-view .batch-bar {
  margin: 0 18px 10px;
}

/* 首頁卡片數字後面的小字（原本 0.85em≈11.67px），對齊 12px 小字規格 */
.home-card small {
  font-size: 12px;
}

/* =====================================================================
 * 頁面標題放在白色大框外面（2026-11-27）
 * 分類、計算機、成就、寵物：標題列（.page-title-out）在米色底上，白色大框（.collection／.panel-card）只放篩選與內容
 * 成就、寵物的白框和分類頁同一種：直角 8px、無陰影
 * ===================================================================== */
.collection-heading.page-title-out,
.calculator-heading.page-title-out {
  margin: 0;
  padding: 4px 2px 16px;
  background: none;
  border: 0;
}
#collection-heading[hidden] {
  display: none;
}
/* 標題移出去後，白色大框上緣原本靠標題撐出的空間改用內距補上 */
#collection-heading + .collection {
  padding-top: 24px;
}
#calculator-view.panel-page,
#achievements-view.panel-page,
#pets-view.panel-page {
  max-width: none;
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
#calculator-view > .panel-card {
  margin: 0;
}
#achievements-view > .panel-card,
#pets-view > .panel-card {
  max-width: none;
  margin: 0;
  padding: 24px;
  background: var(--m-surface);
  border: 1px solid var(--m-line);
  border-radius: 8px;
  box-shadow: none;
}
#achievements-title,
#pets-title {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: normal;
  color: var(--ink);
}
#achievements-view .title-group,
#pets-view .title-group {
  gap: 12px;
}
#achievements-view .category-progress,
#pets-view .category-progress {
  width: auto;
  min-width: 180px;
  font-size: 13px;
  color: var(--muted);
}
.panel-desc {
  margin: 0 0 18px;
}
.panel-desc > p {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
}
@media (max-width: 800px) {
  .collection-heading.page-title-out,
  .calculator-heading.page-title-out {
    padding: 2px 2px 12px;
  }
  #achievements-view > .panel-card,
  #pets-view > .panel-card {
    padding: 16px;
  }
  #collection-heading + .collection {
    padding-top: 16px;
  }
}

/* 側邊選單：成本計算機上方的分隔線（和圖鑑、成就、寵物分開） */
.nav-divider {
  height: 0;
  margin: 12px 6px 6px;
  border-top: 1px solid var(--line);
}

/* ======== 進度條：主色漸層（v1.3.1） ========
 * 所有進度條（首頁總進度與分類卡片、分類頁標題、成就頁與各組小進度條）
 * 統一用主色漸層：--bar-from → --green；底槽統一用 --track。放在檔案最後，覆蓋前面各區塊的單色設定。 */
.bar,
.achievement-meter {
  background: var(--track);
}
.bar i,
.achievement-meter i {
  background: linear-gradient(90deg, var(--bar-from), var(--green));
}

/* ======== 分類標籤（v1.3.1） ========
 * 每一類固定一個色相，不跟主題主色走，任何配色、淺色或夜間都看得出來：
 *   類型：作物＝橄欖綠（--crop-*）、花卉＝與「花色」同一組（--purple-*，紫色系主題下自動改玫瑰）
 *   收錄：日常＝中性灰（--daily-*）、當前活動＝藍（--info-*）、過往活動＝灰紫（--past-*）
 *   活動相關：限定、料理台、待確認＝金（--gold-*）；花色＝--purple-*
 *   寵物：貓＝橘（--cat-*）、狗＝藍灰（--dog-*）
 * 框線一律由文字色與底色混出，夜間版色票在 css/themes.css。 */
.badge.type-crop {
  background: var(--crop-soft);
  color: var(--crop-ink);
  border: 1px solid color-mix(in srgb, var(--crop-ink) 22%, var(--crop-soft));
}
.badge.type-flower,
.badge.color {
  background: var(--purple-soft);
  color: var(--purple-ink);
  border: 1px solid color-mix(in srgb, var(--purple-ink) 22%, var(--purple-soft));
}
.badge.event,
.badge.limited,
.badge.station,
.badge.unknown {
  background: var(--gold-soft);
  color: var(--gold-ink);
  border: 1px solid color-mix(in srgb, var(--gold-ink) 25%, var(--gold-soft));
}
.item.complete .badge.type-crop { background: var(--crop-soft); }
.item.complete .badge.type-flower { background: var(--purple-soft); }

/* ======== 手機版篩選收合（v1.3.1） ========
 * 800px 以下：預設只顯示搜尋、完成狀態和「篩選條件」列（列上顯示和預設不同的條件數），
 * 點「篩選條件」才展開等級、收錄類型、天氣、時段、地點等。桌面版不受影響。 */
.filter-mobile-bar {
  display: none;
}
@media (max-width: 800px) {
  .filter-mobile-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    width: 100%;
  }
  .filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: var(--paper);
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
  }
  .filter-count {
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--green);
    color: var(--on-accent);
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
  }
  .filter-toggle-arrow {
    transition: transform 0.15s;
  }
  .filter-toggle[aria-expanded="true"] .filter-toggle-arrow {
    transform: rotate(180deg);
  }
  .filters:not(.is-open) > :not(.filter-top) {
    display: none !important;
  }
}

/* 空結果：沒有可清除的條件時隱藏提示與按鈕（v1.3.1） */
.empty p[hidden],
.empty .button[hidden] {
  display: none;
}

/* ======== 寵物頁調整（v1.3.1） ========
 * 1. 吃過進度條：原本用刪除紅，改成和其他進度條一樣的主色漸層。
 * 2. 每樣食物的三段選擇：沒選的只留淡字、不加底；選中的用各自顏色的底和字，一眼看出狀態
 *    （未吃過＝只加深文字、喜歡＝淡紅底紅字、不喜歡＝主色調淡底＋深主色字）。
 * 3. 備註按鈕：原本只有「＋」看不出用途，改成「＋ 備註」小按鈕，寬度固定讓各列對齊。 */
/* 「不喜歡」用主色調：主色混卡片色當底、深主色當字，跟每組配色一致 */
#pets-view {
  --pet-dislike-soft: color-mix(in srgb, var(--green) 14%, var(--paper));
  --pet-dislike-line: color-mix(in srgb, var(--green) 35%, var(--paper));
  --pet-dislike-ink: var(--deep);
}
#pets-view .pet-meter {
  background: var(--track);
}
#pets-view .pet-meter i {
  background: linear-gradient(90deg, var(--bar-from), var(--green));
}
#pets-view .pet-pref {
  background: var(--soft);
  border: 1px solid var(--line);
}
#pets-view .pet-pref .pet-choice,
#pets-view .pet-pref .pet-choice + .pet-choice {
  color: var(--muted);
}
#pets-view .pet-pref .pet-choice:hover {
  color: var(--ink);
  background: var(--paper);
}
#pets-view .pet-pref .pet-none.active {
  /* 「未吃過」是大多數食物的狀態，不加底，只加深文字，讓喜歡／不喜歡更醒目 */
  background: none;
  color: var(--ink);
  box-shadow: none;
}
#pets-view .pet-pref .pet-like.active {
  background: var(--danger-soft);
  color: var(--danger-ink);
  box-shadow: 0 0 0 1px var(--danger-line);
}
#pets-view .pet-pref .pet-dislike.active {
  background: var(--pet-dislike-soft);
  color: var(--pet-dislike-ink);
  box-shadow: 0 0 0 1px var(--pet-dislike-line);
}
#pets-view .pet-note-add {
  width: 72px;
  gap: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  font-size: 13px;
}
#pets-view .pet-note-add span {
  font-size: 14px;
}
@media (min-width: 801px) {
  #pets-view .pet-food:has(.pet-food-note) .pet-pref {
    margin-right: 84px; /* 和「＋ 備註」按鈕（72px＋間距）對齊 */
  }
}
@media (max-width: 800px) {
  #pets-view .pet-note-add {
    width: 72px;
    height: 38px;
  }
  #pets-view .pet-food:has(.pet-food-note) .pet-pref {
    margin-right: 80px;
  }
}
/* 4. 批量「全部設為不喜歡」：原本是一行散落的小字＋外框按鈕，改成和列表同寬的提示條，
 *    按鈕用和「不喜歡」相同的主色調，一看就知道按下去會變成哪個狀態。 */
#pets-view .pet-batch-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin: 12px 18px;
  padding: 8px 8px 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
  font-size: 13px;
  color: var(--muted);
}
#pets-view .pet-batch-bar .batch-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 4px 14px;
  border: 1px solid var(--pet-dislike-line);
  border-radius: 8px;
  background: var(--pet-dislike-soft);
  color: var(--pet-dislike-ink);
  font-size: 13px;
  font-weight: 600;
}
#pets-view .pet-batch-bar .batch-button:hover:not(:disabled) {
  background: color-mix(in srgb, var(--green) 24%, var(--paper));
}
@media (max-width: 800px) {
  #pets-view .pet-batch-bar {
    margin: 10px 14px;
  }
  #pets-view .pet-batch-bar .batch-button {
    flex: 1 1 100%;
    justify-content: center;
  }
}
