/* 《命運局限》明亮主題：沿用暗流主遊戲的色票（tailwind.config.js 的 brand） */
:root {
  --bg: #f7f3ef;
  --surface: #fffdfa;
  --card: #f3ebe7;
  --line: #ddcfc9;
  --line-soft: #ebe1dc;
  --text: #2c2427;
  --dim: #6d6064;
  --faint: #a1949a;
  --accent: #8d5266;
  --accent-soft: #f1e2e7;
  --crimson: #8b4157;
  --blue: #435e70;
  --emerald: #435f4c;
  --gold: #a07a3c;
  --danger: #b2483f;
  --shadow: 0 1px 2px rgba(60, 35, 45, .06), 0 6px 20px rgba(60, 35, 45, .07);
  --serif: "Noto Serif TC", "Songti TC", serif;
  --sans: "Noto Sans TC", -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
  --radius: 14px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); line-height: 1.7; font-size: 16px; }
a { color: var(--accent); }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
[hidden] { display: none !important; }
h1 { font-family: var(--serif); font-weight: 600; font-size: 30px; line-height: 1.45; margin: 0 0 10px; letter-spacing: .5px; }
h2 { font-family: var(--serif); font-weight: 600; font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 14px; color: var(--dim); font-weight: 500; margin: 16px 0 8px; }
.lead { color: var(--dim); }
.hint { color: var(--faint); font-size: 13px; }
small { font-size: 12px; }

/* 頂欄 */
.top { display: flex; align-items: center; justify-content: space-between; padding: 10px 20px; background: rgba(247, 243, 239, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; z-index: 10; height: 56px; }
.brand { color: var(--text); text-decoration: none; font-family: var(--serif); font-size: 20px; letter-spacing: 3px; }
.brand b { color: var(--accent); font-weight: 900; }
.brand span { color: var(--dim); margin-left: 10px; font-size: 14px; letter-spacing: 2px; }
.top nav { display: flex; gap: 8px; align-items: center; }
.nav-btn { background: var(--surface); border: 1px solid var(--line); padding: 5px 14px; border-radius: 999px; color: var(--dim); font-size: 14px; }
.nav-btn:hover { color: var(--accent); border-color: var(--accent); }
.who { color: var(--faint); font-size: 12px; }

.screen { padding: 28px 20px 80px; }
.center-box { max-width: 520px; margin: 12vh auto; text-align: center; }

/* 按鈕 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); padding: 11px 22px; border-radius: 999px; text-decoration: none; color: var(--text); font-weight: 500; min-height: 44px; transition: all .15s; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 4px 14px rgba(141, 82, 102, .28); }
.btn.primary:hover { background: var(--crimson); color: #fff; }
.btn.ghost { background: transparent; }
.btn.big { font-size: 20px; padding: 14px 64px; letter-spacing: 8px; font-family: var(--serif); }
.btn.small { min-height: 34px; padding: 5px 14px; font-size: 14px; }
.btn:disabled { opacity: .45; box-shadow: none; }
.card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: var(--shadow); }

/* 開局 */
.setup { max-width: 820px; margin: 0 auto; }
.hero { text-align: center; padding: 10px 0 24px; }
.hero h1 { font-size: 34px; }
.step { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 18px 18px 20px; margin: 14px 0; box-shadow: var(--shadow); }
.step h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; }
.step h2 span { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 14px; font-family: var(--sans); }
.step.more summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 10px; }
.step.more summary::-webkit-details-marker { display: none; }
.step.more summary h2 { margin: 0; }
.step.more[open] summary { margin-bottom: 6px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { border: 1.5px solid var(--line); background: var(--surface); padding: 9px 16px; border-radius: 12px; text-align: left; min-height: 44px; transition: all .15s; }
.opt small { display: block; color: var(--faint); font-size: 12px; line-height: 1.5; }
.opt:hover { border-color: var(--accent); }
.opt.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.opt.on small { color: var(--dim); }
.opts.cards .opt { flex: 1 1 220px; padding: 12px 16px; }
.opt .warn { color: var(--crimson); font-weight: 500; }
.lead-picker { margin-top: 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.lead-picker .opt { display: flex; gap: 10px; align-items: center; padding: 8px 10px; }
.lead-picker .opt span { line-height: 1.3; font-size: 14px; }
.resume { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; margin: 0 0 14px; border-color: var(--accent); }
.resume small { display: block; color: var(--faint); }
.row-btns { display: flex; gap: 8px; }
.start-bar { position: sticky; bottom: 0; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; padding: 16px 0 calc(16px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 35%); margin-top: 10px; }
.cf-step { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.cf-step h3 { margin: 0 0 10px; color: var(--text); font-size: 15px; }
.cf-step input[type=text] { background: var(--bg); border: 1.5px solid var(--line); color: var(--text); padding: 10px 14px; font: inherit; border-radius: 12px; width: 220px; max-width: 100%; }
.cf-step input[type=text]:focus { outline: none; border-color: var(--accent); }
.cf-parents { display: grid; grid-template-columns: 3.5em 1fr; gap: 10px 12px; align-items: start; }
.cf-parents > span { color: var(--dim); padding-top: 10px; }

/* 頭像 */
.av { width: 40px; height: 40px; border-radius: 50%; flex: none; object-fit: cover; background: var(--card); display: inline-grid; place-items: center; font-family: var(--serif); font-weight: 600; color: #fff; font-size: 16px; overflow: hidden; }
.av.lg { width: 64px; height: 64px; font-size: 24px; }
.av.xl { width: 92px; height: 92px; font-size: 34px; }
.av.sm { width: 28px; height: 28px; font-size: 12px; }

/* 遊戲版面 */
.game { display: grid; grid-template-columns: 280px minmax(0, 1fr) 340px; padding: 0; height: calc(100vh - 56px); height: calc(100dvh - 56px); }
.side { overflow-y: auto; padding: 18px 16px 40px; background: var(--surface); }
.side-me { border-right: 1px solid var(--line-soft); }
.side-right { border-left: 1px solid var(--line-soft); padding-top: 12px; }
.pane-life { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.bottom-nav { display: none; }

.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 18px; background: var(--surface); border-bottom: 1px solid var(--line-soft); }
.clock { display: flex; align-items: baseline; gap: 4px; min-width: 120px; }
.clock b { font-family: var(--serif); font-size: 34px; line-height: 1; color: var(--accent); }
.clock span { font-family: var(--serif); font-size: 16px; }
.clock small { margin-left: 8px; color: var(--faint); font-size: 13px; }
.ctl-group { display: flex; align-items: center; gap: 6px; }
.ctl { background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px; padding: 4px 12px; min-height: 38px; min-width: 40px; font-size: 14px; }
.ctl:hover { border-color: var(--accent); }
.ctl.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.ctl.play { width: 46px; font-size: 15px; background: var(--text); color: #fff; border-color: var(--text); }
.speeds { display: flex; background: var(--bg); border-radius: 999px; padding: 2px; border: 1px solid var(--line-soft); }
.speeds .ctl { border: none; min-height: 34px; min-width: 38px; padding: 2px 8px; background: transparent; }
.speeds .ctl.on { background: var(--accent); color: #fff; }
.auto { font-size: 14px; color: var(--dim); display: flex; align-items: center; gap: 6px; min-height: 38px; }
.auto input { width: 18px; height: 18px; accent-color: var(--accent); }
.progress { height: 3px; background: var(--line-soft); }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .1s linear; }
.quick { display: flex; gap: 8px; padding: 10px 18px 0; overflow-x: auto; scrollbar-width: none; }
.quick::-webkit-scrollbar { display: none; }
.quick button { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 14px; font-size: 13px; color: var(--dim); min-height: 34px; }
.quick button b { color: var(--accent); font-weight: 600; }
.quick button:hover { border-color: var(--accent); color: var(--accent); }

.log { list-style: none; margin: 0; padding: 14px 22px 100px; overflow-y: auto; flex: 1; font-family: var(--serif); font-size: 16.5px; line-height: 1.85; }
.log li { display: grid; grid-template-columns: 3.4em 1fr; gap: 12px; padding: 6px 0; animation: fadein .45s ease; }
.log li .a { color: var(--faint); font-family: var(--sans); font-size: 13px; text-align: right; padding-top: 4px; }
.log li .b { display: flex; gap: 10px; align-items: flex-start; }
.log li .b .av { margin-top: 2px; }
.log li.year-start { border-top: 1px dashed var(--line-soft); margin-top: 4px; padding-top: 12px; }
.log li.t-world .b { color: var(--blue); font-size: 15px; }
.log li.t-world .b::before { content: "世界"; font-family: var(--sans); font-size: 11px; background: #e3eaef; color: var(--blue); border-radius: 4px; padding: 1px 6px; margin-right: 2px; height: fit-content; margin-top: 5px; flex: none; }
.log li.t-lead .b, .log li.t-node .b { color: #3f3340; }
.log li.t-muli .b, .log li.t-shura .b { color: var(--crimson); font-style: italic; }
.log li.t-love .b, .log li.t-intimate .b { color: #8a4a63; }
.log li.t-family .b { color: var(--emerald); }
.log li.t-money .b { color: var(--gold); }
.log li.t-death .b { color: var(--danger); font-size: 19px; font-weight: 600; }
.log li.t-choice .b { color: var(--accent); }
.log li.t-story .b { display: block; color: var(--text); font-size: 15.5px; background: var(--surface); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 0 10px 10px 0; white-space: pre-wrap; box-shadow: var(--shadow); }
.log li.t-milestone .b, .log li.t-system .b { color: var(--faint); font-size: 14px; font-family: var(--sans); }
.log li.t-leverage .b { color: var(--gold); }
.log li.t-persona .b { display: block; background: var(--accent-soft); padding: 10px 14px; border-radius: 10px; font-size: 15px; color: #4a3a40; }
@keyframes fadein { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* 個人面板 */
.me-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.me-name { font-family: var(--serif); font-size: 22px; margin: 0; line-height: 1.3; }
.me-sub { color: var(--dim); font-size: 13px; margin: 0; line-height: 1.5; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 12px; }
.chip { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--card); color: var(--dim); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.warn { background: #f7dfdb; color: var(--danger); }
.stat { margin: 9px 0; }
.stat .k { display: flex; justify-content: space-between; font-size: 13px; color: var(--dim); }
.stat .k b { color: var(--text); font-weight: 600; }
.stat .bar { height: 7px; background: var(--card); border-radius: 99px; margin-top: 3px; overflow: hidden; }
.stat .bar div { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #b88497, var(--accent)); transition: width .5s; }
.stat.warn .bar div { background: var(--danger); }
.stat.gray .bar div { background: linear-gradient(90deg, #9a9a9a, #4b4b4b); }
.stat.gray.warn .bar div { background: var(--danger); }
.money-box { background: var(--bg); border-radius: 12px; padding: 10px 12px; margin: 14px 0; }
.money-box .big { font-family: var(--serif); font-size: 22px; color: var(--text); }
.money-box small { color: var(--faint); }
.sect { margin-top: 16px; }
.sect h3 { font-size: 12px; color: var(--faint); letter-spacing: 2px; margin: 0 0 6px; }
.sect ul { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.sect li { padding: 2px 0; color: var(--dim); }
.sect li b { color: var(--text); font-weight: 500; }
.persona-box { font-size: 13px; color: var(--dim); background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; line-height: 1.6; }

/* 右側分頁 */
.tabs { display: flex; gap: 4px; background: var(--bg); border-radius: 999px; padding: 3px; border: 1px solid var(--line-soft); margin-bottom: 12px; }
.tabs button { flex: 1; background: none; border: none; padding: 7px 8px; border-radius: 999px; color: var(--dim); font-size: 14px; min-height: 36px; }
.tabs button.on { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); font-weight: 500; }
.ap { font-size: 13px; color: var(--dim); background: var(--bg); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; }
.ap b { color: var(--accent); }
.person { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 12px; border: 1px solid var(--line-soft); background: var(--surface); margin-bottom: 8px; width: 100%; text-align: left; transition: all .15s; }
.person:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.person .info { flex: 1; min-width: 0; }
.person .nm { font-weight: 500; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.person .tt { font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aff { height: 5px; background: var(--card); border-radius: 99px; margin-top: 5px; overflow: hidden; }
.aff div { height: 100%; background: #c98aa1; border-radius: 99px; }
.empty { color: var(--faint); padding: 30px 10px; text-align: center; font-size: 14px; }

.item-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-soft); background: var(--surface); margin-bottom: 6px; }
.item-row .info { flex: 1; min-width: 0; }
.item-row .nm { font-weight: 500; font-size: 15px; }
.item-row .ds { font-size: 12px; color: var(--faint); line-height: 1.5; }
.item-row .pr { font-size: 13px; color: var(--gold); white-space: nowrap; }
.item-row .btns { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.cat-title { font-size: 12px; color: var(--faint); letter-spacing: 2px; margin: 16px 0 6px; }
.fin { display: grid; gap: 6px; }
.fin .opt { width: 100%; }
.returns { display: flex; gap: 3px; align-items: flex-end; height: 40px; margin: 8px 0; }
.returns span { flex: 1; background: var(--emerald); border-radius: 3px 3px 0 0; min-height: 2px; }
.returns span.neg { background: var(--danger); }

/* 平行人生 */
.par { border: 1px solid var(--line-soft); border-radius: 12px; padding: 12px; margin-bottom: 8px; background: var(--surface); }
.par h4 { margin: 0; font-size: 15px; font-weight: 500; }
.par h4 small { color: var(--faint); font-weight: 400; margin-left: 6px; }
.par .st { font-size: 12px; color: var(--dim); }
.par ul { list-style: none; margin: 6px 0 0; padding: 0; font-size: 13px; color: var(--dim); font-family: var(--serif); }
.par li.d { color: var(--danger); }
.par.dead { opacity: .65; }
.par.dead h4 { text-decoration: line-through; }
.par.me { border-color: var(--accent); background: var(--accent-soft); }

/* 彈出視窗 */
.modal { position: fixed; inset: 0; background: rgba(44, 36, 39, .42); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 30; padding: 16px; animation: fadein .2s; }
.modal-box { background: var(--surface); max-width: 560px; width: 100%; max-height: 90vh; max-height: 90dvh; overflow-y: auto; padding: 24px; border-radius: 20px; box-shadow: 0 20px 60px rgba(44, 36, 39, .25); }
.modal-box .head { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.modal-box .age { color: var(--faint); font-size: 13px; letter-spacing: 1px; }
.modal-box .who-name { font-family: var(--serif); font-size: 18px; font-weight: 600; }
.modal-box .q { font-family: var(--serif); font-size: 19px; margin: 6px 0 18px; line-height: 1.85; white-space: pre-wrap; }
.modal-box .choices { display: flex; flex-direction: column; gap: 8px; }
.modal-box .choices button { text-align: left; background: var(--bg); border: 1.5px solid var(--line); padding: 12px 16px; border-radius: 14px; min-height: 52px; font-size: 16px; transition: all .12s; }
.modal-box .choices button:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.modal-box .choices button small { display: block; color: var(--faint); }
.modal-box .choices button:disabled { opacity: .5; }
.modal-box textarea { width: 100%; min-height: 96px; background: var(--bg); color: var(--text); border: 1.5px solid var(--line); padding: 10px 12px; font: inherit; font-family: var(--serif); border-radius: 12px; resize: vertical; }
.modal-box textarea:focus { outline: none; border-color: var(--accent); }
.modal-box .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.modal-box .scene { font-family: var(--serif); font-size: 16.5px; line-height: 2; color: #4a3640; white-space: pre-wrap; background: #faf3f5; border-radius: 14px; padding: 16px 18px; }
.modal-box .tag { display: inline-block; font-size: 12px; padding: 1px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); margin-bottom: 6px; }
.modal-box .tag.ai { background: #e3eaef; color: var(--blue); }
.milestone-box .q { font-size: 21px; }
.ms-or { text-align: center; color: var(--faint); font-size: 13px; margin: 14px 0 8px; }
.ms-note { font-size: 12px; color: var(--faint); margin-top: 4px; }
.alloc-row { display: grid; grid-template-columns: 1fr auto 2.2em auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.alloc-row.off { opacity: .4; }
.alloc-row .n { text-align: center; font-family: var(--serif); font-size: 20px; color: var(--accent); }
.alloc-row small { display: block; color: var(--faint); font-size: 12px; }
.alloc-row .ctl { min-width: 42px; font-size: 18px; }
.actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.actions-grid button { text-align: left; background: var(--bg); border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 12px; min-height: 58px; }
.actions-grid button b { display: block; font-weight: 500; }
.actions-grid button small { color: var(--faint); line-height: 1.4; display: block; }
.actions-grid button:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.actions-grid button:disabled { opacity: .45; }
.actions-grid button.risky b { color: var(--crimson); }
.writing { color: var(--faint); font-style: italic; }
.writing::after { content: "…"; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* 終局卷宗 */
.dossier-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; max-width: 1100px; margin: 0 auto; }
.dossier { background: #fbf6ea; color: #2a241c; padding: 36px 40px; font-family: var(--serif); border-radius: 6px; position: relative; box-shadow: var(--shadow); border: 1px solid #e8dcc4; }
.dossier .stamp { position: absolute; top: 24px; right: 26px; border: 2px solid #9b2c22; color: #9b2c22; padding: 2px 12px; transform: rotate(6deg); font-size: 14px; letter-spacing: 3px; }
.dossier h2 { color: #7a6f5c; font-size: 13px; letter-spacing: 4px; margin: 0 0 4px; font-weight: 400; }
.dossier h1 { font-size: 32px; margin: 0 0 4px; }
.dossier .meta { color: #7a6f5c; font-size: 14px; margin-bottom: 18px; }
.dossier .body { white-space: pre-wrap; line-height: 2.05; font-size: 16.5px; }
.dossier .tags { margin-top: 18px; }
.dossier .tags span { display: inline-block; border: 1.5px solid #2a241c; padding: 2px 12px; margin: 0 6px 6px 0; font-size: 14px; }
.dossier .words { margin-top: 20px; border-top: 1px dashed #c9bda3; padding-top: 14px; }
.dossier .words p { margin: 6px 0; }
.dossier .words small { color: #7a6f5c; }
.end-side .box { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.end-side textarea { width: 100%; min-height: 90px; background: var(--bg); color: var(--text); border: 1.5px solid var(--line); padding: 10px; font: inherit; border-radius: 12px; }
.end-side label { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0; font-size: 14px; }
.end-side label input { width: 18px; height: 18px; accent-color: var(--accent); margin-top: 3px; }
.end-side ul { padding-left: 18px; margin: 0; }

/* 檔案局 */
.archive { max-width: 1000px; margin: 0 auto; }
.archive-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.archive-head h1 { margin: 0; }
.archive .tabs { max-width: 460px; }
.archive-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.a-card { background: #fbf6ea; border: 1px solid #e8dcc4; padding: 18px; border-radius: 8px; box-shadow: var(--shadow); }
.a-card h4 { font-family: var(--serif); font-size: 19px; margin: 0; font-weight: 600; }
.a-card .meta { color: #7a6f5c; font-size: 12px; }
.a-card .tags { margin: 8px 0; font-size: 13px; color: var(--accent); }
.a-card .excerpt { font-family: var(--serif); font-size: 14px; color: #4b4336; max-height: 8em; overflow: hidden; line-height: 1.75; }
.a-card .words { font-family: var(--serif); font-size: 14px; margin-top: 8px; }
.a-card .offer { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.a-card .offer button { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; font-size: 12px; padding: 4px 10px; color: var(--dim); min-height: 30px; }
.a-card .offer button:hover, .a-card .offer button.done { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.a-card .admin { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; align-items: center; }
.a-card .admin button { background: var(--surface); border: 1px solid var(--line); padding: 3px 10px; border-radius: 999px; }
.a-card.hidden-card { opacity: .5; }
.a-card .flag { color: var(--danger); font-size: 12px; }

.help { line-height: 1.9; }
.help h2 { margin-top: 26px; }
.help ul { padding-left: 20px; }

.toast { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 20px; border-radius: 999px; z-index: 40; font-size: 14px; max-width: 90vw; box-shadow: 0 8px 24px rgba(0,0,0,.2); }

/* 平板 */
@media (max-width: 1180px) {
  .game { grid-template-columns: 250px minmax(0, 1fr) 300px; }
}
/* 手機與小平板：單欄＋底部分頁 */
@media (max-width: 900px) {
  .top { padding: 8px 14px; height: 52px; }
  .brand span { display: none; }
  .who { display: none; }
  .screen { padding: 18px 14px 80px; }
  .game { display: block; height: auto; padding: 0; }
  .game .side, .game .pane-life { display: none; }
  .game.m-life .pane-life { display: flex; height: calc(100dvh - 52px - 64px - env(safe-area-inset-bottom)); }
  .game.m-me .side-me, .game.m-people .side-right, .game.m-items .side-right, .game.m-others .side-right { display: block; border: none; min-height: calc(100dvh - 52px - 64px); padding-bottom: 100px; }
  .game.m-people .tabs#right-tabs, .game.m-items .tabs#right-tabs, .game.m-others .tabs#right-tabs { display: none; }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: rgba(255, 253, 250, .97); backdrop-filter: blur(8px); border-top: 1px solid var(--line-soft); padding: 4px 4px env(safe-area-inset-bottom); }
  .bottom-nav button { flex: 1; background: none; border: none; display: flex; flex-direction: column; align-items: center; font-size: 11px; color: var(--faint); padding: 6px 0; min-height: 56px; }
  .bottom-nav button i { font-style: normal; font-size: 18px; line-height: 1.3; }
  .bottom-nav button.on { color: var(--accent); }
  .controls { padding: 8px 12px; gap: 8px; }
  .clock { min-width: auto; }
  .clock b { font-size: 28px; }
  .ctl-group:nth-of-type(3) { width: 100%; justify-content: space-between; }
  .log { padding: 10px 14px 40px; font-size: 16px; }
  .log li { grid-template-columns: 2.8em 1fr; gap: 8px; }
  .quick { padding: 8px 12px 0; }
  .dossier-wrap { grid-template-columns: 1fr; }
  .dossier { padding: 28px 20px; }
  h1, .hero h1 { font-size: 25px; }
  .btn.big { width: 100%; }
  .modal { align-items: flex-end; padding: 0; }
  .modal-box { border-radius: 20px 20px 0 0; max-height: 88dvh; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); }
  .toast { bottom: 84px; }
}

/* 第三版：人生階段、財務、行動、回顧 */
.stage-chip { margin-left: 8px; font-size: 12px !important; background: var(--accent-soft); color: var(--accent) !important; padding: 1px 9px; border-radius: 999px; }
.pos { color: var(--emerald); }
.neg { color: var(--danger); }
.log li.t-delta .b { font-family: var(--sans); font-size: 12.5px; color: var(--dim); }
.log li.t-delta .b span { background: var(--card); border-radius: 999px; padding: 1px 10px; }
.log li.t-action .b { color: #5b4a62; }
.fin-sum { background: var(--bg); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; }
.fin-sum .nw small { color: var(--faint); display: block; }
.fin-sum .nw b { font-family: var(--serif); font-size: 26px; }
.grid4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 12px; margin-top: 8px; font-size: 14px; }
.grid4 small { display: block; color: var(--faint); }
.ledger { list-style: none; padding: 0; margin: 0 0 6px; font-size: 13.5px; }
.ledger li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px dashed var(--line-soft); }
.ledger li span { color: var(--dim); }
.amts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chipbtn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; font-size: 12px; padding: 3px 10px; min-height: 30px; color: var(--emerald); }
.chipbtn.out { color: var(--blue); }
.chipbtn:hover { border-color: var(--accent); }
.fin-row .info { width: 100%; }
.review { width: 100%; border-collapse: collapse; font-size: 14px; }
.review th { color: var(--faint); font-weight: 400; text-align: right; padding: 4px 6px; }
.review td { padding: 5px 6px; border-bottom: 1px solid var(--line-soft); text-align: right; }
.review td:first-child, .review th:first-child { text-align: left; color: var(--dim); }
.archive-stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 14px; }
.archive-stats .st { background: var(--surface); border: 1px solid var(--line-soft); border-radius: 12px; padding: 10px 14px; font-size: 13px; box-shadow: var(--shadow); flex: 1 1 200px; }
.archive-stats .st b { display: block; font-family: var(--serif); font-size: 15px; margin-bottom: 4px; color: var(--accent); }
.archive-stats ol { margin: 0; padding-left: 18px; color: var(--dim); }

/* 人物卡：調查資料、攻擊區 */
.intel { background: var(--bg); border-radius: 12px; padding: 10px 14px; margin: 8px 0; font-size: 13.5px; }
.intel ul { margin: 4px 0 0; padding-left: 18px; color: var(--dim); }
.intel li.weak { color: var(--crimson); }
.cat-title.danger-title { color: var(--danger); }
.person.gone { opacity: .5; }

/* 第五版：勢力、對話、成就 */
.reps li { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: center; }
.reps li small { grid-column: 1 / -1; color: var(--faint); }
.repbar { position: relative; height: 6px; background: var(--card); border-radius: 99px; overflow: hidden; }
.repbar::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--line); }
.repbar span { position: absolute; top: 0; bottom: 0; background: var(--emerald); border-radius: 99px; }
.chat { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; margin: 6px 0; }
.chat .msg { max-width: 80%; padding: 7px 12px; border-radius: 14px; font-size: 14.5px; line-height: 1.6; }
.chat .msg.me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.chat .msg.them { align-self: flex-start; background: var(--card); border-bottom-left-radius: 4px; font-family: var(--serif); }
.chat-input { display: flex; gap: 6px; }
.chat-input input { flex: 1; min-width: 0; border: 1.5px solid var(--line); border-radius: 999px; padding: 8px 14px; font: inherit; background: var(--bg); }
.chat-input input:focus { outline: none; border-color: var(--accent); }
.a-card.ach.locked { opacity: .55; filter: grayscale(.6); }
