/* 魚百科 App 樣式：疊在 ui-kit.css 之上，只用 kit 的變數 */

html { -webkit-text-size-adjust: 100%; }
body { overscroll-behavior-y: none; }
button { font: inherit; color: inherit; }
.app { max-width: 720px; margin: 0 auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }

/* ---------- 頂部 ---------- */
.top { padding: var(--sp-6) 0 var(--sp-4); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.brand { display: flex; align-items: center; gap: var(--sp-3); }
.brand-mark { width: 36px; height: 36px; flex-shrink: 0; }
.brand h1 { font-size: var(--fs-xl); margin: 0; letter-spacing: -0.01em; }
.brand-sub { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); letter-spacing: 0.06em; }
.badge-review { color: var(--warn); border-color: rgba(251, 191, 36, 0.3); }

/* ---------- 搜尋＋篩選 ---------- */
.search { position: relative; margin-top: var(--sp-4); }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-3); pointer-events: none; }
.search .input { padding: 12px 14px 12px 42px; font-size: var(--fs-base); }
.chips { display: flex; gap: var(--sp-2); overflow-x: auto; padding: var(--sp-3) 0 var(--sp-1); scrollbar-width: none; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--r-full);
  border: 1px solid var(--border); background: var(--surface);
  font-size: var(--fs-sm); color: var(--text-2); cursor: pointer;
  transition: border-color var(--t-hover), color var(--t-hover), background var(--t-hover);
}
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { border-color: var(--primary); color: var(--text); background: rgba(124, 92, 255, 0.12); }
.chip[aria-pressed="true"]::before { content: "✓"; font-size: 12px; color: var(--glow); }
.result-count { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-3); margin: var(--sp-3) 0; }

/* ---------- 魚種卡 ---------- */
.grid { display: grid; gap: var(--sp-3); }
@media (min-width: 640px) { .grid { grid-template-columns: 1fr 1fr; } }

.fish-card {
  display: grid; grid-template-columns: 76px 1fr; gap: var(--sp-4); align-items: center;
  padding: var(--sp-4); text-align: left; width: 100%; cursor: pointer;
  color: var(--text);
}
.fish-card .card-title { font-size: 18px; margin: 0; }
.fish-art {
  width: 76px; height: 56px; border-radius: var(--r-md);
  background: radial-gradient(ellipse at 50% 60%, rgba(124, 92, 255, 0.14), transparent 70%), var(--surface-hi);
  border: 1px solid var(--border-hi); display: grid; place-items: center;
}
.fish-art svg { width: 64px; height: 32px; }
.fish-alias { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fish-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--sp-2); }
.meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-2); background: var(--surface-hi); border: 1px solid var(--border-hi); padding: 2px 8px; border-radius: var(--r-sm); white-space: nowrap; }
.meta b { color: var(--text); font-weight: 600; margin: 0 1px; }
.in-tank { font-family: var(--font-mono); font-size: 11px; color: var(--cyan); margin-left: 6px; }

.empty { text-align: center; padding: var(--sp-7) var(--sp-4); color: var(--text-2); }

/* ---------- 詳細頁 ---------- */
.back { margin: var(--sp-4) 0 0 -8px; }
.hero { text-align: center; padding: var(--sp-4) 0 var(--sp-5); }
.hero-art {
  height: 150px; display: grid; place-items: center; margin-bottom: var(--sp-4);
  background: radial-gradient(ellipse 55% 60% at 50% 55%, rgba(124, 92, 255, 0.18), transparent 70%);
}
.hero-art svg { width: 240px; height: 120px; }
.hero h2 { margin-bottom: var(--sp-1); }
.sci { font-family: var(--font-mono); font-style: italic; font-size: var(--fs-sm); color: var(--text-2); }
.hero .fish-alias { font-size: var(--fs-sm); white-space: normal; }
.hero-badges { display: flex; justify-content: center; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-4); }

.lvl-1 { color: var(--good); border-color: rgba(81, 207, 102, 0.3); }
.lvl-2 { color: var(--cyan); border-color: rgba(34, 211, 238, 0.3); }
.lvl-3 { color: var(--bad); border-color: rgba(255, 107, 107, 0.3); }

.section { margin-top: var(--sp-5); }
.section > .section-label { margin-bottom: var(--sp-3); }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.stat { padding: var(--sp-4); }
.stat .stat-value { font-size: 24px; }
.stat .stat-value small { font-size: var(--fs-sm); color: var(--text-2); font-weight: 500; margin-left: 2px; }
.stat .stat-label { margin-bottom: var(--sp-1); }
.stat-hint { font-size: var(--fs-xs); color: var(--text-3); margin-top: var(--sp-1); }
.stat-hi { border-color: rgba(124, 92, 255, 0.35); }

/* 範圍條：淡色＝可容忍，實色＝建議 */
.range { padding: var(--sp-4); }
.range + .range { margin-top: var(--sp-3); }
.range-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); }
.range-head .stat-value { font-size: 22px; }
.range-head .stat-label { margin: 0; }
.track { position: relative; height: 10px; margin: var(--sp-4) 0 var(--sp-2); border-radius: var(--r-full); background: var(--surface-hi); }
.track .ok { position: absolute; top: 0; bottom: 0; border-radius: var(--r-full); background: rgba(167, 139, 250, 0.22); border: 1px dashed rgba(167, 139, 250, 0.5); }
.track .ideal { position: absolute; top: -2px; bottom: -2px; border-radius: var(--r-full); background: var(--gradient-brand); box-shadow: 0 0 12px rgba(124, 92, 255, 0.45); }
.ticks { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
.legend { display: flex; gap: var(--sp-4); font-size: var(--fs-xs); color: var(--text-2); margin-top: var(--sp-2); }
.legend i { display: inline-block; width: 18px; height: 8px; border-radius: 4px; margin-right: 6px; vertical-align: middle; }
.legend .l-ideal { background: var(--gradient-brand); }
.legend .l-ok { background: rgba(167, 139, 250, 0.22); border: 1px dashed rgba(167, 139, 250, 0.5); }

.notes { list-style: none; margin: 0; padding: 0; }
.notes li { position: relative; padding: var(--sp-3) 0 var(--sp-3) 22px; border-bottom: 1px solid var(--border); font-size: 15px; }
.notes li:last-child { border-bottom: none; }
.notes li::before { content: "→"; position: absolute; left: 0; color: var(--glow); font-family: var(--font-mono); }
.notes li.is-warn::before { content: "!"; color: var(--warn); font-weight: 700; left: 4px; }

.review { display: flex; gap: var(--sp-4); align-items: center; padding: var(--sp-4); border-style: dashed; }
.review-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; border: 1px dashed rgba(251, 191, 36, 0.5); color: var(--warn); font-family: var(--font-mono); }
.review b { display: block; font-size: 15px; }
.review span { font-size: var(--fs-xs); color: var(--text-2); }

.sources { list-style: none; padding: 0; margin: 0; }
.sources li { padding: var(--sp-2) 0; font-size: var(--fs-sm); }
.sources a::after { content: " ↗"; font-family: var(--font-mono); }

.sticky-cta {
  position: fixed; left: 0; right: 0; bottom: calc(64px + env(safe-area-inset-bottom));
  padding: var(--sp-3) 16px; z-index: 5;
  background: linear-gradient(to top, var(--bg) 60%, transparent);
}
.sticky-cta .btn { width: 100%; max-width: 688px; margin: 0 auto; display: flex; justify-content: center; padding: 14px; font-size: var(--fs-base); }
.has-cta .app { padding-bottom: calc(160px + env(safe-area-inset-bottom)); }

/* ---------- 我的缸 ---------- */
.page-title { margin: var(--sp-6) 0 var(--sp-1); font-size: var(--fs-xl); }
.page-sub { color: var(--text-2); font-size: var(--fs-sm); margin-bottom: var(--sp-4); }

.dims { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
.dims .field-label { font-size: var(--fs-xs); color: var(--text-2); font-family: var(--font-mono); letter-spacing: 0.06em; }
.dims .input { font-family: var(--font-mono); font-size: 18px; text-align: center; padding: 10px 6px; }
.vol { display: flex; align-items: baseline; justify-content: space-between; margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid var(--border); }
.vol .stat-value { font-size: 28px; }
.vol .stat-value small { font-size: var(--fs-sm); color: var(--text-2); }

.pick { display: grid; grid-template-columns: 56px 1fr auto; gap: var(--sp-3); align-items: center; padding: var(--sp-3) 0; border-bottom: 1px solid var(--border); }
.pick:last-child { border-bottom: none; }
.pick .fish-art { width: 56px; height: 42px; }
.pick .fish-art svg { width: 46px; height: 23px; }
.pick-name { font-weight: 600; background: none; border: none; padding: 0; text-align: left; cursor: pointer; }
.pick-sub { font-size: var(--fs-xs); color: var(--text-3); font-family: var(--font-mono); }
.stepper { display: flex; align-items: center; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.stepper button { width: 36px; height: 36px; background: var(--surface-hi); border: none; cursor: pointer; font-size: 18px; transition: background var(--t-hover); }
.stepper button:hover { background: rgba(124, 92, 255, 0.15); }
.stepper output { min-width: 34px; text-align: center; font-family: var(--font-mono); }

.verdict { display: flex; gap: var(--sp-4); align-items: center; padding: var(--sp-5); }
.verdict-icon { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; font-weight: 700; flex-shrink: 0; font-family: var(--font-mono); }
.verdict.v-ok { border-color: rgba(81, 207, 102, 0.35); }
.verdict.v-ok .verdict-icon { color: var(--good); border: 2px solid var(--good); }
.verdict.v-warn { border-color: rgba(251, 191, 36, 0.35); }
.verdict.v-warn .verdict-icon { color: var(--warn); border: 2px solid var(--warn); }
.verdict.v-bad { border-color: rgba(255, 107, 107, 0.4); }
.verdict.v-bad .verdict-icon { color: var(--bad); border: 2px solid var(--bad); }
.verdict b { display: block; font-size: var(--fs-lg); }
.verdict span { font-size: var(--fs-sm); color: var(--text-2); }

/* 魚量負荷：刻度 0–150%，細線＝100% */
.load { padding: var(--sp-4); margin-top: var(--sp-3); }
.load .range-head .stat-value { font-size: 22px; }
.load-track { position: relative; height: 10px; margin: var(--sp-4) 0 var(--sp-2); border-radius: var(--r-full); background: var(--surface-hi); }
.load-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: var(--r-full); transition: width var(--t-hover); }
.load-ok .load-fill { background: var(--good); }
.load-warn .load-fill { background: var(--warn); }
.load-bad .load-fill { background: var(--bad); }
.load-mark { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--text-2); border-radius: 1px; }
.load-sub { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }

.setpoints { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); margin-top: var(--sp-3); }

.issues { list-style: none; padding: 0; margin: var(--sp-3) 0 0; display: grid; gap: var(--sp-2); }
.issues li { display: flex; gap: var(--sp-3); align-items: flex-start; font-size: var(--fs-sm); padding: var(--sp-3) var(--sp-4); }
.issues .tag-lvl { font-family: var(--font-mono); font-size: 11px; padding: 2px 8px; border-radius: var(--r-sm); flex-shrink: 0; margin-top: 2px; border: 1px solid; }
.tag-bad { color: var(--bad); border-color: rgba(255, 107, 107, 0.4); }
.tag-warn { color: var(--warn); border-color: rgba(251, 191, 36, 0.4); }
.tag-info { color: var(--text-2); border-color: var(--border-hi); }

.suggest { display: flex; gap: var(--sp-3); overflow-x: auto; margin: 0 -16px; padding: 4px 16px var(--sp-2); scrollbar-width: none; }
.suggest::-webkit-scrollbar { display: none; }
.sug { flex-shrink: 0; width: 132px; padding: var(--sp-3); text-align: center; cursor: pointer; color: var(--text); }
.sug .fish-art { width: 100%; margin-bottom: var(--sp-2); }
.sug b { display: block; font-size: var(--fs-sm); }
.sug span { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
.sug .add { display: block; margin-top: var(--sp-2); font-size: var(--fs-xs); color: var(--glow); }
.sug-warn { display: block; font-style: normal; color: var(--warn); font-family: var(--font-mono); font-size: 11px; margin-bottom: 2px; }

/* ---------- 底部導覽 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center; gap: var(--sp-2);
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  background: rgba(10, 10, 15, 0.88); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
.tab {
  flex: 1; max-width: 200px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px; border-radius: var(--r-md); color: var(--text-3); font-size: 12px; position: relative;
  transition: color var(--t-hover), background var(--t-hover);
}
.tab svg { width: 22px; height: 22px; }
.tab:hover { color: var(--text); }
.tab[aria-current="page"] { color: var(--text); background: rgba(124, 92, 255, 0.1); }
.tab[aria-current="page"] svg { color: var(--glow); }
.tab .count { position: absolute; top: 2px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-full); background: var(--primary); color: #fff; font-family: var(--font-mono); font-size: 11px; line-height: 18px; text-align: center; }

.foot { text-align: center; font-size: var(--fs-xs); color: var(--text-3); margin-top: var(--sp-7); font-family: var(--font-mono); }

.toast {
  position: fixed; left: 50%; bottom: calc(140px + env(safe-area-inset-bottom)); transform: translate(-50%, 12px);
  padding: 10px 18px; border-radius: var(--r-full); background: var(--surface-hi); border: 1px solid var(--border-hi);
  font-size: var(--fs-sm); opacity: 0; pointer-events: none; transition: opacity var(--t-hover), transform var(--t-hover); z-index: 20;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 只淡入不位移：.view 有 transform 會讓裡面的 position:fixed（加入我的缸按鈕）失效 */
@keyframes fp-fade { from { opacity: 0; } to { opacity: 1; } }
.view { animation: fp-fade 360ms ease both; }
