/* ==========================================================================
   MCADDON.NET — CREATOR STUDIO
   Dense editor UI on the visual-style-guide.md tokens (css/tokens.css).
   MinecraftTen only for major headings; Noto Sans for all controls and text.
   ========================================================================== */

@import url('/css/fonts.css');

:root {
  /* Surfaces: darker steps between off-black (#171615) and grey-6 (#262423) */
  --bg-page: var(--mc-core-off-black);
  --bg-surface: #1c1b1a;
  --bg-surface-elevated: #211f1e;
  --bg-surface-hover: var(--mc-core-grey-6);
  --bg-input: #121110;

  /* Borders */
  --border-subtle: #2a2726;
  --border-card: #34302f;
  --border-focus: var(--mc-core-green-4);

  /* Text */
  --text-white: var(--mc-core-white);
  --text-primary: var(--mc-core-grey-1);
  --text-secondary: var(--mc-core-grey-2);
  --text-muted: var(--mc-core-grey-3);
  --text-code: var(--mc-core-grey-2);

  /* Accents */
  --mc-green-primary: var(--mc-core-green-4);
  --mc-green-hover: var(--mc-core-green-3);
  --mc-green-shadow: var(--mc-core-green-6);
  --mc-green-highlight: var(--mc-core-green-2);

  --mc-stone-button: var(--mc-core-grey-5);
  --mc-stone-button-hover: #4a4543;
  --mc-stone-highlight: var(--mc-core-grey-4);
  --mc-stone-shadow: #1f1d1c;

  --mc-gold-subtle: var(--mc-gold-1);
  --mc-redstone-subtle: var(--mc-redstone-1);

  /* Dimensions */
  --nav-height: 54px;
  --toolbar-height: 48px;
  --sidebar-width: 330px;
}

/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--mc-font-body);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-page);
}

::-webkit-scrollbar-thumb {
  background: #2e2a28;
}

::-webkit-scrollbar-thumb:hover {
  background: #423d3a;
}

/* ==========================================================================
   1. MINIMAL HEADER
   ========================================================================== */
.studio-header {
  height: var(--nav-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  user-select: none;
  z-index: 50;
}

.studio-brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex-shrink: 1;
}

/* MinecraftTen strictly for brand logo */
.studio-logo {
  font-family: var(--mc-font-display);
  font-size: 20px;
  color: var(--mc-core-white);
  text-decoration: none;
  letter-spacing: 0.04em;
}

.studio-badge {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  padding: 3px 8px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.studio-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}


/* Bevel buttons (visual-style-guide.md 4.1). The guide's 4px bevel is scaled to 3px/2px for
   the dense editor; labels use the body font because the pixel font lacks punctuation glyphs. */
.mc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: var(--mc-font-body);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.1;
  white-space: nowrap;
  padding: 8px 16px;
  border: none;
  cursor: pointer;
  border-radius: 0;
  text-decoration: none;
  transition: background-color 0.12s ease, transform 0.08s ease;
  user-select: none;
  --bevel: 3px;
}

.mc-btn:active {
  transform: translateY(1px);
  --bevel: 1px;
}

.mc-btn:focus-visible {
  outline: 2px solid var(--mc-core-white);
  outline-offset: 1px;
}

.mc-btn:disabled,
.mc-btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.mc-btn--green {
  background-color: var(--mc-green-primary);
  color: var(--mc-core-white);
  box-shadow: inset 0 var(--bevel) 0 var(--mc-green-highlight), inset 0 calc(var(--bevel) * -1) 0 var(--mc-green-shadow);
}

.mc-btn--green:hover {
  background-color: var(--mc-green-hover);
}

.mc-btn--stone {
  background-color: var(--mc-stone-button);
  color: var(--mc-core-grey-1);
  box-shadow: inset 0 var(--bevel) 0 var(--mc-stone-highlight), inset 0 calc(var(--bevel) * -1) 0 var(--mc-stone-shadow);
}

.mc-btn--stone:hover {
  background-color: var(--mc-stone-button-hover);
  color: var(--mc-core-white);
}

.mc-btn--sm {
  padding: 6px 10px;
  font-size: 12px;
  --bevel: 2px;
}

.mc-btn--sm:active {
  --bevel: 1px;
}

/* ==========================================================================
   2. MINIMAL CATEGORY TOOLBAR
   ========================================================================== */
.studio-toolbar {
  position: relative;
  height: var(--toolbar-height);
  background: #151413;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  user-select: none;
  z-index: 50;
}

/* Chips scroll sideways instead of wrapping onto two lines. */
.studio-category-chips {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
  padding: 4px 0;
}

.studio-category-chips::-webkit-scrollbar {
  height: 4px;
}

.studio-cat-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  padding: 5px 11px;
  flex-shrink: 0;
  white-space: nowrap;
  font-family: var(--mc-font-body);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
}

.studio-cat-btn:hover {
  background: var(--bg-surface-elevated);
  color: var(--mc-core-white);
}

.studio-cat-btn.is-active {
  background: var(--bg-surface-elevated);
  color: var(--mc-core-white);
  font-weight: 600;
  border-color: var(--border-card);
}

/* Consistent Gray Icons */
.studio-cat-icon {
  width: 14px;
  height: 14px;
  image-rendering: pixelated;
  opacity: 0.75;
}

.studio-cat-btn:hover .studio-cat-icon,
.studio-cat-btn.is-active .studio-cat-icon {
  opacity: 1;
}

/* ==========================================================================
   FILE DROPDOWN MENU
   ========================================================================== */
.studio-menu-dropdown-wrap {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  z-index: 100;
}

.studio-cat-btn--menu {
  background: #1e1c1b;
  border: 1px solid #3c3732;
  color: #f0eee9;
  font-weight: 600;
  border-radius: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.studio-cat-btn--menu:hover,
.studio-menu-dropdown-wrap.is-open .studio-cat-btn--menu {
  background: #2b2825;
  border-color: #574f47;
  color: var(--mc-gold-1);
}

.studio-menu-arrow {
  font-size: 8px;
  margin-left: 2px;
  opacity: 0.7;
  transition: transform 0.15s ease;
  display: inline-block;
}

.studio-menu-dropdown-wrap.is-open .studio-menu-arrow {
  transform: rotate(180deg);
}

.studio-menu-dropdown {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  min-width: 195px;
  background: #1a1817;
  border: 1px solid #3d3731;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.75), 0 2px 8px rgba(0, 0, 0, 0.5);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 1000;
  border-radius: 0;
  animation: menuDropFade 0.12s ease-out;
}

@keyframes menuDropFade {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.studio-menu-dropdown-wrap.is-open .studio-menu-dropdown {
  display: flex;
}

.studio-dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 10px;
  background: transparent;
  border: 1px solid transparent;
  color: #e0deda;
  font-family: var(--mc-font-body);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  border-radius: 0;
  transition: all 0.1s ease;
  user-select: none;
}

.studio-dropdown-item:hover {
  background: #2a2622;
  color: var(--mc-core-white);
  border-color: #4a433b;
}

.studio-dropdown-item--primary {
  color: var(--mc-core-green-2);
  font-weight: 600;
}

.studio-dropdown-item--primary:hover {
  background: #1e3314;
  color: var(--mc-core-white);
  border-color: #3b6628;
}

.dropdown-item-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dropdown-item-icon img {
  width: 14px;
  height: 14px;
  image-rendering: pixelated;
  opacity: 0.9;
}

.studio-dropdown-item:hover .dropdown-item-icon img {
  opacity: 1;
}

.dropdown-item-text {
  flex: 1;
  white-space: nowrap;
}

.dropdown-item-badge {
  font-size: 9.5px;
  text-transform: uppercase;
  padding: 1px 5px;
  background: #26221f;
  color: #9c958c;
  border: 1px solid #3d3731;
  border-radius: 0;
  font-weight: 600;
}

.dropdown-item-shortcut {
  font-size: 10px;
  color: #8c857b;
  font-family: monospace;
}

.studio-dropdown-divider {
  height: 1px;
  background: #2f2a25;
  margin: 4px 2px;
}

.studio-view-toggle {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  background: #171615;
  border: 1px solid var(--border-subtle);
  padding: 2px;
}

.studio-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--mc-font-body);
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 10px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.12s ease;
}

.studio-toggle-btn:hover {
  color: var(--text-primary);
}

.studio-toggle-btn.is-active {
  background: var(--bg-surface-elevated);
  color: var(--mc-core-white);
  font-weight: 600;
}
/* ==========================================================================
   BRIDGE-GRADE CONTEXT MENU (Hierarchy Right-Click Actions)
   ========================================================================== */
.studio-context-menu {
  position: fixed;
  z-index: 3000;
  min-width: 210px;
  background: #1c1a19;
  border: 1px solid #3d3731;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.85), 0 2px 6px rgba(0, 0, 0, 0.6);
  padding: 5px;
  border-radius: 0;
  display: none;
  flex-direction: column;
  gap: 2px;
  user-select: none;
  animation: contextMenuFade 0.1s ease-out;
}

.studio-context-menu.is-visible {
  display: flex;
}

@keyframes contextMenuFade {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.studio-context-header {
  padding: 5px 8px 6px;
  font-size: 11px;
  font-weight: 600;
  color: #a39b91;
  border-bottom: 1px solid #2d2824;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.studio-context-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 6px 9px;
  background: transparent;
  border: 1px solid transparent;
  color: #eae7e3;
  font-family: var(--mc-font-body);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  border-radius: 0;
  transition: all 0.1s ease;
  user-select: none;
}

.studio-context-item:hover:not(:disabled) {
  background: #2b2724;
  color: var(--mc-core-white);
  border-color: #4a433b;
}

.studio-context-item:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.studio-context-item--danger:hover:not(:disabled) {
  background: #3b1717;
  color: var(--mc-redstone-2);
  border-color: #632626;
}

.context-item-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}

.context-item-label {
  flex: 1;
  white-space: nowrap;
}

.context-item-shortcut {
  font-size: 10px;
  color: #7d766e;
  font-family: monospace;
  margin-left: 12px;
}

.studio-context-divider {
  height: 1px;
  background: #2b2723;
  margin: 3px 2px;
}

.tree-file.is-context-target,
.tree-folder-header.is-context-target,
.tree-pack-header.is-context-target {
  background: #2d2926 !important;
  outline: 1px dashed #574f47;
}

/* ==========================================================================
   3. STUDIO WORKSPACE LAYOUT
   ========================================================================== */
.studio-workspace {
  display: flex;
  width: 100%;
  height: calc(100vh - var(--nav-height) - var(--toolbar-height));
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   LEFT SIDEBAR: PACK HIERARCHY
   -------------------------------------------------------------------------- */
.studio-sidebar {
  width: var(--sidebar-width);
  min-width: 260px;
  max-width: 380px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
  user-select: none;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 10px 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-title {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.sidebar-search-box {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  color: var(--mc-core-white);
  padding: 6px 9px;
  font-size: 12px;
  font-family: var(--mc-font-body);
  outline: none;
  transition: border-color 0.15s ease;
}

.sidebar-search-input:focus {
  border-color: var(--border-focus);
}

.sidebar-search-input::placeholder {
  color: var(--text-muted);
}

/* Tree Structure */
.sidebar-tree {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.tree-pack-group {
  margin-bottom: 6px;
}

.tree-pack-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface-elevated);
  cursor: pointer;
  transition: background 0.12s ease;
}

.tree-pack-header:hover {
  background: var(--bg-surface-hover);
  color: var(--mc-core-white);
}

.tree-pack-caret {
  display: inline-block;
  font-size: 9px;
  color: var(--text-muted);
  transition: transform 0.15s ease;
  width: 10px;
  text-align: center;
}

.tree-pack-header.is-collapsed .tree-pack-caret {
  transform: rotate(-90deg);
}

.tree-pack-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  background: #252220;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.tree-pack-badge--bp,
.tree-pack-badge--rp {
  background: #252220;
  color: var(--text-secondary);
}

.tree-pack-children {
  display: flex;
  flex-direction: column;
}

.tree-pack-header.is-collapsed+.tree-pack-children {
  display: none;
}

/* Folder */
.tree-folder {
  display: flex;
  flex-direction: column;
}

.tree-folder-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 24px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s ease;
}

.tree-folder-header:hover {
  background: var(--bg-surface-hover);
  color: var(--mc-core-white);
}

.tree-folder-icon {
  width: 15px;
  height: 15px;
  image-rendering: pixelated;
  opacity: 0.85;
}

.tree-folder-count {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: auto;
}

.tree-folder-children {
  display: flex;
  flex-direction: column;
}

.tree-folder-header.is-collapsed+.tree-folder-children,
.tree-folder-children.is-hidden {
  display: none !important;
}

.tree-folder-caret {
  display: inline-block;
  font-size: 9px;
  color: var(--text-muted);
  transition: transform 0.15s ease;
  width: 10px;
  text-align: center;
}

.tree-folder-header.is-collapsed .tree-folder-caret {
  transform: rotate(-90deg);
}

.tree-pack-header.is-collapsed+.tree-pack-children,
.tree-pack-children.is-hidden {
  display: none !important;
}

.is-hidden {
  display: none !important;
}

/* File */
.tree-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 38px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s ease;
}

.tree-file:hover {
  background: var(--bg-surface-hover);
  color: var(--mc-core-white);
}

.tree-file.is-active {
  background: #23201e;
  color: var(--mc-core-white);
  font-weight: 500;
  border-left: 2px solid #ded7d0;
  padding-left: 36px;
}

.tree-file-icon {
  width: 15px;
  height: 15px;
  image-rendering: pixelated;
  opacity: 0.9;
  flex-shrink: 0;
}

.tree-file.is-active .tree-file-icon {
  opacity: 1;
}

.tree-file-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.tree-file-actions {
  display: none;
  align-items: center;
  gap: 3px;
  margin-left: auto;
}

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

.tree-file:hover .tree-file-ext {
  display: none;
}

.tree-file-action-btn {
  background: transparent;
  border: none;
  padding: 3px;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  transition: all 0.12s ease;
}

.tree-file-action-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--mc-core-white);
}

.tree-file-action-btn.btn-delete:hover {
  background: rgba(239, 68, 68, 0.25);
  color: var(--mc-redstone-2);
}

.tree-file-ext {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: auto;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 8px 12px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* --------------------------------------------------------------------------
   MAIN CANVAS / VISUAL EDITOR
   -------------------------------------------------------------------------- */
.studio-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-page);
  overflow: hidden;
  position: relative;
}

.file-meta-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  flex-shrink: 0;
}

.file-meta-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.file-meta-icon {
  width: 18px;
  height: 18px;
  image-rendering: pixelated;
  opacity: 0.8;
}

.file-meta-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.file-meta-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--mc-core-white);
  display: flex;
  align-items: center;
  gap: 6px;
}

.file-meta-identifier {
  font-family: var(--mc-font-code);
  font-size: 11px;
  color: var(--text-muted);
}

.file-meta-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Editor Container: Holds Visual Blocks & Raw Code Views (Split or Single) */
.studio-editor-container {
  flex: 1;
  display: flex;
  flex-direction: row;
  min-height: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  position: relative;
}

/* Canvas Area */
.block-canvas-wrap {
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  padding: 18px 24px 60px 24px;
  background: var(--bg-page);
}

.block-canvas-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 340px;
  text-align: center;
  color: var(--text-muted);
}

.block-canvas-empty-icon {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* ==========================================================================
   4. MINIMAL SCRATCH PARAMETER BLOCKS (Clean Dark Cards)
   ========================================================================== */
.scratch-block-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 580px;
  margin: 0 auto;
  width: 100%;
  font-family: var(--mc-font-body);
}

.scratch-block {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: 0;
  transition: border-color 0.12s ease;
  font-family: var(--mc-font-body);
}

.scratch-block:hover {
  border-color: #3e3834;
}

/* Block Header */
.scratch-block__header {
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.18);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 9px;
  user-select: none;
  cursor: pointer;
  font-family: var(--mc-font-body);
}

.scratch-block__icon {
  width: 16px;
  height: 16px;
  image-rendering: pixelated;
  opacity: 0.95;
}

.scratch-block__title {
  font-family: var(--mc-font-body);
  font-size: 14px;
  font-weight: 700;
  color: var(--mc-core-white);
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow-wrap: break-word;
}

.scratch-block__badge {
  flex-shrink: 0;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  background: #141312;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  text-transform: uppercase;
}

.scratch-block__actions {
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.scratch-block__btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 3px 6px;
  transition: color 0.12s ease;
}

.scratch-block__btn:hover {
  color: var(--mc-core-white);
}

.scratch-block__btn--del:hover {
  color: var(--mc-redstone-2);
}

.scratch-block__caret {
  font-size: 9px;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

.scratch-block.is-collapsed .scratch-block__caret {
  transform: rotate(-90deg);
}

.scratch-block.is-collapsed .scratch-block__body {
  display: none;
}

/* Block Body: Parameter Fields */
.scratch-block__body {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

/* Parameter Row
   Two-column grid: label | control. Every control starts at the same x, shrinks with the
   card and never overflows it. The delete button always reserves its slot so rows align. */
.param-row {
  display: grid;
  grid-template-columns: minmax(96px, min(34%, 220px)) minmax(0, 1fr);
  align-items: center;
  column-gap: 14px;
  padding: 3px 0;
  min-width: 0;
}

.param-row--array {
  align-items: start;
}

.param-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  overflow-wrap: anywhere;
  cursor: help;
}

.param-hint {
  font-size: 11px;
  font-weight: 400;
  line-height: 1.35;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: help;
  transition: color 0.15s ease;
}

.param-hint:hover {
  color: var(--mc-gold-1);
}

.param-ctrl {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

/* Parameter inputs */
.param-input-pill {
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  color: var(--mc-core-white);
  font-family: var(--mc-font-body);
  font-size: 13px;
  padding: 6px 10px;
  width: 92px;
  min-width: 0;
  height: 32px;
  text-align: right;
  outline: none;
  border-radius: 0;
  transition: border-color 0.15s ease;
}

.param-input-pill--text {
  flex: 1 1 auto;
  width: auto;
  text-align: left;
}

.param-input-pill:focus {
  border-color: var(--border-focus);
}

.param-input-pill.is-out-of-range {
  border-color: var(--mc-redstone-2);
}

/* ==========================================================================
   MINECRAFT BEDROCK CONTROLS (Authentic Bedrock Settings UI)
   ========================================================================== */

/* 1. Bedrock Progress Slider */
.param-slider-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}

.param-slider-group .param-input-pill {
  flex: 0 0 92px;
}

.param-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1 1 auto;
  width: auto;
  min-width: 48px;
  height: 24px;
  background: transparent;
  cursor: pointer;
  padding: 0;
  margin: 0;
  border: none;
  outline: none;
  display: block;
  vertical-align: middle;
}

/* Chrome / Safari / Edge Webkit Track */
.param-slider::-webkit-slider-runnable-track {
  height: 6px;
  background: linear-gradient(to right,
      var(--mc-core-green-4) 0%,
      var(--mc-core-green-4) var(--slider-pct, 50%),
      #1d1d1f var(--slider-pct, 50%),
      #1d1d1f 100%);
  border: 1px solid #101010;
  border-radius: 0;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.4);
}

/* Chrome / Safari / Edge Webkit Thumb */
.param-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 20px;
  margin-top: -8px;
  background-image: url('/Assets/ui/slider_button_default.png');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  border: none;
  cursor: pointer;
  border-radius: 0;
  transition: filter 0.1s ease;
}

.param-slider::-webkit-slider-thumb:hover {
  background-image: url('/Assets/ui/slider_button_hover.png');
}

/* Firefox Track */
.param-slider::-moz-range-track {
  height: 6px;
  background: linear-gradient(to right,
      var(--mc-core-green-4) 0%,
      var(--mc-core-green-4) var(--slider-pct, 50%),
      #1d1d1f var(--slider-pct, 50%),
      #1d1d1f 100%);
  border: 1px solid #101010;
  border-radius: 0;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.4);
}

/* Firefox Thumb */
.param-slider::-moz-range-thumb {
  width: 14px;
  height: 20px;
  background-image: url('/Assets/ui/slider_button_default.png');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  border: none;
  cursor: pointer;
  border-radius: 0;
}

.param-slider::-moz-range-thumb:hover {
  background-image: url('/Assets/ui/slider_button_hover.png');
}

/* 2. Official Minecraft Bedrock Toggle Switch */
.mc-bedrock-toggle-wrap {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
  cursor: pointer;
  user-select: none;
  vertical-align: middle;
}

.mc-bedrock-toggle-wrap input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 5;
}

.mc-bedrock-toggle {
  position: absolute;
  top: 0;
  left: 0;
  width: 44px;
  height: 22px;
  background-image: url('/Assets/ui/toggle_off.png');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  box-sizing: border-box;
  pointer-events: none;
}

.mc-bedrock-toggle-wrap:hover .mc-bedrock-toggle {
  background-image: url('/Assets/ui/toggle_off_hover.png');
}

.mc-bedrock-toggle-wrap input:checked+.mc-bedrock-toggle {
  background-image: url('/Assets/ui/toggle_on.png');
}

.mc-bedrock-toggle-wrap input:checked:hover+.mc-bedrock-toggle {
  background-image: url('/Assets/ui/toggle_on_hover.png');
}

.mc-bedrock-toggle__cell,
.mc-bedrock-toggle__thumb {
  display: none;
}

/* Tags / Array */
.param-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 360px;
}

.param-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #1e1c1b;
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 2px 7px;
}

.param-tag-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 10px;
}

.param-tag-remove:hover {
  color: var(--mc-redstone-2);
}

/* Nested sub-brackets & array cards */
.nested-block-bracket {
  margin-top: 6px;
  padding: 8px 10px 8px 12px;
  border-left: 2px solid #574f47;
  background: rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-radius: 0;
}

.nested-bracket-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 3px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nested-bracket-title {
  font-family: var(--mc-font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--mc-gold-1);
  letter-spacing: 0.02em;
}

.nested-bracket-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.btn-add-nested-prop {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #c4beb4;
  font-family: var(--mc-font-body);
  font-size: 10px;
  padding: 1px 6px;
  cursor: pointer;
  border-radius: 0;
  transition: all 0.15s ease;
}

.btn-add-nested-prop:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--mc-gold-1);
  border-color: var(--mc-gold-1);
}

.btn-del-nested-bracket {
  background: transparent;
  border: none;
  color: #7d756e;
  font-size: 11px;
  cursor: pointer;
  padding: 1px 4px;
  line-height: 1;
  transition: color 0.15s ease;
}

.btn-del-nested-bracket:hover {
  color: var(--mc-redstone-2);
}

.nested-empty-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 0;
  margin: 2px 0;
}

.nested-empty-tag {
  font-size: 11px;
  color: #8c837b;
  font-style: italic;
}

.param-del-btn {
  flex: 0 0 18px;
  width: 18px;
  background: transparent;
  border: none;
  color: #615a52;
  font-size: 11px;
  cursor: pointer;
  padding: 2px 0;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.param-del-btn:focus-visible,
.param-row:focus-within .param-del-btn,
.param-row:hover .param-del-btn {
  opacity: 1;
}

.param-del-btn:hover {
  color: var(--mc-redstone-2);
}

.nested-array-items-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nested-array-item-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-radius: 0;
}

.nested-array-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.nested-array-item-badge {
  font-family: var(--mc-font-body);
  font-size: 10.5px;
  font-weight: 600;
  color: #b8b0a5;
  text-transform: uppercase;
}

.array-primitive-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}

.array-primitive-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.array-item-index {
  font-family: monospace;
  font-size: 11px;
  color: #8c837b;
  min-width: 24px;
}

.array-item-del-btn {
  background: transparent;
  border: none;
  color: #8c837b;
  font-size: 12px;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 0;
  transition: all 0.12s ease;
}

.array-item-del-btn:hover {
  color: var(--mc-redstone-2);
  background: rgba(255, 85, 85, 0.12);
}

/* Add Block Bar */
.add-block-bar {
  margin-top: 14px;
  padding: 12px;
  background: transparent;
  border: 1px dashed var(--border-card);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   5. RAW JSON CODE INSPECTOR
   ========================================================================== */
.studio-code-view {
  display: none;
  flex: 1;
  min-width: 0;
  background: #11100f;
  height: 100%;
  overflow: hidden;
  flex-direction: column;
}

.studio-code-view.is-visible {
  display: flex;
}

/* Two-Panel Split View (True Side-by-Side Dual Editor) */
.studio-editor-container.view-split .block-canvas-wrap,
.studio-workspace.view-split .block-canvas-wrap {
  display: block !important;
  flex: 1 1 50% !important;
  width: 50% !important;
  min-width: 0 !important;
  border-right: 1px solid var(--border-card);
  box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.4);
}

.studio-editor-container.view-split .studio-code-view,
.studio-workspace.view-split .studio-code-view {
  display: flex !important;
  flex: 1 1 50% !important;
  width: 50% !important;
  min-width: 0 !important;
}

/* Geometry models: split view shows the 3D preview instead of the JSON panel. */
.studio-editor-container.view-split.has-model-preview .studio-code-view {
  display: none !important;
}

.studio-editor-container.view-split.has-visual-preview .studio-code-view {
  display: none !important;
}

.studio-editor-container.view-split.has-visual-preview .studio-visual-view {
  display: flex !important;
  flex: 1 1 50%;
  width: 50%;
}

.studio-editor-container.view-split.has-model-preview .studio-model-view {
  display: flex !important;
  flex: 1 1 50%;
  width: 50%;
}

.studio-editor-container.view-blocks .block-canvas-wrap {
  display: block !important;
  flex: 1 !important;
  width: 100% !important;
}

.studio-editor-container.view-blocks .studio-code-view {
  display: none !important;
}

.studio-editor-container.view-code .block-canvas-wrap {
  display: none !important;
}

.studio-editor-container.view-code .studio-code-view {
  display: flex !important;
  flex: 1 !important;
  width: 100% !important;
}

.code-editor-header {
  padding: 6px 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.code-editor-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.code-line-numbers {
  width: 38px;
  background: #0e0d0c;
  border-right: 1px solid #1f1d1b;
  color: #4a4541;
  font-family: var(--mc-font-code);
  font-size: 11.5px;
  line-height: 1.6;
  text-align: right;
  padding: 10px 6px;
  user-select: none;
  overflow: hidden;
}

.code-textarea {
  flex: 1;
  background: #11100f;
  border: none;
  color: var(--text-code);
  font-family: var(--mc-font-code);
  font-size: 12.5px;
  line-height: 1.6;
  padding: 10px 14px;
  outline: none;
  resize: none;
  white-space: pre;
  overflow: auto;
}

/* ==========================================================================
   6. COMPONENT SELECTOR MODAL
   ========================================================================== */
.studio-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(8, 8, 8, 0.82);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

.studio-modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.studio-modal {
  background: var(--bg-surface);
  border: 1px solid #3c3733;
  width: 100%;
  max-width: 580px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.9);
}

.studio-modal__header {
  padding: 12px 16px;
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* MinecraftTen strictly for modal title */
.studio-modal__title {
  font-family: var(--mc-font-display);
  font-size: 15px;
  color: var(--mc-core-white);
  letter-spacing: 0.04em;
}

.studio-modal__title-ctx {
  display: block;
  margin-top: 4px;
  font-family: var(--mc-font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.studio-modal__close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 15px;
  cursor: pointer;
}

.studio-modal__close:hover {
  color: var(--mc-core-white);
}

.studio-modal__body {
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.component-pick-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background 0.12s ease;
}

.component-pick-card:hover {
  background: var(--bg-surface-hover);
  border-color: #423d3a;
}

.component-pick-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.component-pick-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--mc-core-white);
}

.component-pick-desc {
  font-size: 11px;
  color: var(--text-muted);
}

/* ==========================================================================
   7. TOAST NOTIFICATIONS
   ========================================================================== */
.studio-toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
  pointer-events: none;
}

.studio-toast {
  background: var(--bg-surface);
  border: 1px solid var(--mc-green-primary);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.7);
  padding: 10px 14px;
  min-width: 240px;
  max-width: 360px;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.18s ease;
}

.studio-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.studio-toast__title {
  font-size: 12px;
  font-weight: 600;
  color: var(--mc-green-highlight);
  margin-bottom: 1px;
}

.studio-toast__desc {
  font-size: 11.5px;
  color: var(--text-secondary);
}

/* ==========================================================================
   8. NEW FILE CREATOR POPUP MODAL (BRIDGE-GRADE RESPONSIVE GRID)
   ========================================================================== */
.studio-modal--new-file {
  max-width: 760px;
  width: 94%;
  max-height: 88vh;
  background: var(--bg-surface);
  border: 2px solid #36322f;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), inset 1px 1px 0 rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
}

.studio-modal__subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
  font-family: var(--mc-font-body);
}

.new-file-input-bar {
  padding: 12px 18px 10px;
  background: #141312;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.new-file-input-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.new-file-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  padding: 0 8px;
  flex: 1;
  min-width: 200px;
  transition: border-color 0.15s ease;
}

.new-file-input-wrap:focus-within {
  border-color: var(--mc-green-primary);
}

.new-file-input-prefix {
  width: 9ch;
  min-width: 4ch;
  max-width: 22ch;
  background: transparent;
  border: none;
  border-bottom: 1px dashed var(--mc-core-grey-4);
  outline: none;
  font-family: var(--mc-font-code);
  font-size: 13px;
  color: var(--mc-core-green-2);
  padding: 6px 2px;
  field-sizing: content;
}

.new-file-input-prefix:focus {
  border-bottom-color: var(--mc-core-green-3);
}

.new-file-input-colon {
  font-family: var(--mc-font-code);
  font-size: 13px;
  color: var(--text-muted);
  user-select: none;
}

/* In-app dialogs (create/js/ui/dialogs.js) */
.studio-dialog-overlay {
  z-index: 3500;
}

.studio-dialog {
  max-width: 440px;
}

.studio-dialog__body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.studio-dialog__message,
.studio-dialog__label {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.studio-dialog__label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
}

.studio-dialog__input {
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  color: var(--mc-core-white);
  font-family: var(--mc-font-code);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 0;
  outline: none;
}

.studio-dialog__input:focus {
  border-color: var(--border-focus);
}

.studio-dialog__error {
  font-size: 12px;
  color: var(--mc-redstone-2);
}

.studio-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-card);
}

.studio-dialog__danger {
  color: var(--mc-redstone-2);
}

.new-file-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--mc-core-white);
  font-family: var(--mc-font-code);
  font-size: 13px;
  padding: 6px 4px;
  width: 100%;
}

/* Category Filter Tabs inside New File Modal */
.new-file-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: #181716;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  flex-shrink: 0;
}

.new-file-tab {
  background: #201e1d;
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  padding: 3px 9px;
  font-size: 11px;
  font-family: var(--mc-font-body);
  cursor: pointer;
  white-space: nowrap;
  border-radius: 0;
  transition: all 0.12s ease;
}

.new-file-tab:hover {
  background: #2a2725;
  color: var(--mc-core-white);
  border-color: #423d3a;
}

.new-file-tab.is-active {
  background: var(--mc-stone-button-hover);
  color: var(--mc-core-white);
  border-color: var(--mc-green-primary);
  box-shadow: inset 0 -2px 0 var(--mc-green-primary);
}

/* New File Responsive Card Grid */
.new-file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(134px, 1fr));
  gap: 10px;
  padding: 14px 18px 20px;
  overflow-y: auto;
  min-height: 200px;
  max-height: calc(88vh - 180px);
  align-content: start;
}

/* Creator Card */
.new-file-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 106px;
  background: #1a1918;
  border: 1px solid #2d2a28;
  border-radius: 0;
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.04), 0 2px 4px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  padding: 12px 8px 10px;
  text-align: center;
  text-decoration: none;
  user-select: none;
  position: relative;
  transition: all 0.14s ease;
}

.new-file-card:hover {
  background: #252322;
  border-color: var(--mc-green-primary);
  transform: translateY(-2px);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.08), 0 6px 16px rgba(0, 0, 0, 0.5);
}

.new-file-card:active {
  transform: translateY(0);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.new-file-card__badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 0;
  line-height: 1;
}

.new-file-card__badge--bp {
  background: rgba(82, 165, 53, 0.18);
  color: var(--mc-core-green-2);
  border: 1px solid rgba(82, 165, 53, 0.35);
}

.new-file-card__badge--rp {
  background: rgba(59, 130, 246, 0.18);
  color: var(--mc-lapis-2);
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.new-file-card__icon-wrap {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #141312;
  border: 1px solid #282524;
  border-radius: 0;
  margin-bottom: 7px;
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.35);
}

.new-file-card__icon {
  width: 24px;
  height: 24px;
  image-rendering: pixelated;
  transition: transform 0.12s ease;
}

.new-file-card:hover .new-file-card__icon {
  transform: scale(1.1);
}

.new-file-card__title {
  font-family: var(--mc-font-display);
  font-size: 11.5px;
  letter-spacing: 0.03em;
  color: var(--mc-core-white);
  margin-bottom: 2px;
  max-width: 100%;
  word-break: break-word;
  line-height: 1.25;
}

.new-file-card:hover .new-file-card__title {
  color: var(--mc-green-highlight);
}

.new-file-card__ext {
  font-family: var(--mc-font-code);
  font-size: 10px;
  color: var(--text-muted);
}

/* ==========================================================================
   UNDO/REDO BUTTON GROUP
   ========================================================================== */
.studio-undo-redo-group {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-right: 6px;
}

.studio-undo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--mc-stone-button);
  border: 1px solid #423d3a;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.14s ease;
  box-shadow: inset 0 1px 0 #4f4945, inset 0 -1px 0 #24211f;
}

.studio-undo-btn:hover:not(:disabled) {
  background: var(--mc-stone-button-hover);
  color: var(--mc-core-white);
  border-color: #574f47;
}

.studio-undo-btn:active:not(:disabled) {
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6);
  transform: translateY(1px);
}

.studio-undo-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.studio-undo-btn svg {
  pointer-events: none;
}

/* ==========================================================================
   DRAG & DROP IMPORT OVERLAY
   ========================================================================== */
.studio-drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(10, 9, 8, 0.88);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.studio-drop-overlay.is-active {
  display: flex;
  pointer-events: auto;
}

.studio-drop-overlay__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 48px 64px;
  border: 3px dashed var(--mc-green-primary);
  background: rgba(82, 165, 53, 0.06);
  text-align: center;
  animation: dropPulse 1.8s ease-in-out infinite;
}

@keyframes dropPulse {

  0%,
  100% {
    border-color: var(--mc-green-primary);
    box-shadow: 0 0 30px rgba(82, 165, 53, 0.15);
  }

  50% {
    border-color: var(--mc-green-highlight);
    box-shadow: 0 0 50px rgba(126, 212, 88, 0.25);
  }
}

.studio-drop-overlay__icon {
  color: var(--mc-green-highlight);
  animation: dropBounce 1.2s ease-in-out infinite;
}

@keyframes dropBounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-12px);
  }
}

.studio-drop-overlay__title {
  font-family: var(--mc-font-display);
  font-size: 28px;
  color: var(--mc-core-white);
  letter-spacing: 0.06em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.studio-drop-overlay__desc {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 420px;
  line-height: 1.5;
}

/* ==========================================================================
   MOBILE SIDEBAR TOGGLE & BACKDROP
   ========================================================================== */
.studio-mobile-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--mc-stone-button);
  border: 1px solid #423d3a;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.14s ease;
}

.studio-mobile-toggle:hover {
  background: var(--mc-stone-button-hover);
  color: var(--mc-core-white);
}

.studio-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 59;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.studio-sidebar-backdrop.is-visible {
  display: block;
  opacity: 1;
}

/* ==========================================================================
   RESPONSIVE — TABLET (max-width: 900px)
   ========================================================================== */
@media (max-width: 900px) {
  :root {
    --sidebar-width: 260px;
  }

  .studio-mobile-toggle {
    display: inline-flex;
  }

  /* Sidebar: hidden off-screen, slides in when open */
  .studio-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 60;
    height: 100vh;
    width: 280px;
    max-width: 85vw;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
  }

  .studio-sidebar.is-mobile-open {
    transform: translateX(0);
    box-shadow: 8px 0 30px rgba(0, 0, 0, 0.6);
  }

  /* Toolbar chips */
  .studio-toolbar {
    overflow: visible;
    gap: 4px;
  }

  .studio-category-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    min-width: 0;
  }

  .studio-cat-btn span {
    white-space: nowrap;
  }

  /* View toggle smaller */
  .studio-view-toggle {
    flex-shrink: 0;
  }

  /* File meta bar wraps */
  .file-meta-bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 12px;
  }

  .file-meta-actions {
    width: 100%;
    justify-content: flex-end;
  }

  /* Header compact */
  .studio-header {
    padding: 0 10px;
  }

  .studio-badge {
    display: none;
  }

  .studio-header-actions {
    gap: 4px;
  }

  /* Hide some button labels */
  #btnValidateJson {
    font-size: 0;
    padding: 5px 8px;
  }

  #btnValidateJson::before {
    content: '✓';
    font-size: 13px;
  }

  /* Modal responsive */
  .studio-modal {
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 90vh !important;
  }

  .new-file-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 14px;
  }
}

/* ==========================================================================
   RESPONSIVE — MOBILE (max-width: 540px)
   ========================================================================== */
@media (max-width: 540px) {
  :root {
    --nav-height: 48px;
    --toolbar-height: 42px;
  }

  /* Header ultra-compact */
  .studio-header {
    padding: 0 8px;
  }

  .studio-logo {
    font-size: 14px;
    white-space: nowrap;
  }

  .studio-undo-redo-group {
    margin-right: 2px;
  }

  .studio-undo-btn {
    width: 28px;
    height: 28px;
  }

  .studio-undo-btn svg {
    width: 13px;
    height: 13px;
  }

  /* Export button compact */
  #btnExportPack {
    font-size: 0;
    padding: 5px 8px;
    gap: 0;
  }

  #btnExportPack::before {
    content: 'EXPORT';
    font-size: 11px;
  }

  .version-select-label {
    display: none;
  }

  /* Toolbar chips scroll */
  .studio-toolbar {
    padding: 0 8px;
    gap: 2px;
  }

  .studio-cat-btn {
    padding: 4px 8px;
    font-size: 11px;
    gap: 4px;
  }

  .studio-cat-icon {
    width: 12px;
    height: 12px;
  }

  /* View toggle tiny */
  .studio-toggle-btn {
    font-size: 11px;
    padding: 3px 8px;
  }

  /* Sidebar full width on mobile */
  .studio-sidebar {
    width: 100vw;
    max-width: 100vw;
  }

  /* Workspace takes full width */
  .studio-workspace {
    height: calc(100vh - var(--nav-height) - var(--toolbar-height));
    height: calc(100dvh - var(--nav-height) - var(--toolbar-height));
  }

  /* File meta compact */
  .file-meta-bar {
    padding: 6px 10px;
  }

  .file-meta-name {
    font-size: 12px;
  }

  .file-meta-identifier {
    font-size: 10px;
  }

  .file-meta-actions .mc-btn {
    font-size: 10px;
    padding: 4px 8px;
  }

  /* Block canvas spacing */
  .block-canvas-wrap {
    padding: 10px;
  }

  .scratch-block__header {
    padding: 8px 10px;
  }

  .scratch-block__body {
    padding: 8px 10px;
  }

  .param-row {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 6px;
  }

  .param-ctrl {
    justify-content: flex-start;
  }

  /* Drop overlay responsive */
  .studio-drop-overlay__inner {
    padding: 32px 24px;
  }

  .studio-drop-overlay__title {
    font-size: 22px;
  }

  .studio-drop-overlay__icon svg {
    width: 48px;
    height: 48px;
  }

  /* New file grid single column */
  .new-file-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 12px;
  }

  .new-file-card {
    aspect-ratio: auto;
    padding: 10px 8px;
  }

  .new-file-card__icon-wrap {
    width: 36px;
    height: 36px;
    margin-bottom: 6px;
  }

  .new-file-card__icon {
    width: 24px;
    height: 24px;
  }

  .new-file-card__title {
    font-size: 12px;
  }

  /* Code view touch friendly */
  .code-textarea {
    font-size: 12px;
    min-height: 300px;
  }

  /* Component modal list */
  .component-pick-card {
    padding: 10px;
  }
}

/* Touch improvements */
/* Very narrow phones: the header actions need the room. */
@media (max-width: 420px) {
  .studio-logo {
    font-size: 11px;
    letter-spacing: 0.02em;
  }

  .studio-brand-wrap {
    gap: 6px;
  }
}

@media (hover: none) and (pointer: coarse) {
  .param-del-btn,
  .array-item-del-btn {
    opacity: 1;
  }

  .studio-cat-btn {
    min-height: 38px;
  }

  .tree-file,
  .tree-folder-header,
  .tree-pack-header {
    min-height: 40px;
  }

  .scratch-block__btn--del {
    width: 28px;
    height: 28px;
    min-width: 28px;
  }

  .param-input-pill {
    min-height: 36px;
    font-size: 14px;
  }

  .mc-bedrock-toggle {
    transform: scale(1.15);
  }
}

/* ==========================================================================
   VALIDATION & VERSION COMPATIBILITY STYLES
   ========================================================================== */
.badge-validation-error {
  display: inline-flex;
  align-items: center;
  background: #4a1515;
  color: var(--mc-redstone-2);
  border: 1px solid #852626;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 0;
  cursor: help;
  white-space: nowrap;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.has-validation-error {
  border-left: 3px solid var(--mc-redstone-2) !important;
  box-shadow: 0 0 10px rgba(255, 68, 68, 0.2);
}

.param-select {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  color: var(--mc-core-grey-1);
  font-family: var(--mc-font-body);
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 0;
  outline: none;
  cursor: pointer;
  height: 32px;
}

.param-select:focus {
  border-color: var(--mc-core-green-3);
}

.version-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #171513;
  border: 1px solid #332f2c;
  padding: 2px 8px;
}

.version-select-label {
  font-size: 11px;
  font-weight: 600;
  color: #8c827a;
  text-transform: uppercase;
}

.version-select-dropdown {
  background: transparent;
  border: none;
  color: var(--mc-core-green-3);
  font-family: var(--mc-font-body);
  font-size: 12px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.version-select-dropdown option {
  background: #1e1b19;
  color: var(--mc-core-grey-1);
}

/* ==========================================================================
   BEDROCK BLOCK EDITOR SECTIONS, CARDS & CHIPS (Bridge-style Workflow)
   ========================================================================== */
.mc-editor-section {
  background: #151312;
  border: 1px solid #2e2824;
  margin-bottom: 14px;
}

.mc-editor-section__header {
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid #2a2522;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mc-editor-section__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mc-font-body);
  font-size: 12.5px;
  font-weight: 700;
  color: #e5ded9;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.mc-editor-section__actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mc-editor-section__body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mc-section-empty {
  padding: 24px 16px;
  text-align: center;
  border: 1px dashed #302a26;
  background: rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: #7d756d;
  font-size: 12px;
}

/* Component Groups Card */
.mc-component-group-card {
  background: #191715;
  border: 1px solid #302b27;
  border-left: 3px solid var(--mc-core-green-3);
  transition: border-color 0.12s ease;
}

.mc-component-group-card:hover {
  border-color: #403a35;
  border-left-color: var(--mc-core-green-3);
}

.mc-component-group-header {
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid #282320;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.mc-component-group-title {
  font-family: var(--mc-font-mono, monospace);
  font-size: 12px;
  font-weight: 600;
  color: var(--mc-core-green-1);
}

.mc-component-group-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mc-component-group-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mc-component-group-card.is-collapsed .mc-component-group-body {
  display: none;
}

.mc-component-group-card.is-collapsed .scratch-block__caret {
  transform: rotate(-90deg);
}

/* Event Cards */
.mc-event-card {
  background: #171514;
  border: 1px solid #352f2a;
  border-left: 3px solid var(--mc-gold-1);
  transition: border-color 0.12s ease;
}

.mc-event-card:hover {
  border-color: #453e37;
  border-left-color: var(--mc-gold-1);
}

.mc-event-card-header {
  padding: 8px 12px;
  background: rgba(226, 168, 59, 0.06);
  border-bottom: 1px solid #2a2521;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.mc-event-card-icon {
  font-size: 13px;
  color: var(--mc-gold-1);
}

.mc-event-card-title {
  font-family: var(--mc-font-mono, monospace);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--mc-gold-1);
}

.mc-event-card-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mc-event-card-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mc-event-card.is-collapsed .mc-event-card-body {
  display: none;
}

.mc-event-card.is-collapsed .scratch-block__caret {
  transform: rotate(-90deg);
}

/* Event Action Cards */
.mc-event-action-card {
  background: #1c1a18;
  border: 1px solid #2d2723;
  margin-top: 2px;
}

.mc-event-action-header {
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.22);
  border-bottom: 1px solid #26211e;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mc-event-action-badge {
  font-family: var(--mc-font-body);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 0;
}

.mc-event-action-badge--add {
  background: rgba(94, 189, 58, 0.15);
  color: var(--mc-core-green-3);
  border: 1px solid rgba(94, 189, 58, 0.35);
}

.mc-event-action-badge--remove {
  background: rgba(224, 74, 74, 0.15);
  color: var(--mc-redstone-2);
  border: 1px solid rgba(224, 74, 74, 0.35);
}

.mc-event-action-badge--set_property {
  background: rgba(58, 140, 224, 0.15);
  color: var(--mc-lapis-2);
  border: 1px solid rgba(58, 140, 224, 0.35);
}

.mc-event-action-badge--generic {
  background: #252220;
  color: #a69e96;
  border: 1px solid #38322e;
}

.mc-event-action-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.mc-event-action-body {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Component Group Reference Chips */
.mc-group-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 28px;
}

.mc-group-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #24211e;
  border: 1px solid #3c3630;
  padding: 3px 8px;
  border-radius: 0;
  transition: background 0.12s, border-color 0.12s;
}

.mc-group-chip:hover {
  background: #2b2724;
  border-color: #4f4740;
}

.mc-chip-text {
  font-family: var(--mc-font-mono, monospace);
  font-size: 11.5px;
  color: var(--mc-core-grey-1);
}

.mc-chip-del {
  background: transparent;
  border: none;
  color: #8c827a;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  padding: 0 2px;
  transition: color 0.12s;
}

.mc-chip-del:hover {
  color: var(--mc-redstone-2);
}

.mc-chips-empty-hint {
  font-size: 11px;
  color: #706862;
  font-style: italic;
}

/* Event Action Card Themes */
.mc-event-action-card--sequence {
  border-left: 3px solid var(--mc-portal-2);
}

.mc-event-action-card--randomize {
  border-left: 3px solid var(--mc-gold-1);
}

.mc-event-action-card--trigger {
  border-left: 3px solid var(--mc-gold-1);
}

.mc-event-action-card--queue_command {
  border-left: 3px solid var(--mc-sculk-cyan-3);
}

.mc-event-action-card--filters {
  border-left: 3px solid var(--mc-lapis-1);
}

.mc-sequence-step-card {
  transition: border-color 0.12s ease;
}

.mc-sequence-step-card:hover {
  border-color: #3e3834;
}

.mc-randomize-choice-card {
  transition: border-color 0.12s ease;
}

.mc-randomize-choice-card:hover {
  border-color: #3e3834;
}

.btn-add-comp-prop {
  color: #a8a096;
  border-color: #38322d;
  background: #1c1a18;
}

.btn-add-comp-prop:hover {
  color: var(--mc-core-grey-1);
  background: #252220;
  border-color: #4a423b;
}

.mc-prop-configured-badge {
  font-size: 11px;
  color: #6e6760;
  font-style: italic;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
/* `hidden` must win over component display rules such as .mc-btn { display: inline-flex }. */
[hidden] {
  display: none !important;
}

/* ==========================================================================
   GEOMETRY: BONES SUMMARY BLOCK + 3D MODEL PREVIEW PANEL
   ========================================================================== */
.geometry-summary__text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.geometry-summary__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.studio-model-view {
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-left: 1px solid var(--border-card);
  background: var(--bg-surface);
}

.model-view-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-card);
}

.model-view-title,
.model-view-texture {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.model-view-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.model-view-select {
  max-width: 220px;
}

.model-view-mount {
  position: relative;
  flex: 1 1 auto;
  min-height: 280px;
}

.model-view-notes {
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 12px 8px;
  min-height: 1.5em;
}

.model-view-notes:empty {
  display: none;
}

.model-view-notes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  line-height: 1.45;
}

.model-view-notes code {
  font-family: var(--mc-font-code);
  font-size: 11.5px;
  color: var(--mc-core-grey-1);
  background: var(--bg-input);
  padding: 1px 4px;
  overflow-wrap: anywhere;
}

.model-preview__stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, var(--mc-sculk-dark-2) 0%, var(--mc-sculk-dark-3) 75%);
}

.model-preview__canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

.model-preview__canvas:active {
  cursor: grabbing;
}

.model-preview__status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  pointer-events: none;
}

.model-preview__controls {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 2;
}

.model-preview__btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mc-font-body);
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  color: var(--mc-core-grey-1);
  background: var(--mc-core-grey-5);
  border: none;
  border-radius: 0;
  cursor: pointer;
  box-shadow: inset 0 2px 0 var(--mc-core-grey-4), inset 0 -2px 0 #1f1d1c;
  transition: background-color 0.12s ease, transform 0.08s ease;
}

.model-preview__btn:hover {
  background: #4a4543;
  color: var(--mc-core-white);
}

.model-preview__btn:active {
  transform: translateY(1px);
  box-shadow: inset 0 1px 0 var(--mc-core-grey-4), inset 0 -1px 0 #1f1d1c;
}

.model-preview__btn:focus-visible {
  outline: 2px solid var(--mc-core-white);
  outline-offset: 1px;
}

.model-preview__btn.is-active {
  background: var(--mc-core-green-5);
  box-shadow: inset 0 2px 0 var(--mc-core-green-3), inset 0 -2px 0 var(--mc-core-green-6);
}

.model-preview__hint {
  position: absolute;
  left: 10px;
  bottom: 8px;
  font-size: 11px;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 2;
}

@media (max-width: 900px) {
  .studio-model-view {
    border-left: none;
    border-top: 1px solid var(--border-card);
  }

  .model-preview__hint {
    display: none;
  }
}

/* Narrow screens: the 3D preview stacks above the header fields instead of sharing the width. */
@media (max-width: 900px) {
  .studio-editor-container.view-split.has-model-preview {
    flex-direction: column;
    overflow-y: auto;
  }

  .studio-editor-container.view-split.has-model-preview .studio-model-view {
    order: -1;
    flex: 0 0 auto;
    width: 100% !important;
    height: 56vh;
    min-height: 320px;
  }

  .studio-editor-container.view-split.has-model-preview .block-canvas-wrap {
    flex: 1 0 auto !important;
    width: 100% !important;
    border-right: none;
    box-shadow: none;
  }

  .model-view-select {
    max-width: 160px;
  }
}

/* ==========================================================================
   VISUAL PREVIEWS — MINECRAFT GUI LANGUAGE
   Recipe, loot and item-picker views reuse the in-game inventory look: a light-grey bevelled
   panel (.mc-inv), recessed slots (.mc-slot) with pixel tooltips, black text fields and the
   crafting arrow. Colours: --mc-gui-* in css/tokens.css.
   ========================================================================== */
.studio-visual-view {
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-left: 1px solid var(--border-card);
  background: var(--bg-surface);
}

.visual-view-mount {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 18px;
  container-type: inline-size;
}

.visual-empty,
.visual-hint,
.visual-warning {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

.visual-warning {
  color: var(--mc-gold-1);
}

/* ---- Item icons ---------------------------------------------------------- */
.item-icon {
  display: inline-block;
  position: relative;
  flex-shrink: 0;
  image-rendering: pixelated;
  background-repeat: no-repeat;
  pointer-events: none;
}

.item-icon__cube {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.item-icon--unknown {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mc-font-display);
  font-size: 18px;
  color: var(--mc-gui-slot-dark);
}

.item-icon--tag {
  color: var(--mc-lapis-1);
}

/* ---- Inventory panel ----------------------------------------------------- */
.mc-inv {
  position: relative;
  padding: 10px 14px 14px;
  color: var(--mc-gui-text);
  background: var(--mc-gui-panel);
  border: 2px solid var(--mc-gui-edge);
  box-shadow: inset 2px 2px 0 var(--mc-gui-highlight), inset -2px -2px 0 var(--mc-gui-shadow), 0 6px 18px rgba(0, 0, 0, 0.45);
}

.mc-inv__title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 26px;
  margin-bottom: 8px;
  font-family: var(--mc-font-display);
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mc-gui-text);
}

.mc-inv__title > span:first-child {
  flex: 1;
}

.mc-inv__tag {
  flex: 0 0 auto !important;
  padding: 1px 6px;
  font-family: var(--mc-font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--mc-core-white);
  background: var(--mc-gui-slot-dark);
}

/* ---- Slot ----------------------------------------------------------------- */
.mc-slot {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  font: inherit;
  background: var(--mc-gui-slot);
  border: 2px solid;
  border-color: var(--mc-gui-slot-dark) var(--mc-gui-highlight) var(--mc-gui-highlight) var(--mc-gui-slot-dark);
  border-radius: 0;
  cursor: pointer;
}

.mc-slot:hover {
  background: var(--mc-gui-slot-hover);
}

.mc-slot:focus-visible {
  outline: 2px solid var(--mc-lapis-1);
  outline-offset: 0;
  z-index: 2;
}

.mc-slot--result {
  width: 60px;
  height: 60px;
}

.mc-slot--unknown {
  box-shadow: inset 0 0 0 2px var(--mc-redstone-1);
}

.mc-slot--nothing::before {
  content: '';
  width: 18px;
  height: 2px;
  background: var(--mc-gui-slot-dark);
}

.mc-slot--add {
  margin-top: 8px;
  font-family: var(--mc-font-display);
  font-size: 22px;
  color: var(--mc-gui-slot-dark);
}

.mc-slot--static {
  cursor: default;
}

.mc-slot.is-current {
  box-shadow: inset 0 0 0 2px var(--mc-core-green-4);
}

.mc-slot__count {
  position: absolute;
  right: 2px;
  bottom: 0;
  font-family: var(--mc-font-display);
  font-size: 13px;
  line-height: 1;
  color: var(--mc-core-white);
  text-shadow: 2px 2px 0 var(--mc-gui-text);
  pointer-events: none;
}

.mc-slot__missing {
  font-family: var(--mc-font-code);
  font-size: 16px;
  font-weight: 700;
  color: var(--mc-redstone-1);
}

/* In-game style tooltip (dark purple-edged box) */
.mc-slot[data-tip]:hover::after,
.mc-slot[data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 6px);
  top: -4px;
  z-index: 50;
  min-width: max-content;
  max-width: 260px;
  padding: 5px 8px;
  white-space: pre;
  font-family: var(--mc-font-body);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--mc-core-white);
  background: var(--mc-gui-tooltip);
  border: 2px solid var(--mc-gui-tooltip-edge);
  pointer-events: none;
}

/* ---- Small shared controls --------------------------------------------------- */
.mc-field {
  height: 28px;
  padding: 2px 6px;
  font-family: var(--mc-font-body);
  font-size: 13px;
  color: var(--mc-core-white);
  background: #000;
  border: 1px solid #a0a0a0;
  border-radius: 0;
  outline: none;
}

.mc-field:focus {
  border-color: var(--mc-core-white);
}

.mc-field--num {
  width: 52px;
  text-align: center;
  -moz-appearance: textfield;
}

.mc-field--num::-webkit-outer-spin-button,
.mc-field--num::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.mc-x {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--mc-gui-shadow);
  background: transparent;
  border: none;
  border-radius: 0;
  cursor: pointer;
}

.mc-x:hover,
.mc-x:focus-visible {
  color: var(--mc-core-white);
  background: var(--mc-redstone-1);
  outline: none;
}

.mc-tag {
  display: inline-block;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--mc-core-white);
  background: var(--mc-lapis-1);
}

.mc-tag--fn {
  background: var(--mc-portal-1);
  text-transform: capitalize;
}

.chip {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-input);
  border: 1px solid var(--border-card);
}

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.stepper__btn {
  width: 28px;
  height: 28px;
  font-size: 16px;
  font-weight: 800;
  color: var(--mc-core-grey-1);
  background: var(--mc-core-grey-5);
  border: none;
  border-radius: 0;
  cursor: pointer;
  box-shadow: inset 0 2px 0 var(--mc-core-grey-4), inset 0 -2px 0 #1f1d1c;
}

.stepper__btn:hover:not(:disabled) {
  background: #4a4543;
}

.stepper__btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.stepper__value {
  min-width: 2.5ch;
  text-align: center;
  font-family: var(--mc-font-display);
  font-size: 15px;
  color: var(--mc-core-white);
}

/* ---- Crafting arrow and furnace flame (pixel art) -------------------------------- */
.mc-arrow {
  flex: 0 0 auto;
  width: 44px;
  height: 30px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 15' shape-rendering='crispEdges'%3E%3Cpath fill='%238b8b8b' d='M0 5h12V0h2v1h1v1h1v1h1v1h1v1h1v1h1v1h1v1h-1v1h-1v1h-1v1h-1v1h-1v1h-1v1h-2v-5H0z'/%3E%3C/svg%3E") no-repeat center / contain;
  image-rendering: pixelated;
}

.mc-flame {
  width: 28px;
  height: 28px;
  margin: 2px 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' shape-rendering='crispEdges'%3E%3Cpath fill='%23f5b027' d='M6 0h2v2h1v2h1v1h1v3h1v4h-1v1h-1v1H4v-1H3v-1H2V8h1V6h1V4h1V2h1z'/%3E%3Cpath fill='%23e64a4a' d='M6 6h2v2h1v4H5V8h1z'/%3E%3C/svg%3E") no-repeat center / contain;
  image-rendering: pixelated;
}

/* ---- Recipe ------------------------------------------------------------------- */
.recipe-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

.recipe-inv {
  display: inline-block;
}

.recipe-board {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 4px 6px 2px;
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(3, var(--slot));
}

/* Recipes are drawn larger than other slot views: they are the focus of the panel. */
.recipe-inv {
  --slot: 56px;
}

.recipe-inv .mc-slot {
  width: var(--slot);
  height: var(--slot);
}

.recipe-inv .mc-slot--result {
  width: 76px;
  height: 76px;
}

.recipe-inv .mc-arrow {
  width: 56px;
  height: 38px;
}

.recipe-slots {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.recipe-slots--furnace,
.recipe-slots--brewing_mix,
.recipe-slots--brewing_container {
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.recipe-slots__cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.recipe-slots__label {
  font-size: 11px;
  font-weight: 700;
  color: var(--mc-gui-text);
}

.recipe-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.recipe-info__name {
  font-family: var(--mc-font-display);
  font-size: 18px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--mc-core-white);
}

.recipe-info__id {
  font-family: var(--mc-font-code);
  font-size: 12px;
  color: var(--text-muted);
}

.recipe-info__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 4px;
}

.recipe-info__label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ---- Loot table ----------------------------------------------------------------- */
.loot-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}

.loot-panel > .mc-btn {
  align-self: flex-start;
}

.loot-pool__rolls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mc-font-body);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
  color: var(--mc-gui-text);
}

.loot-range {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.loot-range__dash {
  color: var(--mc-gui-shadow);
  font-weight: 700;
}

.loot-conditions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.loot-conditions__label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--mc-gui-text);
}

.loot-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.loot-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto 24px;
  align-items: center;
  gap: 8px 12px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

.loot-row:last-child {
  border-bottom: none;
}

.loot-row__fields {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.loot-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.loot-field__label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--mc-gui-shadow);
}

.loot-row__name {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.loot-row__title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--mc-gui-text);
  overflow-wrap: anywhere;
}

.loot-row__id {
  font-family: var(--mc-font-code);
  font-size: 11px;
  color: var(--mc-gui-shadow);
  overflow-wrap: anywhere;
}

.loot-row__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.loot-row__na {
  color: var(--mc-gui-shadow);
  text-align: center;
}

.loot-chance {
  display: flex;
  align-items: center;
  gap: 8px;
}

.loot-chance__pct {
  min-width: 4ch;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--mc-gui-text);
}

/* Experience-bar style chance meter */
.mc-bar {
  flex: 1;
  height: 10px;
  background: #2b2b2b;
  border: 1px solid var(--mc-gui-edge);
}

.mc-bar__fill {
  height: 100%;
  background: #80ff20;
  box-shadow: inset 0 -3px 0 #3fa30e;
}

.loot-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.loot-summary__title {
  font-family: var(--mc-font-display);
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mc-core-grey-1);
}

/* Hotbar: dark frame with slots side by side */
.mc-hotbar {
  display: inline-flex;
  flex-wrap: wrap;
  align-self: flex-start;
  padding: 2px;
  background: var(--mc-gui-edge);
  border: 2px solid var(--mc-gui-slot-dark);
}

.mc-hotbar .mc-slot {
  background: #5a5a5a;
  border-color: #2b2b2b #9a9a9a #9a9a9a #2b2b2b;
}

@container (max-width: 470px) {
  .loot-row {
    grid-template-columns: 44px minmax(0, 1fr) 24px;
  }

  .loot-row__fields {
    grid-column: 2 / 4;
    grid-row: 2;
  }
}

.mc-slot__count--small {
  font-family: var(--mc-font-body);
  font-size: 11px;
  font-weight: 800;
}

/* ---- Item picker (creative inventory) -------------------------------------------- */
.item-picker.mc-inv {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(560px, 94vw);
  height: min(640px, 86vh);
}

.item-picker .mc-inv__title {
  margin-bottom: 0;
}

.item-picker__search {
  width: 100%;
  height: 32px;
}

.item-picker__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 6px 0 2px;
}

.item-picker__section {
  margin: 8px 0 4px;
  font-family: var(--mc-font-display);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--mc-gui-text);
}

.item-picker__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 44px);
  justify-content: center;
}

.item-picker__use {
  margin: 4px 0 6px;
}

.item-picker__foot {
  min-height: 22px;
  font-size: 12.5px;
  color: var(--mc-gui-text);
  overflow-wrap: anywhere;
}

.item-picker__foot code {
  margin-left: 6px;
  font-family: var(--mc-font-code);
  font-size: 11.5px;
  color: var(--mc-gui-shadow);
}

.item-picker .mc-slot[data-tip]::after {
  display: none;
}

@media (max-width: 900px) {
  .studio-editor-container.view-split.has-visual-preview {
    flex-direction: column;
    overflow-y: auto;
  }

  .studio-editor-container.view-split.has-visual-preview .studio-visual-view {
    order: -1;
    flex: 0 0 auto;
    width: 100% !important;
    max-height: 64vh;
    border-left: none;
    border-bottom: 1px solid var(--border-card);
  }

  .studio-editor-container.view-split.has-visual-preview .block-canvas-wrap {
    flex: 1 0 auto !important;
    width: 100% !important;
    border-right: none;
    box-shadow: none;
  }

  .recipe-board {
    gap: 10px;
  }

  .mc-slot[data-tip]:hover::after,
  .mc-slot[data-tip]:focus-visible::after {
    display: none;
  }
}

/* ==========================================================================
   ENTITIES VIEW: GRID + DETAIL PANEL (stone cards, visual-style-guide.md 4.2/4.3)
   ========================================================================== */
.studio-entities-view {
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg-page);
}

.studio-editor-container.view-entities .block-canvas-wrap,
.studio-editor-container.view-entities .studio-code-view,
.studio-editor-container.view-entities .studio-model-view,
.studio-editor-container.view-entities .studio-visual-view {
  display: none !important;
}

.studio-editor-container.view-entities .studio-entities-view {
  display: flex !important;
  flex: 1;
  width: 100%;
}

.entities-mount {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px 28px;
}

.entities-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 18px;
}

.entities-bar__search {
  width: min(300px, 100%);
}

.entities-bar__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.entities-bar__count {
  margin-left: auto;
  font-family: var(--mc-font-display);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.entities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
}

.entity-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0;
  text-align: left;
  color: var(--text-secondary);
  background: var(--mc-core-grey-5);
  border: 2px solid var(--mc-core-grey-5);
  border-radius: 0;
  box-shadow: inset 0 4px 0 var(--mc-core-grey-4), var(--mc-elevation-1);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.entity-card:hover,
.entity-card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--mc-sculk-cyan-2);
  outline: none;
}

.entity-card__thumb {
  aspect-ratio: 1;
  margin: 4px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 42%, var(--mc-sculk-dark-1) 0%, var(--mc-sculk-dark-2) 45%, var(--mc-sculk-dark-3) 100%);
}

.entity-card__img {
  width: 92%;
  height: 92%;
  object-fit: contain;
}

.entity-card__placeholder {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.entity-card__name {
  padding: 10px 12px 0;
  font-family: var(--mc-font-display);
  font-size: 16px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--mc-core-white);
  overflow-wrap: anywhere;
}

.entity-card__id {
  padding: 2px 12px 0;
  font-family: var(--mc-font-code);
  font-size: 11px;
  color: var(--mc-core-grey-3);
  overflow-wrap: anywhere;
}

.entity-status {
  display: flex;
  gap: 4px;
  padding: 10px 12px 12px;
}

.entity-status__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--mc-core-grey-6);
  box-shadow: inset 0 0 0 1px #1f1d1c;
  opacity: 0.32;
  filter: grayscale(1);
}

.entity-status__item.is-on {
  opacity: 1;
  filter: none;
  background: var(--mc-core-green-6);
  box-shadow: inset 0 2px 0 var(--mc-core-green-5);
}

.entity-status__item img {
  width: 14px;
  height: 14px;
  image-rendering: pixelated;
}

/* Detail panel (right side of the split view for entity files) */
.entity-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.entity-panel__head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.entity-panel__name {
  font-family: var(--mc-font-display);
  font-size: 22px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mc-core-white);
}

.entity-panel__id {
  font-family: var(--mc-font-code);
  font-size: 12px;
  color: var(--text-muted);
}

.entity-panel__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.entity-panel__section {
  margin-top: 10px;
  padding-bottom: 6px;
  font-family: var(--mc-font-display);
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--mc-core-grey-2);
  border-bottom: 2px solid var(--border-card);
}

.entity-panel__model {
  position: relative;
  height: 320px;
  min-height: 220px;
  border: 2px solid var(--mc-sculk-dark-1);
}

.entity-panel__notes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.entity-panel__notes:empty {
  display: none;
}

.entity-egg {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.entity-egg > canvas,
.entity-egg > .item-icon {
  box-sizing: content-box;
}

.entity-egg > canvas,
.entity-egg > .item-icon {
  padding: 6px;
  background: var(--mc-gui-slot);
  border: 2px solid;
  border-color: var(--mc-gui-slot-dark) var(--mc-gui-highlight) var(--mc-gui-highlight) var(--mc-gui-slot-dark);
}

.entity-egg__field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.entity-egg__field input[type="color"] {
  width: 36px;
  height: 30px;
  padding: 0;
  background: var(--bg-input);
  border: 1px solid var(--border-card);
  border-radius: 0;
  cursor: pointer;
}

@media (max-width: 900px) {
  .entities-grid {
    grid-template-columns: repeat(auto-fill, minmax(146px, 1fr));
    gap: 12px;
  }

  .entities-mount {
    padding: 14px 16px 24px;
  }

  .entities-bar__count {
    margin-left: 0;
  }
}

/* ==========================================================================
   VIEWER BAR + TREE MODE (json_tree_view.js, node_inspector.js)
   Outline and inspector use the Minecraft GUI chrome (.mc-inv). The inspector's fields are
   the List-mode builders, so they sit in a dark recessed well that keeps their own styling.
   ========================================================================== */
.viewer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.viewer-bar__spacer {
  flex: 1 1 auto;
}

.viewer-seg {
  display: flex;
  background: var(--bg-page);
  border: 1px solid var(--border-subtle);
  padding: 2px;
}

.viewer-seg__btn,
.viewer-bar__btn {
  font-family: var(--mc-font-body);
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 10px;
  white-space: nowrap;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 0;
  cursor: pointer;
}

.viewer-seg__btn:hover,
.viewer-bar__btn:hover {
  color: var(--text-primary);
}

.viewer-seg__btn[aria-pressed="true"] {
  background: var(--bg-surface-elevated);
  color: var(--mc-core-white);
  font-weight: 600;
}

.viewer-seg__btn:focus-visible,
.viewer-bar__btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: -2px;
}

.scratch-block__summary {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

.scratch-block:not(.is-collapsed) .scratch-block__summary {
  display: none;
}

/* Tree mode widens the stack and lays the outline beside the inspector. */
.scratch-block-stack.is-tree-mode {
  max-width: 1180px;
  container-type: inline-size;
}

.jtree-layout {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  align-items: start;
  gap: 14px;
  min-width: 0;
}

/* ---- Outline ------------------------------------------------------------- */
.jtree-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 8px 8px 10px;
  position: sticky;
  top: 0;
}

.jtree-panel__title {
  padding: 0 4px;
  margin-bottom: 6px;
}

.jtree-search {
  width: 100%;
  min-width: 0;
  margin-bottom: 6px;
}

.jtree {
  position: relative;
  max-height: calc(100vh - 250px);
  min-height: 120px;
  overflow: auto;
  padding: 2px;
  background: var(--mc-gui-slot);
  border: 2px solid;
  border-color: var(--mc-gui-slot-dark) var(--mc-gui-highlight) var(--mc-gui-highlight) var(--mc-gui-slot-dark);
}

.jtree-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  height: 26px;
  padding: 0 4px 0 calc(4px + var(--depth, 0) * 14px);
  font-family: var(--mc-font-body);
  font-size: 12.5px;
  color: var(--mc-core-white);
  cursor: pointer;
  outline: none;
}

.jtree-row:hover {
  background: var(--mc-gui-slot-hover);
}

.jtree-row[aria-selected="true"] {
  background: var(--mc-gui-slot-dark);
  box-shadow: inset 2px 0 0 var(--mc-core-green-4);
}

.jtree-row:focus-visible {
  box-shadow: inset 0 0 0 2px var(--mc-lapis-1);
}

.jtree-caret {
  flex: 0 0 12px;
  width: 12px;
  text-align: center;
  font-size: 11px;
  color: var(--mc-core-white);
}

.jtree-caret::before {
  content: "\25BE";
}

.jtree-row[aria-expanded="false"] .jtree-caret::before {
  content: "\25B8";
}

.jtree-caret.is-leaf::before {
  content: "";
}

.jtree-icon {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  image-rendering: pixelated;
}

.jtree-label {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  text-shadow: 1px 1px 0 var(--mc-gui-slot-dark);
}

.jtree-row--section > .jtree-label {
  font-weight: 700;
}

.jtree-sum {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  color: var(--mc-core-grey-1);
  opacity: 0.85;
}

.jtree-acts {
  display: none;
  flex: 0 0 auto;
  margin-left: auto;
  gap: 2px;
}

.jtree-row:hover .jtree-acts,
.jtree-row[aria-selected="true"] .jtree-acts {
  display: flex;
}

.jtree-act {
  width: 20px;
  height: 20px;
  padding: 0;
  font-family: var(--mc-font-body);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  color: var(--mc-core-white);
  background: var(--mc-core-green-4);
  border: none;
  border-radius: 0;
  box-shadow: inset 0 2px 0 var(--mc-core-green-2), inset 0 -2px 0 var(--mc-core-green-6);
  cursor: pointer;
}

.jtree-act:hover {
  background: var(--mc-core-green-3);
}

.jtree-act--del {
  background: var(--mc-gui-shadow);
  box-shadow: inset 0 2px 0 var(--mc-gui-slot-hover), inset 0 -2px 0 var(--mc-gui-slot-dark);
}

.jtree-act--del:hover {
  background: var(--mc-redstone-1);
}

.jtree-empty {
  margin: 8px 4px 0;
  font-size: 12px;
  color: var(--mc-gui-text);
}

.jtree-empty[hidden] {
  display: none;
}

/* ---- Inspector ----------------------------------------------------------- */
.jinsp {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.jinsp-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  min-width: 0;
}

.jinsp-icon {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  padding: 4px;
  box-sizing: content-box;
  image-rendering: pixelated;
  background: var(--mc-gui-slot);
  border: 2px solid;
  border-color: var(--mc-gui-slot-dark) var(--mc-gui-highlight) var(--mc-gui-highlight) var(--mc-gui-slot-dark);
}

.jinsp-titles {
  flex: 1 1 180px;
  min-width: 0;
}

.jinsp-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 2px;
  margin-bottom: 2px;
}

.jinsp-crumb {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 2px;
  font-family: var(--mc-font-body);
  font-size: 11.5px;
  color: var(--mc-gui-shadow);
  background: transparent;
  border: none;
  border-radius: 0;
  cursor: pointer;
}

.jinsp-crumb:hover,
.jinsp-crumb:focus-visible {
  color: var(--mc-gui-edge);
  text-decoration: underline;
  outline: none;
}

.jinsp-crumb-sep {
  font-size: 11.5px;
  color: var(--mc-gui-shadow);
}

/* Dynamic ids and keys: body font, never MinecraftTen (no glyphs for : _ .). */
.jinsp-title {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: var(--mc-font-body);
  font-size: 16px;
  font-weight: 700;
  color: var(--mc-gui-text);
}

.jinsp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}

.jinsp-desc,
.jinsp-empty {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--mc-gui-text);
}

.jinsp-warn {
  margin: 0;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--mc-core-white);
  background: var(--mc-gui-tooltip);
  border: 2px solid var(--mc-redstone-1);
}

.jinsp-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.jinsp-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.jinsp-slot__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.jinsp-slot__name {
  font-size: 13px;
  font-weight: 700;
  color: var(--mc-gui-text);
}

.jinsp-slot__id {
  overflow-wrap: anywhere;
  font-family: var(--mc-font-code);
  font-size: 11px;
  color: var(--mc-gui-shadow);
}

.jinsp-body {
  display: flex;
  flex-direction: column;
  gap: 11px;
  min-width: 0;
  padding: 12px 14px;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 2px solid;
  border-color: var(--mc-gui-slot-dark) var(--mc-gui-highlight) var(--mc-gui-highlight) var(--mc-gui-slot-dark);
}

/* Bodies lifted out of List-mode cards bring their own padding. */
.jinsp-body > .scratch-block__body,
.jinsp-body > .mc-event-card-body {
  padding: 0;
}

.jinsp-subtitle {
  margin-bottom: 6px;
  font-family: var(--mc-font-display);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mc-gui-text);
}

.jinsp-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 4px;
}

.jinsp-tile {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: center;
  column-gap: 6px;
  min-width: 0;
  padding: 6px 8px;
  text-align: left;
  font-family: var(--mc-font-body);
  color: var(--mc-core-white);
  background: var(--mc-gui-slot);
  border: 2px solid;
  border-color: var(--mc-gui-slot-dark) var(--mc-gui-highlight) var(--mc-gui-highlight) var(--mc-gui-slot-dark);
  border-radius: 0;
  cursor: pointer;
}

.jinsp-tile:hover {
  background: var(--mc-gui-slot-hover);
}

.jinsp-tile:focus-visible {
  outline: 2px solid var(--mc-lapis-1);
  outline-offset: 0;
}

.jinsp-tile__icon {
  width: 16px;
  height: 16px;
  image-rendering: pixelated;
}

.jinsp-tile__label,
.jinsp-tile__sum {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jinsp-tile__label {
  font-size: 12.5px;
  font-weight: 700;
  text-shadow: 1px 1px 0 var(--mc-gui-slot-dark);
}

.jinsp-tile__sum {
  grid-column: 2;
  font-size: 11px;
  color: var(--mc-core-grey-1);
}

/* "+ Add Property to <long component id>" wraps instead of overflowing its card. */
.btn-add-comp-prop {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
}

/* Narrow panels (Split view, phones): inspector below a shorter outline. Kept after the base
   rules so it wins at equal specificity. */
@container (max-width: 640px) {
  .jtree-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .jtree-panel {
    position: static;
  }

  .jtree {
    max-height: 300px;
  }
}

/* Touch screens have no hover, so row actions stay visible. */
@media (hover: none) {
  .jtree-acts {
    display: flex;
  }
}
