/* 獵魔村誦經團 POV 戰情室 — 羊皮紙告示板（淺色、手機優先） */
:root {
  color-scheme: light;
  /* 羊皮紙 */
  --bg: #eadfc6;
  --grain: rgba(110, 75, 30, 0.10);
  --surface: #f7f0df;
  --surface-2: #efe4c9;
  --surface-3: #e5d6b3;
  --field: #fcf8ee;
  --line: #dccaa1;
  --line-2: #cdb68a;
  --line-3: #b89c68;
  --frame: #e0cfa6;
  /* 墨色 */
  --text: #2a1d12;
  --text-2: #3d2c1c;
  --muted: #5f4a33;
  /* 金、封蠟紅 */
  --gold: #9a6a14;
  --gold-ink: #7d5510;
  --gold-soft: rgba(154, 106, 20, 0.14);
  --seal: #8e2a1e;
  --seal-hover: #9f3326;
  --seal-dark: #5e1a12;
  --seal-ink: #fbeed3;
  /* 木頭（頁首、底部選單） */
  --wood: #2e2014;
  --wood-2: #3d2b1a;
  --wood-line: #6b4f2e;
  --wood-text: #f3e6c8;
  --wood-muted: #e6d6b4;
  --wood-gold: #e0b458;
  --wood-gold-hi: #f6d78a;
  --ring: #d9a441;
  /* 狀態 */
  --accent: var(--seal);
  --accent-ink: var(--seal-ink);
  --accent-soft: rgba(142, 42, 30, 0.08);
  --win: #2e6b33;
  --loss: #9b2f22;
  --warn: #8a5a00;
  --warn-bg: #f6e4b8;
  --warn-line: #d9b25e;
  --danger-text: #9b2f22;
  /* 形狀 */
  --radius: 6px;
  --panel-shadow: inset 0 0 0 4px var(--surface), inset 0 0 0 5px var(--frame), 0 12px 26px -20px rgba(60, 40, 15, 0.55);
  --nav-h: 66px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", "Noto Sans CJK TC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Noto Serif TC", "Songti TC", "PMingLiU", "MingLiU", "Noto Serif CJK TC", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(var(--grain) 1px, transparent 1.3px);
  background-size: 7px 7px;
  color: var(--text);
  font: 15px/1.55 var(--font);
  min-height: 100vh;
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }
h1, h2, h3, p { margin: 0; }
h1 { font-family: var(--serif); font-weight: 900; font-size: 24px; line-height: 1.25; }
h2 { font-size: 16px; line-height: 1.4; }
h3 { font-size: 14px; line-height: 1.4; margin-bottom: 6px; color: var(--text-2); }
a { color: inherit; }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
ul, ol { margin: 0; padding: 0; list-style: none; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.spacer { flex: 1 1 auto; }
.block { display: block; }
.serif { font-family: var(--serif); font-weight: 900; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold-ink); outline-offset: 2px; }
::selection { background: rgba(154, 106, 20, 0.28); }

/* ── 外框：木頭頁首 ── */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--wood); color: var(--wood-text);
  border-bottom: 3px solid var(--gold); box-shadow: 0 3px 0 #1c130b; /* 不用 backdrop-filter：它會讓底部導覽（fixed）被框在頁首裡 */
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; height: 60px;
  display: flex; align-items: center; gap: 12px; padding: 0 8px 0 14px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; flex: 1 1 auto; color: var(--wood-text); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--seal); color: var(--seal-ink); border: 2px solid var(--ring);
}
.brand-mark .ico { width: 19px; height: 19px; stroke-width: 2; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; gap: 2px; }
.brand-guild { font-family: var(--serif); font-weight: 900; font-size: 17px; letter-spacing: 0.06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-app { font-size: 11px; color: var(--wood-gold); letter-spacing: 0.2em; }
.topbar-tools { display: flex; align-items: center; gap: 2px; flex: none; }
.me-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; max-width: 150px;
  padding: 0 12px; border-radius: 999px; background: var(--wood-2); border: 1px solid var(--wood-line); color: var(--wood-text); cursor: pointer;
}
.me-btn span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; font-weight: 700; }
.me-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--wood-gold); flex: none; }
.me-btn.me-empty { border-color: var(--wood-gold); color: var(--wood-gold-hi); }
.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center; flex: none;
  border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.topbar .icon-btn { width: 44px; height: 44px; color: var(--wood-muted); }
.topbar .icon-btn:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.icon-btn-sm { width: 34px; height: 34px; }
.icon-btn-sm .ico { width: 18px; height: 18px; }

.subbar { max-width: 1200px; margin: 0 auto; padding: 10px 12px 0; }
.period-box { display: flex; align-items: center; gap: 8px; justify-content: center; flex-wrap: wrap; }
.period-box .icon-btn { width: 38px; height: 38px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line-2); color: var(--muted); }
.period-box .icon-btn:hover { background: var(--field); color: var(--text); }
.period-label { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; justify-content: center; }
.period-label b { font-family: var(--serif); font-weight: 900; font-size: 18px; }
.tag { display: inline-block; font-size: 12px; padding: 0 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); margin-left: 4px; vertical-align: 1px; }
.tag-now { background: transparent; color: var(--gold-ink); border: 1px solid #b08a3e; font-weight: 700; }

.main { max-width: 1200px; margin: 0 auto; padding: 12px 12px calc(var(--nav-h) + var(--safe-b) + 28px); transition: opacity 0.15s; }
.main.refreshing, .refreshing { opacity: 0.55; }

/* 底部選單（手機）：木頭底、中間封蠟按鈕 */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--wood); border-top: 3px solid var(--gold);
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--wood-muted); font-size: 11px;
}
.nav-item .ico { width: 22px; height: 22px; }
.nav-item.on { color: var(--wood-gold-hi); font-weight: 700; }
.nav-accent { color: var(--wood-gold-hi); font-weight: 700; justify-content: flex-start; }
.nav-accent .ico {
  width: 54px; height: 54px; padding: 14px; border-radius: 50%; margin-top: -22px;
  background: var(--seal); color: var(--seal-ink) !important; stroke-width: 2.6;
  box-shadow: 0 0 0 3px var(--wood), 0 0 0 5px var(--ring);
}

@media (min-width: 960px) {
  .topbar-inner { height: 68px; padding: 0 16px; justify-content: space-between; }
  .brand { flex: 0 1 auto; }
  .brand-mark { width: 42px; height: 42px; }
  .brand-guild { font-size: 20px; letter-spacing: 0.08em; }
  .brand-app { font-size: 12px; letter-spacing: 0.24em; }
  .nav {
    position: static; height: auto; padding: 0; background: none; border: 0;
    display: flex; gap: 4px; flex: none; align-items: center;
  }
  .nav-item { flex-direction: row; gap: 8px; height: 44px; padding: 0 14px; border-radius: 8px; font-size: 15px; font-weight: 500; }
  .nav-item .ico { width: 18px; height: 18px; }
  .nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
  .nav-item.on { color: var(--wood-gold-hi); background: rgba(217, 164, 65, 0.16); box-shadow: inset 0 -3px 0 var(--ring); }
  .nav-accent, .nav-accent.on {
    height: 40px; margin: 0 6px; padding: 0 16px; border-radius: 20px; justify-content: center;
    background: var(--seal); color: var(--seal-ink); box-shadow: inset 0 0 0 1px var(--ring); font-weight: 700;
  }
  .nav-accent:hover { background: var(--seal-hover); color: var(--seal-ink); }
  .nav-accent .ico { width: 18px; height: 18px; padding: 0; margin: 0; border-radius: 0; background: none; color: inherit !important; box-shadow: none; stroke-width: 2.4; }
  .main { padding: 16px 16px 56px; }
  .subbar { padding: 16px 16px 0; }
}

/* ── 版面 ── */
.grid-2, .record-layout { display: grid; gap: 16px; }
.col, .stack { display: grid; gap: 16px; align-content: start; min-width: 0; }
@media (min-width: 960px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 24px; }
  .grid-2 > .col { gap: 24px; }
  .record-layout { grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr); align-items: start; gap: 24px; }
}
/* 告示板：雙框線 */
.card {
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius);
  box-shadow: var(--panel-shadow); padding: 18px 18px 18px; min-width: 0;
}
@media (min-width: 700px) { .card { padding: 22px 26px 24px; } }
.card-head { margin-bottom: 14px; display: grid; gap: 2px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.card h2 { font-family: var(--serif); font-weight: 900; font-size: 19px; display: inline-flex; align-items: center; gap: 10px; }
.card h2::before { content: ""; width: 8px; height: 8px; background: var(--gold); transform: rotate(45deg); flex: none; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.toolbar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.toolbar p { flex: 1 1 220px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.chips-wrap { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── 按鈕、輸入 ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 14px; border-radius: 6px; cursor: pointer; text-decoration: none; white-space: nowrap;
  background: var(--field); border: 1px solid var(--line-2); color: var(--text); font-size: 14px; font-weight: 700;
  box-shadow: 0 2px 0 var(--line);
}
.btn:hover { background: #fffcf4; border-color: var(--line-3); }
.btn:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--line); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-sm .ico { width: 16px; height: 16px; }
.btn-primary {
  background: var(--seal); border-color: var(--seal); color: var(--seal-ink);
  box-shadow: inset 0 0 0 1px var(--ring), 0 3px 0 var(--seal-dark);
}
.btn-primary:hover { background: var(--seal-hover); border-color: var(--seal-hover); }
.btn-primary:active { box-shadow: inset 0 0 0 1px var(--ring), 0 1px 0 var(--seal-dark); }
.btn-danger { background: var(--loss); border-color: var(--loss); color: #fff; box-shadow: 0 2px 0 #5c1a12; }
.btn-danger-ghost { background: transparent; border-color: rgba(155, 47, 34, 0.45); color: var(--loss); box-shadow: none; }
.btn-danger-ghost:hover { background: rgba(155, 47, 34, 0.08); }
.btn-block { width: 100%; height: 50px; font-size: 16px; }
.link { color: var(--gold-ink); font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.link:hover { text-decoration: underline; color: #5c3d09; }
.link .ico { width: 16px; height: 16px; }
.link-btn {
  background: none; border: 0; padding: 0; cursor: pointer; color: var(--text); text-align: left; font-weight: 700;
  text-decoration: underline; text-decoration-color: rgba(125, 85, 16, 0.35); text-underline-offset: 3px;
}
.link-btn:hover { text-decoration-color: var(--gold-ink); color: #000; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 4px; min-height: 34px; padding: 4px 12px; border-radius: 999px;
  background: var(--field); border: 1px solid var(--line-2); cursor: pointer; font-size: 14px;
}
.chip-btn:hover { border-color: var(--gold); }
.chip-btn .ico { width: 16px; height: 16px; color: var(--gold-ink); }

.input {
  width: 100%; height: 44px; padding: 0 12px; border-radius: 6px;
  background: var(--field); border: 1px solid var(--line-2); color: var(--text); font: inherit; font-size: 16px;
}
.input::placeholder { color: #9b8466; }
textarea.input { height: auto; min-height: 64px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
select.input { appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 19px, calc(100% - 12px) 19px; background-size: 5px 5px; background-repeat: no-repeat; }
.input-auto { width: auto; min-width: 120px; flex: 0 1 auto; }
.input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(154, 106, 20, 0.2); }
.filters .input { height: 40px; font-size: 15px; }
.filters select.input { background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px; }
.search-box { position: relative; flex: 1 1 200px; min-width: 0; }
.search-box .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; }
.search-box .input { padding-left: 36px; }

.form { display: grid; gap: 16px; }
.form-row { display: grid; gap: 12px; }
@media (min-width: 560px) { .form-row { grid-template-columns: 1fr 1fr; } }
.field { display: grid; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; color: var(--text-2); font-weight: 700; }
.field-hint { font-size: 12px; color: var(--muted); }
.form-warn:empty { display: none; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line-2); max-width: 100%; }
.seg-btn { border: 0; background: transparent; padding: 7px 12px; border-radius: 6px; cursor: pointer; color: var(--muted); font-size: 14px; white-space: nowrap; }
.seg-btn:hover { color: var(--text); }
.seg-btn.on { background: var(--field); color: var(--text); font-weight: 700; box-shadow: inset 0 0 0 1px var(--line-2), 0 1px 2px rgba(60, 40, 15, 0.15); }
.seg-tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; width: 100%; margin-bottom: 14px; scrollbar-width: none; }
.seg-tabs::-webkit-scrollbar { display: none; }
.seg-tabs .seg-btn { flex: 1 0 auto; padding: 9px 14px; font-size: 15px; }
.seg-tabs .seg-btn.on { font-family: var(--serif); font-weight: 900; }
.seg-result { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0; background: none; border: 0; width: 100%; }
.seg-result .seg-btn {
  height: 58px; font-family: var(--serif); font-size: 24px; font-weight: 900; border-radius: 8px; border: 2px solid var(--line-2); background: var(--field); color: var(--muted);
}
.seg-result .seg-win.on { background: var(--win); border-color: var(--win); color: #fff; box-shadow: 0 3px 0 #1d4521; }
.seg-result .seg-loss.on { background: var(--loss); border-color: var(--loss); color: #fff; box-shadow: 0 3px 0 #5c1a12; }

/* ── 職業、配置 ── */
.cchip {
  display: inline-flex; align-items: center; justify-content: center; gap: 2px; min-width: 22px; padding: 1px 5px; border-radius: 4px;
  background: var(--c, #6b5a45); color: #fff; font-size: 12px; font-weight: 700; line-height: 18px; white-space: nowrap;
}
.cchip b { font-weight: 800; }
.comp-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.comp-bar { display: inline-flex; gap: 2px; align-items: center; vertical-align: middle; flex: none; }
.comp-bar i { width: 8px; height: 15px; border-radius: 2px; display: block; }
.comp-bar i.empty-cell { background: transparent; box-shadow: inset 0 0 0 1px var(--line-3); }
.comp-line { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lineup-sig { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.power { white-space: nowrap; }
.htags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.htag {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 6px; border-radius: 4px;
  background: var(--field); font-size: 12px; border: 1px solid var(--line);
}
.htag i { width: 8px; height: 8px; border-radius: 2px; background: var(--c); flex: none; }
.htag-gone { color: var(--muted); font-style: italic; }

.rbadge {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 6px; flex: none;
  font-family: var(--serif); font-weight: 900; font-size: 17px;
}
.r-win { background: var(--win); color: #fff; }
.r-loss { background: var(--loss); color: #fff; }
.rbadge-big { width: 54px; height: 54px; font-size: 26px; border-radius: 8px; }

/* 勝敗條：綠＝勝、紅＝敗，段與段之間 2px 間隔 */
.wl-bar { display: block; width: 100%; min-width: 60px; }
.wl-track { display: flex; gap: 2px; height: 10px; }
.wl-track i { display: block; min-width: 3px; border-radius: 2px; }
.wl-w { background: var(--win); }
.wl-l { background: var(--loss); }
.wl-text { white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 13px; }
.wl-pct { font-size: 15px; font-family: var(--serif); font-weight: 900; }
.legend { display: flex; gap: 14px; align-items: center; font-size: 12px; color: var(--text-2); margin-bottom: 8px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.lg { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.lg-w { background: var(--win); }
.lg-l { background: var(--loss); }

/* ── 本期：告示板主視覺 ── */
.home { display: grid; gap: 16px; }
@media (min-width: 960px) { .home { gap: 24px; } }
.hero {
  position: relative; display: grid; gap: 16px;
  grid-template-columns: minmax(0, 1fr); grid-template-areas: "title" "count" "quest" "cta";
}
.hero-title { grid-area: title; display: grid; gap: 4px; padding-right: 76px; }
.hero-title h1 { font-size: 40px; line-height: 1.05; letter-spacing: 0.04em; }
.hero-dates { font-size: 14px; color: var(--muted); }
.hero-sub { font-size: 13px; color: var(--muted); }
.hero-side { display: contents; }
.seal {
  position: absolute; top: 16px; right: 16px; width: 60px; height: 60px; border-radius: 50%; flex: none;
  display: grid; place-items: center; background: var(--seal); color: var(--seal-ink);
  font-family: var(--serif); font-weight: 900; font-size: 14px; line-height: 1.05; letter-spacing: 0.05em;
  writing-mode: vertical-rl; text-orientation: upright;
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--seal); transform: rotate(-8deg);
}
.seal-quiet { background: var(--surface-3); color: var(--muted); box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--line-3); }
.hero-count { grid-area: count; display: grid; gap: 2px; border-top: 1px dashed var(--line-2); padding-top: 12px; }
.hero-count .label { font-size: 13px; color: var(--muted); }
.hero-count .count { font-family: var(--serif); font-weight: 900; font-size: 32px; line-height: 1.15; }
.hero-count .end { font-size: 12px; color: var(--muted); }
.btn-hero { grid-area: cta; height: 52px; font-size: 16px; }
.btn-hero .ico { width: 20px; height: 20px; stroke-width: 2.4; }
/* 任務路線：菱形節點 */
.quest { grid-area: quest; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.quest li { position: relative; display: grid; gap: 8px; align-content: start; min-width: 0; }
.quest li::after { content: ""; position: absolute; left: 22px; right: 0; top: 10px; border-top: 2px dashed var(--line-3); }
.quest li:last-child::after { display: none; }
.quest li.q-done::after { border-top-style: solid; border-color: var(--gold); }
.q-mark { position: relative; width: 22px; height: 22px; display: grid; place-items: center; z-index: 1; }
.q-mark::before { content: ""; position: absolute; inset: 4px; transform: rotate(45deg); background: var(--surface); box-shadow: inset 0 0 0 2px var(--line-3); }
.q-mark .ico { position: relative; width: 12px; height: 12px; stroke-width: 3.5; color: var(--surface); }
.q-done .q-mark::before { inset: 3px; background: var(--gold); box-shadow: none; }
.q-now .q-mark::before { inset: 2px; background: var(--seal); box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px rgba(142, 42, 30, 0.35); }
.q-text { display: grid; gap: 1px; min-width: 0; padding-right: 6px; }
.q-text b { font-size: 14px; }
.q-now .q-text b { color: var(--seal); }
.q-text span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 370px) { .q-text span { display: none; } }
@media (min-width: 960px) {
  .hero { grid-template-columns: minmax(0, 1fr) 360px; grid-template-areas: "title side" "quest side"; column-gap: 36px; row-gap: 24px; padding: 30px 36px 32px; }
  .hero-title { padding-right: 0; }
  .hero-title h1 { font-size: 58px; }
  .hero-dates { font-size: 17px; }
  .hero-title-line { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
  .hero-sub { font-size: 14px; }
  .hero-side {
    grid-area: side; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "seal count" "cta cta";
    align-content: center; gap: 18px; border-left: 1px dashed var(--line-2); padding-left: 36px;
  }
  .seal { position: static; grid-area: seal; width: 72px; height: 72px; font-size: 16px; }
  .hero-count { border-top: 0; padding-top: 0; align-self: center; }
  .hero-count .count { font-size: 38px; }
  .btn-hero { height: 54px; font-size: 17px; }
  .q-text b { font-size: 16px; }
  .q-text span { font-size: 13px; }
}

.mine { display: grid; gap: 12px; }
.mine-row { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 8px 12px; align-items: start; padding-bottom: 12px; border-bottom: 1px dashed var(--line); }
.mine-row:last-child { border-bottom: 0; padding-bottom: 0; }
.mine-row > .btn { grid-column: 2; justify-self: start; }
.mine-label { font-size: 13px; color: var(--muted); font-weight: 700; padding-top: 8px; }
.mine-val { display: grid; gap: 6px; min-width: 0; }
.lineup-mini {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; text-align: left; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px;
}
.lineup-mini:hover { border-color: var(--line-3); background: #f2e8cf; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
@media (min-width: 600px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; min-width: 0; }
.tile-label { font-size: 13px; color: var(--muted); }
.tile-value { font-family: var(--serif); font-size: 27px; font-weight: 900; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-sub { font-size: 12px; color: var(--muted); }
.tile-hero { background: #f3e3bb; border-color: #b08a3e; }
.tile-hero .tile-value { font-size: 36px; color: var(--gold-ink); }
.chase {
  display: flex; gap: 8px; align-items: flex-start; font-size: 14px; margin-bottom: 10px;
  background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 6px; padding: 8px 10px;
}
.chase .ico, .warn .ico, .notice .ico { color: var(--warn); width: 18px; height: 18px; margin-top: 2px; }
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 6px 6px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.table td { padding: 10px 6px; border-bottom: 1px dashed var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .me-row td { background: var(--gold-soft); }
.num .w { color: var(--win); font-weight: 700; }
.num .l { color: var(--loss); font-weight: 700; }
.miss { font-size: 12px; color: var(--seal); font-weight: 700; }

/* ── 戰報卡 ── */
.battle-list { display: grid; gap: 10px; }
.bcard {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; width: 100%;
  text-align: left; cursor: pointer; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 12px 14px;
  box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 4px var(--frame);
}
.bcard:hover { border-color: var(--line-3); }
.card .battle-list { gap: 0; }
.card .bcard { background: transparent; border: 0; border-bottom: 1px dashed var(--line); border-radius: 0; box-shadow: none; padding: 12px 2px; }
.card .bcard:last-child { border-bottom: 0; }
.card .bcard:hover { background: rgba(154, 106, 20, 0.06); }
.bcard-main { display: grid; gap: 4px; min-width: 0; }
.bcard-title { overflow-wrap: anywhere; }
.bcard-vs { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.vs-side { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.bcard-note { color: var(--text-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bcard-thumb { width: 56px; height: 72px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line-2); }

/* ── 角色池 ── */
.class-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.fchip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  background: var(--field); border: 1px solid var(--line-2); font-size: 13px; white-space: nowrap; color: var(--text-2);
}
.fchip.on { border-color: var(--text); background: var(--text); color: var(--surface); font-weight: 700; }
.fchip-dot { width: 9px; height: 9px; border-radius: 2px; background: var(--c); }
.fchip.on .fchip-dot { box-shadow: 0 0 0 1px var(--surface); }
.member-cards { display: grid; gap: 10px; }
@media (min-width: 700px) { .member-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1040px) { .member-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.member-card { background: var(--field); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; min-width: 0; }
.member-card.is-me { border-color: #b08a3e; background: #fbf1d8; box-shadow: inset 0 0 0 1px #b08a3e; }
.member-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.member-card-head b { font-family: var(--serif); font-weight: 900; font-size: 16px; }
.hunter-line { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 3px 0; border-top: 1px dashed var(--line); }
.member-card-head + .hunter-line, .warn + .hunter-line, .mine-val .hunter-line:first-child { border-top: 0; }
.mine-val .hunter-line { border-top: 1px dashed var(--line); }
.hunter-line .cchip { min-width: 26px; height: 26px; font-size: 13px; }
.hunter-text { display: grid; min-width: 0; line-height: 1.3; }
.hunter-name { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hunter-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hunter-power { font-family: var(--serif); font-weight: 900; font-variant-numeric: tabular-nums; color: var(--text); font-size: 16px; white-space: nowrap; }
.hunter-thumb { width: 34px; height: 40px; border-radius: 4px; object-fit: cover; flex: none; border: 1px solid var(--line-2); cursor: zoom-in; }
.warn { display: flex; gap: 6px; align-items: flex-start; color: var(--warn); margin: 4px 0; }
.warn-text { color: var(--warn); font-weight: 700; }
.lineup-grid { display: grid; gap: 12px; }
@media (min-width: 700px) { .lineup-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1040px) { .lineup-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.lineup-card { padding: 16px 18px; }
.note { white-space: pre-wrap; color: var(--text-2); margin-top: 8px; overflow-wrap: anywhere; }

.class-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
@media (min-width: 520px) { .class-pick { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.class-opt {
  display: flex; align-items: center; justify-content: center; gap: 6px; height: 44px; border-radius: 6px; cursor: pointer;
  background: var(--field); border: 2px solid var(--line); font-size: 14px; font-weight: 700; padding: 0 6px; white-space: nowrap;
}
.class-opt i { width: 10px; height: 10px; border-radius: 2px; background: var(--c); flex: none; }
.class-opt.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--field)); }
.recent-box:empty { display: none; }
.recent-box { display: grid; gap: 8px; padding: 10px; border-radius: 6px; background: var(--surface-2); border: 1px dashed var(--line-3); }

/* 組陣容 */
.builder { display: grid; gap: 12px; }
.builder-sticky { position: sticky; top: -16px; z-index: 2; background: var(--surface); margin: 0 -16px; padding: 10px 16px; border-bottom: 1px solid var(--line-2); box-shadow: 0 8px 12px -10px rgba(60, 40, 15, 0.45); }
.builder-sum { display: grid; gap: 6px; }
.big-count { font-family: var(--serif); font-weight: 900; font-size: 24px; }
.pick-list { display: grid; gap: 6px; }
@media (min-width: 700px) { .pick-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pick {
  display: grid; grid-template-columns: 24px auto minmax(0, 1fr) auto; grid-template-areas: "chk cls name pow" "chk cls owner pow";
  align-items: center; gap: 0 8px; text-align: left; cursor: pointer; padding: 8px 10px; border-radius: 6px;
  background: var(--field); border: 2px solid var(--line); min-height: 54px;
}
.pick:disabled { opacity: 0.4; cursor: not-allowed; }
.pick.on { border-color: var(--seal); background: #f8e9dc; }
.pick-check { grid-area: chk; width: 22px; height: 22px; border-radius: 4px; border: 2px solid var(--line-3); display: grid; place-items: center; background: var(--field); }
.pick.on .pick-check { background: var(--seal); border-color: var(--seal); color: var(--seal-ink); }
.pick-check .ico { width: 14px; height: 14px; stroke-width: 3; }
.pick .cchip { grid-area: cls; }
.pick-art { grid-area: cls; position: relative; display: block; }
.pick-thumb { width: 36px; height: 42px; border-radius: 4px; object-fit: cover; display: block; }
.pick-art .cchip { position: absolute; left: -4px; bottom: -4px; font-size: 10px; line-height: 14px; min-width: 0; padding: 0 4px; }
.pick-name { grid-area: name; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-owner { grid-area: owner; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick.own .pick-owner { color: var(--seal); font-weight: 700; }
.pick-power { grid-area: pow; font-family: var(--serif); font-weight: 900; font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 14px; }

/* ── 記錄對戰 ── */
.notice {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px;
  background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 6px; padding: 10px 12px;
}
.notice span { flex: 1 1 200px; }
.lineup-pick { display: grid; gap: 6px; }
.lu-opt {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; width: 100%; text-align: left; cursor: pointer;
  background: var(--field); border: 2px solid var(--line); border-radius: 6px; padding: 8px 10px; min-height: 46px;
}
.lu-opt.on { border-color: var(--seal); background: #f8e9dc; }
.lu-none { color: var(--muted); }
.opp-history:empty { display: none; }
.opp-history { margin-top: -6px; }
.opp-history p { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.opp-history .ico { width: 16px; height: 16px; color: var(--gold-ink); }
.stepper-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.stepper { display: grid; gap: 4px; min-width: 0; }
.step-tile {
  display: grid; justify-items: center; gap: 4px; padding: 8px 2px 6px; border-radius: 6px; cursor: pointer;
  background: var(--field); border: 2px solid var(--line); min-width: 0;
}
.stepper.has .step-tile { border-color: var(--c); background: color-mix(in srgb, var(--c) 12%, var(--field)); }
.step-tile:disabled { cursor: default; }
.step-val { font-family: var(--serif); font-weight: 900; font-size: 22px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.step-minus { height: 32px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--field); cursor: pointer; font-size: 18px; line-height: 1; padding: 0; color: var(--muted); }
.step-minus:disabled { opacity: 0.3; cursor: default; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.shot { position: relative; border-radius: 6px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line-2); min-height: 120px; display: grid; }
.shot img { width: 100%; height: 120px; object-fit: cover; }
.shot .spinner { place-self: center; }
.shot-meta { position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 6px; background: rgba(46, 32, 20, 0.82); color: var(--wood-text); font-size: 11px; }
.shot.err { border-color: var(--loss); }
.shot-x { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(46, 32, 20, 0.85); color: #fff; display: grid; place-items: center; cursor: pointer; }
.shot-x .ico { width: 16px; height: 16px; }
.shot-add {
  min-height: 120px; border-radius: 6px; border: 2px dashed var(--line-3); background: var(--field); cursor: pointer;
  display: grid; place-items: center; align-content: center; gap: 4px; color: var(--muted);
}
.shot-add:hover { border-color: var(--seal); color: var(--seal); }

/* ── 戰報明細 ── */
.detail { display: grid; gap: 14px; }
.detail-head { display: flex; gap: 12px; align-items: center; }
.detail-title { font-family: var(--serif); font-weight: 900; font-size: 20px; overflow-wrap: anywhere; }
.vs-grid { display: grid; gap: 10px; }
@media (min-width: 560px) { .vs-grid { grid-template-columns: 1fr 1fr; } }
.vs-col { display: grid; gap: 6px; align-content: start; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 12px; min-width: 0; }
.vs-col h3 { display: flex; align-items: center; gap: 6px; margin: 0; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.photo { position: relative; padding: 0; border: 1px solid var(--line-2); border-radius: 6px; overflow: hidden; cursor: zoom-in; background: var(--surface-2); }
.photo img { width: 100%; height: 220px; object-fit: cover; object-position: top; }
.photo-note { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(46, 32, 20, 0.82); color: var(--wood-text); padding: 4px 6px; }
.viewer { max-height: 72vh; overflow: auto; border-radius: 6px; background: #1c130b; }
.viewer-img { width: 100%; cursor: zoom-in; }
.viewer.zoom .viewer-img { width: auto; max-width: none; cursor: zoom-out; }
.viewer-note { margin-top: 8px; }

/* ── 分析 ── */
.insights { display: grid; gap: 12px; }
@media (min-width: 700px) { .insights { grid-template-columns: 1fr 1fr; } }
.insight { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--panel-shadow); padding: 16px 18px; min-width: 0; }
.insight h3 { display: flex; align-items: center; gap: 8px; color: var(--text); font-family: var(--serif); font-weight: 900; font-size: 16px; margin-bottom: 8px; }
.ins-dot { width: 10px; height: 10px; border-radius: 2px; transform: rotate(45deg); }
.insight-loss .ins-dot { background: var(--loss); }
.insight-win .ins-dot { background: var(--win); }
.insight ol { display: grid; gap: 6px; }
.insight li { display: flex; align-items: center; gap: 6px; min-width: 0; }
.insight li .link-btn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.rank-list { display: grid; }
.rank-row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(80px, 34%) 118px; gap: 12px; align-items: center;
  width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px dashed var(--line); padding: 10px 6px; cursor: pointer;
}
.rank-row:hover { background: rgba(154, 106, 20, 0.07); }
.rank-row:disabled { cursor: default; opacity: 0.5; }
.rank-row .wl-text { text-align: right; }
.rank-name { display: grid; gap: 2px; min-width: 0; }
.rank-name > b, .rank-name > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-name .comp-line { white-space: normal; }
.hunter-id { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.hunter-id b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) {
  .rank-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name text" "bar bar"; gap: 6px 10px; }
  .rank-row .rank-name { grid-area: name; }
  .rank-row .wl-bar { grid-area: bar; }
  .rank-row .wl-text { grid-area: text; }
}
.mini-table { display: grid; gap: 4px; }
.mini-row {
  display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap;
  padding: 8px 10px; border-radius: 6px; background: var(--surface-2); min-width: 0;
}
.mini-btn { width: 100%; text-align: left; border: 0; cursor: pointer; flex-wrap: nowrap; }
.mini-btn:hover { background: var(--surface-3); }
.mini-main { display: grid; gap: 2px; min-width: 0; flex: 1 1 auto; }
.mini-main > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart { position: relative; margin-bottom: 10px; }
.scatter { width: 100%; height: auto; display: block; }
.scatter .grid { stroke: rgba(60, 40, 15, 0.10); stroke-width: 1; }
.scatter .axis { stroke: rgba(60, 40, 15, 0.35); stroke-width: 1; }
.scatter .diag { stroke: rgba(60, 40, 15, 0.35); stroke-width: 1; stroke-dasharray: 4 4; }
.scatter .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.scatter .zone { fill: var(--muted); font-size: 12px; }
.scatter .axis-title { fill: var(--text-2); font-size: 12px; }
.scatter .dot { stroke: var(--surface); stroke-width: 2; }
.scatter .dot.on { stroke: var(--text); }
.scatter .dot-w { fill: var(--win); }
.scatter .dot-l { fill: var(--loss); }
.scatter .hit { fill: transparent; cursor: pointer; }
.scatter .hit:focus { outline: none; }
.tip {
  position: absolute; transform: translate(-50%, calc(-100% - 12px)); pointer-events: none; z-index: 3;
  background: var(--wood); color: var(--wood-text); border: 1px solid var(--wood-line); border-radius: 6px; padding: 6px 10px; font-size: 12px; white-space: nowrap;
  box-shadow: 0 6px 16px rgba(40, 25, 10, 0.35);
}

/* ── 使用教學 ── */
.help { display: grid; gap: 16px; max-width: 880px; margin: 0 auto; }
.help-hero { display: grid; gap: 10px; }
.help-hero h1 { font-size: 30px; }
.help-hero > p:first-of-type { color: var(--text-2); }
.help-sched { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 700px) { .help-sched { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.help-sched li { display: grid; gap: 2px; padding: 10px 12px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); }
.help-sched li b { font-family: var(--serif); font-weight: 900; font-size: 16px; }
.help-toc { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.help-toc a { font-size: 13px; padding: 5px 12px; border-radius: 999px; background: var(--field); border: 1px solid var(--line-2); text-decoration: none; color: var(--text-2); }
.help-toc a:hover { color: var(--text); border-color: var(--gold); }
.help-card { scroll-margin-top: 80px; }
.help-card h2 { font-size: 20px; }
.help-card h3 { color: var(--gold-ink); font-weight: 700; margin: 16px 0 8px; }
.help-emoji { display: none; }
.help-steps { display: grid; gap: 14px; }
.help-step { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; align-items: start; }
.help-num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--seal); color: var(--seal-ink); font-family: var(--serif); font-weight: 900; font-size: 15px; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--seal); }
.help-step-body { display: grid; gap: 4px; min-width: 0; }
.help-step-body p { color: var(--text-2); font-size: 14px; }
.help-tip { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; padding: 8px 10px; border-radius: 6px; background: rgba(46, 107, 51, 0.08); border: 1px solid rgba(46, 107, 51, 0.35); }
.help-tip .ico { width: 16px; height: 16px; color: var(--win); margin-top: 2px; }
.help-warn { background: var(--warn-bg); border-color: var(--warn-line); }
.help-warn .ico { color: var(--warn); }
.help-demo { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px; border-radius: 6px; background: var(--surface-2); border: 1px dashed var(--line-3); margin: 4px 0; }
.help-demo-col { display: grid; gap: 4px; margin-top: 12px; }
.help-rank { border-bottom: 0; cursor: default; padding: 4px 0; }
.help-rank:hover { background: none; }
.help-inline { display: inline-flex; align-items: center; gap: 4px; }
.help-list { display: grid; gap: 8px; padding-left: 18px; list-style: disc; color: var(--text-2); font-size: 14px; }
.help-list b { color: var(--text); }
.help-faq { display: grid; gap: 4px; margin: 0; }
.help-faq dt { font-weight: 700; margin-top: 10px; }
.help-faq dd { margin: 0; color: var(--text-2); font-size: 14px; }
.kbd { display: inline-block; padding: 0 6px; border-radius: 4px; border: 1px solid var(--line-3); border-bottom-width: 2px; background: var(--field); font-size: 12px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--text); }
.help-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; padding: 10px 12px; border-radius: 6px;
  background: #fbf1d8; border: 1px solid #b08a3e; font-size: 14px;
}
.help-banner > .ico { color: var(--gold-ink); }
.help-banner > span { flex: 1 1 220px; }

/* ── 截圖匯入 ── */
.imp-intro { display: grid; gap: 10px; }
.imp-progress { display: grid; gap: 6px; }
.imp-list { display: grid; gap: 8px; }
.imp-row { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 10px; padding: 10px; border-radius: 6px; background: var(--field); border: 1px solid var(--line); }
.imp-row.off { opacity: 0.5; }
.imp-row.pending .imp-fields { opacity: 0.6; }
.imp-thumb { padding: 0; border: 0; background: none; cursor: zoom-in; align-self: start; }
.imp-thumb img { width: 84px; border-radius: 4px; border: 1px solid var(--line-2); }
.imp-fields { display: grid; gap: 8px; min-width: 0; }
.imp-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.imp-inc { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; cursor: pointer; }
.imp-inc input { width: 18px; height: 18px; accent-color: var(--seal); }
.imp-flag { font-size: 12px; font-weight: 700; color: #6b4500; background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 4px; padding: 0 6px; }
.imp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 8px; }
@media (min-width: 760px) { .imp-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.imp-f { display: grid; gap: 2px; min-width: 0; position: relative; }
.imp-f > span:first-child { font-size: 11px; color: var(--muted); }
.imp-f .input { height: 38px; font-size: 15px; padding: 0 8px; }
.imp-f select.input { padding-right: 26px; background-position: calc(100% - 15px) 16px, calc(100% - 10px) 16px; }
.imp-f.warn-field .input { border-color: var(--warn-line); background: #fdf3da; }
.imp-power { position: absolute; right: 8px; bottom: 9px; pointer-events: none; }

/* ── 設定 ── */
.member-admin, .trash-list { display: grid; }
.madmin-row, .trash-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.madmin-row.is-hidden b { color: var(--muted); }
.trash-row > div { flex: 1 1 200px; min-width: 0; }
.meter { height: 10px; border-radius: 999px; background: rgba(154, 106, 20, 0.18); overflow: hidden; margin-bottom: 8px; }
.meter i { display: block; height: 100%; background: var(--gold); border-radius: 999px; }
.about { display: grid; gap: 6px; padding-left: 18px; list-style: disc; color: var(--text-2); }
.id-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 12px; }
.id-item { min-height: 46px; border-radius: 6px; background: var(--field); border: 1px solid var(--line-2); cursor: pointer; padding: 6px 10px; font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.id-item:hover { border-color: var(--gold); background: #fffcf4; }
.id-item.on { border-color: var(--seal); box-shadow: inset 0 0 0 1px var(--seal); }

/* ── 面板、提示、狀態 ── */
.sheet-root { position: fixed; inset: 0; z-index: 100; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(30, 20, 10, 0.55); opacity: 0; transition: opacity 0.18s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh; max-height: 92dvh;
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line-2); border-bottom: 0;
  border-radius: 10px 10px 0 0; transform: translateY(100%); transition: transform 0.2s ease; overflow: hidden;
  box-shadow: 0 -10px 30px -10px rgba(30, 20, 10, 0.45);
}
.sheet-root.open .sheet-backdrop { opacity: 1; }
.sheet-root.open .sheet { transform: translateY(0); }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 12px 10px 10px 18px; border-bottom: 1px solid var(--line-2); flex: none; background: var(--surface-2); }
.sheet-title { flex: 1 1 auto; font-family: var(--serif); font-weight: 900; font-size: 18px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body { padding: 16px 18px; overflow-y: auto; overscroll-behavior: contain; flex: 1 1 auto; -webkit-overflow-scrolling: touch; }
.sheet-foot { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 12px 18px calc(12px + var(--safe-b)); border-top: 1px solid var(--line-2); flex: none; flex-wrap: wrap; background: var(--surface-2); }
.confirm-text { white-space: pre-wrap; font-size: 15px; }
@media (min-width: 700px) {
  .sheet {
    left: 50%; right: auto; bottom: auto; top: 50%; width: min(560px, 92vw); max-height: 86vh;
    border-radius: 8px; border-bottom: 1px solid var(--line-2);
    transform: translate(-50%, -48%) scale(0.98); opacity: 0; transition: transform 0.18s ease, opacity 0.18s;
    box-shadow: 0 24px 60px -18px rgba(30, 20, 10, 0.55);
  }
  .sheet.sheet-wide { width: min(900px, 94vw); }
  .sheet-root.open .sheet { transform: translate(-50%, -50%); opacity: 1; }
  .sheet-foot { padding-bottom: 12px; }
}
#toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 18px); transform: translate(-50%, 20px);
  z-index: 300; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; width: max-content; max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 960px) { #toast { bottom: 24px; } }
.toast-inner { display: flex; gap: 8px; align-items: flex-start; background: var(--wood); color: var(--wood-text); border: 1px solid var(--wood-line); border-radius: 8px; padding: 10px 14px; box-shadow: 0 10px 28px rgba(30, 20, 10, 0.4); font-size: 14px; }
.toast-ok .ico { color: #9fd39a; }
.toast-err { border-color: #c4604f; }
.toast-err .ico { color: #ffab9c; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 32px 12px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--seal); animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 24px 12px; color: var(--muted); display: grid; gap: 12px; justify-items: center; }
.error-box { display: flex; gap: 10px; align-items: flex-start; background: rgba(155, 47, 34, 0.07); border: 1px solid rgba(155, 47, 34, 0.4); border-radius: 6px; padding: 12px; }
.error-box .ico { color: var(--danger-text); }
.error-box div { display: grid; gap: 8px; justify-items: start; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: 0.01ms !important; }
}

/* ── 拖曳截圖進來（fixed：在頁面上蓋住整個視窗；在面板裡蓋住面板，因為面板有 transform） ── */
.drop-zone.drop-on::after {
  content: attr(data-drop);
  position: fixed; inset: 12px; z-index: 500;
  display: flex; align-items: center; justify-content: center; text-align: center;
  border: 2px dashed var(--ring); border-radius: 10px;
  background: rgba(46, 32, 20, 0.86);
  color: var(--wood-text); font-family: var(--serif); font-size: 20px; font-weight: 900;
  pointer-events: none;
}

/* ── 陣型圖（4×4 菱形格子，跟遊戲一樣 1～16 號；敵方在右上） ── */
.fboard { position: relative; z-index: 0; isolation: isolate; width: 100%; max-width: 460px; margin: 0 auto; padding: 6px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); }
.fboard.compact { max-width: 380px; margin: 10px auto 4px; }
.fboard-inner { position: relative; width: 100%; aspect-ratio: 1 / 1; container-type: inline-size; }
.fcell { position: absolute; width: 25%; height: 25%; pointer-events: none; }
.fcell-hit {
  position: absolute; inset: 0; padding: 0; margin: 0; border: 0; background: none; cursor: pointer; pointer-events: auto;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); -webkit-tap-highlight-color: transparent;
}
.fcell-hit:focus-visible { outline: none; }
.fcell-shape {
  position: absolute; left: 50%; top: 50%; width: 66%; height: 66%; border-radius: 4px;
  transform: translate(-50%, -50%) rotate(45deg);
  border: 2px solid #c4a978; background: rgba(252, 248, 238, 0.75); transition: box-shadow 0.12s, border-color 0.12s;
}
.fcell.has .fcell-shape { border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, #fcf8ee); }
.fcell.own .fcell-shape { box-shadow: 0 0 0 2px var(--surface-2), 0 0 0 4px var(--seal); }
.fcell-hit:focus-visible .fcell-shape { box-shadow: 0 0 0 3px var(--gold-ink); }
.fboard.editable .fcell-hit:hover .fcell-shape { border-color: var(--seal); }
.fboard.picking .fcell:not(.has) .fcell-shape { border-style: dashed; border-color: var(--seal); background: rgba(142, 42, 30, 0.06); }
.fcell.picked .fcell-shape { box-shadow: 0 0 0 3px var(--ring), 0 0 14px 2px rgba(217, 164, 65, 0.85); }
.fcell.drop-target .fcell-shape { border-style: dashed; border-color: var(--seal); background: rgba(142, 42, 30, 0.14); }
.fcell-num {
  position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; pointer-events: none;
  font-family: var(--serif); font-weight: 900; font-size: 5.6cqw; color: #b89c68;
}
/* 角色圖放在菱形中間偏上、名字在下面；一律疊在所有格子的上面（不會被隔壁格蓋住） */
.ftoken { position: absolute; left: 50%; top: 21%; z-index: 2; width: 18cqw; margin-left: -9cqw; display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.ftoken-art {
  width: 9.5cqw; height: 9.5cqw; border-radius: 50%; flex: none;
  background-color: #2b2118; background-size: 190% auto; background-position: 50% 52%; background-repeat: no-repeat;
  box-shadow: 0 0 0 2px var(--c, var(--line-3)), 0 2px 4px rgba(40, 25, 10, 0.35);
}
.ftoken-noart { display: grid; place-items: center; background: var(--c); color: #fff; font-weight: 900; font-size: 4.6cqw; }
.ftoken-name, .ftoken-job {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.15;
  text-shadow: 0 0 2px var(--surface-2), 0 0 3px var(--surface-2), 0 0 4px var(--surface-2);
}
.ftoken-name { margin-top: 0.6cqw; font-size: max(10px, 2.9cqw); font-weight: 700; color: var(--text); }
.ftoken-job { font-size: max(9px, 2.5cqw); font-weight: 700; color: var(--c, var(--muted)); }
.fboard.compact .ftoken-job { display: none; }
.fboard.compact .ftoken { top: 24%; }
.fcell.picked .ftoken { transform: scale(1.06); }
.fboard-enemy {
  position: absolute; right: 2%; top: 3%; display: inline-flex; align-items: flex-start; gap: 2px;
  font-family: var(--serif); font-weight: 900; font-size: max(11px, 3.4cqw); color: var(--seal);
}
.fboard-arrow { width: 7cqw; height: 7cqw; stroke-width: 2.4; }
.fghost { position: fixed; z-index: 600; width: 72px; transform: translate(-50%, -40%); pointer-events: none; opacity: 0.9; container-type: inline-size; }
.fghost .ftoken { position: static; width: auto; margin: 0; }
.fghost .ftoken-art { width: 44px; height: 44px; }
.fghost .ftoken-name { font-size: 12px; }
.fghost .ftoken-job { font-size: 11px; }
.feditor.dragging, .feditor.dragging * { cursor: grabbing !important; }

.feditor-grid { display: grid; gap: 14px; }
@media (min-width: 760px) { .feditor-grid { grid-template-columns: minmax(0, 1fr) 260px; align-items: start; } }
.feditor-side { display: grid; gap: 10px; align-content: start; }
.row-start { display: flex; gap: 8px; flex-wrap: wrap; }
.ftray { display: grid; gap: 8px; padding: 10px; border-radius: 6px; background: var(--field); border: 1px dashed var(--line-3); min-height: 90px; }
.ftray.can-return { border-color: var(--seal); background: #fbf0ea; }
.ftray.drop-target { border-color: var(--seal); background: rgba(142, 42, 30, 0.08); }
.ftray-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.ftray-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.ftray-item {
  position: relative; display: grid; justify-items: center; gap: 2px; padding: 6px 4px 5px; border-radius: 6px; cursor: pointer;
  background: var(--surface); border: 2px solid var(--c, var(--line)); container-type: inline-size; min-width: 0;
}
.ftray-item .ftoken { position: static; width: auto; margin: 0; max-width: 100%; }
.ftray-item .ftoken-art { width: 40px; height: 40px; }
.ftray-item .ftoken-name { font-size: 12px; }
.ftray-item .ftoken-job { font-size: 11px; }
.ftray-item.own { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--seal); }
.ftray-item.picked { box-shadow: 0 0 0 3px var(--ring), 0 0 12px rgba(217, 164, 65, 0.8); }
.ftray-owner { font-size: 11px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flegend-own { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 2px; transform: rotate(45deg); box-shadow: 0 0 0 2px var(--seal); vertical-align: 0; }

.builder-steps { margin: 10px 0 0; }
.builder-steps .seg-btn { display: inline-flex; align-items: baseline; justify-content: center; gap: 6px; }
.step-sub { font-size: 12px; color: var(--muted); font-family: var(--font); font-weight: 700; }
.lineup-formation { margin: 4px 0; }
.lineup-formation-btn { margin: 10px 0 2px; }
