:root {
  /* 全站固定純黑底白字(不跟隨系統深淺色)。--card 比底色亮一階,讓卡片 / 彈窗 / 輸入框在純黑上仍分得出來 */
  --bg: #000;
  --fg: #fff;
  --muted: #9a9a9a;
  --card: #161616;
  /* 毛玻璃(彈窗 / 回文卡片 / catalog 卡片共用):半透明底 + 模糊後方畫面 */
  --glass-bg: rgb(22 22 22 / .8);
  --glass-blur: blur(18px) saturate(1.2);
  --line: #2a2a2a;
  --accent: #df64ba;
  --quote: #7fcf8f;
  color-scheme: dark; /* 原生控制項(下拉選單、勾選框、捲軸)也用深色 */
}
* { box-sizing: border-box; }
/* 背景插圖:版務在後台 /mod/appearance 上傳(存在 R2,由 /api/background 提供);沒上傳時 404,url() 載入失敗 = 不顯示。
   建議上傳去背(透明底)的圖;透明度壓低只當氛圍、不干擾閱讀。固定在視窗右下,捲動時不動;pointer-events:none 不擋點擊 */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  /* bottom -12vh:整張往下沉,腳稍微超出畫面,頭部離頂端的標題列遠一點 */
  background: url("/api/background") no-repeat right 0 bottom -12vh / auto 100%;
  opacity: .25;
}
@media (max-width: 720px) {
  body::before { background-position: center bottom -12vh; opacity: .12; }
}
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.6 system-ui, "Noto Sans TC", sans-serif; }
a { color: var(--accent); }
/* 標題列固定在畫面最上方(sticky):要有不透明底色蓋住捲上去的內容;z-index 低於浮動彈窗(40/41)。
   scroll-padding-top 讓 #p123 這類錨點跳轉時,目標貼文不會被固定的標題列蓋住 */
/* scrollbar-gutter:永遠保留捲軸的位置。否則短頁(首頁)沒有捲軸、長頁(有文章的板)有捲軸,
   置中的標題列與內容會因為可用寬度差了一條捲軸而左右跳動 */
html { scroll-padding-top: 56px; scrollbar-gutter: stable; }
header.site { position: sticky; top: 0; z-index: 30; background: var(--bg); font-weight: 700; }
/* 與 main 用同樣的寬度基準(960px + 16px 內距),讓標題左緣跟文章內容左緣對齊,不要貼著視窗邊緣 */
header.site .site-inner {
  /* min-height = 上下 padding 10px×2 + 右上發文按鈕 34px:沒有發文按鈕的頁面(首頁等)標題列高度也一樣,不會忽高忽低 */
  max-width: 960px; min-height: 54px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 16px; flex-wrap: nowrap;
}
header.site a { text-decoration: none; }
/* 0u0n 與頁面標題(板名)同一列靠左;margin-right:auto 把右上的「發文」推到最右邊 */
header.site .site-title { display: flex; align-items: baseline; gap: 6px; min-width: 0; margin-right: auto; white-space: nowrap; }
header.site .site-title > * { flex-shrink: 0; }
header.site .site-title a { color: var(--accent); }
header.site .site-title .sep { color: var(--muted); font-weight: 400; }
/* 目前頁面(最後一段)太長時用 … 截斷,前面的路徑保持完整 */
header.site .site-title h1 { flex-shrink: 1; min-width: 0; margin: 0; font-size: 1em; overflow: hidden; text-overflow: ellipsis; }
header.site .site-title .aside { margin-left: 6px; }
/* 右上 icon 群(目前只有放大鏡;Layout 的 action 可再放其他動作):圓形 icon 按鈕,平常無底色無邊框,滑鼠移過去才有淡淡的底色 */
.site-tools { flex-shrink: 0; display: flex; align-items: center; gap: 2px; }
.icon-btn {
  list-style: none; display: flex; align-items: center; justify-content: center; cursor: pointer;
  width: 34px; height: 34px; border-radius: 999px; color: var(--accent); background: none;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover, .icon-btn:focus-visible { background: var(--card); }

/* 搜尋列:平常藏起來;header.searching 時取代整條標題列(目前位置、右上 icon 都藏起來)。
   沒有框、沒有底色,只有一條底線;左邊放大鏡、右邊 ✕,跟右上 icon 同一套線條風格 */
.site-search { display: none; flex: 1; min-width: 0; align-items: center; gap: 10px; }
.site-search:focus-within { border-bottom-color: var(--accent); }
.site-search > svg { flex-shrink: 0; width: 18px; height: 18px; color: var(--muted); }
.site-search-input {
  flex: 1; min-width: 0; height: 34px; padding: 0;
  font: inherit; font-weight: 400; font-size: .95em; color: var(--fg);
  background: none; border: 0; border-radius: 0; outline: none;
}
.site-search-input::placeholder { color: var(--muted); }
.site-search-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; } /* 用自己的 ✕ */
.site-search-close {
  flex-shrink: 0; width: 34px; height: 34px; font-size: 1.05em; line-height: 1;
  color: var(--muted); background: none; border: 0; border-radius: 999px; cursor: pointer;
}
.site-search-close:hover { color: var(--accent); background: var(--card); }
header.site.searching .site-title, header.site.searching .site-tools { display: none; }
header.site.searching .site-search { display: flex; }
main { max-width: 960px; margin: 0 auto; padding: 8px; }

/* ---- 左側看板目錄(桌面版,見 layout.tsx):跟主內容排成一組、整組置中,目錄緊貼在主內容的左邊 ----
   body 變成置中的 flex:目錄(sticky、自己捲動)+ #page(標題列 + 內容,最寬 960px)。視窗不夠寬時 #page 先縮。
   窄螢幕不顯示(--sidebar-w = 0),改用標題列裡的 .board-strip。
   --sidebar-w 也給固定定位的輸入列 / 提示用:整組置中時,內容區的中心 = 視窗中心往右 --sidebar-w / 2 */
.sidebar { display: none; }
@media (min-width: 1024px) {
  body.has-sidebar { --sidebar-w: 200px; display: flex; justify-content: center; align-items: flex-start; }
  body.has-sidebar #page { flex: 0 1 960px; min-width: 0; }
  body.has-sidebar .sidebar {
    display: block; position: sticky; top: 0; z-index: 31; flex: 0 0 var(--sidebar-w); height: 100vh;
    overflow-y: auto; overscroll-behavior: contain; background: var(--bg);
  }
  body.has-sidebar .board-strip { display: none; }
}
/* 跟右邊的標題列同高,文字垂直位置對齊 */
.sidebar-head { height: 55px; display: flex; align-items: center; padding: 0 16px; color: var(--muted); font-weight: 700; }
.sidebar ul { list-style: none; margin: 0; padding: 0px 0; }
.sidebar a { display: flex; align-items: baseline; gap: 8px; padding: 6px 16px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar a:hover .board-name { text-decoration: underline; }
/* 目前所在的板:只用文字顏色標示(板名跟代號一樣變成強調色),不加底色或色條 */
.sidebar a[aria-current="page"] .board-name { color: var(--accent); }
.sidebar a.htmx-request { opacity: .6; } /* 換頁載入中 */
/* 窄螢幕的看板切換列(在標題列裡,跟著固定在最上面):橫向捲動,不換行。
   標題列變高了,錨點跳轉(#p123)要多留一點空間,不然目標貼文會被蓋住 */
@media (max-width: 1023px) {
  html:has(.board-strip) { scroll-padding-top: 104px; }
}
.board-strip { display: flex; gap: 6px; overflow-x: auto; padding: 0 16px 10px; font-weight: 400; scrollbar-width: none; }
.board-strip a { flex-shrink: 0; padding: 4px 12px; border-radius: 999px; background: var(--card); text-decoration: none; white-space: nowrap; }
.board-strip a[aria-current="page"] { box-shadow: inset 0 0 0 1px var(--accent); }
.menu { margin: 0 auto; padding: 8px; }
h1 { font-size: 1.3rem; margin: 0 0 12px; }
/* 首頁看板列表:「/b/ 綜合  混亂邪惡的根據地 (づ′▽`)づ」——代號、板名、說明(含顏文字)排成一行,不用破折號 */
.boards { list-style: none; padding: 0; }
.boards li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 6px 0; }
.boards a { text-decoration: none; }
.boards a:hover .board-name { text-decoration: underline; }
.board-slug { color: var(--accent); }
.board-name { color: var(--fg); font-weight: 700; }
.desc { color: var(--muted); }

/* minmax(0, 1fr):grid 欄位預設最小寬度 = 內容寬度,Turnstile(最小 300px)、原生檔案選擇器這類不會縮的元素
   會把整個表單撐得比彈窗寬(小手機上輸入框跑出畫面);鎖成 0 起算,欄寬才會跟著彈窗 */
.post-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 8px; max-width: 640px; }
.post-form > * { min-width: 0; }
/* 輸入框不畫邊框,只用底色跟面板區隔;focus 時才出現強調色外框 */
.post-form input:not([type=checkbox]):not([type=file]), .post-form textarea, .post-form select, .post-form .file-field {
  width: 100%; box-sizing: border-box; padding: 8px 10px; font: inherit; color: inherit;
  background: var(--card); border: 0; border-radius: 6px;
}
/* 欄位底色要跟所在的底不同才看得出來:一般頁面(檢舉頁)的底是 --bg,欄位用 --card;
   浮動彈窗的底是 --card,欄位反過來用 --bg */
.post-form textarea { resize: vertical; }
.post-form :is(input, textarea, select):focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.post-form label { display: grid; gap: 2px; color: var(--muted); font-size: .9em; }
.post-form .file-field { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; cursor: pointer; }
.post-form .file-field input { min-width: 0; max-width: 100%; font-size: .9em; color: var(--muted); }
.post-form .file-field input::file-selector-button {
  margin-right: 8px; padding: 3px 10px; font: inherit; color: var(--fg);
  background: var(--card); border: 0; border-radius: 4px; cursor: pointer;
}
.post-form .file-field .hint { margin-left: auto; font-size: .8em; }
/* Turnstile 是第三方 iframe,內部樣式改不了;interaction-only 讓它平常隱藏,只在需要人工驗證時才出現 */
.post-form .cf-turnstile { border-radius: 6px; overflow: hidden; }
.post-form label.sage { display: inline-flex; gap: 4px; align-items: center; }
.post-form .actions { display: flex; gap: 12px; align-items: center; justify-content: flex-end; }
.post-form button {
  padding: 6px 18px; font: inherit; cursor: pointer;
  color: #fff; background: var(--accent); border: 0; border-radius: 6px;
}
.post-form button:hover { filter: brightness(1.08); }
.form-error { color: #c0392b; min-height: 0; }

.catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 16px; }
.card { display: block; padding: 10px 12px; background: var(--glass-bg); border: 1px solid var(--line); border-radius: 6px; color: inherit; text-decoration: none; }
.card:hover { border-color: var(--accent); }
.card .subject { font-weight: 700; overflow-wrap: anywhere; }
.card .excerpt { color: var(--muted); font-size: .9em; overflow-wrap: anywhere; margin: 4px 0; }
.card .stats { color: var(--muted); font-size: .8em; }

/* minmax(0, 1fr):grid 欄位預設最小寬度 = 內容寬度,.meta 不換行時會把整欄撐出畫面外;
   鎖成 0 起算,欄寬才會跟著螢幕,.meta 的 … 截斷 / 橫向滑動才會生效 */
.thread { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.post { padding: 8px 12px; min-width: 0; }
/* 被選取(#p123)的貼文:用 box-shadow 畫框,一定會跟著 border-radius 變圓角(outline 在較舊的瀏覽器是直角);
   OP 本身沒有圓角,所以 :target 時補上跟回文卡片一樣的 6px */
.post:target { border-radius: 6px; box-shadow: 0 0 0 2px var(--accent); }
/* OP 融入頁面背景、不畫框;回覆才用卡片樣式(底色 + 外框)區隔,而且不縮排,跟 OP 對齊 */
.post.op { background: transparent; border: none; }
.post.reply { background: var(--glass-bg); border: 1px solid var(--line); border-radius: 6px; }
/* 標題列固定一行不換行(手機也是)。按鈕([回應]/[檢舉])跟 No. 永遠完整顯示、不縮;
   空間不夠時由標題 / 名稱 / ID 先用 … 截斷,手機上時間也只留 MM/DD HH:MM(見 post.tsx 的 Time)。 */
.meta {
  display: flex; flex-wrap: nowrap; align-items: baseline; gap: 10px; white-space: nowrap;
  overflow: hidden; color: var(--muted); font-size: .85em;
}
.meta > * { flex-shrink: 0; }
.meta .subject, .meta .name, .meta .uid { flex-shrink: 1; min-width: 1.5em; overflow: hidden; text-overflow: ellipsis; }
.meta .subject { color: var(--accent); font-weight: 700; }
.meta .name { color: var(--quote); font-weight: 700; }
.meta .no, .meta .reply-btn, .meta .report, .meta .uid { font-size: .9em; }
.t-sep { display: none; }
@media (max-width: 480px) {
  .meta { gap: 6px; font-size: .78em; }
  .meta .t-opt { display: none; }
  .meta .t-sep { display: inline; }
}
.body { margin-top: 6px; overflow-wrap: anywhere; }
.body .line { min-height: 1.2em; white-space: pre-wrap; }
.body .quote { color: var(--quote); }
/* 標籤:內文下面一排 #標籤 連結(點了搜尋同板同標籤) */
.tags { clear: both; display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 6px 0 0; font-size: .85em; }
.tag { color: var(--accent); text-decoration: none; }
.tag:hover { text-decoration: underline; }
/* 推文(PTT 風格的一行短訊息):在內文下面、「回應:>>N」上面。跟 .backlinks 一樣要 clear 掉附圖的 float,
   才會排在整篇貼文最下面,而不是被擠到圖片右邊 */
.pushes { clear: both; list-style: none; margin: 6px 0 0; padding: 0; font-size: .88em; }
.pushes:empty { display: none; }
.push, .push-form { display: flex; align-items: baseline; gap: 8px; padding: 2px 0; }
/* 點了跟 .meta .uid 一樣,查這個 ID 發過的所有文章/推文(/id/:uid) */
.push-uid { flex-shrink: 0; color: var(--quote); font-family: ui-monospace, monospace; font-size: .92em; text-decoration: none; }
.push-uid:hover { text-decoration: underline; }
.push-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.push time { flex-shrink: 0; color: var(--muted); font-size: .85em; }
.push-form { clear: both; margin-top: 4px; font-size: .88em; }
.push-form input {
  flex: 1; min-width: 0; padding: 2px 0; font: inherit; color: var(--fg);
  background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; outline: none;
}
.push-form input:focus { border-bottom-color: var(--accent); }
.push-form button { flex-shrink: 0; padding: 0 4px; font: inherit; color: var(--accent); background: none; border: 0; cursor: pointer; }
.push-form button:disabled { opacity: .5; cursor: default; }
.push-form .push-cancel { color: var(--muted); }
.push-form .push-cancel:hover { color: var(--fg); }
.push-error { flex-basis: 100%; color: #e57373; font-size: .9em; }
.push-error:empty { display: none; }
.push-form { flex-wrap: wrap; }
/* [刪除](只有發文者自己看得到):跟 [檢舉] 一樣是純文字方括號連結的樣子 */
.meta .del-form { display: inline; margin: 0; }
.meta .del-btn { padding: 0; font: inherit; font-size: .9em; color: var(--muted); background: none; border: 0; cursor: pointer; }
.meta .del-btn:hover { color: #e57373; text-decoration: underline; }
/* [推文] 跟 [回應] / [檢舉] 一樣是純文字方括號連結的樣子(它是 button,要把按鈕外觀拿掉) */
.meta .push-btn { padding: 0; font: inherit; font-size: .9em; color: var(--accent); background: none; border: 0; cursor: pointer; }
.meta .push-btn:hover { text-decoration: underline; }
/* clear:both 是關鍵:貼文有附圖時,.attachment 用 float:left,只有 .post::after 在整篇貼文最後才清 float。
   沒有自己 clear 的話,.backlinks 內文夠短時會被擠去圖片右邊,而不是乖乖排在貼文最下面。 */
.backlinks { clear: both; margin-top: 6px; font-size: .85em; display: flex; gap: 8px; flex-wrap: wrap; }
.backlinks::before { content: "回應:"; color: var(--muted); }

.attachment { float: left; margin: 6px 12px 6px 0; max-width: 260px; }
.attachment img { display: block; border: 1px solid var(--line); border-radius: 4px; background: var(--card); }
.attachment figcaption { color: var(--muted); font-size: .75em; overflow-wrap: anywhere; }
.post::after { content: ""; display: block; clear: both; }
.card .thumb { display: block; max-width: 100%; max-height: 160px; margin: 0 auto 6px; border-radius: 4px; }

.notice { color: var(--quote); margin: 8px 0; }
.notice:empty { display: none; }
/* 回覆送出後的浮動提示(討論串頁的 #form-notice):固定在畫面下方中央,蓋在內容上 */
.notice.toast {
  position: fixed; left: calc(50% + var(--sidebar-w, 0px) / 2); bottom: 24px; transform: translateX(-50%); z-index: 50; margin: 0;
  width: max-content; max-width: calc(100% - var(--sidebar-w, 0px) - 32px); padding: 10px 16px; border-radius: 8px;
  background: var(--card); box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
}

/* 版務後台 */
.modnav { display: flex; gap: 16px; align-items: center; margin-bottom: 12px; }
.modnav .whoami { margin-left: auto; color: var(--muted); font-size: .85em; }
.modcard { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; margin: 8px 0; overflow: hidden; }
.modcard.st-hidden, .modcard.st-deleted { opacity: .85; }
.modcard .excerpt, .modtext { white-space: pre-wrap; overflow-wrap: anywhere; }
.modtext { font: inherit; margin: 6px 0 0; }
.badge { padding: 0 6px; border: 1px solid var(--line); border-radius: 10px; font-size: .8em; }
.badge.urgent { background: #c0392b; color: #fff; border-color: #c0392b; }
.urgent-box { border: 2px solid #c0392b; border-radius: 6px; padding: 4px 12px 8px; margin-bottom: 16px; }
.muted { color: var(--muted); }
.modimg { float: left; margin: 4px 12px 4px 0; max-width: 240px; max-height: 240px; cursor: pointer; filter: blur(24px); }
.modimg.revealed { filter: none; }
.actions-box .row { display: flex; gap: 8px; flex-wrap: wrap; }
button.danger { color: #fff; background: #c0392b; border: 1px solid #c0392b; border-radius: 4px; }
form.inline { display: inline; margin-left: 12px; }
.modlog { border-collapse: collapse; width: 100%; font-size: .9em; }
.modlog th, .modlog td { border-bottom: 1px solid var(--line); padding: 4px 8px; text-align: left; }
.bans { list-style: none; padding: 0; }
.bans li { padding: 6px 0; border-bottom: 1px solid var(--line); }

/* 國旗:Windows 內建的 emoji 字型沒有國旗(會顯示成「TW」兩個字母),所以網站自帶只含國旗的 Twemoji 字型。
   unicode-range 只涵蓋國旗用的 Regional Indicator 字元:頁面上真的出現國旗時瀏覽器才會下載(約 78KB),
   其他文字與 emoji(例如 Tor 的 🧅)照常用系統字型。授權見 public/vendor/TwemojiCountryFlags.LICENSE.txt */
@font-face {
  font-family: "Twemoji Country Flags";
  src: url("/vendor/TwemojiCountryFlags.woff2") format("woff2");
  unicode-range: U+1F1E6-1F1FF, U+E0062-E007F, U+1F3F4;
  font-display: swap;
}
.meta .flag { font-family: "Twemoji Country Flags", "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-size: 1.1em; cursor: help; }

/* 展開式討論串列表(取代舊卡片牆當預設頁,見 BoardIndexPage) */
.view-toggle { font-size: .7em; font-weight: 400; color: var(--muted); }
/* 串與串之間不畫分隔線,只用留白隔開 */
.idx-thread { margin: 0 0 40px; }
.idx-thread:last-child { margin-bottom: 0; }
/* 主文章與回覆的間距沿用完整討論串頁同一份 .thread(grid + gap),不要另外用 margin-top 湊,
   否則兩邊各用一套機制,日後很容易兜不齊。這裡只需取消 .thread 自帶的 margin-top(那是給完整討論串頁,
   跟上面的「回覆」切換區塊留白用的;在列表頁,跟上一串的間距已經由 .idx-thread 的 margin 負責)。 */
.idx-thread .thread { margin-top: 0; }
.idx-footer { color: var(--muted); font-size: .85em; margin: 8px 0 0; }
/* 分頁:沒有框線;箭頭只有 icon,頁碼是數字,目前頁用淡淡的底色標出來 */
.pagination { display: flex; justify-content: center; align-items: center; gap: 4px; margin: 20px 0 8px; color: var(--muted); font-size: .95em; }
.pagination .page-icon, .pagination .page-num {
  display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 34px; padding: 0 6px;
  border-radius: 999px; color: var(--accent); text-decoration: none;
}
.pagination .page-icon svg { width: 18px; height: 18px; }
.pagination a:hover { background: var(--card); }
.pagination .page-num.current { color: var(--fg); font-weight: 700; background: var(--card); }
.pagination .disabled { color: var(--muted); opacity: .35; }

/* 「回應」跟「檢舉」一樣是純文字連結(方括號 [回應]),不另外畫框/底色,見 .meta .no/.reply-btn/.report */

/* 進站確認頁(見 pages.tsx 的 GatePage) */
.gate { max-width: 560px; margin: 24px auto; }
.gate h1 { font-size: 1.3em; }
.gate-rules { padding-left: 1.4em; line-height: 1.7; }
.gate-rules li + li { margin-top: 4px; }
.post-form label.gate-check { display: flex; gap: 8px; align-items: flex-start; color: var(--fg); font-size: 1em; cursor: pointer; }
.gate-check input { margin-top: .35em; }

/* 毛玻璃:要輸入文字的彈窗、疊在背景插圖上的回文 / catalog 卡片都用同一套。
   只用半透明的話,後面的插圖會清楚透出來跟文字打架;模糊後只剩色塊,保留通透感又好讀。
   不支援 backdrop-filter 的瀏覽器退回幾乎不透明的深灰,仍然可讀 */
.post.reply, .card {
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .post.reply, .card { background: rgb(22 22 22 / .95); }
}

/* 引用預覽(滑鼠移到 >>123 上,見 app.js):浮在內容之上、標題列之上,但在發文彈窗(40/41)之下。
   pointer-events:none:預覽只是看的,不會擋到滑鼠、也不會因為滑鼠碰到它而閃爍 */
.quote-preview {
  position: fixed; z-index: 35; pointer-events: none;
  width: max-content; max-width: min(640px, calc(100vw - 16px)); max-height: 70vh; overflow: hidden;
  background: var(--glass-bg); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}
/* 預覽框本身已經有底色和外框,裡面那篇貼文不再畫一次卡片 */
.quote-preview .post { background: none; border: 0; outline: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.quote-preview.missing { padding: 8px 12px; color: var(--muted); font-size: .9em; }

/* 搜尋結果頁 */
.search-summary { margin: 0 0 12px; }
.search-hit { margin-bottom: 12px; }
.search-where { margin: 0 0 4px; font-size: .85em; }
/* /id/:uid 查詢頁裡的推文結果:跟文章結果共用 .search-hit / .search-where,內文用一行純文字 + 時間 */
.id-push-text { margin: 0; overflow-wrap: anywhere; }
.id-push-text time { color: var(--muted); font-size: .85em; margin-left: 6px; }

/* 圖片大圖預覽(滑鼠移到縮圖上,見 app.js):大小 / 位置由 JS 依原圖尺寸跟畫面空間算好 */
.image-preview {
  position: fixed; z-index: 36; pointer-events: none;
  background: var(--card); border-radius: 6px; overflow: hidden; box-shadow: 0 10px 30px rgba(0, 0, 0, .6);
}
.image-preview img { display: block; width: 100%; height: 100%; object-fit: contain; }

/* 版務:看板管理 */
.board-admin h2 { font-size: 1.05em; margin: 4px 0 8px; }
.board-admin .post-form { max-width: none; }
.board-admin .board-delete { margin-top: 12px; }
.board-admin .board-delete .actions { justify-content: flex-start; }

/* 版務:貼文管理 */
.mod-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.mod-filter select, .mod-filter input { padding: 6px 10px; font: inherit; color: var(--fg); background: var(--card); border: 0; border-radius: 6px; }
.mod-filter input { flex: 1; min-width: 160px; }
.mod-filter button, .mod-bulk button, .mod-post-actions button {
  padding: 4px 12px; font: inherit; font-size: .9em; color: var(--fg); background: var(--card);
  border: 1px solid var(--line); border-radius: 6px; cursor: pointer;
}
.mod-bulk { position: sticky; top: 56px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 8px 0; background: var(--bg); }
.mod-post .meta { flex-wrap: wrap; white-space: normal; overflow: visible; }
.mod-post-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; clear: both; }
.mod-post-actions a { font-size: .9em; }
.mod-bulk button.danger, .mod-post-actions button.danger { color: #fff; background: #c0392b; border-color: #c0392b; }

/* ---- 小尺寸手機 ---- */

/* Turnstile 的 flexible 尺寸最小 300px,320px 寬的手機扣掉彈窗邊距放不下:
   等比例縮小(只縮視覺,點擊區域跟著縮),並把縮掉的高度收回來;overflow 是最後一道防線 */
.post-form .cf-turnstile { max-width: 100%; overflow: hidden; }
@media (max-width: 380px) {
  .post-form .cf-turnstile { width: 118%; transform: scale(.85); transform-origin: left top; margin-bottom: -10px; overflow: visible; }
}

/* iOS Safari 在輸入框字級小於 16px 時,點進去會自動放大畫面(而且不會縮回來)。
   觸控裝置上所有輸入框一律 16px;桌面維持原本比較小的字級 */
@media (pointer: coarse) {
  input:not([type=checkbox]):not([type=radio]), textarea, select { font-size: 16px !important; }
}
.bg-preview { display: block; max-width: 240px; max-height: 320px; margin: 4px 0 8px; border-radius: 6px; background: #000; }

/* ---- 討論串頁的聊天式回覆輸入列(#composer,見 pages.tsx 的 Composer、app.js) ---- */
/* 固定在畫面下方中間,跟 main 同寬;毛玻璃底,跟其他卡片一致。z-index 在標題列(30)之下、彈窗(40)之下 */
.composer {
  position: fixed; left: calc(50% + var(--sidebar-w, 0px) / 2); bottom: calc(12px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
  width: min(928px, calc(100% - var(--sidebar-w, 0px) - 16px)); padding: 6px;
  display: flex; flex-direction: column; gap: 6px;
  background: var(--glass-bg); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 8px 28px rgba(0, 0, 0, .5);
}
.composer-spacer { height: 66px; }
.composer-bar { display: flex; align-items: flex-end; gap: 2px; }
.composer-bar textarea {
  flex: 1; min-width: 0; min-height: 34px; max-height: 9.5em; padding: 6px 8px; resize: none; overflow-y: auto;
  font: inherit; line-height: 1.45; color: var(--fg); background: none; border: 0; outline: none;
}
.composer-bar textarea::placeholder { color: var(--muted); }
/* 「附加圖片」在 + 展開的詳細設定裡:整個 label 就是 file input 的按鈕,真正的 input 藏起來 */
.composer-attach {
  position: relative; flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  color: var(--accent); font-size: .9em;
}
.composer-attach svg { width: 18px; height: 18px; }
.composer-attach:hover span { text-decoration: underline; }
.composer-attach input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.composer .icon-btn { flex-shrink: 0; padding: 0; border: 0; }
/* + 打開時轉 45 度變成 ×,表示再按一次收起 */
.composer-more svg { transition: transform .15s ease; }
.composer-more[aria-expanded="true"] svg { transform: rotate(45deg); }
/* 送出:只有 › 箭頭 icon,沒有底色、沒有邊框(滑鼠移過去才有淡淡的圓形底色,跟其他 icon 一致) */
.composer .composer-send svg { width: 22px; height: 22px; }
.composer .composer-send:disabled { opacity: .4; cursor: default; }
/* 清除內容:灰色的重設 icon,只有輸入列有內容時才出現(app.js 控制 hidden) */
.composer .composer-reset { color: var(--muted); }
.composer .composer-reset:hover { color: var(--fg); }
.composer .composer-reset svg { width: 18px; height: 18px; }
.composer .composer-reset[hidden] { display: none; }
.composer.sending .composer-send svg { animation: composer-pulse .9s ease-in-out infinite; }
@keyframes composer-pulse { 50% { opacity: .35; } }

/* 詳細設定:第一行「附加圖片 …… sage」,第二行「名稱|標籤」並排 */
.composer-extra { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 4px 8px 0; }
.composer-fields { flex: 1 0 100%; display: flex; gap: 12px; }
/* 開新串:標題跟「附加圖片」同一行,佔滿剩下的寬度 */
.composer-extra .composer-subject { flex: 1 1 200px; }
.composer-fields input { flex: 1 1 0; }
.composer-extra input:not([type=checkbox]) {
  min-width: 0; padding: 4px 0; font: inherit; font-size: .9em; color: var(--fg);
  background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; outline: none;
}
.composer-extra input:not([type=checkbox]):focus { border-bottom-color: var(--accent); }
.composer-extra .sage { display: inline-flex; gap: 4px; align-items: center; color: var(--muted); font-size: .9em; }

.composer-preview { display: flex; align-items: center; gap: 10px; padding: 4px 8px 0; font-size: .85em; color: var(--muted); }
.composer-preview img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; background: #000; }
.composer-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-file-clear { padding: 2px 6px; color: var(--muted); background: none; border: 0; cursor: pointer; }
.composer-file-clear:hover { color: var(--accent); }

.composer-challenge { padding: 6px 8px 0; }
.composer-challenge p { margin: 0 0 6px; font-size: .85em; }
.composer-error { padding: 0 8px; color: #e57373; font-size: .85em; }
.composer-error:empty { display: none; }
[hidden].composer-extra, [hidden].composer-preview, [hidden].composer-challenge { display: none; }

/* 送出成功提示浮在輸入列上方,不要被蓋住 */
.notice.toast.above-composer { bottom: calc(96px + env(safe-area-inset-bottom)); }
