* {
  box-sizing: border-box;
  transition: none !important;
}

:root {
  --diff-del-color: #ff0033;
  --diff-del-rgb: 255, 0, 51;
  --diff-add-color: #80ff00;
  --diff-add-rgb: 128, 255, 0;
}

[data-diff-theme="rg"] {
  --diff-del-color: #ff0033;
  --diff-del-rgb: 255, 0, 51;
  --diff-add-color: #80ff00;
  --diff-add-rgb: 128, 255, 0;
}

[data-diff-theme="op"] {
  --diff-del-color: #ff9900;
  --diff-del-rgb: 255, 153, 0;
  --diff-add-color: #8000ff;
  --diff-add-rgb: 128, 0, 255;
}

[data-diff-theme="yb"] {
  --diff-del-color: #00eaff;
  --diff-del-rgb: 0, 234, 255;
  --diff-add-color: #fff700;
  --diff-add-rgb: 255, 247, 0;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #ffffff;
  color: #000000;
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  letter-spacing: 0.2px;
  overflow: hidden;
}

body.theme-bg {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/*
 * Content surface lock (panel-only):
 * Keep outer layout layers transparent so body background can be visible.
 * Only real content panels/cards stay opaque.
 * 刻意不含 .assist-box / .aux-modules：AUX 由 .bottom-panel 的 rgba + backdrop-filter 負責玻璃底，
 * 內層若封白會把透明鏈打斷。
 */
.projector-wrapper,
.raw-section,
.raw-box,
.drawer-section,
.drawer-list,
.file-item,
.auth-card,
.download-list,
.theme-card {
  background-color: #fff;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

#app {
  height: 100%;
}

.topbar {
  position: sticky;
  top: 0;
  height: 40px;
  border-bottom: 1px solid #000;
  background: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 12px;
  z-index: 10;
}

.topbar .right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.theme-group {
  position: relative;
  display: inline-flex;
  align-items: center;
}

/* 桌面：THEME 固定視窗右上（DOM 在 .right-panel，不佔 header 流） */
@media (min-width: 769px) {
  #furnace-view .theme-group {
    position: fixed;
    top: 8px;
    right: 12px;
    z-index: 60;
    color: #000;
  }
}

/*
 * HOVER BRIDGE (theme-group)：
 * 僅在精準 hover 裝置啟用；觸控／窄屏改由 .theme-open + JS 切換。
 */
@media (hover: hover) and (pointer: fine) {
  .theme-group::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 10px;
  }

  .theme-group:hover .theme-trigger {
    opacity: 1;
  }

  .theme-group:hover .theme-card {
    opacity: 1;
    pointer-events: auto;
  }
}

.theme-trigger {
  font-size: 10px;
  opacity: 0.6;
  cursor: default;
  user-select: none;
}

.theme-card {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 136px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.9);
  font-size: 10px;
  opacity: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 35;
}

@media (max-width: 768px) {
  /*
   * 小螢幕 THEME 貼版面下緣；卡片若向下展開會落在 viewport 外，
   * 與 html/body overflow:hidden 一併看起來像「點了沒反應」——改向上展開。
   */
  #furnace-view .theme-card {
    top: auto;
    bottom: calc(100% + 8px);
    /* 預設桌面的 right:0 會讓寬面板向左長、小螢幕易裁切；改由左緣向右展開（數值可再微調） */
    left: 0;
    right: auto;
    max-width: min(280px, calc(100vw - 24px));
    max-height: min(45vh, 280px);
    overflow-y: auto;
  }

  #furnace-view .theme-group.theme-open .theme-card {
    opacity: 1;
    pointer-events: auto;
    z-index: 80;
  }
}

.theme-section {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.theme-title {
  opacity: 0.7;
  text-transform: lowercase;
}

.theme-options {
  display: inline-flex;
  gap: 8px;
}

.theme-opt {
  cursor: pointer;
  user-select: none;
  opacity: 0.72;
}

.theme-opt:hover,
.theme-opt.active {
  opacity: 1;
  text-decoration: underline;
}

.theme-opt:focus {
  outline: none;
}

.theme-opt:focus-visible {
  opacity: 1;
  text-decoration: underline;
}

.theme-upload {
  cursor: pointer;
  opacity: 0.78;
  white-space: nowrap;
}

.theme-upload:hover {
  opacity: 1;
  text-decoration: underline;
}

.theme-upload:focus {
  outline: none;
}

.theme-upload:focus-visible {
  opacity: 1;
  text-decoration: underline;
}

.theme-bg-upload {
  display: none;
}

/* THEME 卡片內按鈕：無系統框／無 focus 外框，僅 hover、.active、:focus-visible 用底線 */
.theme-card button {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: none;
  background: none;
  box-shadow: none;
  border-radius: 0;
  outline: none;
}

.theme-card button::-moz-focus-inner {
  border: 0;
}

.theme-card button:focus-visible {
  text-decoration: underline;
}

.theme-bg-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.bg-preset {
  font: inherit;
  font-size: 11px;
  padding: 2px 6px;
  margin: 0;
  border: none;
  background: none;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
  text-transform: lowercase;
}

.bg-preset:hover,
.bg-preset.active {
  opacity: 1;
  text-decoration: underline;
}

.theme-bg-delete {
  font: inherit;
  font-size: 11px;
  padding: 2px 6px;
  margin: 0;
  border: none;
  background: none;
  color: inherit;
  opacity: 0.85;
  cursor: pointer;
  text-transform: lowercase;
}

@media (hover: hover) and (pointer: fine) {
  .theme-bg-delete:hover {
    color: #ff0000;
    opacity: 1;
    text-decoration: underline;
  }
}

@media (max-width: 768px) {
  .theme-bg-delete {
    color: #ff0000;
    opacity: 1;
  }
}

.desk-menu {
  position: absolute;
  top: 30px;
  right: 12px;
  width: 220px;
  background: #fff;
  border: 1px solid #000;
  z-index: 30;
}

.desk-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid #000;
  cursor: pointer;
}

.desk-menu-item:last-child {
  border-bottom: none;
}

.desk-menu-item:hover,
.desk-menu-item.active {
  background: #000;
  color: #fff;
}

.desk-menu-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.desk-menu-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* Desk 列右側 ✏️／x：預設黑底白字、白框；hover 白底黑字黑框（與 drawer 檔案列分開） */
.desk-menu-actions .file-action {
  border: 1px solid #fff;
  background: #000;
  color: #fff;
}

.desk-menu-actions .file-action:hover,
.desk-menu-actions .file-action:focus-visible,
.desk-menu-actions .file-action:active,
.desk-menu-actions .file-action.is-active {
  background: #fff;
  color: #000;
  border-color: #000;
  outline: none;
}

.desk-menu-actions .file-action-delete:hover,
.desk-menu-actions .file-action-delete:focus-visible,
.desk-menu-actions .file-action-delete:active,
.desk-menu-actions .file-action-delete.is-active {
  background: #fff;
  color: #000;
  border-color: #000;
  outline: none;
}

.desk-delete-glyph {
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}

.desk-menu-item:hover .desk-delete-glyph {
  color: #fff;
}

.desk-delete-glyph:hover {
  color: #ff0000 !important;
}

.desk-menu-item-create {
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}

.desk-rename-btn {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  font-size: 11px;
}

#desk-switcher-btn {
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  position: relative;
  top: 2px;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.06);
}

@media (max-width: 768px) {
  #desk-switcher-btn {
    /* 與桌面 top:2px 不同，inline-flex 會讓 ⛻ 視覺偏上，往下補 3px */
    top: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* 比先前略窄，少往左佔位；仍維持約 44px 級觸控高度 */
    min-width: 36px;
    min-height: 30px;
    padding: 0 4px;
    margin-left: -10px;
    margin-right: 0;
  }
}

.lang-mini {
  margin-right: 8px;
  cursor: pointer;
  font-size: 11px;
  opacity: 0.7;
  user-select: none;
}

.lang-mini:hover {
  opacity: 1;
  text-decoration: underline;
}

#walkthrough-btn {
  margin-left: 8px;
  border: 1px solid #000;
  background: #fff;
  font-size: 11px;
  padding: 0 4px;
  cursor: pointer;
}

#walkthrough-btn:hover {
  background: #000;
  color: #fff;
}

.hidden {
  display: none !important;
}

#drop-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.04);
  border: 2px dashed #000;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 999;
  font-size: 12px;
}

.support-card {
  position: fixed;
  right: 10px;
  bottom: 51px;
  width: 200px;
  border: 1px solid #000;
  background: #fff;
  padding: 8px;
  font-size: 11px;
  line-height: 1.4;
  z-index: 100;
}

.support-title {
  margin-bottom: 4px;
}

.support-copy {
  opacity: 0.85;
}

.support-btn {
  margin-top: 6px;
  border: 1px solid #000;
  background: #fff;
  padding: 2px 6px;
  cursor: pointer;
}

.support-btn:hover {
  background: #000;
  color: #fff;
}

.support-dismiss {
  margin-top: 4px;
  font-size: 9px;
  opacity: 0.5;
  cursor: pointer;
}

.support-dismiss:hover {
  opacity: 0.9;
}

#card-test-panel {
  position: fixed;
  top: 8px;
  right: 8px;
  width: 170px;
  border: 1px solid #000;
  background: #fff;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 200;
  font-size: 10px;
}

.card-test-title {
  font-size: 10px;
}

#card-test-panel button {
  border: 1px solid #000;
  background: #fff;
  font-size: 10px;
  cursor: pointer;
  text-align: left;
}

#card-test-panel button:hover {
  background: #000;
  color: #fff;
}

.view {
  display: block;
  height: 100%;
  margin-top: 0;
  padding: 0;
}

.view.hidden {
  display: none !important;
}

#shelf-view,
#furnace-view {
  width: 100%;
  height: 100%;
}

#shelf-view {
  padding: 12px;
  padding-bottom: 56px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.shelf-header {
  border: 1px solid #000000;
  padding: 8px 10px;
  margin-bottom: 12px;
}

.shelf-header h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.frag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  padding: 0;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  align-content: start;
}

.frag-card {
  border: 1px solid #000000;
  padding: 8px;
  height: 100px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  background: #fff;
  position: relative;
}

.frag-card--meat {
  padding-right: 24px;
}

.card-drag-handle {
  position: absolute;
  right: 2px;
  left: auto;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  cursor: grab;
  padding: 10px 4px;
  margin: -10px 0;
  font-size: 14px;
  line-height: 1;
  opacity: 0.45;
  user-select: none;
  touch-action: none;
  color: inherit;
}

.card-drag-handle:active {
  cursor: grabbing;
}

@media (max-width: 1024px) {
  .card-drag-handle {
    display: none;
    pointer-events: none;
  }
}

.frag-card--dragging {
  opacity: 0.65;
}

.frag-card--meat[data-shelf-drop-before="1"] {
  box-shadow: inset 4px 0 0 0 rgba(0, 0, 0, 0.45);
}

.frag-card--meat[data-shelf-drop-after="1"] {
  box-shadow: inset -4px 0 0 0 rgba(0, 0, 0, 0.45);
}

button:hover,
.frag-card:hover,
.file-item:hover,
.sidebar-item:hover,
.file-action:hover {
  background: #000000;
  color: #ffffff;
}

.new-btn {
  width: auto;
  height: 100px;
  min-height: 100px;
  padding: 8px;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
}

.card-name {
  font-size: 11px;
  word-break: break-word;
}

@media (min-width: 1025px) {
  .frag-card--meat .card-name {
    cursor: pointer;
  }
}

.card-tag {
  font-size: 10px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meatmark-row {
  position: absolute;
  top: 5px;
  right: 4px;
  z-index: 4;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 3px;
}

.card-meatmark-row .meatmark {
  position: static;
  font-size: 12px;
  line-height: 1;
}

.card-meat-rename {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  color: inherit;
  touch-action: manipulation;
}

.card-meat-rename:hover,
.card-meat-rename:focus-visible,
.card-meat-rename:active {
  background: transparent !important;
  color: inherit !important;
  border: none;
  outline: none;
}

@media (min-width: 1025px) {
  .card-meat-rename {
    display: none !important;
  }
}

.meatmark {
  font-size: 12px;
  line-height: 1;
}

.meat-delete-glyph {
  position: absolute;
  right: 6px;
  bottom: 6px;
  z-index: 3;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  opacity: 1;
  transition: opacity 0.15s ease;
}

@media (min-width: 1025px) {
  .meat-delete-glyph {
    opacity: 0;
  }

  .frag-card:hover .meat-delete-glyph,
  .meat-delete-glyph:focus-visible {
    opacity: 1;
  }

  .frag-card:hover .card-tag {
    max-width: calc(100% - 18px);
  }

  .frag-card--meat:hover .card-tag {
    max-width: calc(100% - 32px);
  }
}

.meat-delete-glyph:hover {
  color: #ff0000 !important;
}

.shelf-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 40px;
  border-top: 1px solid #000;
  background: #fff;
  padding: 4px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  z-index: 20;
}

.shelf-footer .left-tag {
  border: 1px solid #000;
  padding: 2px 8px;
}

.shelf-footer .footer-auth {
  display: flex;
  align-items: center;
  position: relative;
}

/* 
 * HOVER BRIDGE (footer-auth):
 * Invisible buffer zone between auth trigger and floating `.auth-card`.
 * Purpose: keep :hover chain continuous while cursor crosses the tiny gap.
 * IMPORTANT: do not remove unless hover-close behavior is reworked in JS.
 */
.shelf-footer .footer-auth::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 100%;
  width: 200px;
  height: 8px;
}

.shelf-footer #auth-entry {
  cursor: pointer;
}

.shelf-footer .sync-indicator {
  margin-left: 6px;
  font-size: 10px;
  color: #0057ff;
}

.auth-card {
  position: absolute;
  bottom: calc(100% - 2px);
  left: 0;
  width: 180px;
  border: 1px solid #000;
  background: #fff;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 50;
  padding-bottom: 18px;
}

.auth-name-line {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.auth-email {
  font-size: 10px;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.auth-user-mark {
  font-size: 10px;
  opacity: 0.7;
  flex-shrink: 0;
}

.auth-title {
  font-size: 11px;
}

.auth-stats {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
}

.auth-verify {
  font-size: 8px;
  color: #c00;
  cursor: pointer;
  opacity: 0.85;
  white-space: nowrap;
}

.auth-bar {
  height: 2px;
  background: #ddd;
}

#auth-bar-fill {
  height: 100%;
  width: 0;
  background: #000;
}

.auth-toggle {
  font-size: 10px;
  cursor: pointer;
}

.auth-mini-actions {
  position: absolute;
  right: 6px;
  bottom: 4px;
  display: flex;
  gap: 6px;
}

.auth-mini-btn {
  font-size: 11px;
  cursor: pointer;
  opacity: 0.6;
  user-select: none;
}

.auth-mini-btn:hover {
  opacity: 1;
}

.shelf-footer .left-tag:hover {
  color: #ff0000;
  text-decoration: underline;
}

.shelf-footer .locks {
  display: flex;
  gap: 4px;
}

@media (max-width: 768px) {
  .shelf-footer {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 180ms ease, opacity 180ms ease !important;
  }

  body.mobile-footer-visible .shelf-footer {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
}

.furnace-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 12px;
  height: calc(100vh - 24px);
  height: calc(100dvh - 24px);
  padding: 12px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  min-width: 0;
  min-height: 0;
}

.left-main {
  min-width: 0;
  min-height: 0;
  position: relative;
}

.projector-wrapper {
  border: 1px solid #000;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #fff;
  position: relative;
}

/* 包住 #projector-view + 空狀態 overlay；position:relative 為 overlay absolute 錨點（必須） */
.projector-view-stack {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* projector 無輸入：CRT scanline + noise（略加存在感；pointer-events:none） */
.projector-empty-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.11) 0,
      rgba(0, 0, 0, 0.11) 1px,
      transparent 1px,
      transparent 3px
    ),
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0.14), transparent 68%);
  mix-blend-mode: multiply;
  opacity: 0.72;
}

.projector-empty-overlay[hidden] {
  display: none !important;
}

.projector-empty-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.075) 3px
  );
  animation: crt-wobble 3s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .projector-empty-overlay::after {
    animation: none;
  }
}

@keyframes crt-wobble {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(1px);
  }
}

.projector-header-row {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  border-bottom: 1px solid #000;
  background: #000;
  color: #fff;
}

/* 預設隱藏；路徑含片段 `dev`（如 `/dev`、`/app/:meatId/dev`）→ `.pipeline-debug-is-shown` */
.pipeline-debug {
  display: none;
  position: absolute;
  top: 42px;
  right: 6px;
  width: 220px;
  max-height: 180px;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #22ff00;
  font-size: 10px;
  line-height: 1.2;
  flex-direction: column;
  z-index: 50;
  overflow: hidden;
  backdrop-filter: blur(8px) saturate(50%);
  -webkit-backdrop-filter: blur(8px) saturate(50%);
}

.pipeline-debug.pipeline-debug-is-shown {
  display: flex;
}

.pipeline-debug.pipeline-debug-is-shown.aux-collapsed {
  display: block;
}

.pipeline-debug-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 2px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 10px;
  line-height: 1.2;
  flex-shrink: 0;
  position: relative;
}

.pipeline-debug-header .aux-mobile-toggle {
  position: static;
  flex-shrink: 0;
}

.pipeline-log {
  padding: 4px;
  overflow-y: auto;
  font-size: 10px;
  line-height: 1.2;
  min-height: 0;
  flex: 1;
}

.pipeline-debug.aux-collapsed {
  width: 56px;
  height: 24px;
  max-height: 24px;
  padding: 4px;
}

.pipeline-debug.aux-collapsed .pipeline-log {
  display: none;
}

.pipeline-debug.aux-collapsed .pipeline-debug-header {
  border-bottom: none;
  padding: 0;
  height: 100%;
  justify-content: flex-end;
}

.pipeline-debug.aux-collapsed .pipeline-debug-header > span:first-child {
  display: none;
}

.pipeline-line {
  white-space: pre-wrap;
  word-break: break-word;
}

.pipeline-line.warn {
  color: #ffcc00;
}

.pipeline-line.error {
  color: #ff4d4d;
}

.pipeline-line.success {
  color: #00ff9c;
}

.pipeline-line.divider {
  color: rgba(34, 255, 0, 0.38);
  letter-spacing: 0.02em;
}

@media (max-width: 768px) {
  .pipeline-debug {
    width: min(220px, calc(100vw - 24px));
    max-height: 140px;
  }
}

.back-inline {
  border: none;
  background: transparent;
  color: #fff;
  padding: 6px 10px;
  font-size: 18px;
  cursor: pointer;
}

.back-inline:hover {
  background: #fff;
  color: #000;
}

.projector-title {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  padding: 6px 10px;
  font-size: 13px;
  min-width: 0;
  cursor: default;
}

.projector-title-prefix {
  flex-shrink: 0;
  white-space: nowrap;
}

.projector-filename {
  /* flex:1 會把 span 撐滿整列 → 整條都是 pointer；改為不 grow，短檔名時 hitbox 貼齊文字 */
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.projector-rename-input {
  flex: 1;
  min-width: 0;
}

@media (min-width: 1025px) {
  .projector-filename {
    cursor: pointer;
  }

  .projector-filename:hover {
    text-decoration: underline;
  }
}

/*
 * projector-rename-btn intentionally does NOT share `.file-action`. The two
 * cascades collide on a single-class specificity tie, and `.file-action`
 * appears later in the file (it would always win). Per design-spec, file-action
 * is scoped to drawer file rows + desk menu icons; the projector ✏️ has its
 * own visual contract (black base / white inverse on hover).
 */
.projector-rename-btn {
  border: 1px solid #fff;
  background: #000;
  color: #fff;
  font-size: 11px;
  line-height: 1;
  padding: 0 6px;
  margin-right: 6px;
  cursor: pointer;
  flex-shrink: 0;
  min-width: 18px;
  text-align: center;
}

.projector-rename-btn:hover,
.projector-rename-btn:focus-visible,
.projector-rename-btn:active {
  background: #fff;
  color: #000;
  border-color: #fff;
  outline: none;
}

#projector-walkthrough-btn {
  border: 1px solid #fff;
  background: #000;
  color: #fff;
  font-size: 11px;
  padding: 0 6px;
  margin-right: 6px;
  cursor: pointer;
  flex-shrink: 0;
}

#projector-walkthrough-btn:hover {
  background: #fff;
  color: #000;
}

@media (min-width: 1025px) {
  .projector-rename-btn {
    display: none;
  }
}

#furnace-view {
  position: relative;
  margin-top: 0;
  height: 100vh;
  height: 100dvh;
  padding-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Large fixed canvas from ?adPreview=1 — allow scroll instead of clipping */
#furnace-view.ad-preview-active {
  overflow: auto;
  align-items: flex-start;
}

.workspace {
  width: min(100%, 1100px);
  max-width: 1100px;
  max-height: 900px;
  height: min(100%, 900px);
  margin: 0;
  display: flex;
  flex-direction: column;
}

/* Dev: ?adPreview=1 — fixed canvas for screenshot / card exports */
.workspace.ad-preview-root {
  width: var(--preview-width, min(100%, 1100px));
  height: var(--preview-height, min(100%, 900px));
  max-width: none;
  max-height: none;
  flex-shrink: 0;
  --board-ratio: 50;
  --drawer-ratio: 50;
}

@media (min-width: 1025px) {
  .workspace.ad-preview-root .right-panel {
    grid-template-rows: calc(var(--board-ratio, 50) * 1%) calc(var(--drawer-ratio, 50) * 1%);
  }
}

@media (max-width: 1024px) {
  .workspace.ad-preview-root .right-panel {
    grid-template-rows:
      calc(var(--board-ratio, 50) * 1%)
      calc(var(--drawer-ratio, 50) * 1%)
      auto;
  }
}

@media (max-width: 768px) {
  .workspace.ad-preview-root .right-panel {
    grid-template-columns: calc(var(--board-ratio, 50) * 1%) calc(var(--drawer-ratio, 50) * 1%);
    grid-template-rows: minmax(0, 1fr) auto;
  }
}

.ad-preview-panel {
  position: fixed;
  right: 8px;
  bottom: 8px;
  z-index: 10000;
  width: 200px;
  padding: 8px;
  border: 1px solid #000;
  background: #fff;
  font-size: 10px;
  line-height: 1.3;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.ad-preview-panel h4 {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
}

.ad-preview-panel .ad-preview-hint {
  margin: 0 0 6px;
  font-size: 9px;
  opacity: 0.65;
  line-height: 1.25;
}

.ad-preview-panel label {
  display: block;
  margin-top: 6px;
}

.ad-preview-panel input[type="range"] {
  width: 100%;
}

.ad-preview-panel .ad-preview-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.ad-preview-panel .ad-preview-presets button {
  border: 1px solid #000;
  background: #fff;
  font-size: 9px;
  padding: 2px 4px;
  cursor: pointer;
}

.ad-preview-panel .ad-preview-presets button:hover {
  background: #000;
  color: #fff;
}

/* #projector-view 同時帶 .projector-view + .projector-body（單節點）；底角鈕為同層 absolute。
 * 此處未再疊 padding-bottom：實測僅 board 的 .raw-wrap 留白有效；projector 若要同等效果需另加內層捲動容器或改 HTML。 */
.projector-body {
  padding: 16px;
  font-size: 15px;
  line-height: 1.6;
  min-width: 0;
  height: 100%;
  overflow: auto;
  overflow-wrap: normal;
  word-break: normal;
}

.projector-view {
  position: relative;
  z-index: 1;
  border: none;
  min-width: 0;
  white-space: pre-wrap;
  outline: none;
  flex: 1;
}

/* 行動端：只縮 projector 內文（#projector-view 本體）；header / 角鈕 / board / drawer 不碰 */
@media (max-width: 768px) {
  #projector-view.projector-body {
    font-size: 13px;
    line-height: 1.45;
  }
}

/* Projector diff overlay (view-only): hover 僅貼 .diff-content；marker 為其後兄弟，用 ~ 選取；copy/export 仍只用 clean。 */
#projector-view.projector-view--diff {
  white-space: normal;
}

.projector-view--diff .proj-line {
  position: relative;
  display: block;
  min-height: 1.55em;
  /* 預留 🪄（約 11px）+ 與正文最小間距（原 22px 偏寬） */
  padding-left: 14px;
}

/* block + fit-content：hover 區仍貼文字寬，且避免 inline-block 與子層 max-height 動畫疊加造成高度怪異／裁切 */
.projector-view--diff .diff-content {
  display: block;
  width: fit-content;
  max-width: 100%;
  white-space: pre-wrap;
  word-break: normal;
  cursor: copy;
}

.projector-view--diff .diff-del {
  display: block;
  box-sizing: border-box;
  max-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  color: var(--diff-del-color);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--diff-del-color);
  font-size: 0.92em;
  line-height: 1.45;
  white-space: pre-wrap;
  background: rgba(var(--diff-del-rgb), 0.23);
  opacity: 0;
  transition:
    opacity 0.12s ease 0.06s,
    margin 0.12s ease,
    padding 0.12s ease;
}

.projector-view--diff .diff-ghost,
.projector-view--diff .diff-insert-hl {
  background: transparent;
  transition: background 0.12s ease;
}

.projector-view--diff .diff-add {
  background: transparent;
  transition: background 0.12s ease;
}

.projector-view--diff .diff-marker {
  position: absolute;
  left: 0;
  top: 0.12em;
  font-size: 11px;
  line-height: 1;
  color: #000;
  opacity: 0;
  cursor: default;
  pointer-events: none;
  user-select: none;
  transition: opacity 0.12s ease;
}

@media (hover: hover) and (pointer: fine) {
  .projector-view--diff .diff-content:hover ~ .diff-marker {
    opacity: 0.88;
  }

  /* 展開後不設上限，避免 18em 等固定 max-height 裁切長刪除段（像少一行） */
  .projector-view--diff .diff-content:hover .diff-del {
    max-height: none;
    overflow: visible;
    margin-bottom: 0.2rem;
    padding: 0.1em 0.15em;
    opacity: 0.9;
  }

  .projector-view--diff .diff-content:hover .diff-add {
    background: rgba(var(--diff-add-rgb), 0.35);
  }

  .projector-view--diff .diff-content:hover .diff-ghost {
    background: rgba(var(--diff-add-rgb), 0.35);
  }

  .projector-view--diff .diff-content:hover .diff-insert-hl {
    background: rgba(var(--diff-add-rgb), 0.35);
  }
}

.aux-dock {
  position: absolute;
  bottom: 4px;
  left: 4px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  max-width: min(200px, calc(100% - 8px));
}

.aux-dock .bottom-panel {
  position: relative;
  bottom: auto;
  left: auto;
}

.aux-preset-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  line-height: 1;
  max-width: 100%;
}

.aux-preset-chip {
  box-sizing: border-box;
  display: inline-block;
  border: 1px solid #0000ff;
  border-radius: 6px;
  background: transparent;
  color: #0000ff;
  font: inherit;
  font-size: 10px;
  line-height: 1;
  padding: 2px 4px 0 4px;
  cursor: pointer;
  margin: 0;
}

.aux-preset-chip:hover:not(.preset-active),
.aux-preset-chip:focus-visible:not(.preset-active) {
  color: #ff0000;
  border-color: #ff0000;
}

.aux-preset-chip.preset-active {
  color: #ff0000;
  border-color: #ff0000;
}

.aux-preset-chip.preset-active:hover,
.aux-preset-chip.preset-active:focus-visible {
  color: #ff0000;
  border-color: #ff0000;
}

/* Auto preset chip (Phase 2): cyan active state; not .aux-preset-chip */
.aux-auto-chip {
  box-sizing: border-box;
  display: inline-block;
  border: 1px solid #0000ff;
  border-radius: 6px;
  background: transparent;
  color: #0000ff;
  font: inherit;
  font-size: 10px;
  line-height: 1;
  padding: 2px 4px 0 4px;
  cursor: pointer;
  margin: 0;
}

.aux-auto-chip:hover:not(:disabled):not(.aux-auto-active),
.aux-auto-chip:focus-visible:not(:disabled):not(.aux-auto-active) {
  color: #ff0000;
  border-color: #ff0000;
}

.aux-auto-chip.aux-auto-active {
  color: #00ffea;
  border-color: #00ffea;
  text-shadow: 0 0 6px rgba(0, 255, 234, 0.6);
}

.aux-auto-chip.aux-auto-active:hover:not(:disabled),
.aux-auto-chip.aux-auto-active:focus-visible:not(:disabled) {
  color: #00ffea;
  border-color: #00ffea;
}

.aux-auto-chip.is-tour-locked {
  opacity: 0.5;
  pointer-events: none;
}

@keyframes aux-auto-pulse {
  0%,
  100% {
    text-shadow: 0 0 6px rgba(0, 255, 234, 0.6);
    filter: brightness(1);
  }

  50% {
    text-shadow: 0 0 14px rgba(0, 255, 234, 0.95);
    filter: brightness(1.12);
  }
}

.aux-auto-pulsing {
  animation: aux-auto-pulse 0.25s ease 1;
}

.aux-snapshot-chip {
  box-sizing: border-box;
  display: inline-block;
  border: 1px solid #668;
  border-radius: 6px;
  background: transparent;
  color: #0000ff;
  font: inherit;
  font-size: 10px;
  line-height: 1;
  padding: 2px 4px 0 4px;
  cursor: pointer;
  margin: 0;
}

.aux-snapshot-chip:hover:not(:disabled),
.aux-snapshot-chip:focus-visible:not(:disabled) {
  color: #ff0000;
  border-color: #ff0000;
}

.aux-snapshot-chip.is-tour-locked {
  opacity: 0.5;
  pointer-events: none;
}

.bottom-panel {
  position: absolute;
  bottom: 4px;
  left: 4px;
  width: 200px;
  /* 桌面：加高模組列表可視區（行動版由 .aux-dock 內規則覆寫 height） */
  height: min(220px, 36vh);
  border: none;
  background: rgba(32, 32, 32, 0.1);
  padding: 6px;
  font-size: 10px;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 4px;
  min-height: 0;
  backdrop-filter: blur(8px) saturate(50%);
  -webkit-backdrop-filter: blur(8px) saturate(50%);
}

.aux-modules {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  min-height: 0;
  flex: 1;
  background-color: transparent;
}

.aux-module-line {
  display: flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  font-size: 10px;
  line-height: 1.2;
  cursor: pointer;
}

.aux-main {
  flex-shrink: 0;
}

.aux-hint {
  color: #ff0000;
  font-size: 10px;
  opacity: 0;
  transition: opacity 100ms ease;
}

.aux-module-line:hover .aux-hint {
  opacity: 1;
}

/* 觸控或移動窄屏：預設全顯 AUX 翻譯小紅字（無精準 hover 也看得見） */
@media (hover: none), (max-width: 768px) {
  .aux-hint {
    opacity: 1;
  }
}

.aux-module-line:hover {
  text-decoration: underline;
}

.aux-module-line.is-enabled {
  color: #ea00ff;
}

.aux-terminal-line {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 14px;
}

.aux-prompt {
  font-size: 10px;
  line-height: 1;
}

.aux-input {
  border: none;
  background: transparent;
  color: #000;
  padding: 0;
  font-size: 10px;
  line-height: 1;
  outline: none;
  width: 120px;
}

.aux-tail-cursor {
  font-size: 10px;
  line-height: 1;
}

.bottom-panel.has-text .aux-tail-cursor {
  display: none;
}

.aux-mobile-toggle {
  display: block;
  position: absolute;
  left: 4px;
  bottom: 4px;
  border: none;
  background: transparent;
  padding: 0;
  font-size: 10px;
  cursor: pointer;
}

.bottom-panel {
  padding-bottom: 18px;
}

.bottom-panel.aux-collapsed {
  width: 56px;
  height: 24px;
  padding: 4px;
  display: block;
}

.bottom-panel.aux-collapsed .aux-modules,
.bottom-panel.aux-collapsed .aux-terminal-line {
  display: none;
}

.right-panel {
  position: relative;
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 12px;
  min-width: 0;
  min-height: 0;
}

.raw-section,
.drawer-section {
  border: 1px solid #000000;
  padding: 10px;
  display: flex;
  min-width: 0;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.raw-section {
  position: relative;
}

/* Board 區定位基準（角鈕等） */
.board {
  position: relative;
}

.raw-box {
  border: 1px solid #000;
  padding: 8px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.raw-section label,
.drawer-title {
  font-size: 11px;
  margin-bottom: 0;
  line-height: 1.1;
}

/* Board only：為右下角 🧹/📃 留空：可編輯區為 #raw-input，角鈕對 .raw-section absolute。 */
.raw-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding-bottom: 16px;
}

.fake-cursor {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1.0em;
  background: #000;
  animation: fake-cursor-blink 1s infinite;
  pointer-events: none;
}

@keyframes fake-cursor-blink {
  0%,
  50%,
  100% {
    opacity: 1;
  }
  25%,
  75% {
    opacity: 0;
  }
}

#raw-input {
  width: 100%;
  height: 100%;
  flex: 1;
  min-height: 0;
  resize: none;
  border: none;
  padding: 0;
  font-size: 11px;
  line-height: 1.2;
  outline: none;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.corner-action {
  position: absolute;
  right: 4px;
  bottom: 4px;
  border: 1px solid #000;
  background: #fff;
  color: #000;
  padding: 1px 6px;
  font-size: 11px;
  cursor: pointer;
}

.projector-actions {
  position: absolute;
  right: 4px;
  bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 5;
}

.projector-actions .corner-action,
.projector-action-btn {
  position: static;
  right: auto;
  bottom: auto;
}

.download-group {
  position: relative;
  display: inline-flex;
  align-items: center;
}

/*
 * HOVER BRIDGE (download-group):
 * Invisible bridge between format chip (`.projector-format-indicator`) and
 * `.download-list` to prevent hover dropout/flicker.
 * This is a structural UX fix (no delay/timer), same pattern as auth bridge.
 */
.download-group::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 100%;
  width: 100%;
  height: 6px;
}

.projector-format-indicator {
  display: inline-block;
  border: none;
  background: rgba(0, 0, 0, 0.07);
  color: #000;
  font-size: 11px;
  line-height: 1.2;
  padding: 3px 7px;
  user-select: none;
  vertical-align: middle;
}

/* 與參考版 tool-kiln-main8：匯出選到 .pdf 時略加重可讀性（不影響其他格式） */
.projector-format-indicator[data-format="pdf"],
.download-list button[data-format="pdf"] {
  font-weight: 600;
}
.projector-format-indicator[data-format="pdf"] {
  background: rgba(0, 0, 0, 0.1);
}

.projector-action-btn {
  border: 1px solid #000;
  background: #fff;
  color: #000;
}

.projector-action-btn:hover,
.projector-action-btn:focus-visible,
.projector-action-btn:active {
  background: #000;
  color: #fff;
  outline: none;
}

.download-list {
  position: absolute;
  bottom: calc(100% + 2px);
  left: 0;
  border: 1px solid #000;
  background: #fff;
  display: flex;
  flex-direction: column;
  min-width: 58px;
  z-index: 6;
}

.download-list button {
  border: none;
  border-bottom: 1px solid #000;
  background: #fff;
  color: #000;
  text-align: left;
  padding: 2px 6px;
  font-size: 11px;
  cursor: pointer;
}

.download-list button:last-child {
  border-bottom: none;
}

.download-list button:hover,
.download-list button:focus-visible {
  background: #000;
  color: #fff;
  outline: none;
}

.raw-actions {
  position: absolute;
  right: 4px;
  bottom: 4px;
  display: flex;
  align-items: stretch;
}

.raw-actions .corner-action {
  position: static;
  right: auto;
  bottom: auto;
}

.raw-actions .raw-clear-btn {
  margin-right: -1px;
  opacity: 0.52;
}

#raw-input.raw-input-board-empty {
  cursor: pointer;
}

.corner-action.copy-success {
  background: #000;
  color: #fff;
  border-color: #000;
}

.file-list {
  border: none;
  margin-top: 0;
}

.drawer-list {
  overflow: auto;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.drawer-section {
  padding: 4px;
}

.furnace-qr-wrap {
  display: none;
}

.furnace-qr {
  display: block;
  width: 50px;
  height: auto;
  transform: translateY(-10px);
}

.drawer-upload-bar {
  margin-top: 4px;
  border-top: 1px solid #000;
  display: flex;
  align-items: center;
  height: 28px;
  min-height: 28px;
  max-height: 28px;
  flex-shrink: 0;
  padding: 2px 0;
  cursor: pointer;
}

.upload-filename {
  flex: 1;
  padding: 2px 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  opacity: 0.6;
}

.upload-confirm {
  border-left: 1px solid #000;
  border-top: none;
  border-right: none;
  border-bottom: none;
  background: transparent;
  color: inherit;
  padding: 2px 8px;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.35;
}

.upload-confirm:disabled {
  cursor: not-allowed;
}

.upload-confirm.enabled {
  opacity: 1;
  transform: scale(1.05);
}

.upload-confirm:hover {
  background: transparent;
  color: inherit;
}

.upload-confirm.flash {
  transform: scale(1.12);
}

.drawer-upload-bar:hover {
  background: #f5f5f5;
}

.hidden-file-input {
  display: none;
}

.file-item {
  padding: 6px 8px;
  border-bottom: 1px solid #000;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.file-item:last-child {
  border-bottom: none;
}

.file-name {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  white-space: nowrap;
}

.file-delete-glyph {
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}

.file-item:hover .file-actions {
  display: flex;
}

.file-action {
  border: 1px solid #000;
  background: #fff;
  color: #000;
  cursor: pointer;
  font-size: 10px;
  line-height: 1;
  padding: 2px 4px;
  min-width: 18px;
  text-align: center;
}

/* ✏️ in drawer file row + desk row: nudge glyph 1px down; keep total padding; skip projector "r" */
.file-action:not(.file-action-delete):not(.projector-rename-btn) {
  padding-top: 3px;
  padding-bottom: 1px;
}

.file-action:hover,
.file-action:focus-visible,
.file-action:active,
.file-action.is-active {
  background: #000;
  color: #fff;
  border-color: #fff;
  outline: none;
}

.file-action-delete:hover,
.file-action-delete:focus-visible,
.file-action-delete:active,
.file-action-delete.is-active {
  background: #000;
  color: #fff;
  border-color: #fff;
  outline: none;
}

/* Drawer only: when row is dark, buttons switch to white-outline mode. */
.file-item:hover .file-action {
  background: transparent;
  color: #fff;
  border-color: #fff;
}

/* Drawer only: hovered/pressed button in dark row becomes white-filled. */
.file-item:hover .file-action:hover,
.file-item:hover .file-action:focus-visible,
.file-item:hover .file-action:active,
.file-item:hover .file-action.is-active {
  background: #fff;
  color: #000;
  border-color: #fff;
  outline: none;
}

.drawer-rename-input {
  width: 100%;
  min-width: 0;
  border: none;
  background: #fff36b;
  color: #ff0000;
  font-size: 12px;
  line-height: 1.1;
  padding: 0 2px;
  outline: none;
}

@media (min-width: 1025px) {
  .file-item:hover .file-delete-glyph {
    color: #fff;
  }

  .file-delete-glyph:hover {
    color: #ff0000 !important;
  }
}

.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  border-top: 1px solid #000;
  background: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 12px;
  font-size: 11px;
}

@media (max-width: 1024px) {
  .right-panel {
    grid-template-rows: 1fr 1fr auto;
  }

  .furnace-qr-wrap {
    display: flex;
    justify-content: flex-end;
    margin-top: 5px;
  }
}

@media (max-width: 768px) {
  .workspace {
    max-width: 100%;
    margin: 0;
  }

  .furnace-layout {
    display: grid;
    grid-template-columns: 1fr;
    /* Projector 上限約 55vh；下方 board+drawer 用 1fr 吃滿剩餘高度 */
    grid-template-rows: minmax(0, 55vh) minmax(0, 1fr);
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    gap: 12px;
    padding: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .left-main {
    min-height: 0;
    overflow: hidden;
  }

  .right-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    column-gap: 12px;
    row-gap: 2px; /* board 下緣 ↔ 第二列（THEME / QR）垂直距離 */
    height: 100%;
    min-height: 0;
    max-height: none;
  }

  .raw-section {
    grid-column: 1;
    grid-row: 1;
  }

  .drawer-section {
    grid-column: 2;
    grid-row: 1;
  }

  .furnace-qr-wrap {
    grid-column: 2;
    grid-row: 2;
    margin-top: 5px;
  }

  /* THEME：board 下緣 2px（見 .right-panel row-gap）、與 board 左邊界對齊；卡片用 .theme-open + JS */
  #furnace-view .theme-group {
    position: relative;
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
    align-self: start;
    margin-top: 0;
    padding-left: 0;
    z-index: 25;
    color: #000;
    width: max-content;
  }

  #furnace-view .theme-trigger {
    cursor: pointer;
  }

  /* 小屏：pipeline debug 仍依 .pipeline-debug-is-shown（與桌面同一套 dev gate） */

  /* 小屏：不要 AUX 指令輸入列；assist 僅剩模組列表 + 折疊鈕 */
  .assist-box .aux-terminal-line {
    display: none !important;
  }

  /* 小屏：aux-dock 拉高並 flex-end，預設列貼底、assist 吃滿釋出的垂直空間 */
  .aux-dock {
    height: min(40vh, 300px);
    max-height: min(40vh, 300px);
    justify-content: flex-end;
    gap: 6px;
    align-items: stretch;
  }

  .aux-dock .assist-box.bottom-panel:not(.aux-collapsed) {
    flex: 1 1 auto;
    min-height: 0;
    grid-template-rows: 1fr;
    height: auto;
    min-height: 120px;
    max-height: min(28vh, 220px);
  }

  .aux-preset-row {
    flex-shrink: 0;
  }

  .raw-section,
  .drawer-section {
    height: auto;
    min-height: 120px;
    max-height: none;
    overflow: auto;
    flex: 1 1 auto;
  }

}

/* Narrow + short viewport: 略壓 projector 上限，仍把垂直空間留給下方 1fr */
@media (max-width: 768px) and (max-height: 700px) {
  .furnace-layout {
    gap: 8px;
    padding: 8px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    grid-template-rows: minmax(0, 48vh) minmax(0, 1fr);
  }

  .right-panel {
    column-gap: 8px;
    row-gap: 2px;
  }

  .raw-section,
  .drawer-section {
    min-height: 100px;
  }
}

/* Tablet sidebar: avoid oversized board/drawer when window is short */
@media (min-width: 769px) and (max-width: 1024px) and (max-height: 720px) {
  .right-panel {
    max-height: min(42vh, 360px);
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr) auto;
    overflow: hidden;
  }

  .raw-section,
  .drawer-section {
    min-height: 100px;
    overflow: auto;
  }
}

/* Machine-readable reference only (crawlers / AI); not shown in UI. HTML kept for stable anchors. */
.kiln-machine-ref {
  display: none !important;
}
