/* 異聞（tianxia/features/yiwen）：第 248 批照企劃者挑的乙版「頁邊朱批」（docs/superpowers/specs/2026-11-21-異聞-畫面/card-b.html 的數值搬過來）。
   一幕畫成一頁書：左直條第幾幕、中正文、右頁邊直書朱批與名號小印；順逆章蓋在正文末尾；做法排成路牌。只用 style.css 的色票。 */

/* 整頁的紙：蓋在頁面上，內容最寬 520、左右 16px */
.yw-wrap { position: fixed; inset: 0; z-index: 60; overflow-y: auto; background: var(--paper); color: var(--ink); -webkit-overflow-scrolling: touch; }
.yw-card { box-sizing: border-box; width: 100%; max-width: 520px; margin: 0 auto; padding: 0 16px calc(24px + var(--bottom)); font: 15px/1.65 var(--sans); overflow-wrap: anywhere; }
.yw-card *, .yw-card *::before, .yw-card *::after { box-sizing: border-box; }
.yw-card p { margin: 0; }
.yw-top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 -16px; padding: calc(6px + var(--top)) 16px 6px; background: var(--card); border-bottom: 1px solid var(--line); }
.yw-top-tx { min-width: 0; display: flex; flex-direction: column; }
.yw-title { margin: 0; font: 700 17px/1.3 var(--kai); letter-spacing: .08em; color: var(--ink); }
.yw-top-tx small { font: 500 12px/1.4 var(--sans); color: var(--ink-2); }
.yw-card .btn.yw-hide { width: auto; flex: none; min-height: 44px; padding: 0 14px; }
.yw-scr { padding: 12px 0 0; display: flex; flex-direction: column; gap: 12px; }

/* 卡 */
.yw-cd { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.yw-cd.yw-flush { padding: 0; overflow: hidden; gap: 0; }

/* 頁首圖：有此地的圖用它，沒有就是墨暈底；往下淡進卡色 */
.yw-art {
  position: relative; height: 168px; overflow: hidden;
  background:
    radial-gradient(ellipse 60% 45% at 28% 72%, color-mix(in srgb, var(--ink) 26%, transparent), transparent 70%),
    radial-gradient(ellipse 45% 35% at 78% 38%, color-mix(in srgb, var(--ink) 16%, transparent), transparent 70%),
    repeating-linear-gradient(135deg, var(--card-2) 0 9px, color-mix(in srgb, var(--card-2) 60%, var(--line)) 9px 18px);
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent); mask-image: linear-gradient(to bottom, #000 55%, transparent);
}
.yw-art-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.yw-hero-tx { position: relative; margin-top: -52px; padding: 0 14px 12px; display: flex; flex-direction: column; gap: 6px; }
.yw-hook { font: 700 20px/1.75 var(--kai); color: var(--ink); letter-spacing: .04em; }
.yw-frame { font: 400 14px/1.7 var(--kai); color: var(--ink-2); }
.yw-meta { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; padding-top: 8px; border-top: 1px dashed var(--line); }
.yw-meta b { font: 700 19px/1.3 var(--kai); letter-spacing: .08em; color: var(--ink); }
.yw-meta small { font: 500 12px var(--sans); color: var(--ink-2); }

/* 朱印（2px 朱框、楷書、轉 −4°；實心的是重要的） */
.yw-seal { display: inline-block; padding: 3px 8px; border: 2px solid var(--accent); border-radius: 4px; color: var(--accent); background: var(--card); font: 700 15px/1.2 var(--kai); letter-spacing: .2em; transform: rotate(-4deg); }
.yw-seal.solid { background: var(--accent); color: var(--accent-ink); }
.yw-hero .yw-seal { position: absolute; top: 12px; right: 14px; }
/* 順逆圓章（轉 −10°），蓋在正文末尾 */
.yw-luck { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--accent); color: var(--accent); font: 700 18px/1 var(--kai); transform: rotate(-10deg); position: absolute; right: 8px; bottom: 10px; opacity: .78; }

/* 段標（楷書、左邊一筆墨） */
.yw-hd { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.yw-hd h4 { margin: 0; padding-left: 8px; border-left: 3px solid var(--ink); font: 700 17px/1.3 var(--kai); letter-spacing: .12em; color: var(--ink); }
.yw-hd small { font: 400 12px var(--sans); color: var(--ink-2); }

/* 路牌：左邊做法（楷書），右邊一欄狀態 */
.yw-signs { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); }
.yw-sign { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 56px; padding: 6px 12px 6px 14px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
.yw-sign:first-child { border-top: 0; }
.yw-sign > b { flex: 1; min-width: 0; font: 700 16px/1.4 var(--kai); }
.yw-sign > b small { display: block; font: 400 12px/1.4 var(--sans); color: var(--ink-2); }
.yw-sign.yw-zp > b { color: var(--accent); }
.yw-sign.locked { cursor: default; background: var(--card-2); }
.yw-sign.locked > b { color: var(--ink-2); font-weight: 400; }
.yw-st { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; min-width: 76px; max-width: 45%; font: 400 11px/1.35 var(--sans); color: var(--ink-2); text-align: right; }
.yw-st strong { font: 700 17px/1.1 var(--serif); color: var(--ink); }
.yw-st strong small { font: 500 11px var(--sans); color: var(--ink-2); margin-left: 2px; }
.yw-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font: 600 12px/1.5 var(--sans); }
.yw-chip.free { border: 1px solid var(--accent); color: var(--accent); }
.yw-chip.paid { border: 1px solid var(--gold); color: var(--gold); }
.yw-chip.off { border: 1px dashed var(--line); color: var(--ink-2); }
.yw-legend { font: 400 12px/1.5 var(--sans); color: var(--ink-2); padding: 0 2px; }

/* 自己說（這一批灰著）、「？」規矩、按鈕 */
.yw-say { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); font: 16px/1.4 var(--sans); color: var(--ink-2); }
.yw-say.off { opacity: .5; border-style: dashed; }
.yw-help { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--ink-2); font: 600 13px var(--sans); cursor: pointer; }
.yw-q { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid currentColor; font-size: 12px; }
.yw-rules { margin: -6px 0 0; padding: 10px 14px 10px 28px; border-radius: 10px; background: var(--card-2); font: 400 13px/1.7 var(--sans); color: var(--ink-2); }
.yw-card .yw-btn { width: 100%; min-height: 48px; }

/* 回聲句（虛線左線、sans）；發掘者那一步不畫 */
.yw-echo { padding: 2px 0 2px 10px; border-left: 2px dashed var(--line); font: 400 14px/1.6 var(--sans); color: var(--ink-2); }

/* 一頁書：左直條、中正文、右頁邊直書朱批 */
.yw-book { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.yw-num { flex: none; width: 30px; display: flex; align-items: center; justify-content: center; writing-mode: vertical-rl; font: 700 14px/1 var(--kai); letter-spacing: .2em; color: var(--accent-ink); background: var(--accent); }
.yw-leaf { position: relative; flex: 1; min-width: 0; padding: 12px 10px 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.yw-leaf.yw-sealed { padding-bottom: 56px; } /* 章蓋在正文末尾底下：替身那種一兩行的短文也不壓到字 */
.yw-txt { display: flex; flex-direction: column; gap: 8px; font: 400 16px/1.85 var(--kai); color: var(--ink); }
.yw-txt p { text-indent: 2em; }
.yw-margin { flex: none; width: 58px; padding: 12px 4px 12px 0; display: flex; flex-direction: column; align-items: center; gap: 8px; border-left: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--accent-soft); }
.yw-zp-tx { writing-mode: vertical-rl; font: 700 17px/1.5 var(--kai); color: var(--accent); letter-spacing: .08em; }
.yw-zp-tx small { font: 400 12px var(--kai); letter-spacing: .04em; }
/* 朱批長了：先折成兩行直書，再長才縮字；頁邊跟著書長，不出框 */
.yw-zp-2 .yw-zp-tx { font-size: 15px; line-height: 1.4; letter-spacing: .02em; max-height: 12.5em; }
.yw-zp-3 .yw-zp-tx { font-size: 13px; line-height: 1.4; letter-spacing: .02em; max-height: 23em; }
.yw-stamp { writing-mode: vertical-rl; padding: 4px 2px; border: 1.5px solid var(--accent); border-radius: 2px; font: 700 12px/1 var(--kai); letter-spacing: .1em; color: var(--accent); }
.yw-stamp.solid { background: var(--accent); color: var(--accent-ink); }
.yw-zp-name { max-width: 54px; font: 400 10px/1.3 var(--kai); color: var(--accent); text-align: center; overflow-wrap: anywhere; }

/* 較早的幕：收成一行 */
.yw-prev { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 0 12px; border: 1px dashed var(--line); border-radius: 10px; background: none; font: 400 14px/1.4 var(--kai); color: var(--ink-2); text-align: left; cursor: pointer; }
.yw-prev span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 等說書人寫：格線頁＋墨點三顆 */
.yw-ruled { min-height: 150px; border-radius: 6px; background: repeating-linear-gradient(to bottom, transparent 0 29px, var(--line) 29px 30px); display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: 0 4px; }
.yw-wait { display: flex; align-items: center; gap: 10px; align-self: flex-start; padding: 0 6px; background: var(--card); font: 400 15px/1.6 var(--kai); color: var(--ink-2); }
.yw-dots { display: inline-flex; gap: 5px; }
.yw-dots i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--ink-2); animation: yw-dot 1.2s infinite; }
.yw-dots i:nth-child(2) { animation-delay: .2s; }
.yw-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes yw-dot { 0%, 60%, 100% { background: transparent; } 20%, 40% { background: var(--ink); border-color: var(--ink); } }
@media (prefers-reduced-motion: reduce) { .yw-dots i { animation: none; } .yw-dots i:first-child { background: var(--ink); } }
.yw-note { font: 400 13px/1.6 var(--sans); color: var(--ink-2); }

/* 收尾卡 */
.yw-close { padding: 2px 0 2px 10px; border-left: 2px dashed var(--line); font: 400 15px/1.8 var(--kai); color: var(--ink-2); }
.yw-fin { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 0 2px; }
.yw-fin .yw-seal { font-size: 20px; padding: 4px 12px; }
.yw-fin-title { font: 700 19px/1.3 var(--kai); letter-spacing: .08em; color: var(--ink); }
.yw-trail3 { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: 10px; background: var(--card-2); font: 400 14px/1.6 var(--kai); color: var(--ink-2); }
.yw-trail3 b { color: var(--accent); font-weight: 700; }
.yw-grey { font: 400 13px/1.6 var(--sans); color: var(--ink-2); }
.yw-gain { display: flex; flex-wrap: wrap; gap: 4px 12px; font: 600 14px/1.5 var(--sans); color: var(--ink); }
.yw-gain span::before { content: "・"; color: var(--gold); }

/* 收起時頁上那一條「進行中」 */
.yw-track { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 44px; margin: 0 0 8px; padding: 0 12px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 10px; background: var(--card); color: var(--ink); font: 400 14px/1.4 var(--kai); text-align: left; cursor: pointer; }
.yw-track i { font-style: normal; color: var(--ink-2); }

/* 窄機：頁邊與直條收窄（360 寬正文一行 ≥14 字）；更窄（<340）朱批改成頁頂橫排 */
@media (max-width: 379px) {
  .yw-num { width: 24px; font-size: 13px; }
  .yw-margin { width: 46px; padding: 10px 3px 10px 0; }
  .yw-leaf { padding: 10px 8px 10px 10px; }
  .yw-leaf.yw-sealed { padding-bottom: 54px; }
  .yw-zp-tx { font-size: 15px; line-height: 1.35; }
  .yw-zp-2 .yw-zp-tx { font-size: 13px; line-height: 1.3; max-height: 12.5em; }
  .yw-zp-3 .yw-zp-tx { font-size: 12px; line-height: 1.25; max-height: 23em; }
  .yw-zp-name { max-width: 42px; }
}
@media (max-width: 339px) {
  .yw-book { flex-wrap: wrap; }
  .yw-margin { order: -1; flex: 0 0 100%; width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 6px 10px; border-left: 3px solid var(--accent); border-bottom: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--line)); }
  .yw-zp-tx, .yw-zp-2 .yw-zp-tx, .yw-zp-3 .yw-zp-tx { writing-mode: horizontal-tb; flex: 1 1 100%; max-height: none; font-size: 14px; line-height: 1.5; }
  .yw-stamp { writing-mode: horizontal-tb; padding: 2px 4px; }
  .yw-zp-name { max-width: none; text-align: left; }
  .yw-say-open .input { padding-left: 6px; padding-right: 6px; }  /* 第 261 批：320 寬時提示字尾巴被截（內容 122px＜字 128px），左右各收 6px；高度照舊 44 */
}
/* 自己說的那一格（第 252 批）：一格＋主鈕；被擋的那一句與還能說幾次寫在格下；等待頁的「停」 */
.yw-say.yw-say-open { padding: 4px 4px 4px 10px; gap: 6px; background: var(--card); border-color: var(--ink-2); }
.yw-say-open .input { flex: 1; min-width: 0; min-height: 44px; border: 0; background: none; color: var(--ink); font: 400 16px/1.4 var(--kai); outline: none; }
.yw-say-open .input::placeholder { color: var(--ink-2); opacity: .8; }
.yw-say-open:focus-within { border-color: var(--accent); }
.yw-say-open .btn.yw-say-go { flex: none; width: auto; min-height: 44px; padding: 0 14px; white-space: nowrap; }
.yw-say-msg { margin: -4px 0 0; font: 400 13px/1.6 var(--kai); color: var(--accent); }
.yw-say-msg small { display: block; font: 400 12px var(--sans); color: var(--ink-2); }
.yw-card .yw-stop { margin-top: 12px; }