/* 编辑器 / 画布 模式切换（ascii-editor.html 左上角、canvas.html 顶栏共用）。参照 ASCII Magic 的 Studio | Flow。 */
.mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid #f4f4f5;
  border-radius: 10px;
  background: #ffffff;
}

.mode-switch a {
  display: inline-flex;
  height: 32px;
  align-items: center;
  padding: 0 12px;
  border-radius: 7px;
  color: #71717a;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.mode-switch a:hover {
  background: #f4f4f5;
  color: #27272a;
}

.mode-switch a[aria-current="page"] {
  background: #27272a;
  color: #ffffff;
  cursor: default;
}

.mode-switch a:focus-visible {
  outline: 2px solid #27272a;
  outline-offset: 1px;
}

/* 两个页面都浮在左上角同一位置（24, 24），和左侧工具栏左边对齐；切换页面时不跳动 */
.mode-switch.is-floating {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 30;
}

/* 画布：放进顶栏左侧那组按钮里，去掉自己的边框 */
.flow-topbar .mode-switch {
  padding: 0;
  border: 0;
  background: transparent;
}

html[data-color-scheme="dark"] .mode-switch {
  border-color: #27272a;
  background: #18181b;
}

html[data-color-scheme="dark"] .flow-topbar .mode-switch {
  background: transparent;
}

html[data-color-scheme="dark"] .mode-switch a {
  color: #a1a1aa;
}

html[data-color-scheme="dark"] .mode-switch a:hover {
  background: #27272a;
  color: #f4f4f5;
}

html[data-color-scheme="dark"] .mode-switch a[aria-current="page"] {
  background: #f4f4f5;
  color: #18181b;
}

html[data-color-scheme="dark"] .mode-switch a:focus-visible {
  outline-color: #f4f4f5;
}

/* 左侧工具栏（编辑器和画布共用 .ascii-tool-rail）：深色模式下悬停时图标提亮（原规则是浅色下的压暗，深色里会变得更暗） */
html[data-color-scheme="dark"] .ascii-tool-button:hover .ascii-rail-img:not(.ascii-rail-img-logo),
html[data-color-scheme="dark"] .ascii-tool-button:focus-visible .ascii-rail-img:not(.ascii-rail-img-logo) {
  filter: brightness(0) invert(0.86);
}

html[data-color-scheme="dark"] .ascii-tool-button.is-active:hover .ascii-rail-img:not(.ascii-rail-img-logo) {
  filter: brightness(0);
}
