/* 原 styles.css L558-L1003 连续区间纯移动（UI 重构阶段 A）。内容：历史侧栏/工作区壳（含面板骨架杂项）。层叠顺序由 01→12 的 <link> 顺序保持。 */
/* 面板滚动行为在此处；.preview-panel 的内边距与底色在 04-editor.css，互补不重复。 */
.editor-panel,
.preview-panel {
  min-height: 0;
  overflow: auto;
}

/* 历史记录右侧抽屉：body 直属层，从视口右缘滑入，覆盖预览区（含长文设置的右栏）。 */
/* 历史抽屉打开时 body 挂 .history-open，::after 作为抽屉下的暖色轻遮罩，确立浮层层级。 */
body.history-open::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 390;
  background: rgba(64, 43, 18, 0.28);
  opacity: 1;
  transition: opacity 200ms ease;
  pointer-events: none;
}

body:not(.history-open)::after {
  opacity: 0;
}

.history-drawer-right {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 400;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 10px;
  width: min(270px, 86vw);
  padding: 18px 12px;
  border-left: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow-popover);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 200ms ease, visibility 0s linear 200ms;
}

.history-drawer-right.open {
  transform: translateX(0);
  visibility: visible;
  transition: transform 200ms ease;
}

.panel-resizer {
  position: relative;
  z-index: 4;
  width: 6px;
  min-width: 6px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  cursor: col-resize;
  align-self: stretch;
  touch-action: none;
}

.panel-resizer::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 2px;
  width: 1px;
  background: var(--line);
  transition: background 120ms ease, width 120ms ease, left 120ms ease;
}

.panel-resizer:hover::after,
.panel-resizer.active::after {
  left: 1px;
  width: 3px;
  background: var(--active-bg);
}

body.resizing-panels {
  cursor: col-resize;
  user-select: none;
}

body.resizing-panels iframe,
body.resizing-panels canvas,
body.resizing-panels textarea {
  pointer-events: none;
}

body.cloud-session-checking .workspace,
body.cloud-session-checking .site-footer,
body.entry-choice-pending .workspace,
body.entry-choice-pending .site-footer {
  visibility: hidden;
}

/* 无账号模式只有本机工作区：不展示账号、邮箱或云端入口；反馈入口保留。 */
body.no-account #accountDock,
body.no-account #entryChoiceModal,
body.no-account #accountModal,
body.no-account #welcomeBackModal,
body.no-account [data-feature-badge="account"] {
  display: none !important;
}

body.cloud-session-checking::before {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--paper);
  content: "正在打开你的工作区…";
  font-size: 14px;
  font-weight: 800;
}

.editor-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: visible;
  background: var(--paper);
  border-right: 1px solid var(--line);
  padding: 18px;
}

/* 引导演示态压暗到 0.85：再低（旧值 0.52）会把压暗区文字拖到 AA 线以下。
   「只读示例」的信号由虚线边框 + guide 底色 + 引导气泡承担，不靠重度压暗。 */
body[data-guide-readonly="true"] .mode-switch,
body[data-guide-readonly="true"] .brand-actions button:not(#newProjectBtn),
body[data-guide-readonly="true"] .editor-controls {
  pointer-events: none;
  opacity: 0.85;
}

body[data-guide-readonly="true"] .editor-textarea {
  border-style: dashed;
  color: var(--guide-text);
  background: var(--guide-bg);
  cursor: default;
}

body[data-guide-readonly="true"] .editor-textarea:focus {
  box-shadow: none;
}

/* 布局（flex）在此处定义；.topbar-actions 的间距在 04-editor.css，互补不重复。 */
.brand-row,
.brand-actions,
.preview-topbar,
.toolbar,
.topbar-actions {
  display: flex;
  align-items: center;
}

.brand-row {
  /* 面板宽度由用户拖拽决定、与视口无关，所以窄宽度收放用容器查询（见下方 @container）。 */
  container-type: inline-size;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 0;
}

/* 面板拖得很窄时收一档 logo 字号与按钮内边距，保住「logo + 新建/上传」一行。
   加 .editor-panel 前缀压过 honey.css（文档序在后）的同权重 logo 字号。
   24px：窄档下字标仍清晰（原 20px 被反馈过小）；429px 面板内实测一行无忧。 */
@container (max-width: 429px) {
  .editor-panel .brand-row h1 {
    font-size: 24px;
  }

  .editor-panel .header-mode-button {
    padding-inline: 8px;
  }
}

.brand-title {
  /* 基点用 auto 而不是写死宽度：编辑面板被用户拖窄时，logo+按钮才能保住一行。 */
  flex: 1 1 auto;
  min-width: 0;
}

.brand-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

/* 预览区头部左侧：工作区切换器 + 状态行（原「预览与下载」标题位）。 */
.preview-heading {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  min-width: 0;
}

.mode-switch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control-bg);
}

.mode-switch button {
  height: 34px;
  border-radius: 6px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.mode-switch button.active {
  color: var(--active-text);
  background: var(--active-bg);
}

.header-mode-button {
  height: 42px;
  padding-inline: 10px;
  font-size: 13px;
}

.brand-row h1 {
  margin: 0;
  line-height: 1.05;
  letter-spacing: 0;
  font-size: 22px;
  white-space: nowrap;
}

.brand-english {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.15;
  white-space: nowrap;
}

#statusText {
  display: block;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
}

.history-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.history-filter {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.history-filter button {
  min-height: 28px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.history-filter button.active {
  color: var(--active-text);
  background: var(--active-bg);
  /* 选中底色已压成轻 tint，用 outline 描边保持辨识度（不用 inset ring：按钮不挂 box-shadow）。 */
  outline: 1px solid var(--active-border);
  outline-offset: -1px;
}

.history-list {
  display: grid;
  gap: 8px;
  align-content: start;
  overflow-y: auto;
  padding-right: 2px;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  gap: 6px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  color: var(--control-text);
  background: var(--control-bg);
  text-align: left;
}

.history-item.active {
  border-color: var(--active-border);
  background: var(--active-bg);
  color: var(--active-text);
}

.history-item.built-in {
  border-style: dashed;
}

.history-item span,
.history-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item span {
  font-size: 13px;
  font-weight: 760;
}

.history-item small {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.history-item small b {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  color: var(--active-text);
  background: var(--active-bg);
  font-size: 11px;
  font-weight: 850;
  line-height: 20px;
}

.history-item.active small {
  color: currentColor;
  /* 0.72 会把时间戳拖到选中黄底 4.5:1 以下；0.85 是 AA 下留有余量的层级弱化。 */
  opacity: 0.85;
}

.history-item.active small b {
  color: var(--active-bg);
  background: var(--active-text);
}

.history-empty {
  padding: 12px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--control-bg);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.history-item .history-open {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 6px;
  color: inherit;
  background: transparent;
  text-align: left;
  justify-content: stretch;
}

.history-delete {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: currentColor;
  background: transparent;
  opacity: 0.7;
}

.history-delete:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  opacity: 1;
}

.history-delete svg {
  width: 16px;
  height: 16px;
}

.history-lock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  color: currentColor;
  opacity: 0.65;
}

.history-lock svg {
  width: 15px;
  height: 15px;
}

.panel-section {
  border-top: 1px solid var(--line);
  padding: 18px 0;
}

.editor-controls {
  position: relative;
  z-index: 8;
  display: grid;
  gap: 10px;
  padding: 10px 0 12px;
  border-top: 1px solid var(--line);
}

.section-title {
  margin-bottom: 12px;
  color: var(--control-text);
  font-size: 13px;
  font-weight: 800;
}

.toolbar {
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 0;
}

