/* 關西 9 人行｜阪急マルーン
   版面：栗色頂欄＋黃銅細線，內容區淺色、區塊用「座椅綠」（--h2）交替；手機優先，底部 5 個分頁。
   顏色全部由 --h（主色相）、--h2（區塊色相）、--c（彩度倍數）在 OKLCH 算出，三個數字可以漸變，換配色時整個畫面一起「調色」。
   形狀：圓角兩種（6px 小元件、14px 卡片與面板）；陰影只有一種，給浮起來的面板與按鈕。 */

@property --h { syntax: '<number>'; inherits: true; initial-value: 22; }
@property --h2 { syntax: '<number>'; inherits: true; initial-value: 112; }
@property --c { syntax: '<number>'; inherits: true; initial-value: 1; }

:root {
  --h: 22; --h2: 112; --c: 1;
  --gold-h: 85;
  /* 淺色 */
  --bg: oklch(0.945 calc(0.008 * var(--c)) var(--h));
  --sf: oklch(0.995 calc(0.003 * var(--c)) var(--h));
  --sf2: oklch(0.968 calc(0.007 * var(--c)) var(--h));
  --ink: oklch(0.255 calc(0.03 * var(--c)) var(--h));
  --mu: oklch(0.47 calc(0.025 * var(--c)) var(--h));
  --line: oklch(0.86 calc(0.015 * var(--c)) var(--h));
  --acc: oklch(0.385 calc(0.11 * var(--c)) var(--h));
  --acc-soft: oklch(0.93 calc(0.03 * var(--c)) var(--h));
  --on-acc: oklch(0.95 0.035 var(--gold-h));
  --hd-bg: oklch(0.3 calc(0.09 * var(--c)) var(--h));
  --hd-bg-solid: var(--hd-bg);
  --hd-ink: oklch(0.86 calc(0.08 * max(var(--c), 0.45)) var(--gold-h));
  --hd-mu: oklch(0.78 calc(0.04 * var(--c)) var(--h));
  --hd-field: oklch(0.36 calc(0.085 * var(--c)) var(--h));
  --brass: oklch(0.68 calc(0.1 * max(var(--c), 0.4)) 80);
  --blk: oklch(0.905 calc(0.045 * max(var(--c), 0.4)) var(--h2));
  --blk-ink: oklch(0.3 calc(0.05 * max(var(--c), 0.4)) var(--h2));
  --blk-mu: oklch(0.42 calc(0.04 * max(var(--c), 0.4)) var(--h2));
  --mark: oklch(0.9 0.09 95);
  --good: oklch(0.5 0.11 150);
  --warn: oklch(0.5 0.12 65);
  --warn-bg: oklch(0.93 0.06 85);
  --bad: oklch(0.5 0.16 28);
  --next-bg: oklch(0.17 0.01 60);
  --next-ink: oklch(0.8 0.15 75);
  --map-land: oklch(0.958 0.006 85);
  --map-water: oklch(0.86 0.035 225);
  --map-road: oklch(1 0 0);
  --map-road2: oklch(0.975 0.003 var(--h));
  --map-rail: oklch(0.42 calc(0.09 * var(--c)) var(--h));
  --shadow: 0 6px 24px oklch(0.2 0.03 var(--h) / 0.18);
  --r1: 6px; --r2: 14px;
  --serif: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  --sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  color-scheme: light;
  transition: --h 0.9s cubic-bezier(0.45, 0, 0.2, 1), --h2 0.9s cubic-bezier(0.45, 0, 0.2, 1), --c 0.9s cubic-bezier(0.45, 0, 0.2, 1);
}
:root.no-theme-anim { transition: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: oklch(0.175 calc(0.014 * var(--c)) var(--h));
    --sf: oklch(0.225 calc(0.018 * var(--c)) var(--h));
    --sf2: oklch(0.2 calc(0.016 * var(--c)) var(--h));
    --ink: oklch(0.92 calc(0.015 * var(--c)) var(--h));
    --mu: oklch(0.72 calc(0.02 * var(--c)) var(--h));
    --line: oklch(0.32 calc(0.02 * var(--c)) var(--h));
    --acc: oklch(0.83 0.09 var(--gold-h));
    --acc-soft: oklch(0.3 0.04 var(--gold-h));
    --on-acc: oklch(0.24 0.04 var(--gold-h));
    --hd-bg: oklch(0.235 calc(0.065 * var(--c)) var(--h));
    --hd-field: oklch(0.29 calc(0.06 * var(--c)) var(--h));
    --blk: oklch(0.255 calc(0.03 * max(var(--c), 0.4)) var(--h2));
    --blk-ink: oklch(0.9 calc(0.035 * max(var(--c), 0.4)) var(--h2));
    --blk-mu: oklch(0.74 calc(0.03 * max(var(--c), 0.4)) var(--h2));
    --mark: oklch(0.45 0.08 95);
    --good: oklch(0.76 0.11 150);
    --warn: oklch(0.82 0.11 80);
    --warn-bg: oklch(0.33 0.05 80);
    --bad: oklch(0.74 0.13 28);
    --map-land: oklch(0.2 calc(0.012 * var(--c)) var(--h));
    --map-water: oklch(0.32 0.04 235);
    --map-road: oklch(0.3 0.01 var(--h));
    --map-road2: oklch(0.25 0.01 var(--h));
    --map-rail: oklch(0.65 calc(0.08 * var(--c)) var(--h));
    --shadow: 0 6px 24px oklch(0 0 0 / 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: oklch(0.175 calc(0.014 * var(--c)) var(--h));
  --sf: oklch(0.225 calc(0.018 * var(--c)) var(--h));
  --sf2: oklch(0.2 calc(0.016 * var(--c)) var(--h));
  --ink: oklch(0.92 calc(0.015 * var(--c)) var(--h));
  --mu: oklch(0.72 calc(0.02 * var(--c)) var(--h));
  --line: oklch(0.32 calc(0.02 * var(--c)) var(--h));
  --acc: oklch(0.83 0.09 var(--gold-h));
  --acc-soft: oklch(0.3 0.04 var(--gold-h));
  --on-acc: oklch(0.24 0.04 var(--gold-h));
  --hd-bg: oklch(0.235 calc(0.065 * var(--c)) var(--h));
  --hd-field: oklch(0.29 calc(0.06 * var(--c)) var(--h));
  --blk: oklch(0.255 calc(0.03 * max(var(--c), 0.4)) var(--h2));
  --blk-ink: oklch(0.9 calc(0.035 * max(var(--c), 0.4)) var(--h2));
  --blk-mu: oklch(0.74 calc(0.03 * max(var(--c), 0.4)) var(--h2));
  --mark: oklch(0.45 0.08 95);
  --good: oklch(0.76 0.11 150);
  --warn: oklch(0.82 0.11 80);
  --warn-bg: oklch(0.33 0.05 80);
  --bad: oklch(0.74 0.13 28);
  --map-land: oklch(0.2 calc(0.012 * var(--c)) var(--h));
  --map-water: oklch(0.32 0.04 235);
  --map-road: oklch(0.3 0.01 var(--h));
  --map-road2: oklch(0.25 0.01 var(--h));
  --map-rail: oklch(0.65 calc(0.08 * var(--c)) var(--h));
  --shadow: 0 6px 24px oklch(0 0 0 / 0.5);
  color-scheme: dark;
}
@media (prefers-reduced-motion: reduce) { :root { transition: none; } }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body {
  font-family: var(--sans); font-size: 16px; line-height: 1.75; -webkit-text-size-adjust: 100%;
  line-break: strict; text-autospace: normal; overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--acc); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; line-height: 1.4; text-wrap: balance; letter-spacing: -0.01em; }
h2 { font-size: 21px; }
h3 { font-size: 18px; }
.num { font-variant-numeric: tabular-nums; }
.mu { color: var(--mu); }
.small { font-size: 14px; }
.tiny { font-size: 13px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ───────── 外框 ───────── */
.app { display: flex; flex-direction: column; height: 100%; max-width: 560px; margin: 0 auto; position: relative; background: var(--bg); }
.hd {
  background: var(--hd-bg); color: var(--hd-ink); padding: calc(10px + env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 12px max(14px, env(safe-area-inset-left));
  display: grid; gap: 10px; box-shadow: inset 0 -3px 0 var(--brass); position: relative; z-index: 5;
}
.hd-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.brand { font-family: var(--serif); font-size: 19px; font-weight: 600; letter-spacing: 0.04em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd-btn { min-width: 44px; height: 44px; display: inline-grid; place-items: center; border: 0; background: transparent; color: inherit; border-radius: var(--r1); cursor: pointer; padding: 0 4px; }
.hd-btn:active { background: var(--hd-field); }
.sync { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--hd-mu); }
.sync i { width: 8px; height: 8px; border-radius: 50%; background: oklch(0.75 0.13 150); }
.sync.pending i { background: oklch(0.78 0.14 70); }
.sync.sending i { animation: blink 0.9s infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.srch { display: flex; align-items: center; gap: 8px; background: var(--hd-field); color: var(--hd-ink); border-radius: var(--r1); padding: 0 6px 0 12px; min-height: 44px; }
.srch input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 16px; outline: none; color: var(--hd-ink); }
.srch:focus-within { box-shadow: 0 0 0 2px var(--hd-ink); }

.main { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 24px; }
.offline { background: var(--warn-bg); color: var(--warn); font-size: 14px; padding: 6px 16px; }

.tabs { display: grid; grid-template-columns: repeat(5, 1fr); background: var(--hd-bg); color: var(--hd-ink); padding: 4px max(4px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left)); box-shadow: inset 0 3px 0 var(--brass); z-index: 5; }
.tab { border: 0; background: transparent; color: inherit; font-size: 12.5px; display: grid; justify-items: center; gap: 1px; min-height: 54px; padding-top: 8px; cursor: pointer; opacity: 0.6; }
.tab svg { width: 23px; height: 23px; }
.tab[aria-selected="true"] { opacity: 1; font-weight: 700; }
.tab[aria-selected="true"] svg { stroke-width: 2.2; }

/* ───────── 區塊 ───────── */
.blk { padding: 22px max(16px, env(safe-area-inset-right)) 22px max(16px, env(safe-area-inset-left)); display: grid; gap: 12px; }
.blk.alt { background: var(--blk); color: var(--blk-ink); }
.blk.alt .mu { color: var(--blk-mu); }
.blk.tight { padding-top: 14px; padding-bottom: 14px; }
.row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 10px; }

.card { background: var(--sf); color: var(--ink); border-radius: var(--r2); padding: 14px 16px; display: grid; gap: 8px; }
.card .mu { color: var(--mu); }
button.card { border: 0; text-align: left; cursor: pointer; width: 100%; }
button.card:active { transform: scale(0.99); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px; border-radius: var(--r1); border: 1.5px solid var(--acc); background: var(--acc); color: var(--on-acc); font-size: 15px; font-weight: 700; cursor: pointer; text-decoration: none; transition: transform 100ms ease-out; }
.btn:active { transform: scale(0.97); }
.btn.line { background: transparent; color: var(--acc); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--acc); padding: 0 10px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.hd :focus-visible, .tabs :focus-visible { outline-color: var(--hd-ink); }

.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * max(16px, env(safe-area-inset-left))); padding: 2px max(16px, env(safe-area-inset-left)); }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 40px; padding: 0 14px; border-radius: var(--r1); border: 1.5px solid var(--line); background: var(--sf); color: var(--ink); font-size: 14.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { border-color: var(--acc); background: var(--acc); color: var(--on-acc); font-weight: 700; }

.tags { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 14px; color: var(--mu); }
.tag-small { color: var(--good); font-weight: 700; }
.tag-lock { color: var(--bad); font-weight: 700; }
.stale { display: inline-block; background: var(--warn-bg); color: var(--warn); font-weight: 700; font-size: 13px; padding: 0 6px; border-radius: 3px; }

/* 「次は」：車廂裡的下一站看板 */
.next { background: var(--next-bg); color: var(--next-ink); border-radius: var(--r1); padding: 10px 14px 12px; display: grid; gap: 0; }
.next small { color: oklch(0.78 0.02 80); font-size: 13px; }
.next b { font-size: 18px; font-weight: 700; letter-spacing: 0.02em; }

.big { font-family: var(--serif); font-size: 52px; font-weight: 600; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

/* 景點卡 */
.place { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
.place .nm { font-family: var(--serif); font-size: 18px; font-weight: 600; line-height: 1.45; }
.place .ja { font-size: 14px; color: var(--mu); }
.place .by { grid-row: 1 / 3; grid-column: 2; align-self: start; }
.place .tags, .place .votes { grid-column: 1 / -1; }
.votes { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.vote { min-height: 40px; padding: 0 14px; border-radius: var(--r1); border: 1.5px solid var(--line); background: transparent; color: var(--ink); font-size: 14.5px; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; transition: transform 100ms ease-out; }
.vote:active { transform: scale(0.95); }
.vote b { font-variant-numeric: tabular-nums; }
.vote[aria-pressed="true"] { background: var(--acc); border-color: var(--acc); color: var(--on-acc); }
.faces { display: flex; margin-left: auto; }
.faces .avatar { margin-left: -7px; border-radius: 50%; box-shadow: 0 0 0 2px var(--sf); }

/* 交通卡 */
.route { display: grid; gap: 6px; }
.route .top { display: flex; gap: 12px; align-items: flex-start; }
.route .mode { font-weight: 700; }
.route .tot { margin-left: auto; text-align: right; line-height: 1.35; }
.route .tot b { font-family: var(--serif); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.route .meta { font-size: 14px; color: var(--mu); display: flex; flex-wrap: wrap; gap: 0 14px; }
.yen::after { content: " 円"; font-size: 0.6em; font-family: var(--sans); }

/* 表格 */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th, .tbl td { padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-weight: 500; color: var(--mu); font-size: 13.5px; }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr.on td { color: var(--acc); font-weight: 700; }
.tbl tr.best td:first-child::after { content: "（最省）"; font-size: 13px; color: var(--good); font-weight: 400; }

/* 表單 */
.fld { display: grid; gap: 6px; font-size: 15px; }
.fld > span { color: var(--mu); font-size: 14px; }
.fld input, .fld select, .fld textarea, .inp {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: var(--r1); border: 1.5px solid var(--line); background: var(--sf); color: var(--ink); font-size: 16px;
}
.fld textarea { min-height: 84px; resize: vertical; }
.fld input:focus, .fld select:focus, .fld textarea:focus, .inp:focus { outline: none; border-color: var(--acc); }
.hint { font-size: 14px; color: var(--mu); }
.err { color: var(--bad); font-size: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; }
.check input { width: 22px; height: 22px; accent-color: var(--acc); }

.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; border-bottom: 1px solid var(--line); }
.blk.alt .set-row { border-bottom-color: color-mix(in oklch, var(--blk-ink) 15%, transparent); }
.set-row:last-child { border-bottom: 0; }
.set-row .lb { display: grid; line-height: 1.45; }
.set-row .lb small { color: var(--mu); font-size: 13px; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { width: 44px; height: 44px; border-radius: var(--r1); border: 1.5px solid var(--line); background: var(--sf); font-size: 20px; cursor: pointer; }
.stepper output { min-width: 3ch; text-align: center; font-family: var(--serif); font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sel { min-height: 44px; padding: 0 10px; border-radius: var(--r1); border: 1.5px solid var(--line); background: var(--sf); color: var(--ink); font-size: 15px; max-width: 58%; }
.warnline { display: flex; gap: 8px; font-size: 15px; line-height: 1.6; }
.warnline.critical { color: var(--bad); font-weight: 700; }
.warnline.warn { color: var(--warn); }

/* 面板（從下面拉上來） */
.scrim { position: fixed; inset: 0; background: oklch(0.15 0.02 var(--h) / 0.45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; animation: fade 180ms ease-out; }
.sheet {
  width: 100%; max-width: 560px; max-height: 90%; overflow-y: auto; background: var(--bg); color: var(--ink);
  border-radius: var(--r2) var(--r2) 0 0; box-shadow: var(--shadow); position: relative;
  padding-bottom: env(safe-area-inset-bottom); animation: up 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
  border-top: 3px solid var(--brass);
}
.sheet.full { max-height: 100%; height: 100%; border-radius: 0; border-top: 0; }
.sheet-hd { position: sticky; top: 0; z-index: 2; background: var(--hd-bg); color: var(--hd-ink); display: flex; align-items: center; gap: 8px; padding: 10px max(10px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left)); min-height: 56px; }
.sheet.full .sheet-hd { padding-top: calc(10px + env(safe-area-inset-top)); box-shadow: inset 0 -3px 0 var(--brass); }
.sheet-hd h2 { font-size: 19px; flex: 1; min-width: 0; }
.closing .scrim, .scrim.closing { animation: fade 160ms ease-in reverse forwards; }
.scrim.closing .sheet { animation: down 180ms ease-in forwards; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes down { to { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet, .scrim { animation: none !important; } }

.toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: var(--r1); font-size: 15px; z-index: 60; max-width: calc(100% - 32px); box-shadow: var(--shadow); animation: up 200ms ease-out; }
.fab { position: absolute; right: max(16px, env(safe-area-inset-right)); bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 6; box-shadow: var(--shadow); border-radius: var(--r1); }

/* 留言 */
.cmt { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; }
.cmt .who { font-weight: 700; font-size: 14px; }
.cmt .t { color: var(--mu); font-size: 13px; margin-left: 6px; font-weight: 400; }
.cmt p { margin: 0; grid-column: 2; white-space: pre-wrap; overflow-wrap: anywhere; }

/* 百科 */
.wiki h3 { font-size: 19px; }
.wiki p { margin: 0; font-size: 16.5px; line-height: 1.9; white-space: pre-line; }
.wiki .src { font-size: 13.5px; color: var(--mu); overflow-wrap: anywhere; }

/* 地圖 */
.mapview { position: absolute !important; inset: 0; }
.mapchips { position: absolute; top: 10px; left: 0; right: 0; z-index: 3; }
.mapchips .chip { box-shadow: 0 1px 4px oklch(0 0 0 / 0.2); }
.pickbar { position: absolute; left: 12px; right: 12px; bottom: 16px; z-index: 4; background: var(--hd-bg); color: var(--hd-ink); padding: 12px 14px; border-radius: var(--r2); display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow); }
.maplibregl-ctrl-attrib { font-size: 11px; }
.maplibregl-ctrl-bottom-right { bottom: 8px; }
.mk { border: 0; padding: 0; background: transparent; cursor: pointer; position: relative; display: grid; place-items: center; }
.pin { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); display: grid; place-items: center; box-shadow: 0 0 0 2px var(--map-land), 0 2px 5px oklch(0 0 0 / 0.3); }
.pin span { transform: rotate(45deg); color: #fff; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mk-small .pin { width: 15px; height: 15px; border-radius: 50%; transform: none; }
.mk.s-planned .pin { box-shadow: 0 0 0 2px var(--map-land), 0 0 0 4px var(--ink); }
.mk.s-backup .pin { opacity: 0.75; outline: 2px dashed var(--ink); outline-offset: 2px; }
.mk.s-drop { opacity: 0.35; }
.mk-stay { background: var(--hd-bg); color: var(--hd-ink); font-size: 12.5px; font-weight: 700; padding: 4px 8px; border-radius: var(--r1); white-space: nowrap; box-shadow: 0 0 0 2px var(--brass); }
.mk-name { position: absolute; left: 100%; top: 50%; transform: translateY(-50%); margin-left: 6px; white-space: nowrap; font-size: 13px; font-weight: 700; color: var(--ink); text-shadow: 0 0 3px var(--map-land), 0 0 3px var(--map-land), 0 0 3px var(--map-land); pointer-events: none; }
.hide-names .mk-name { display: none; }

/* 進場畫面（通關碼、我是誰） */
.gate { min-height: 100%; display: grid; align-content: start; }
.gate-hd { background: var(--hd-bg); color: var(--hd-ink); padding: calc(56px + env(safe-area-inset-top)) 24px 32px; box-shadow: inset 0 -3px 0 var(--brass); display: grid; gap: 8px; }
.gate-hd h1 { font-size: 30px; letter-spacing: 0.06em; }
.gate-hd p { margin: 0; color: var(--hd-mu); }
.who-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.who-btn { border: 1.5px solid var(--line); background: var(--sf); border-radius: var(--r2); padding: 14px 6px 10px; display: grid; justify-items: center; gap: 6px; cursor: pointer; font-size: 15px; }
.who-btn[aria-pressed="true"] { border-color: var(--acc); box-shadow: 0 0 0 1.5px var(--acc); }

/* 角色設定 */
.av-stage { background: var(--hd-bg); color: var(--hd-ink); display: grid; justify-items: center; gap: 6px; padding: 18px 16px 20px; box-shadow: inset 0 -3px 0 var(--brass); }
.av-stage .avatar { filter: drop-shadow(0 4px 10px oklch(0 0 0 / 0.25)); }
.av-stage .nm { font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: 0.04em; min-height: 1.4em; }
.av-tabs { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); background: var(--sf); position: sticky; top: 56px; z-index: 1; }
.av-tab { border: 0; background: transparent; min-height: 48px; font-size: 14.5px; color: var(--mu); cursor: pointer; box-shadow: inset 0 -2px 0 transparent; }
.av-tab[aria-selected="true"] { color: var(--acc); font-weight: 700; box-shadow: inset 0 -3px 0 var(--acc); }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 10px; }
.opt { border: 1.5px solid var(--line); background: var(--sf); border-radius: var(--r2); padding: 8px 4px 6px; display: grid; justify-items: center; gap: 2px; cursor: pointer; font-size: 14px; transition: transform 100ms ease-out; }
.opt:active { transform: scale(0.96); }
.opt[aria-pressed="true"] { border-color: var(--acc); box-shadow: 0 0 0 1.5px var(--acc); font-weight: 700; color: var(--acc); }
.swatch { width: 40px; height: 40px; border-radius: 50%; }
.taken { font-size: 12px; color: var(--mu); }

/* 配色選擇 */
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-opt { border: 1.5px solid var(--line); background: var(--sf); border-radius: var(--r2); padding: 0 0 8px; overflow: hidden; cursor: pointer; display: grid; gap: 6px; text-align: center; font-size: 14.5px; }
.theme-opt .sw { height: 44px; display: grid; grid-template-rows: 1fr 6px 14px; }
.theme-opt[aria-pressed="true"] { border-color: var(--acc); box-shadow: 0 0 0 1.5px var(--acc); font-weight: 700; }
.hue { width: 100%; height: 44px; -webkit-appearance: none; appearance: none; background: transparent; }
.hue::-webkit-slider-runnable-track { height: 14px; border-radius: 7px; background: linear-gradient(90deg in oklch longer hue, oklch(0.3 0.09 0), oklch(0.3 0.09 359)); }
.hue::-moz-range-track { height: 14px; border-radius: 7px; background: linear-gradient(90deg in oklch longer hue, oklch(0.3 0.09 0), oklch(0.3 0.09 359)); }
.hue::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; margin-top: -8px; border-radius: 50%; background: var(--hd-ink); border: 3px solid var(--hd-bg); box-shadow: var(--shadow); }
.hue::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: var(--hd-ink); border: 3px solid var(--hd-bg); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1.5px solid var(--line); border-radius: var(--r1); overflow: hidden; }
.seg button { border: 0; min-height: 44px; background: var(--sf); cursor: pointer; font-size: 15px; }
.seg button + button { border-left: 1.5px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--acc); color: var(--on-acc); font-weight: 700; }

.empty { text-align: center; color: var(--mu); padding: 28px 12px; line-height: 1.9; }
.loading { display: grid; place-items: center; height: 100%; color: var(--mu); }
