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

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;
}

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;
}

.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-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;
}

.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;
}

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

.meatmark {
  position: absolute;
  top: 5px;
  right: 4px;
  z-index: 4;
  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;
}

.doc-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;
}

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

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

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

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

.auth-card {
  position: absolute;
  bottom: 25px;
  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;
}

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

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

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

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

.furnace-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 12px;
  height: calc(100vh - 24px);
  padding: 12px;
  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-header-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #000;
  background: #000;
  color: #fff;
}

.pipeline-debug {
  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;
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow: hidden;
  backdrop-filter: blur(8px) saturate(50%);
  -webkit-backdrop-filter: blur(8px) saturate(50%);
}

.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;
  display: block;
}

.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;
}

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

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

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

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

.projector-rename-btn {
  margin-right: 6px;
}

#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;
  padding-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.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 {
  border: none;
  min-width: 0;
  white-space: pre-wrap;
  outline: none;
  flex: 1;
}

.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;
}

.bottom-panel {
  position: absolute;
  bottom: 4px;
  left: 4px;
  width: 200px;
  height: 100px;
  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;
}

.aux-module-line {
  width: fit-content;
  font-size: 10px;
  line-height: 1.2;
  cursor: pointer;
}

.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 {
  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;
}

.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;
}

.raw-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.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;
}

.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;
}

.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-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;
    grid-template-rows: 0.9fr 290px;
    height: 100vh;
    gap: 12px;
  }

  .right-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr auto;
    gap: 12px;
    height: 100%;
  }

  .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;
  }

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

}

/* Reference doc: stable anchors for citation / SEO (collapsed by default) */
.kiln-reference-doc {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 12;
  margin: 0;
  border-top: 1px solid #999;
  background: #f0f0f0;
  font-size: 11px;
  line-height: 1.45;
  color: #111;
}

.kiln-reference-summary {
  cursor: pointer;
  padding: 5px 12px;
  list-style: none;
  font-weight: normal;
  background: #e4e4e4;
  border-bottom: 1px solid #bbb;
}

.kiln-reference-summary::-webkit-details-marker {
  display: none;
}

.kiln-reference-inner {
  max-height: min(38vh, 300px);
  overflow-y: auto;
  padding: 10px 12px 14px;
}

.kiln-ref-section h2 {
  font-size: 12px;
  margin: 12px 0 6px;
  font-weight: bold;
}

.kiln-ref-section:first-child h2 {
  margin-top: 0;
}

.kiln-ref-section p,
.kiln-ref-block p {
  margin: 0 0 8px;
}

.kiln-ref-section ul {
  margin: 0 0 8px;
  padding-left: 1.2em;
}

.kiln-ref-pre {
  margin: 0 0 6px;
  padding: 6px 8px;
  background: #fff;
  border: 1px solid #ccc;
  white-space: pre-wrap;
  font-family: inherit;
}
