/* 配色：日本傳統色
   勿忘草 #7DB9DE 底色 ・ 紅 #CB1B45 強調 ・ 紺 #0F2540 文字 ・ 白練 #FCFAF2 紙面
   字體與版面參考 NIPPON COLORS：明朝體直書大標、羅馬字大寫小標、細體數字、粗窄體英文標籤、
   右側直式工具列、中欄資訊（環形圖＋細線數據）、和紙質感底色、捲動時底色隨段落變化 */
:root {
  --sky: #7DB9DE;
  --paper: rgba(252, 250, 242, .95);
  --paper-solid: #FCFAF2;
  --ink: #0F2540;
  --ink-2: #4A6480;
  --ink-3: #8FA3B6;
  --line: #DCE5EC;
  --on: #FFFFFF;
  --on-2: rgba(255, 255, 255, .78);
  --on-line: rgba(255, 255, 255, .5);
  --accent: #CB1B45;
  --narr: #113285;
  --radius: 6px; --r-sm: 4px;
  --rail: 78px; --info: 250px; --tbh: 0px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --serif: 'Noto Serif TC', 'Hiragino Mincho ProN', 'PMingLiU', serif;
  --sans: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  --cond: 'Oswald', 'Noto Sans TC', sans-serif;               /* 粗窄體：NIPPON COLORS、C/M/Y 標籤 */
  --roman: 'Cormorant Garamond', 'Times New Roman', serif;      /* 羅馬字：KIKUJIN */
  --thin: 'Lato', 'Helvetica Neue', sans-serif;               /* 細體數字：177 / 180 / 121 */
  font-family: var(--sans);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--tbh) + 16px); scroll-behavior: smooth; }
body { margin: 0; color: var(--on); font-size: 14px; line-height: 1.65; -webkit-font-smoothing: antialiased;
  background-color: color-mix(in srgb, var(--segc, var(--sky)) 24%, var(--sky)); transition: background-color 1s ease; }
/* 和紙質感：細微雜訊＋上方柔光 */
body::before { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background:
    radial-gradient(ellipse at 60% -10%, rgba(255,255,255,.28), transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: .5; mix-blend-mode: soft-light; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
.muted { color: var(--on-2); }
.grow { flex: 1; }
[hidden] { display: none !important; }
::selection { background: rgba(203, 27, 69, .25); }
/* 中英切換：淡出換字再淡入 */
[data-zh] { transition: opacity .16s ease-out, filter .16s ease-out; }
.zh-fade { opacity: 0; filter: blur(2px); transition-duration: .07s; transition-timing-function: ease-in; }
.kicker { font-family: var(--cond); font-weight: 600; font-size: 11px; letter-spacing: .28em; color: var(--accent); margin: 0 0 4px; }

/* ---------- 按鈕 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: transparent; border: 1px solid var(--on-line); border-radius: var(--r-sm);
  padding: 5px 16px; cursor: pointer; white-space: nowrap; color: var(--on); letter-spacing: .1em; text-decoration: none;
  transition: background .2s, border-color .2s, color .2s; }
.btn:hover { background: rgba(255,255,255,.16); border-color: var(--on); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.btn.primary:hover { background: #b3163c; border-color: #b3163c; }
.btn.ink { color: var(--ink); border-color: #c6d3de; }
.btn.ink:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.danger { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger:hover { background: #b3163c; }
.btn:disabled { opacity: .5; cursor: default; }
.icon { background: none; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0 9px; font-size: 12px; cursor: pointer; color: var(--ink-2); letter-spacing: .06em; transition: .2s; }
.icon:hover { color: var(--ink); border-color: var(--ink-2); background: rgba(15,37,64,.04); }
.icon:disabled { opacity: .3; cursor: default; }
.icon.danger:hover { color: #fff; background: var(--accent); border-color: var(--accent); }
.x { background: none; border: 0; color: inherit; opacity: .55; cursor: pointer; font-size: 18px; line-height: 1; padding: 0 4px; transition: .2s; }
.x:hover { opacity: 1; color: var(--accent); }
.pill { font-family: var(--cond); font-size: 11px; letter-spacing: .14em; padding: 1px 8px; border-radius: var(--r-sm); background: var(--accent); color: #fff; }
.pill.dim { background: rgba(255,255,255,.22); color: var(--on); }
/* 數字輸入：和周圍文字融成一體，只在滑過或輸入時出現細底線 */
.num { width: 2.6em; background: transparent; border: 0; border-bottom: 1px solid transparent; padding: 0 1px; margin: 0 2px; text-align: right;
  font: inherit; color: inherit; transition: border-color .2s; -moz-appearance: textfield; appearance: textfield; }
.num::-webkit-outer-spin-button, .num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num:hover { border-bottom-color: color-mix(in srgb, currentColor 40%, transparent); }
.num:focus { outline: none; border-bottom-color: var(--accent); }
.cps .num { border-bottom-color: color-mix(in srgb, currentColor 40%, transparent); }

/* ---------- 右側直式工具列 ---------- */
.rail { position: fixed; top: 0; right: 0; bottom: 0; width: var(--rail); z-index: 30; display: flex; flex-direction: column; align-items: center; gap: 22px; padding-bottom: 22px; }
.sun { display: block; width: 66px; height: 66px; border-radius: 50%; background: var(--accent); margin-top: -16px; flex: none; transition: transform .5s var(--ease); }
.sun:hover { transform: scale(1.08); }
.brand { writing-mode: vertical-rl; font-family: var(--cond); font-weight: 600; font-size: 25px; letter-spacing: .06em; text-decoration: none; line-height: 1; margin-top: -6px; }
.rail-btns { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.rb { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 46px; padding: 6px 0 4px; background: none; border: 0; cursor: pointer; color: var(--on); opacity: .82; transition: opacity .2s, transform .2s; }
.rb svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.rb span { font-family: var(--cond); font-weight: 500; font-size: 9.5px; letter-spacing: .14em; }
.rb:hover { opacity: 1; transform: translateY(-1px); }
.rb.on { opacity: 1; }
.rb.on svg { fill: rgba(255,255,255,.35); }
/* 編輯開關：和其他圖示同一種樣式；打開時圖示外圍亮起紅色圓 */
.vsw { cursor: pointer; user-select: none; margin-top: 6px; gap: 12px; }
.vsw input { display: none; }
.vsw svg { box-sizing: content-box; width: 20px; height: 20px; padding: 7px; margin: -7px; border-radius: 50%; transition: background .3s, color .3s; }
.vsw input:checked + svg { background: var(--accent); }
.vsw input:checked ~ span.zh::after { content: '中'; }
.vsw:has(input:checked) { opacity: 1; }
.ro { writing-mode: vertical-rl; font-family: var(--cond); font-size: 11px; letter-spacing: .2em; opacity: .8; }
.save { margin-top: auto; writing-mode: vertical-rl; font-family: var(--cond); font-size: 10.5px; letter-spacing: .22em; color: var(--on-2); transition: color .3s; }
.save.pending, .save.saving { color: var(--on); }
.save.saving::before { content: '● '; animation: blink 1s infinite; }
.save.offline, .save.error { color: #fff; background: var(--accent); padding: 6px 2px; border-radius: var(--r-sm); }
@keyframes blink { 50% { opacity: .2; } }

/* ---------- 中欄資訊：目前段落 ---------- */
.info-panel { position: fixed; top: 0; bottom: 0; right: var(--rail); width: var(--info); z-index: 10; display: flex; flex-direction: column; align-items: center; gap: 48px; padding: 56px 32px 56px 16px; overflow-y: auto; scrollbar-width: none; }
.info-panel::-webkit-scrollbar { display: none; }
.ip-stats { width: 100%; max-width: 150px; flex: none; margin: 0; display: flex; flex-direction: column; }
.ip-row { border-top: 1px solid var(--on-line); padding: 9px 0 18px; }
.ip-row:last-child { border-bottom: 1px solid var(--on-line); }
.ip-row dt { font-family: var(--cond); font-weight: 600; font-size: 11px; letter-spacing: .12em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ip-row dd { margin: 2px 0 0; font-family: var(--thin); font-weight: 300; font-size: 26px; line-height: 1.15; text-align: right; }
/* 分類組成：兩欄排列，每格是圓環（數字在圈內）＋下方名稱 */
.ip-types dd { margin: 10px 0 0; text-align: left; font-family: var(--sans); font-weight: 400; line-height: 1.4; }
.ip-types ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 8px; }
.ip-types li { display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.ip-types li span { max-width: 100%; font-size: 10.5px; letter-spacing: .06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ring { --p: 0; position: relative; width: 46px; height: 46px; flex: none; display: grid; place-items: center; font-style: normal; }
.ring::before { content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), rgba(255,255,255,.28) 0);
  -webkit-mask: radial-gradient(circle, transparent 19.5px, #000 20px); mask: radial-gradient(circle, transparent 19.5px, #000 20px); }
.ring b { position: relative; font-family: var(--thin); font-weight: 300; font-size: 14px; }
.ring small { font-size: 8.5px; margin-left: 1px; opacity: .85; }
.ip-name { order: -1; flex: none; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.vcols { display: flex; flex-direction: row-reverse; gap: 14px; max-height: 62vh; }
.vname { writing-mode: vertical-rl; font-family: var(--serif); font-weight: 600; font-size: 64px; letter-spacing: .14em; line-height: 1.1; margin: 0; }
.vsub { writing-mode: vertical-rl; font-family: var(--serif); font-weight: 500; font-size: 17px; letter-spacing: .3em; margin: 10px 0 0; color: var(--on-2); }
.ip-name .roman { margin: 22px 0 0; font-size: 16px; text-align: center; }
.ip-sec { margin: 18px 0 0; font-family: var(--thin); font-weight: 300; font-size: 44px; line-height: 1; }
.ip-sec small { font-family: var(--cond); font-weight: 600; font-size: 11px; letter-spacing: .16em; margin-left: 6px; }
.info-panel.swap .vcols, .info-panel.swap .roman, .info-panel.swap .ip-sec { animation: rise .7s var(--ease) both; }
.info-panel.swap .ip-row { animation: fade .6s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes fade { from { opacity: 0; } }

/* ---------- 主體 ---------- */
main { margin-right: calc(var(--rail) + var(--info)); padding: 104px clamp(120px, 10vw, 200px) 160px 72px; max-width: 1640px; }
.np-open main { margin-right: calc(var(--rail) + 430px); }
.loading, .fail { min-height: 70vh; display: grid; place-content: center; justify-items: center; text-align: center; gap: 14px; }
.loading i { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
.loading p { font-family: var(--cond); font-size: 12px; letter-spacing: .4em; margin: 0; }
@keyframes pulse { 50% { transform: scale(.72); opacity: .6; } }
.fail h1 { font-family: var(--serif); font-weight: 600; letter-spacing: .14em; margin: 0 0 8px; }

.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; flex-wrap: wrap; margin-bottom: 14px; }
.title { font-family: var(--serif); font-size: 52px; font-weight: 600; margin: 0; letter-spacing: .1em; line-height: 1.25; }
.roman { font-family: var(--roman); font-weight: 500; font-size: 17px; text-transform: uppercase; letter-spacing: .32em; margin: 6px 0 0; color: var(--on); }
.stats { display: flex; margin: 0; }
.stats div { min-width: 92px; padding: 6px 18px 0 0; border-top: 1px solid var(--on-line); }
.stats dt { font-family: var(--cond); font-weight: 600; font-size: 11px; letter-spacing: .14em; }
.stats dd { margin: 2px 0 0; font-family: var(--thin); font-weight: 300; font-size: 32px; line-height: 1.1; letter-spacing: .02em; }
.meta { color: var(--on-2); font-size: 12px; margin-bottom: clamp(96px, 14vh, 150px); letter-spacing: .04em; min-height: 1em; }
.meta .n { font-family: var(--thin); letter-spacing: .04em; }

/* 篩選列：兩排，左邊小標題對齊 */
.legend { display: flex; flex-direction: column; gap: 12px; margin-bottom: clamp(64px, 9vh, 96px); }
.lg-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lg-label { width: 52px; flex: none; font-family: var(--cond); font-weight: 600; font-size: 11px; letter-spacing: .16em; }
/* 鏡位：圓點大小代表景別遠近（大遠景最小、大特寫最大） */
.sz-chip i, .lb.sz i { width: var(--d); height: var(--d); background: currentColor; box-shadow: none; border-radius: 50%; display: inline-block; flex: none; opacity: .85; }
.sz-chip i { margin: 0 1px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 3px 13px; border-radius: 999px; border: 1px solid var(--on-line);
  background: rgba(255,255,255,.08); cursor: pointer; font-size: 13px; color: var(--on); letter-spacing: .08em; transition: .2s; }
.chip:hover { background: rgba(255,255,255,.2); }
.chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1px rgba(255,255,255,.75); }
.chip.on { background: var(--paper-solid); color: var(--ink); border-color: var(--paper-solid); }
.chip.add, .chip.clear { border-style: dashed; }
.ed-chip { cursor: default; padding: 3px 8px 3px 10px; gap: 7px; }
.ed-chip input[type=color] { width: 12px; height: 12px; border-width: 1px; }
.ed-chip .x { font-size: 14px; padding: 0 2px; }
input[type=color] { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border: 1px solid #fff; padding: 0; background: none; cursor: pointer; border-radius: 50%; overflow: hidden; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: 0; border-radius: 50%; }

/* 旁白開關：放在分類標籤那一排 */
.narr-chip { cursor: pointer; gap: 8px; padding: 3px 13px 3px 6px; }
.narr-chip.on { background: var(--paper-solid); border-color: var(--paper-solid); color: var(--ink); }
.narr-chip.on .cps { color: var(--ink-2); }
.narr-chip.on .mini-sw:not([aria-checked="true"]) { border-color: var(--ink-3); }
.nc-label { background: none; border: 0; padding: 0; font: inherit; letter-spacing: inherit; color: inherit; cursor: pointer; }
.nc-label:disabled { cursor: default; }
.narr-chip.off { border-style: dashed; cursor: default; }
.narr-chip.off:hover { background: rgba(255,255,255,.08); }
.narr-chip .cps, .narr-chip .num { cursor: text; }
.narr-chip.off .nc-label { color: var(--on-2); }
.mini-sw { position: relative; width: 28px; height: 16px; border-radius: 999px; border: 1px solid rgba(255,255,255,.8); background: transparent; cursor: pointer; padding: 0; flex: none;
  transition: background .35s, border-color .35s; }
.mini-sw i { position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%; background: #fff; transition: transform .45s cubic-bezier(.65, 0, .25, 1.25); }
.mini-sw[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.mini-sw[aria-checked="true"] i { transform: translateX(12px); }
.nc-label { transition: color .3s; }
/* 語速：無旁白時收起來（寬度與透明度一起過渡） */
.cps { display: inline-block; max-width: 180px; overflow: hidden; white-space: nowrap; vertical-align: middle; font-size: 12px; color: var(--on-2); transition: max-width .5s var(--ease), opacity .35s ease, margin .5s var(--ease); }
.no-narr .cps { max-width: 0; opacity: 0; margin-left: -8px; }
/* 無旁白：旁白相關的東西全部隱藏 */
.no-narr .f-narr, .no-narr .cnt, .no-narr .narr-only, .no-narr [data-act="narr"] { display: none !important; }
.no-scr .f-scr { display: none !important; }
/* 時間軸：像色票上方的色條 */
.tl { display: flex; gap: 4px; }
.tlseg { position: relative; flex: 0 0 auto; min-width: 4px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 28px 8px 0 0; color: var(--on); text-decoration: none; overflow: hidden; white-space: nowrap; }
/* 色條獨立成一層，滑過時只在原位加粗（向上長），文字位置完全不動 */
.tlseg::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 18px; border-radius: 5px 5px 0 0; background: var(--c);
  transform-origin: bottom; transform: scaleY(.78); transition: transform .35s var(--ease); }
.tlseg:hover::before { transform: scaleY(1); }
.tl-row { display: flex; align-items: baseline; gap: 8px; }
.tl-time { font-family: var(--thin); font-size: 12px; color: var(--on-2); letter-spacing: .05em; }
.tl-name { font-family: var(--serif); font-size: 14px; font-weight: 500; letter-spacing: .1em; }
.tl-pct { font-family: var(--thin); font-size: 12px; color: var(--on-2); letter-spacing: .04em; }
.tlticks { position: relative; height: 0; font-family: var(--thin); font-size: 12px; color: var(--on-2); margin-bottom: 14px; letter-spacing: .05em; }
.tlticks span { position: absolute; top: 2px; }
.tlticks .end { right: 0; top: -20px; }

/* ---------- 段落 ---------- */
.seg { margin-top: 96px; }
/* 標題區（篩選、時間軸）和第一個段落之間多留一點，分出「總覽」與「內容」兩塊 */
.tlticks + .seg { margin-top: 380px; }
.seg-head { display: flex; align-items: baseline; gap: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--on-line); margin-bottom: 30px; flex-wrap: wrap; }
.seg-head .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; box-shadow: 0 0 0 2px rgba(255,255,255,.85); align-self: center; }
.seg-head input[type=color] { align-self: center; }
.seg-head h2 { margin: 0; font-family: var(--serif); font-size: 26px; font-weight: 600; letter-spacing: .12em; }
.seg-head .range { font-family: var(--thin); font-weight: 300; font-size: 18px; letter-spacing: .04em; }
.seg-head .muted { font-family: var(--thin); font-size: 13px; }
.seg-tools { display: flex; gap: 4px; align-self: center; }
.seg-tools .icon { color: var(--on); border-color: var(--on-line); }
.seg-tools .icon:hover { background: rgba(255,255,255,.16); color: #fff; border-color: #fff; }
.seg-tools .icon.danger:hover { background: var(--accent); border-color: var(--accent); }

/* ---------- 卡片 ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 32px 28px; min-height: 40px; }
.card { background: var(--paper); color: var(--ink); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; position: relative;
  border-top: 5px solid var(--c, var(--ink)); box-shadow: 0 1px 2px rgba(15,37,64,.06), 0 10px 28px -16px rgba(15,37,64,.35);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease); }
.card:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(15,37,64,.06), 0 18px 36px -16px rgba(15,37,64,.45); }
.intro .head, .intro .legend, .intro .tl, .intro .tlticks { animation: rise .8s var(--ease) both; }
.intro .legend { animation-delay: .08s; } .intro .tl, .intro .tlticks { animation-delay: .14s; }
.intro .card { animation: rise .8s var(--ease) both; animation-delay: calc(.2s + var(--i, 0) * 40ms); }
.frame { position: relative; aspect-ratio: 16 / 9; background: #E9EFF4; overflow: hidden; }
.frame img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .8s var(--ease); }
.card:hover .frame img { transform: scale(1.03); }
.ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); font-family: var(--serif); font-size: 14px; text-align: center; padding: 20px; letter-spacing: .12em;
  background-image: linear-gradient(rgba(15,37,64,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(15,37,64,.045) 1px, transparent 1px); background-size: 24px 24px; }
.editing .frame:not(.has-img) { cursor: pointer; }
.editing .frame:not(.has-img):hover .ph { color: var(--accent); }
.no { position: absolute; top: 8px; left: 8px; border-radius: var(--r-sm); background: var(--ink); color: #fff; padding: 1px 9px; font-family: var(--cond); font-weight: 500; font-size: 14px; letter-spacing: .12em; }
.tc-badge { position: absolute; bottom: 8px; right: 8px; background: rgba(252,250,242,.94); color: var(--ink); border-radius: var(--r-sm); padding: 0 8px; font-family: var(--thin); font-size: 12px; letter-spacing: .05em; font-variant-numeric: tabular-nums; }
.grip { position: absolute; top: 6px; right: 8px; cursor: grab; font-size: 17px; line-height: 1; padding: 2px 5px; background: rgba(252,250,242,.94); color: var(--ink); border-radius: var(--r-sm); user-select: none; }
.frame-tools { position: absolute; bottom: 8px; left: 8px; display: flex; gap: 4px; opacity: 0; transition: .25s; }
.frame-tools .icon { background: var(--ink); color: #fff; border-color: var(--ink); }
.frame:hover .frame-tools { opacity: 1; }
.frame.drop-img { outline: 2px dashed var(--accent); outline-offset: -6px; }

.info { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.row1 { display: flex; align-items: baseline; gap: 8px; }
.size { font-family: var(--serif); font-size: 18px; font-weight: 600; flex: 1; letter-spacing: .06em; line-height: 1.4; }
/* 標題列右側：這鏡的秒數（編輯時可直接改） */
.row1 .dur { font-family: var(--thin); font-size: 18px; font-weight: 300; color: var(--ink); white-space: nowrap; }
.row1 .dur small { font-family: var(--sans); font-size: 11px; color: var(--ink-2); margin-left: 3px; letter-spacing: .1em; }
.row1 .dur .num { width: 2em; }
.f .opts { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 3px; }
.lb.sz { display: inline-flex; align-items: center; gap: 5px; }
.lb.sz.on { color: #fff; background: var(--ink); border-color: var(--ink); }
.size.unset { color: var(--ink-3); font-weight: 500; font-size: 14px; letter-spacing: .12em; }
.lb { font-size: 11px; padding: 0 7px; border-radius: var(--r-sm); border: 1px solid var(--line); background: none; color: var(--ink-3); letter-spacing: .06em; transition: .2s; }
.lb.on { color: var(--ink); background: color-mix(in srgb, var(--c) 55%, #fff); border-color: color-mix(in srgb, var(--c) 80%, var(--ink)); }
.lb.tag { color: var(--ink-2); background: #EEF3F7; }
button.lb { cursor: pointer; }
button.lb:not(.on):hover { color: var(--ink); border-color: var(--ink-3); }
.fields { display: flex; flex-direction: column; gap: 0; margin-top: 4px; }
/* 每個欄位是獨立區塊：上方標籤（中文＋英文），下方內容，區塊之間有細線與留白 */
.f { padding: 14px 0 15px; border-top: 1px solid var(--line); font-size: 13.5px; line-height: 1.85; }
.fl { display: flex; align-items: baseline; gap: 8px; margin-bottom: 5px; }
.fl b { font-size: 11px; font-weight: 700; color: var(--ink-2); letter-spacing: .2em; }
.fl em { font-style: normal; font-family: var(--cond); font-weight: 500; font-size: 9.5px; letter-spacing: .22em; color: var(--ink-3); }
.fv { white-space: pre-wrap; word-break: break-word; color: var(--ink); letter-spacing: .03em; }
/* 旁白和其他欄位同一種樣式；字數提示緊貼在旁白下方 */
.f-narr + .cnt { margin: -10px 0 6px; }
.empty-shot { margin: 0; padding: 18px 0; border-top: 1px solid var(--line); color: var(--ink-3); font-family: var(--serif); font-size: 13px; letter-spacing: .2em; text-align: center; }
.f-tags .fv { font-size: 12.5px; color: var(--ink-2); }
.cnt { font-size: 11px; color: var(--ink-3); align-self: flex-end; letter-spacing: .04em; }
.cnt:empty { display: none; }
.cnt.warn { display: table; margin-left: auto; color: #fff; background: var(--accent); padding: 0 6px; border-radius: var(--r-sm); font-weight: 700; }
.card-tools { display: flex; gap: 6px; justify-content: flex-end; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }

/* 可編輯欄位 */
[contenteditable] { outline: none; border-radius: var(--r-sm); min-height: 1.4em; transition: background .15s, box-shadow .15s; }
.editing [contenteditable]:hover { background: rgba(255,255,255,.14); }
.editing .card [contenteditable]:hover { background: #F1F5F8; }
.editing [contenteditable]:focus { background: rgba(255,255,255,.2); box-shadow: 0 0 0 1px #fff; }
.editing .card [contenteditable]:focus { background: #fff; box-shadow: 0 0 0 1px var(--accent); }
[contenteditable]:empty::before { content: attr(data-ph); color: var(--on-2); font-weight: 400; font-family: var(--sans); font-size: 13px; letter-spacing: .04em; }
.card [contenteditable]:empty::before { color: var(--ink-3); }

/* 拖曳 */
.card.dragging { opacity: .35; }
#dropLine { position: fixed; z-index: 40; width: 3px; margin-left: -1.5px; border-radius: 3px; background: var(--accent); pointer-events: none;
  box-shadow: 0 0 0 3px rgba(203,27,69,.18); transition: left .15s var(--ease), top .15s var(--ease), height .15s var(--ease); }
#dropLine::before, #dropLine::after { content: ''; position: absolute; left: 50%; width: 9px; height: 9px; margin-left: -4.5px; border-radius: 50%; background: var(--accent); }
#dropLine::before { top: -4px; } #dropLine::after { bottom: -4px; }
.grid.drop-end { outline: 2px dashed #fff; outline-offset: 5px; }

.add-card { min-height: 130px; border: 1px dashed var(--on-line); color: var(--on); cursor: pointer; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 15px; background: rgba(255,255,255,.07); box-shadow: none; letter-spacing: .14em; }
.add-card:hover { background: rgba(255,255,255,.17); border-color: #fff; transform: none; box-shadow: none; }
.add-seg { margin-top: 36px; width: 100%; padding: 16px; border-style: dashed; font-family: var(--serif); letter-spacing: .14em; }
.filter-empty { margin: 80px 0; text-align: center; font-family: var(--serif); letter-spacing: .3em; color: var(--on-2); }
.notes { margin-top: 110px; padding-top: 14px; border-top: 1px solid var(--on-line); color: var(--on-2); font-size: 12px; white-space: pre-wrap; letter-spacing: .06em; }

/* 總覽模式（瀏覽與編輯都適用）：卡片縮小，只留畫格、鏡位、時間；點一下展開 */
.compact .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px 16px; align-items: start; }
.compact .card:not(.open) .fields, .compact .card:not(.open) .cats, .compact .card:not(.open) .card-tools { display: none; }
.compact .card:not(.open) { cursor: pointer; }
.compact .card:not(.open) .info { padding: 10px 12px 12px; gap: 2px; }
.compact .card:not(.open) .size { font-size: 14px; }
.compact .card:not(.open) .row1 .dur { font-size: 15px; }
.compact .card.open { grid-column: span 2; cursor: default; }
.compact .card:not(.open):hover::after { content: '展開'; position: absolute; right: 10px; bottom: 10px; font-size: 11px; letter-spacing: .2em; color: var(--accent); }
.compact .add-card { min-height: 120px; align-self: stretch; }
.add-card { align-self: stretch; }

/* ---------- 旁白稿面板 ---------- */
.np { position: fixed; top: 0; right: var(--rail); bottom: 0; width: 430px; background: var(--paper-solid); color: var(--ink); display: flex; flex-direction: column; z-index: 20;
  box-shadow: -16px 0 40px -18px rgba(15,37,64,.45); animation: slidein .45s var(--ease); }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } }
.np-head { display: flex; align-items: center; gap: 8px; padding: 26px 22px 16px; border-bottom: 1px solid var(--line); }
.np-head > div { flex: 1; }
.np-head b { font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: .14em; }
.np-head .muted { color: var(--ink-2); font-size: 12px; font-family: var(--thin); margin-top: 2px; }
.np-body { overflow-y: auto; padding: 4px 22px 48px; }
.np-row { padding: 18px 0 20px; border-bottom: 1px solid var(--line); }
.np-k { font-size: 12px; color: var(--ink-3); font-family: var(--thin); letter-spacing: .06em; }
.np-k a { font-family: var(--cond); font-weight: 500; text-decoration: none; color: var(--accent); margin-right: 4px; }
.np-k .muted { color: var(--ink-3); }
.np-t { font-family: var(--serif); font-size: 16px; margin-top: 4px; color: var(--narr); letter-spacing: .05em; line-height: 1.8; }
.np-row.silent .np-t { font-family: var(--sans); color: var(--ink-3); font-size: 13px; }
.np-row .cnt { text-align: right; margin-top: 2px; }

/* ---------- 對話框、提示 ---------- */
.dlg { background: var(--paper-solid); color: var(--ink); border: 0; border-top: 5px solid var(--accent); border-radius: var(--radius); width: min(580px, 92vw); padding: 26px 28px 22px;
  box-shadow: 0 30px 80px rgba(15,37,64,.4); }
.dlg[open] { animation: rise .45s var(--ease); }
.dlg.small { width: min(420px, 92vw); }
.dlg::backdrop { background: rgba(15,37,64,.42); backdrop-filter: blur(3px); }
.dlg h3 { margin: 0 0 14px; font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: .12em; }
.dlg-body { color: var(--ink-2); margin: -4px 0 0; }
.share-item { padding: 14px 0; border-top: 1px solid var(--line); }
.share-item > div:first-child { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.share-item b { font-family: var(--serif); font-weight: 600; letter-spacing: .1em; }
.share-item span { color: var(--ink-3); font-size: 12px; }
.copyrow { display: flex; gap: 6px; }
.copyrow input { flex: 1; min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 10px; color: var(--ink); font-family: var(--thin); }
.dlg-foot { margin-top: 20px; display: flex; justify-content: flex-end; gap: 8px; }
.toast { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 22px; border-radius: var(--r-sm); letter-spacing: .08em; z-index: 60;
  box-shadow: 0 10px 30px rgba(15,37,64,.35); animation: toast .45s var(--ease); }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 12px); } }

/* ---------- 首頁 ----------
   三欄：左＝建立與專案色票欄、中＝細線數據、右＝直書大標，最右是工具列
   （字級整體約為初版的 70%，間距同步收小） */
.home { --segc: var(--sky); }
.home .kicker { font-size: 9px; letter-spacing: .3em; }
.hm { display: grid; grid-template-columns: minmax(0, 1fr) 110px minmax(180px, 260px); gap: 0 clamp(40px, 5vw, 96px);
  min-height: 100vh; margin-right: var(--rail); padding: clamp(64px, 9vh, 120px) clamp(32px, 6vw, 120px) 96px; }
.hm-main { min-width: 0; animation: rise .9s var(--ease) both; }
.hm-lead { font-family: var(--serif); font-weight: 600; font-size: clamp(25px, 2.5vw, 39px); line-height: 1.5; letter-spacing: .14em; margin: 18px 0 26px; }
.hm-desc { color: var(--on-2); font-size: 11.5px; line-height: 2.1; letter-spacing: .08em; margin: 0 0 clamp(56px, 8vh, 96px); max-width: 44em; text-wrap: pretty; }

.hm-label { display: flex; align-items: baseline; gap: 14px; margin: 0 0 18px; font-weight: 400; }
.hm-label b { font-family: var(--serif); font-weight: 600; font-size: 12.5px; letter-spacing: .24em; }
.hm-label em { font-style: normal; font-family: var(--cond); font-weight: 600; font-size: 8.5px; letter-spacing: .3em; color: var(--on-2); }
.hm-label small { font-size: 10px; color: var(--on-2); letter-spacing: .08em; margin-left: 6px; padding-left: 14px; border-left: 1px solid var(--on-line); }

/* 建立表單：大字底線輸入框＋紅色中文按鈕 */
.hm-form { max-width: 640px; margin-bottom: clamp(72px, 11vh, 128px); }
.hm-field { display: flex; align-items: center; gap: 24px; border-bottom: 1px solid var(--on); padding-bottom: 6px; transition: border-color .3s; }
.hm-field:focus-within { border-bottom-color: var(--accent); box-shadow: 0 1px 0 var(--accent); }
.hm-field input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--on); font-family: var(--serif); font-weight: 500;
  font-size: clamp(17px, 1.55vw, 24px); letter-spacing: .1em; padding: 8px 0; }
.hm-field input::placeholder { color: rgba(255,255,255,.55); }
.hm-go { flex: none; display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: var(--r-sm); background: var(--accent); color: #fff; cursor: pointer;
  padding: 8px 14px 8px 17px; font-family: var(--sans); font-weight: 500; font-size: 11px; letter-spacing: .22em; transition: background .25s; }
.hm-go svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform .4s var(--ease); }
.hm-go:hover { background: #b3163c; }
.hm-go:hover svg { transform: translateX(3px); }
.hm-go.busy svg { animation: blink 1s infinite; }
.hm-form .err { margin-top: 10px; font-size: 11px; color: #fff; background: var(--accent); padding: 4px 10px; display: inline-block; border-radius: var(--r-sm); }
.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* 最近開啟：像色票的直排專案欄 */
.hm-recent { padding-top: 0; }
.swatches { list-style: none; margin: 6px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, 84px); gap: 40px 22px; }
.swatches li { position: relative; animation: rise .8s var(--ease) both; }
.swatches a { display: flex; flex-direction: column; align-items: center; height: 240px; border-radius: var(--r-sm); padding: 0 0 10px; text-decoration: none; border-top: 6px solid var(--c);
  background: linear-gradient(rgba(255,255,255,.1), rgba(255,255,255,0)); transition: background .35s, transform .45s var(--ease); }
.swatches a:hover { background: linear-gradient(rgba(255,255,255,.24), rgba(255,255,255,.04)); transform: translateY(-3px); }
.sw-no { font-family: var(--thin); font-weight: 300; font-size: 18px; margin: 10px 0 7px; letter-spacing: .04em; }
.sw-title { writing-mode: vertical-rl; font-family: var(--serif); font-weight: 600; font-size: 15px; letter-spacing: .2em; line-height: 1.3; flex: none; height: 140px; overflow: hidden; }
.sw-date { writing-mode: vertical-rl; font-family: var(--thin); font-size: 8.5px; letter-spacing: .1em; color: var(--on-2); margin: 7px 0; }
.sw-mode { font-family: var(--cond); font-weight: 600; font-size: 8px; letter-spacing: .22em; padding: 1px 5px; border-radius: var(--r-sm); border: 1px solid var(--on-line); }
.sw-mode.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.sw-x { position: absolute; top: 9px; right: 3px; width: 18px; height: 18px; border: 0; border-radius: 50%; background: rgba(15,37,64,.25); color: #fff; cursor: pointer;
  font-size: 11px; line-height: 1; opacity: 0; transition: opacity .25s, background .2s; }
.swatches li:hover .sw-x { opacity: 1; }
.sw-x:hover { background: var(--accent); }
.sw-empty { display: flex; gap: 16px; align-items: flex-start; height: 190px; }
.sw-empty span { writing-mode: vertical-rl; font-family: var(--serif); font-size: 12px; letter-spacing: .3em; color: var(--on-2); border-top: 6px solid rgba(255,255,255,.35); padding: 12px 22px; height: 100%;
  border-left: 1px dashed var(--on-line); border-right: 1px dashed var(--on-line); border-radius: var(--r-sm); }
.sw-empty span + span { font-size: 10px; }

/* 中欄數據 */
.hm-stats { margin: 0; padding-top: 6px; align-self: start; position: sticky; top: 64px; animation: fade 1s .2s ease both; }
.hm-stats div { border-top: 1px solid var(--on-line); padding: 8px 0 22px; }
.hm-stats div:last-child { border-bottom: 1px solid var(--on-line); }
.hm-stats dt { font-family: var(--cond); font-weight: 600; font-size: 8px; letter-spacing: .16em; }
.hm-stats dd { margin: 3px 0 0; font-family: var(--thin); font-weight: 300; font-size: 31px; line-height: 1.05; text-align: right; }
.hm-stats dd.small { font-size: 15px; letter-spacing: .04em; }

/* 右側直書大標 */
.hm-hero { align-self: start; position: sticky; top: 56px; display: flex; flex-direction: column; align-items: center; animation: rise 1.1s .1s var(--ease) both; }
.hm-hero .vcols { max-height: none; gap: 20px; }
.hm-hero .vname { font-size: clamp(67px, 6vw, 105px); letter-spacing: .16em; line-height: 1; }
.hm-hero .vsub { font-size: 12.5px; margin-top: 16px; letter-spacing: .5em; }
.hm-hero .roman { margin-top: 28px; font-size: 14px; letter-spacing: .42em; }

/* ---------- 匯出版 ---------- */
.export main { margin: 0 auto; padding-top: 48px; }
.np-export { margin-top: 64px; max-width: 760px; background: var(--paper-solid); color: var(--ink); padding: 10px 30px 26px; border-radius: var(--radius); border-top: 5px solid var(--accent); }
.np-export h2 { font-family: var(--serif); font-size: 24px; font-weight: 600; letter-spacing: .14em; }
.np-export > .muted { color: var(--ink-2); }

/* ---------- 窄螢幕：工具列移到上方，隱藏資訊欄 ---------- */
@media (max-width: 1180px) {
  :root { --info: 0px; }
  .info-panel { display: none; }
  .hm { grid-template-columns: 1fr; }
  .hm-hero { order: -1; position: static; flex-direction: row; align-items: flex-end; gap: 28px; margin-bottom: 40px; }
  .hm-hero .vcols { flex-direction: row; }
  .hm-hero .vname, .hm-hero .vsub { writing-mode: horizontal-tb; }
  .hm-hero .vname { font-size: 50px; } .hm-hero .vsub { margin: 0 0 7px; } .hm-hero .roman { margin: 0 0 10px; }
  .hm-stats { order: 2; position: static; display: flex; gap: 20px; margin-top: 64px; }
  .hm-stats div { flex: 1; border-bottom: 1px solid var(--on-line); }
}
@media (max-width: 760px) {
  :root { --rail: 0px; --tbh: 58px; }
  .rail { top: 0; bottom: auto; left: 0; right: 0; width: auto; height: var(--tbh); flex-direction: row; gap: 12px; padding: 0 12px; position: sticky;
    background: color-mix(in srgb, var(--segc, var(--sky)) 24%, var(--sky)); border-bottom: 1px solid var(--on-line); }
  .sun { width: 26px; height: 26px; margin: 0; }
  .brand { writing-mode: horizontal-tb; font-size: 16px; margin: 0; }
  .rail-btns { flex-direction: row; margin: 0 0 0 auto; gap: 2px; }
  .rb { width: 38px; } .rb span { display: none; }
  .ro { writing-mode: horizontal-tb; }
  .save { display: none; }
  main { margin-right: 0; padding: 26px 16px 70px; }
  .np-open main { margin-right: 0; }
  .np { width: 100%; top: var(--tbh); right: 0; }
  .title { font-size: 30px; }
  .head { gap: 14px; }
  .stats div { min-width: 66px; padding-right: 8px; }
  .stats dd { font-size: 24px; }
  .grid { grid-template-columns: 1fr; }
  .compact .grid { grid-template-columns: repeat(2, 1fr); }
  .hm { padding: 32px 20px 64px; margin-right: 0; }
  .hm-hero { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 28px; }
  .hm-hero .vcols { flex-direction: column; gap: 6px; }
  .hm-hero .vname { font-size: 42px; white-space: nowrap; }
  .hm-hero .vsub { letter-spacing: .3em; font-size: 11px; }
  .hm-hero .roman { margin: 4px 0 0; font-size: 11px; }
  .hm-field { flex-wrap: wrap; border-bottom: 0; box-shadow: none !important; } .hm-field input { flex-basis: 100%; border-bottom: 1px solid #fff; margin-bottom: 18px; }
  .hm-field input:focus { border-bottom-color: var(--accent); }
  .swatches { grid-template-columns: repeat(auto-fill, 76px); gap: 28px 14px; }
  .swatches a { height: 230px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print {
  .rail, .info-panel, .np, .frame-tools, .grip, .card-tools, .add-card, .add-seg { display: none !important; }
  main { margin: 0; }
  body { background: #fff; color: var(--ink); }
  body::before { display: none; }
  .title, .roman, .seg-head h2, .meta, .tlticks, .notes, .stats { color: var(--ink); }
  .card { break-inside: avoid; box-shadow: 0 0 0 1px var(--line); }
}
