@media (max-width: 700px) {
  .studio-file-actions,
  .action-group {
    scrollbar-width: none;
  }

  .studio-file-actions::-webkit-scrollbar,
  .action-group::-webkit-scrollbar {
    display: none;
  }
}

/* JSON 工作台工具栏：保持操作名称横向可读，并建立清晰的主次层级。 */
.json-studio {
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.studio-topbar {
  min-height: 72px;
  padding: 12px 20px;
}

.studio-brand b {
  font-size: 14px;
  letter-spacing: -.01em;
}

.studio-brand span {
  font-size: 10px;
}

.studio-file-actions {
  gap: 8px;
}

.studio-file-actions button,
.studio-file-actions .file-action {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 12px;
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.studio-file-actions em {
  margin-left: 0;
  line-height: 16px;
}

.studio-workspace {
  grid-template-columns: minmax(0, 4fr) minmax(0, 6fr);
  height: clamp(500px, 68vh, 720px);
  min-height: 0;
  overflow: hidden;
}

.studio-workspace .editor-pane {
  height: 100%;
  overflow: hidden;
}

.studio-workspace .output-view,
.studio-workspace .code-editor,
.studio-workspace .code-editor textarea {
  min-height: 0;
}

.studio-workspace .code-editor,
.studio-workspace .output-view {
  height: auto;
  flex: 1 1 auto;
}

.studio-workspace .output-view[data-panel="text"]:not([hidden]) {
  display: flex;
  min-height: 0;
  flex-direction: column;
}

.studio-workspace .output-view[data-panel="text"] .code-editor {
  width: 100%;
  height: 100%;
  min-height: 0;
  flex: 1 1 0;
  overflow: hidden;
}

.studio-workspace .code-editor textarea {
  height: 100%;
  padding-bottom: 48px;
  scroll-padding-bottom: 48px;
  overflow: auto;
}

.studio-workspace .line-numbers {
  padding-bottom: 48px;
}

.studio-workspace .syntax-highlight,
.studio-workspace .json-tree,
.studio-workspace .query-panel,
.studio-workspace .diff-panel {
  overflow: auto;
}

.output-pane {
  background: #fbfdfc;
  box-shadow: inset 3px 0 0 rgba(23, 79, 66, .12);
}

.output-pane > header {
  background: #f7fbf9;
}

.output-pane .code-editor,
.output-pane .syntax-highlight,
.output-pane .json-tree,
.output-pane .query-panel,
.output-pane .diff-panel {
  background-color: #fbfdfc;
}

.json-studio.has-output-error .output-pane {
  background: #fff8f7;
  box-shadow: inset 3px 0 0 #d04b43;
}

.json-studio.has-output-error .output-pane > header,
.json-studio.has-output-error .output-pane .code-editor {
  background: #fff8f7;
}

.json-studio.has-output-error #jsonOutput {
  color: #a62f2f;
  font-weight: 600;
  white-space: pre-wrap;
}

.tree-error {
  display: flex;
  min-height: 100%;
  align-items: flex-start;
  flex-direction: column;
  justify-content: center;
  padding: 32px;
  color: #a62f2f;
}

.tree-error b { font-size: 15px; }
.tree-error pre { margin: 12px 0; white-space: pre-wrap; font: 11px/1.7 Consolas, monospace; }
.tree-error span { color: #8c625e; font-size: 10px; }
.studio-file-actions button:disabled,
.studio-actions button:disabled { opacity: .45; cursor: not-allowed; }

/* Keep secondary information readable on high-resolution desktop displays. */
.studio-status > div,
.studio-status #jsonStatus {
  font-size: 11px;
}

.studio-inspector header span {
  font-size: 10px;
}

.studio-inspector header h2 {
  font-size: 17px;
}

.studio-inspector header button {
  min-height: 30px;
  padding: 6px 10px;
  font-size: 10px;
}

.stat-cards span {
  font-size: 10px;
}

.type-bars > div {
  grid-template-columns: 66px 1fr 30px;
  gap: 8px;
  min-height: 20px;
  font-size: 10px;
}

.type-bars i {
  height: 6px;
}

.conversion-grid button {
  grid-template-columns: 42px 1fr;
  min-height: 74px;
  column-gap: 11px;
  padding: 12px;
}

.conversion-grid i {
  width: 42px;
  height: 42px;
  font-size: 10px;
}

.conversion-grid b {
  font-size: 11px;
}

.conversion-grid span {
  font-size: 9px;
  line-height: 1.45;
}

.studio-actions {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0 20px;
  min-height: 0;
  padding: 12px 20px 10px;
}

.action-group {
  min-width: 0;
  gap: 7px;
}

.action-group + .action-group {
  padding-left: 20px;
}

.studio-actions button,
.action-group label,
.action-group select {
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.studio-actions button {
  min-height: 34px;
  padding: 8px 11px;
}

.primary-actions button {
  border-color: var(--line);
  background: #fff;
}

.primary-actions button.active {
  border-color: var(--green);
  background: var(--green);
}

.studio-actions kbd {
  margin-left: 7px;
  font-size: 9px;
}

.action-group select {
  min-height: 34px;
  padding: 7px 9px;
}

.utility-actions {
  grid-column: 1 / -1;
  margin: 10px 0 0;
  padding: 10px 0 0 !important;
  border-top: 1px solid var(--line);
  border-left: 0 !important;
}

.utility-actions::before {
  content: "高级处理";
  flex: 0 0 auto;
  margin-right: 4px;
  color: #8a9490;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
}

.utility-actions button {
  min-height: 30px;
  padding: 6px 9px;
  color: #64706c;
  font-size: 10px;
}

.utility-actions #clearJson {
  order: 1;
}

.utility-actions #copyJson {
  order: 2;
  display: inline-flex;
  min-width: 104px;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-left: auto;
  padding: 7px 13px;
  border-color: var(--green);
  background: var(--green);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 5px 14px rgba(23, 79, 66, .16);
}

.utility-actions #copyJson::before {
  content: "";
  width: 14px;
  height: 14px;
  background: no-repeat center/14px 14px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='8' y='8' width='13' height='13' rx='2'/%3E%3Cpath d='M16 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h3'/%3E%3C/svg%3E");
}

.utility-actions #copyJson:hover {
  background: #103f35;
  color: #fff;
}

.json-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 160;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 16px;
  border-radius: 10px;
  background: #153f35;
  color: #fff;
  box-shadow: 0 14px 40px rgba(12, 38, 31, .24);
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .18s, transform .18s;
  pointer-events: none;
}

.json-toast::before {
  content: "✓";
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: var(--green);
  font-size: 12px;
}

.json-toast.show {
  opacity: 1;
  transform: translateY(0);
}

body.json-page-dark {
  --paper: #101713;
  --surface: #18231f;
  --surface-2: #22302b;
  --ink: #e5eee9;
  --muted: #9eaca6;
  --line: #34443e;
  background: #101713;
  color: #e5eee9;
}

body.json-page-dark .site-header {
  border-color: #2e3d38;
  background: rgba(16, 23, 19, .94);
}

body.json-page-dark .new-brand,
body.json-page-dark .primary-nav a,
body.json-page-dark .nav-menu-trigger {
  color: #dbe6e1;
}

body.json-page-dark .new-brand > small,
body.json-page-dark .primary-nav a:not(.json-home-link) {
  color: #9eaaa5;
}

body.json-page-dark .global-search-trigger,
body.json-page-dark .mobile-tools-trigger {
  border-color: #34443e;
  background: #18231f;
  color: #b9c6c0;
}

body.json-page-dark kbd {
  border-color: #43534d;
  background: #26342f;
  color: #c2cec8;
}

body.json-page-dark .tools-mega-menu,
body.json-page-dark .mega-menu-head,
body.json-page-dark .command-panel,
body.json-page-dark .json-modal > section {
  border-color: #34443e;
  background: #17211e;
  color: #e5eee9;
}

body.json-page-dark .mega-menu-grid section,
body.json-page-dark .command-results a.selected,
body.json-page-dark .json-modal input,
body.json-page-dark #historyList article {
  border-color: #34443e;
  background: #202d28;
  color: #dce7e2;
}

body.json-page-dark .json-workbench-page,
body.json-page-dark .json-guide,
body.json-page-dark .tool-guide {
  color: #e5eee9;
}

body.json-page-dark .json-guide article,
body.json-page-dark .related-tools a {
  border-color: #34443e;
  background: #18231f;
}

body.json-page-dark .site-footer {
  border-color: #2e3d38;
  background: #101713;
  color: #98a69f;
}

body.json-page-dark .site-footer a,
body.json-page-dark .site-footer b {
  color: #dce7e2;
}

body.json-page-dark .command-input,
body.json-page-dark .mega-menu-head {
  border-color: #34443e;
}

body.json-page-dark .command-input input {
  color: #edf4f0;
}

body,
.site-header,
.site-footer {
  transition: background-color .18s, color .18s, border-color .18s;
}

.editor-pane > header {
  min-height: 52px;
  padding: 8px 16px;
}

.editor-pane > header b,
.output-tabs button {
  font-size: 11px;
}

.editor-pane > header span,
.editor-pane > header small,
.tree-actions input,
.tree-actions button {
  font-size: 9px;
}

@media (max-width: 1180px) {
  .studio-actions {
    grid-template-columns: 1fr;
  }

  .action-group + .action-group {
    margin-top: 9px;
    padding: 9px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .utility-actions {
    grid-column: auto;
  }
}

@media (max-width: 1050px) {
  .studio-workspace {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .studio-workspace .editor-pane {
    height: min(560px, 68vh);
  }

  .output-pane {
    box-shadow: inset 0 3px 0 rgba(23, 79, 66, .12);
  }
}

@media (max-width: 700px) {
  .studio-topbar {
    padding: 12px;
  }

  .studio-actions {
    display: block;
    padding: 8px 10px;
  }

  .action-group {
    gap: 6px;
    padding: 6px 0;
    overflow-x: auto;
  }

  .action-group + .action-group,
  .utility-actions {
    margin-top: 0;
    padding: 8px 0 4px !important;
  }

  .utility-actions::before {
    position: sticky;
    left: 0;
    padding: 8px 8px 8px 0;
    background: #f7f9f8;
  }
}
