/* MilkTeaBBS 轉錄工具：與 bbs-gateway 同一套配色（兄弟站） */
:root {
  --accent-color: #0066cc;
  --tea: #d97706;            /* 米博士暖橘 */
  --tea-dark: #b45309;
  --tea-ink: #78350f;
  --tea-wash: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  --tea-line: #fde68a;
  --tea-glow: rgba(217, 119, 6, 0.42);
  --tea-glow-far: rgba(217, 119, 6, 0.16);
  --bg-color: #f8f9fa;
  --card-bg: #ffffff;
  --text-color: #333333;
  --text-muted: #666666;
  --border-color: #e0e0e0;
  --input-border: #cfcfcf;
  --danger: #b91c1c;
  --danger-wash: #fef2f2;
  --screen: #000000;
  --shade: rgba(248, 249, 250, 0.35);
  --rail: 76px;               /* 收起時左邊露出的寬度 */
  --open: 85%;                /* 疊層展開時左邊的寬度 */
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --tea-ink: #fde68a;
    --tea-wash: linear-gradient(135deg, #2a2112 0%, #33270f 100%);
    --tea-line: #6b4a12;
    --bg-color: #15130f;
    --card-bg: #211d17;
    --text-color: #ece8e1;
    --text-muted: #a9a29a;
    --border-color: #3a342b;
    --input-border: #4a4238;
    --danger: #f87171;
    --danger-wash: #2c1515;
    --shade: rgba(21, 19, 15, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --tea-ink: #fde68a; --tea-wash: linear-gradient(135deg, #2a2112 0%, #33270f 100%); --tea-line: #6b4a12;
  --bg-color: #15130f; --card-bg: #211d17; --text-color: #ece8e1; --text-muted: #a9a29a;
  --border-color: #3a342b; --input-border: #4a4238; --danger: #f87171; --danger-wash: #2c1515;
  --shade: rgba(21, 19, 15, 0.35); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang TC", "Microsoft JhengHei", sans-serif;
  line-height: 1.6; color: var(--text-color); background: var(--bg-color);
  display: flex; flex-direction: column;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--tea); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-muted); }

/* ---------- 頂部列（與 gateway 相同） ---------- */
.topbar {
  background: var(--card-bg); border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.25rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; flex: none;
}
.brand { display: flex; align-items: center; gap: 0.75rem; margin-right: auto; }
.avatar {
  width: 2.75rem; height: 2.75rem; border-radius: 0.85rem; flex: none;
  background: linear-gradient(160deg, #fff7e6, #f6dfb5);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06), 0 2px 5px rgba(0, 0, 0, 0.08);
  display: grid; place-items: center; font-size: 1.5rem; line-height: 1;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 1.05rem; }
.brand-text small { color: var(--text-muted); font-size: 0.8rem; }

.dock { display: flex; gap: 0.35rem; align-items: flex-start; --here: #f97316; --here-text: #c2410c; --here-glow: rgba(249, 115, 22, 0.28); }
.dock-item {
  display: flex; flex-direction: column; align-items: center; gap: 0.2rem;
  width: 5.4rem; padding: 0.25rem 0.1rem 0.45rem; border-radius: 10px;
  color: var(--text-muted); position: relative; transition: transform .18s ease, color .18s ease;
}
.dock-icon {
  width: 2.5rem; height: 2.5rem; border-radius: 0.8rem; display: grid; place-items: center; font-size: 1.45rem; line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06), 0 2px 5px rgba(0, 0, 0, 0.08);
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.dock-label { font-size: 0.72rem; line-height: 1.2; white-space: nowrap; }
.t-www .dock-icon { background: linear-gradient(160deg, #fff0f5, #fbd3e0); }
.t-bbs .dock-icon { background: linear-gradient(160deg, #fff7e6, #f6dfb5); }
.t-mud .dock-icon { background: linear-gradient(160deg, #eefbe9, #cfeec3); }
.t-yt  .dock-icon { background: linear-gradient(160deg, #eaf4ff, #cfe4fb); }
.dock-item:hover { transform: translateY(-3px); color: var(--text-color); }
.dock-item.current { color: var(--here-text); font-weight: 600; }
.dock-item.current .dock-icon { box-shadow: inset 0 0 0 2px var(--here), 0 2px 6px var(--here-glow); }
.dock-item.current::after {
  content: ""; position: absolute; bottom: 0; left: 50%; width: 5px; height: 5px;
  margin-left: -2.5px; border-radius: 50%; background: var(--here);
}

/* 電子佈告欄的下拉：滑鼠移上去（或鍵盤選到、手機點一下）時，下方左右並排兩個選項 */
.dock-group { position: relative; display: flex; }
.dock-pop {
  position: absolute; top: 100%; left: 50%; z-index: 30;
  display: flex; gap: 0.35rem; padding: 0.4rem; margin-top: 6px;
  background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
  opacity: 0; visibility: hidden; transform: translate(-50%, -4px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
}
.dock-pop::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; height: 10px; } /* 滑鼠往下移時不會中途斷掉 */
.dock-group:hover .dock-pop, .dock-group:focus-within .dock-pop, .dock-group.open .dock-pop {
  opacity: 1; visibility: visible; transform: translate(-50%, 0);
}
.dock-pop a {
  white-space: nowrap; padding: 0.4rem 0.8rem; border-radius: 7px; font-size: 0.85rem;
  color: var(--text-color); border: 1px solid var(--border-color); background: var(--bg-color);
}
.dock-pop a:hover, .dock-pop a:focus-visible { border-color: var(--tea); color: var(--tea-dark); }
.dock-pop a[aria-current="page"] { background: var(--tea); border-color: var(--tea); color: #fff; font-weight: 600; }

.menu-wrap { position: relative; }
.menu-btn {
  width: 40px; height: 40px; border-radius: 6px; border: 1px solid var(--border-color);
  background: var(--card-bg); font-size: 1.25rem; line-height: 1; cursor: pointer;
}
.menu-btn[aria-expanded="true"] { border-color: var(--tea); color: var(--tea-dark); }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 200px; padding: 0.4rem;
  background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.menu button { display: block; width: 100%; text-align: left; padding: 0.55rem 0.75rem; border: 0; border-radius: 6px; background: none; cursor: pointer; }
.menu button:hover, .menu button:focus-visible { background: var(--bg-color); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--border-color); margin: 0.3rem 0; }

/* ---------- 按鈕與表單（與 gateway 相同） ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.6rem 1.1rem; min-height: 42px; border-radius: 6px; border: 1px solid transparent; cursor: pointer; font-weight: 600;
}
.btn-tea { background: var(--tea); color: #fff; box-shadow: 0 2px 6px rgba(217, 119, 6, 0.25); }
.btn-tea:hover { background: var(--tea-dark); }
.btn-tea:disabled { background: #e5a55a; box-shadow: none; cursor: not-allowed; opacity: 0.7; }
.btn-plain { background: var(--card-bg); border-color: var(--border-color); color: var(--text-color); }
.btn-plain:hover { border-color: #bdbdbd; }
.btn-block { width: 100%; }
.btn-sm { min-height: 32px; padding: 0.3rem 0.7rem; font-size: 0.85rem; }
.link { border: 0; background: none; color: var(--tea-dark); cursor: pointer; text-decoration: underline; }

input[type=text], input[type=password] {
  width: 100%; padding: 0.6rem 0.75rem; font: inherit; color: var(--text-color);
  border: 1px solid var(--input-border); border-radius: 6px; background: var(--card-bg);
}
input:focus-visible { outline: 3px solid rgba(217, 119, 6, 0.3); outline-offset: 0; border-color: var(--tea); }
input:disabled { background: var(--bg-color); color: var(--text-muted); cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field > span { font-weight: 600; font-size: 0.95rem; }
.check, .radio { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.check input, .radio input { width: 1.05rem; height: 1.05rem; accent-color: var(--tea); flex: none; }
.form-error { background: var(--danger-wash); border: 1px solid #fecaca; color: var(--danger); border-radius: 6px; padding: 0.55rem 0.75rem; font-size: 0.92rem; }

/* ---------- 主內容 ---------- */
.page {
  flex: 1; min-height: 0; width: 100%; max-width: 1920px; margin: 0 auto;
  padding: 1rem 1.25rem 1.25rem; display: flex; flex-direction: column; gap: 0.85rem;
}

/* 兩種轉錄方式的切換（網頁轉錄／站對站轉錄） */
.modes { display: flex; gap: 0.35rem; flex: none; }
.modes a {
  padding: 0.35rem 0.9rem; border-radius: 999px; font-size: 0.88rem;
  border: 1px solid var(--border-color); background: var(--card-bg); color: var(--text-muted);
}
.modes a:hover { border-color: var(--tea); color: var(--tea-dark); }
.modes a[aria-current="page"] { background: var(--tea); border-color: var(--tea); color: #fff; font-weight: 600; }

/* 網址列 */
.urlbar { display: grid; grid-template-columns: 1fr auto auto; gap: 0.5rem 0.6rem; align-items: center; flex: none; }
.urlbar input { font-size: 1rem; padding: 0.65rem 0.85rem; }
.urlbar-hint { grid-column: 1 / -1; font-size: 0.85rem; color: var(--text-muted); min-height: 1.4em; }
.urlbar-hint.ok { color: var(--tea-dark); }
.urlbar-hint.err { color: var(--danger); }

/* ---------- 工作區 ---------- */
.workspace { position: relative; flex: 1; min-height: 540px; }

.pane {
  background: var(--card-bg); border-radius: 12px;
  box-shadow: 0 0 0 1px var(--border-color);
  transition: box-shadow .15s ease, width .28s ease, flex-basis .28s ease, left .28s ease;
  overflow: hidden; outline: none;
}
/* 焦點所在的半邊：奶茶色發光 */
.workspace[data-focus="left"] .pane-left,
.workspace[data-focus="right"] .pane-right {
  box-shadow: 0 0 0 3px var(--tea), 0 0 16px 3px var(--tea-glow), 0 0 44px 12px var(--tea-glow-far);
}
.pane.pop { animation: glow-pop .32s ease-out; }
@keyframes glow-pop {
  0%   { box-shadow: 0 0 0 4px var(--tea), 0 0 26px 8px var(--tea-glow), 0 0 70px 22px var(--tea-glow-far); }
  100% { box-shadow: 0 0 0 3px var(--tea), 0 0 16px 3px var(--tea-glow), 0 0 44px 12px var(--tea-glow-far); }
}

/* 左側 */
.pane-left { display: flex; flex-direction: column; z-index: 3; }
.left-inner { flex: 1; min-height: 0; display: flex; flex-direction: column; min-width: 520px; }
.left-head { display: flex; align-items: center; gap: 0.75rem; min-width: 0; padding: 0.7rem 0.85rem 0.5rem; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--border-color); border-radius: 7px; overflow: hidden; flex: none; }
.seg button { border: 0; background: var(--card-bg); padding: 0.28rem 0.85rem; font-size: 0.88rem; cursor: pointer; color: var(--text-muted); }
.seg button + button { border-left: 1px solid var(--border-color); }
.seg button[aria-pressed="true"] { background: var(--tea); color: #fff; font-weight: 600; }
.src { font-size: 0.85rem; color: var(--text-muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.title-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 0.6rem; padding: 0 0.85rem 0.6rem; }
.title-row label { font-size: 0.88rem; font-weight: 600; }
.title-row input { padding: 0.4rem 0.6rem; }
.bytes { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bytes.over { color: var(--danger); font-weight: 600; }

.doc { position: relative; flex: 1; min-height: 0; margin: 0 0.85rem; border-radius: 8px; background: var(--screen); overflow: auto; }
.doc-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #8a8a8a; padding: 2rem; text-align: center; }
.screen-doc { padding: 10px 12px; width: max-content; min-width: 100%; }
.loading {
  position: absolute; inset: 0; background: rgba(0, 0, 0, 0.82); color: #f3e7d3;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.4rem;
}
.clock { font-size: 2.6rem; font-weight: 700; font-variant-numeric: tabular-nums; color: #fbbf24; line-height: 1.1; }
.stage { font-size: 0.95rem; margin-bottom: 0.6rem; }
.left-foot { padding: 0.55rem 0.85rem 0.75rem; display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.88rem; }
.stats { color: var(--text-muted); font-variant-numeric: tabular-nums; min-height: 1.4em; }
.stats b { color: var(--text-color); font-weight: 600; }
.stats .warn { color: var(--danger); font-weight: 600; }

/* 收起時的左側：模糊的樣子 */
.rail-face {
  position: absolute; inset: 0; z-index: 2; display: none; place-items: center; cursor: pointer;
  background: color-mix(in srgb, var(--card-bg) 72%, transparent);
}
.rail-face span { writing-mode: vertical-rl; letter-spacing: 0.4em; font-size: 0.9rem; color: var(--text-muted); font-weight: 600; }
.workspace[data-drawer="collapsed"] .pane-left .rail-face { display: grid; }
.workspace[data-drawer="collapsed"] .pane-left .left-inner { filter: blur(3px); opacity: 0.55; pointer-events: none; user-select: none; }

/* 貼上按鈕 */
.gutter { display: flex; align-items: center; justify-content: center; z-index: 5; }
.paste {
  display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
  width: 58px; padding: 0.7rem 0; border-radius: 14px; border: 0; cursor: pointer;
  background: var(--tea); color: #fff; font-weight: 700; font-size: 0.85rem;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.35);
}
.paste-arrow { font-size: 1.5rem; line-height: 1; }
.paste:hover { background: var(--tea-dark); }
.paste:disabled { background: #d8c3a5; box-shadow: none; cursor: not-allowed; }

/* 右側：終端機 */
.pane-right { display: flex; flex-direction: column; }
.term-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0.6rem 0.75rem 0.75rem; }
.term-bar { display: flex; align-items: center; gap: 0.75rem; min-height: 1.8rem; font-size: 0.85rem; color: var(--text-muted); }
.conn { display: flex; align-items: center; gap: 0.4rem; }
.conn .dot { width: 8px; height: 8px; border-radius: 50%; background: #bbb; }
.conn.on .dot { background: #16a34a; }
.conn.busy .dot { background: var(--tea); }
.term-note { margin-left: auto; color: var(--tea-dark); }
.term-bar .btn-sm { min-height: 28px; padding: 0.15rem 0.65rem; }
.screen-box { position: relative; flex: 1; min-height: 0; background: var(--screen); border-radius: 8px; display: grid; place-items: center; overflow: hidden; }
.term { transition: opacity .2s ease, filter .2s ease; }
.term .xterm { padding: 0; }
.term .xterm-viewport { overflow-y: hidden !important; background: var(--screen) !important; }
.screen-box.dim .term { opacity: 0.35; filter: blur(2px); }
.closed {
  position: absolute; inset: 0; background: rgba(0, 0, 0, 0.72); color: #fff; padding: 1rem; text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.6rem;
}
.closed-title { font-size: 1.15rem; font-weight: 700; }
.closed-text { color: #e9dfcf; font-size: 0.92rem; margin-bottom: 0.3rem; }

.login {
  position: absolute; width: min(380px, calc(100% - 2rem)); padding: 1.4rem 1.4rem 1.5rem;
  background: var(--card-bg); color: var(--text-color); border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5); display: flex; flex-direction: column; gap: 0.85rem;
}
.login h2 { font-size: 1.25rem; }
.login .lead { color: var(--text-muted); font-size: 0.92rem; margin-top: -0.4rem; }

.checklist {
  position: absolute; right: 12px; bottom: 12px; width: min(330px, calc(100% - 24px));
  list-style: none; padding: 0.75rem 0.9rem; border-radius: 10px;
  background: rgba(24, 20, 14, 0.92); color: #e9dfcf; font-size: 0.84rem; line-height: 1.45;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); border: 1px solid rgba(217, 119, 6, 0.4);
}
.checklist li { display: grid; grid-template-columns: 1.3rem 1fr; gap: 0.3rem; padding: 0.12rem 0; color: #9c9284; }
.checklist li::before { content: "·"; text-align: center; }
.checklist li.doing { color: #fff; }
.checklist li.doing::before { content: "◌"; color: #fbbf24; animation: spin 1s linear infinite; display: inline-block; }
.checklist li.done { color: #e9dfcf; }
.checklist li.done::before { content: "✓"; color: #fbbf24; font-weight: 700; }
.checklist li.fail { color: #fca5a5; }
.checklist li.fail::before { content: "✕"; color: #f87171; font-weight: 700; }
.checklist .cl-head { display: block; grid-template-columns: none; color: #fbbf24; font-weight: 700; margin-bottom: 0.2rem; }
.checklist .cl-head::before { content: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 疊層展開時，右邊露出的那一條 */
.shade { display: none; }

/* 鎖定 */
.lock {
  position: absolute; inset: 0; z-index: 20; border-radius: 12px; display: grid; place-items: center; padding: 1rem;
  background: rgba(20, 16, 10, 0.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.lock-card {
  width: min(520px, 100%); background: var(--card-bg); border-radius: 14px; padding: 1.75rem 1.75rem 1.5rem; text-align: center;
  box-shadow: 0 0 0 3px var(--tea), 0 24px 60px rgba(0, 0, 0, 0.45);
}
.lock-mark { font-size: 2.4rem; line-height: 1; margin-bottom: 0.5rem; }
.lock-card h2 { font-size: 1.2rem; line-height: 1.45; margin-bottom: 0.6rem; }
.lock-card p { color: var(--text-muted); }
.lock-actions { display: flex; gap: 0.5rem; justify-content: center; flex-wrap: wrap; margin-top: 1.1rem; }

.toast {
  position: fixed; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 50;
  background: #2a241c; color: #f5ead8; padding: 0.6rem 1rem; border-radius: 8px; font-size: 0.9rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3); max-width: calc(100vw - 2rem);
}

/* ---------- BBS 畫面（左右共用的格子規則：英數半格、其他一格） ---------- */
.screen {
  --fs: 16px;
  font-family: "MingLiU", "細明體", "Noto Sans Mono CJK TC", "PingFang TC", "Microsoft JhengHei", Menlo, Consolas, monospace;
  font-size: var(--fs); line-height: 1; color: #c0c0c0;
}
.screen .row { display: block; height: 1.25em; white-space: pre; }
.screen .c { display: inline-block; width: 0.5em; height: 1.25em; line-height: 1.25em; text-align: center; vertical-align: top; overflow: visible; }
.screen .w { width: 1em; }
.screen .bad { background: #b91c1c !important; color: #fff !important; }
.screen .code { color: #fbbf24; }
.screen .esc { color: #fb923c; font-weight: 700; }
.screen .cur { background: #c0c0c0; color: #000; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { background: transparent; color: inherit; } }

/* ---------- 對話框 ---------- */
.dlg {
  border: 1px solid var(--border-color); border-radius: 12px; padding: 1.6rem;
  width: min(460px, calc(100vw - 2rem)); margin: auto; background: var(--card-bg); color: var(--text-color);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
}
.dlg-wide { width: min(620px, calc(100vw - 2rem)); }
.dlg::backdrop { background: rgba(20, 12, 0, 0.45); }
.dlg form { display: flex; flex-direction: column; gap: 0.8rem; }
.dlg h2 { font-size: 1.2rem; }
.dlg h3 { font-size: 1rem; margin-top: 0.3rem; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.4rem; }
.ack-mark { font-size: 2.2rem; line-height: 1; }

/* ---------- 提供 HTML（蓋住畫面的大輸入區） ---------- */
.dlg-html { width: min(1100px, calc(100vw - 2rem)); height: min(86vh, 900px); max-height: calc(100vh - 2rem); padding: 1.1rem 1.25rem 1.2rem; }
.dlg-html[open] { display: flex; flex-direction: column; gap: 0.6rem; }
.html-head { display: flex; align-items: center; gap: 1rem; }
.html-head h2 { font-size: 1.15rem; margin-right: auto; }
.x {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border-color); background: var(--card-bg);
  font-size: 1.05rem; line-height: 1; cursor: pointer; color: var(--text-muted); flex: none;
}
.x:hover { color: var(--text-color); border-color: var(--tea); }
.html-lead { color: var(--text-muted); font-size: 0.9rem; }
#html-src {
  flex: 1; min-height: 0; width: 100%; resize: none; padding: 0.75rem 0.85rem;
  font: 13px/1.5 Menlo, Consolas, "Noto Sans Mono CJK TC", monospace; color: var(--text-color);
  background: var(--bg-color); border: 1px solid var(--input-border); border-radius: 8px;
}
#html-src:focus-visible { outline: 3px solid rgba(217, 119, 6, 0.3); outline-offset: 0; border-color: var(--tea); }
#html-src.drop { border: 2px dashed var(--tea); background: var(--tea-wash); }
.html-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.html-size { margin-left: auto; color: var(--text-muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.stats .note { color: var(--tea-dark); }

.tabs-phone { display: none; }
.rotate-hint { display: none; color: var(--text-muted); font-size: 0.85rem; text-align: center; padding-top: 0.4rem; }
@media (max-width: 600px) and (orientation: portrait) { .rotate-hint { display: block; } }

/* ============ 版面一：疊層抽屜（一般螢幕） ============ */
@media (min-width: 761px) and (max-width: 1399.98px) {
  .workspace { display: block; }
  .pane-right { position: absolute; top: 0; bottom: 0; right: 0; left: calc(var(--rail) + 14px); }
  .pane-left { position: absolute; top: 0; bottom: 0; left: 0; width: var(--rail); }
  .workspace[data-drawer="open"] .pane-left { width: var(--open); }
  .gutter { position: absolute; top: 50%; left: calc(var(--rail) + 7px); transform: translate(-50%, -50%); transition: left .28s ease; }
  .workspace[data-drawer="open"] .gutter { left: var(--open); }
  .workspace[data-drawer="open"] .shade {
    display: block; position: absolute; top: 0; bottom: 0; right: 0; left: var(--open); z-index: 2; cursor: pointer;
    border-radius: 0 12px 12px 0; background: var(--shade);
    -webkit-backdrop-filter: blur(4px) saturate(0.8); backdrop-filter: blur(4px) saturate(0.8);
  }
}

/* ============ 版面二：左右並排（1,400px 以上） ============ */
@media (min-width: 1400px) {
  .workspace { display: flex; align-items: stretch; gap: 0; }
  .pane-left { position: relative; flex: 0 0 var(--rail); }
  .workspace[data-drawer="open"] .pane-left { flex-basis: calc(50% - 40px); }
  .gutter { flex: 0 0 80px; }
  .pane-right { position: relative; flex: 1 1 0; min-width: 0; }
}

/* ============ 版面三：手機分頁 ============ */
@media (max-width: 760px) {
  .topbar { padding: 0.6rem 0.8rem; gap: 0.6rem; }
  .brand { display: none; }
  .dock { flex: 1 1 auto; min-width: 0; justify-content: space-between; gap: 0.2rem; }
  .dock-item { width: auto; flex: 1 1 0; min-width: 0; }
  .dock-group { flex: 1 1 0; min-width: 0; }
  .dock-group .dock-item { flex: 1 1 auto; }
  .dock-icon { width: 2.2rem; height: 2.2rem; font-size: 1.2rem; border-radius: 0.7rem; }
  .dock-label { font-size: 0.66rem; }
  .page { padding: 0.75rem; gap: 0.6rem; }
  .urlbar { grid-template-columns: 1fr auto; }
  .urlbar #btn-html { grid-row: 2; grid-column: 1 / -1; }
  .tabs-phone { display: flex; gap: 0.25rem; }
  .tabs-phone button {
    flex: 1; padding: 0.45rem; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-color);
    color: var(--text-muted); cursor: pointer;
  }
  .tabs-phone button[aria-selected="true"] { background: var(--card-bg); color: var(--text-color); font-weight: 700; box-shadow: inset 0 -3px 0 var(--tea); }
  .workspace { display: flex; flex-direction: column; min-height: 480px; }
  .workspace .pane { box-shadow: 0 0 0 1px var(--border-color) !important; }
  .pane-left, .pane-right { flex: 1; min-height: 0; }
  .left-inner { min-width: 0; }
  .workspace[data-ptab="right"] .pane-left, .workspace[data-ptab="right"] .gutter { display: none; }
  .workspace[data-ptab="left"] .pane-right { display: none; }
  .workspace .pane-left .rail-face { display: none !important; }
  .workspace .pane-left .left-inner { filter: none !important; opacity: 1 !important; pointer-events: auto !important; }
  .gutter { padding-top: 0.6rem; }
  .paste { flex-direction: row; width: 100%; justify-content: center; gap: 0.5rem; padding: 0.7rem; font-size: 1rem; }
  .paste-arrow { font-size: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .dock-item:hover { transform: none; }
}
