@import url("https://fonts.googleapis.com/css2?family=Archivo:wght@500;600;700&family=Bricolage+Grotesque:wght@500;600;700&family=Chakra+Petch:wght@500;600;700&family=Fira+Code:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500;600&family=Inconsolata:wght@500;600;700&family=JetBrains+Mono:wght@400;500;700&family=Manrope:wght@500;600;700&family=Nunito+Sans:wght@500;600;700&family=Outfit:wght@500;600;700&family=Plus+Jakarta+Sans:wght@500;600;700&family=Public+Sans:wght@500;600;700&family=Roboto+Mono:wght@400;500;700&family=Share+Tech+Mono&family=Sora:wght@500;600;700&family=Source+Code+Pro:wght@400;500;600;700&family=Source+Sans+3:wght@500;600;700&family=Space+Grotesk:wght@500;600;700&family=Work+Sans:wght@500;600;700&display=swap");

:root {
  --bg-app: #1e1e1e;
  --bg-shell: #1e1e1e;
  --bg-sidebar: #252526;
  --bg-panel: #1e1e1e;
  --bg-editor: #1e1e1e;
  --bg-terminal: #1e1e1e;
  --bg-inspector: #252526;
  --bg-status: #007acc;
  --bg-titlebar: #252526;
  --line: #3c3c3c;
  --line-strong: #3c3c3c;
  --text-main: #d4d4d4;
  --text-soft: #9cdcfe;
  --text-muted: #808080;
  --accent: #007acc;
  --accent-deep: #264f78;
  --accent-contrast: #ffffff;
  --focus: #007acc;
  --focus-ring: rgba(0, 122, 204, 0.18);
  --danger: #f44747;
  --hover: #2a2d2e;
  --selection: #264f78;
  --surface-panel: #252526;
  --surface-card: #252526;
  --surface-chip: #1e1e1e;
  --surface-accent-soft: rgba(0, 122, 204, 0.08);
  --surface-accent: rgba(0, 122, 204, 0.12);
  --surface-danger: rgba(244, 71, 71, 0.14);
  --surface-overlay: rgba(255, 255, 255, 0.03);
  --success: #b5cea8;
  --danger-line: rgba(244, 71, 71, 0.32);
  --overlay: rgba(0, 0, 0, 0.55);
  --shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --bottom-panel-height: 220px;
  --sidebar-panel-width: 250px;
  --output-panel-width: 320px;
  --notes-panel-width: 320px;
  --panel-resizer-size: 8px;
  --status-text: #ffffff;
  --font-ui: "Space Grotesk", "Segoe UI", sans-serif;
  --font-code: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  --ace-gutter-bg: #252526;
  --ace-gutter-text: #858585;
  --ace-print-margin: rgba(255, 255, 255, 0.08);
  --ace-bg: #1e1e1e;
  --ace-text: #d4d4d4;
  --ace-cursor: #aeafad;
  --ace-selection: rgba(38, 79, 120, 0.52);
  --ace-active-line: rgba(255, 255, 255, 0.04);
  --ace-selected-word: rgba(0, 122, 204, 0.28);
  --ace-keyword: #569cd6;
  --ace-function: #dcdcaa;
  --ace-string: #ce9178;
  --ace-comment: #6a9955;
  --ace-variable: #9cdcfe;
  --ace-number: #b5cea8;
  --ace-tag: #4ec9b0;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: var(--font-ui);
  background: var(--bg-app);
  color: var(--text-main);
  font-size: clamp(13px, 0.78rem + 0.18vw, 15px);
  letter-spacing: -0.01em;
  overflow: hidden;
}

* {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--accent) 68%, transparent) color-mix(in srgb, var(--surface-panel) 88%, transparent);
}

*::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

*::-webkit-scrollbar-track {
  background:
    linear-gradient(180deg, var(--surface-overlay), transparent),
    color-mix(in srgb, var(--surface-panel) 90%, transparent);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 92%, white 8%), color-mix(in srgb, var(--accent-deep) 82%, var(--accent) 18%))
    padding-box;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, white 14%, transparent);
}

*::-webkit-scrollbar-thumb:hover {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 100%, white 12%), color-mix(in srgb, var(--selection) 84%, var(--accent) 16%))
    padding-box;
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    color 160ms ease,
    border-color 160ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.app-shell {
  height: 100dvh;
  max-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  overflow: hidden;
}

.titlebar {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  padding: 5px 10px;
  background: var(--bg-titlebar);
  border-bottom: 1px solid var(--line);
}

.brand-cluster,
.title-actions,
.panel-head,
.panel-actions,
.meta-pills,
.console-head,
.modal-head {
  display: flex;
  align-items: center;
}

.brand-cluster {
  gap: 8px;
}

.brand-badge {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.14),
    inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.brand-badge img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.eyebrow,
.panel-label {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.brand-cluster h1,
.panel-head h2,
.editor-topline h2 {
  margin: 1px 0 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0;
}

.title-actions,
.theme-switcher,
.panel-actions,
.meta-pills {
  gap: 6px;
  flex-wrap: wrap;
}

.title-actions {
  margin-left: auto;
  justify-content: flex-end;
}

.mobile-panel-switcher {
  display: none;
}

.mobile-panel-btn {
  min-height: 38px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-panel);
  color: var(--text-soft);
  font-size: 0.74rem;
  font-weight: 700;
}

.mobile-panel-btn.active {
  background: var(--selection);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.ghost-btn,
.soft-btn,
.accent-btn,
.panel-btn,
.tab-btn {
  border-radius: var(--radius-sm);
}

.ghost-btn,
.soft-btn,
.panel-btn {
  padding: 5px 8px;
  color: var(--text-soft);
  background: var(--bg-panel);
  border: 1px solid var(--line);
  font-size: 0.69rem;
  font-weight: 600;
}

.panel-action-btn,
.toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.btn-icon {
  width: 16px;
  height: 16px;
  display: inline-grid;
  place-items: center;
  color: currentColor;
  flex: 0 0 16px;
}

.btn-icon svg {
  width: 100%;
  height: 100%;
}

.btn-label {
  min-width: 0;
}

.accent-btn {
  padding: 5px 9px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 800;
  font-size: 0.69rem;
}

.theme-switcher,
.font-switcher {
  position: relative;
  flex: 0 0 auto;
  min-width: 190px;
}

.theme-toggle,
.font-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, var(--surface-overlay), transparent),
    var(--surface-card);
  border: 1px solid var(--line);
  color: var(--text-main);
  font-size: 0.67rem;
  font-weight: 700;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.theme-toggle:hover,
.theme-switcher.open .theme-toggle,
.font-toggle:hover,
.font-switcher.open .font-toggle {
  border-color: var(--accent);
  background:
    linear-gradient(180deg, var(--surface-overlay), transparent),
    var(--surface-panel);
}

.theme-toggle-swatch,
.font-toggle-preview {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--theme-swatch-start), var(--theme-swatch-end));
  border: 1px solid var(--line);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    0 0 0 3px var(--surface-overlay);
}

.font-toggle-preview {
  display: grid;
  place-items: center;
  color: var(--text-main);
  font-size: 0.64rem;
  font-weight: 700;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 26%, transparent), color-mix(in srgb, var(--surface-panel) 88%, transparent));
}

.theme-toggle-copy,
.font-toggle-copy {
  display: grid;
  gap: 1px;
  flex: 1;
}

.theme-toggle-label,
.font-toggle-label {
  color: var(--text-muted);
  font-size: 0.52rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.theme-toggle-value,
.font-toggle-value {
  color: var(--text-main);
  font-size: 0.69rem;
}

.theme-toggle-arrow,
.font-toggle-arrow {
  color: var(--text-soft);
  font-size: 0.68rem;
  font-weight: 900;
  transition: transform 160ms ease;
}

.theme-switcher.open .theme-toggle-arrow,
.font-switcher.open .font-toggle-arrow {
  transform: rotate(180deg);
}

.theme-menu,
.font-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(320px, 86vw);
  max-height: min(58vh, 420px);
  display: grid;
  gap: 6px;
  padding: 8px;
  overflow-y: auto;
  border-radius: 18px;
  background:
    linear-gradient(180deg, var(--surface-overlay), transparent),
    var(--surface-card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 15;
}

.theme-btn,
.font-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.theme-btn:hover,
.font-btn:hover {
  background: var(--surface-overlay);
  color: var(--text-main);
}

.font-preview {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  flex: 0 0 22px;
  border-radius: 8px;
  color: var(--text-main);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 24%, transparent), color-mix(in srgb, var(--surface-panel) 90%, transparent));
  border: 1px solid var(--line);
  font-size: 0.68rem;
  font-weight: 700;
}

.theme-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--theme-swatch-start), var(--theme-swatch-end));
  border: 1px solid var(--line);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.theme-btn.active,
.font-btn.active {
  background: var(--selection);
  border-color: var(--accent);
  color: var(--text-main);
}

.ghost-btn.active,
.soft-btn.active {
  background: var(--selection);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.small-btn {
  padding: 5px 8px;
  font-size: 0.68rem;
}

.workbench {
  display: grid;
  grid-template-columns: var(--sidebar-panel-width) minmax(0, 1fr) var(--output-panel-width);
  grid-template-areas: "sidebar editor output";
  min-height: 0;
  overflow: hidden;
}

.panel {
  min-height: 0;
}

.sidebar {
  grid-area: sidebar;
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--line);
}

.explorer-resizer {
  position: absolute;
  top: 0;
  right: calc(var(--panel-resizer-size) / -2);
  bottom: 0;
  width: var(--panel-resizer-size);
  cursor: col-resize;
  z-index: 4;
  touch-action: none;
}

.explorer-resizer::before {
  content: "";
  position: absolute;
  right: 2px;
  top: 50%;
  width: 3px;
  height: 72px;
  transform: translateY(-50%);
  border-radius: 999px;
  background: linear-gradient(180deg, transparent, var(--line), transparent);
}

.explorer-resizer:hover::before {
  background: linear-gradient(180deg, transparent, var(--accent), transparent);
}

.panel-head {
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px 8px;
}

.compact-head {
  padding-bottom: 8px;
}

.panel-caption,
.output-note {
  margin: 0 10px 10px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  background: var(--surface-panel);
  border: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 0.7rem;
  line-height: 1.5;
}

.tree-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 6px 10px;
}

.tree-summary-card {
  display: grid;
  gap: 8px;
  margin: 0 4px 10px;
  padding: 10px;
  border-radius: 12px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 8%, transparent), transparent 58%),
    var(--surface-accent-soft);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.tree-summary-title {
  margin: 0;
  color: var(--text-main);
  font-size: 0.73rem;
  font-weight: 700;
}

.tree-summary-copy {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.68rem;
  line-height: 1.5;
}

.tree-summary-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tree-summary-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-chip);
  border: 1px solid var(--line);
  color: var(--text-soft);
  font-size: 0.63rem;
  font-weight: 700;
}

.tags-panel {
  border-top: 1px solid var(--line);
  padding-bottom: 14px;
}

.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 10px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--surface-accent);
  border: 1px solid var(--line);
  color: var(--text-main);
  font-size: 0.64rem;
  font-weight: 600;
}

.tag-empty {
  color: var(--text-muted);
  font-size: 0.68rem;
}

.tree-group {
  margin-left: 10px;
  padding-left: 8px;
  border-left: 1px dashed var(--line);
}

.tree-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 7px 8px;
  color: var(--text-soft);
  border-radius: 12px;
  background: transparent;
  margin-top: 2px;
  font-size: 0.72rem;
}

.tree-row:hover,
.tree-row.active {
  background: var(--hover);
  color: var(--text-main);
}

.tree-main {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}

.tree-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.tree-icon {
  width: 22px;
  height: 22px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: linear-gradient(180deg, var(--surface-overlay), var(--surface-chip));
  border: 1px solid var(--line);
  color: var(--text-soft);
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  overflow: hidden;
}

.tree-icon svg {
  width: 14px;
  height: 14px;
}

.tree-icon.is-folder {
  color: color-mix(in srgb, var(--accent) 62%, var(--text-main) 38%);
}

.tree-icon.is-file {
  color: var(--text-soft);
}

.tree-icon-badge {
  position: absolute;
  right: 1px;
  bottom: 1px;
  min-width: 9px;
  height: 9px;
  padding: 0 2px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 82%, var(--bg-panel) 18%);
  color: var(--accent-contrast);
  font-size: 0.42rem;
  line-height: 1;
  letter-spacing: 0;
}

.tree-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-main);
}

.tree-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 0.62rem;
}

.tree-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 160ms ease;
}

.tree-row:hover .tree-actions,
.tree-row.active .tree-actions {
  opacity: 1;
}

.icon-btn {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--hover);
  color: var(--text-muted);
  font-size: 0.65rem;
}

.icon-btn:hover {
  background: var(--surface-danger);
  color: var(--danger);
}

.tree-action-btn {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-chip);
  color: var(--text-muted);
  border: 1px solid transparent;
}

.tree-action-btn svg {
  width: 13px;
  height: 13px;
}

.tree-action-btn:hover {
  border-color: var(--line);
  background: var(--surface-overlay);
  color: var(--text-main);
}

.tree-action-btn.danger:hover {
  background: var(--surface-danger);
  border-color: var(--danger-line);
  color: var(--danger);
}

.editor-stack {
  grid-area: editor;
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) var(--panel-resizer-size) var(--bottom-panel-height);
  background: var(--bg-shell);
  overflow: hidden;
}

.editor-stack.bottom-collapsed {
  grid-template-rows: minmax(0, 1fr);
}

.editor-panel,
.terminal-panel,
.output-panel,
.solution-panel {
  min-height: 0;
}

.editor-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  background: var(--bg-shell);
}

.editor-tabs {
  min-height: 32px;
  display: flex;
  align-items: flex-end;
  gap: 1px;
  overflow: auto;
  background: var(--surface-panel);
  border-bottom: 1px solid var(--line);
}

.tab-btn {
  min-height: 32px;
  padding: 0 11px;
  background: var(--hover);
  color: var(--text-muted);
  border: 0;
  border-radius: 0;
  white-space: nowrap;
  font-size: 0.68rem;
  font-weight: 600;
}

.tab-btn.active {
  background: var(--bg-editor);
  color: var(--text-main);
  border-top: 1px solid var(--accent);
}

.editor-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-panel);
}

.editor-toolbar,
.editor-nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.editor-nav-actions {
  flex-wrap: wrap;
}

.meta-pill {
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--surface-panel);
  border: 1px solid var(--line);
  color: var(--text-soft);
  font-size: 0.64rem;
  font-weight: 600;
}

.editor-wrap {
  position: relative;
  min-height: 0;
  background: var(--bg-editor);
  overflow: hidden;
  touch-action: pan-x pan-y;
}

#editor {
  width: 100%;
  height: 100%;
}

#editor,
.ace_editor,
.ace_editor * {
  font-family: var(--font-code) !important;
}

.editor-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  z-index: 2;
  background: var(--bg-editor);
}

.empty-card {
  width: min(520px, 100%);
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface-card);
  box-shadow: var(--shadow);
}

.empty-card h3 {
  margin: 8px 0 6px;
  font-size: 1.08rem;
}

.empty-card p:last-child {
  margin-bottom: 0;
  color: var(--text-soft);
  line-height: 1.5;
  font-size: 0.74rem;
}

.bottom-panels {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--panel-resizer-size) minmax(240px, var(--notes-panel-width));
  border-top: 1px solid var(--line);
  background: var(--bg-terminal);
  overflow: hidden;
}

.bottom-panels.console-only,
.bottom-panels.notes-only {
  grid-template-columns: minmax(0, 1fr);
}

.bottom-resizer {
  height: var(--panel-resizer-size);
  cursor: row-resize;
  position: relative;
  background: var(--bg-shell);
  touch-action: none;
}

.bottom-resizer::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 3px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  background: var(--line);
}

.bottom-resizer:hover::before {
  background: var(--accent);
}

.editor-stack.bottom-collapsed .bottom-panels {
  display: none;
}

.editor-stack.bottom-collapsed .bottom-resizer {
  display: none;
}

.terminal-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--bg-terminal);
  min-width: 0;
}

.notes-resizer {
  position: relative;
  width: var(--panel-resizer-size);
  min-width: var(--panel-resizer-size);
  cursor: col-resize;
  background: var(--bg-terminal);
  touch-action: none;
}

.notes-resizer::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3px;
  height: 72px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  background: linear-gradient(180deg, transparent, var(--line), transparent);
}

.notes-resizer:hover::before {
  background: linear-gradient(180deg, transparent, var(--accent), transparent);
}

.solution-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: var(--bg-inspector);
  border-left: 1px solid var(--line);
  min-width: 0;
}

.bottom-panel-head {
  flex-wrap: wrap;
}

.bottom-tab-strip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-panel);
  border: 1px solid var(--line);
}

.bottom-tab-btn {
  padding: 5px 10px;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  border: 0;
  font-size: 0.66rem;
  font-weight: 700;
}

.bottom-tab-btn.active,
.bottom-tab-btn:hover {
  background: var(--selection);
  color: var(--accent-contrast);
}

.bottom-view {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.terminal-log {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 12px 8px;
  font: 0.76rem var(--font-code);
}

.terminal-entry {
  margin: 0;
  padding: 3px 0;
  color: var(--text-soft);
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal-entry.command {
  color: var(--text-soft);
}

.terminal-entry.success {
  color: var(--success);
}

.terminal-entry.error {
  color: var(--danger);
}

.terminal-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px 12px;
  border-top: 1px solid var(--line);
}

.prompt-label {
  font: 0.74rem var(--font-code);
  color: var(--text-soft);
}

.terminal-input-row input,
.modal-form input,
.modal-form select {
  width: 100%;
  padding: 8px 10px;
  color: var(--text-main);
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  font-size: 0.72rem;
}

.terminal-input-row input:focus,
.modal-form input:focus,
.modal-form select:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.debug-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  padding: 0 12px 8px;
}

.debug-card {
  padding: 10px;
  border-radius: var(--radius-md);
  background: var(--surface-card);
  border: 1px solid var(--line);
}

.debug-card span {
  display: block;
  color: var(--text-muted);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.debug-card strong {
  display: block;
  margin-top: 4px;
  color: var(--text-main);
  font-size: 0.72rem;
}

.debug-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.debug-entry {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-card);
  border: 1px solid var(--line);
  color: var(--text-soft);
  font: 0.72rem var(--font-code);
}

.debug-entry.info {
  color: var(--text-main);
}

.debug-entry.warn {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line) 60%);
  color: var(--text-soft);
}

.debug-entry.success {
  border-color: color-mix(in srgb, var(--success) 50%, var(--line) 50%);
  color: var(--success);
}

.debug-entry.error {
  border-color: var(--danger-line);
  color: var(--danger);
}

.solution-grid {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
}

.solution-card {
  padding: 10px;
  border-radius: 10px;
  background: var(--surface-card);
  border: 1px solid var(--line);
}

.solution-label {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.56rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.solution-card h3 {
  margin: 7px 0 4px;
  font-size: 0.8rem;
}

.solution-card p:last-child {
  margin-bottom: 0;
  color: var(--text-soft);
  line-height: 1.45;
  font-size: 0.7rem;
}

.swipe-note {
  margin-top: 10px;
}

.output-panel {
  grid-area: output;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) 180px;
  background: var(--bg-panel);
  border-left: 1px solid var(--line);
  min-width: 260px;
  position: relative;
  overflow: hidden;
}

.output-resizer {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--panel-resizer-size);
  cursor: col-resize;
  z-index: 2;
  touch-action: none;
}

.output-resizer::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 50%;
  width: 3px;
  height: 72px;
  border-radius: 999px;
  transform: translateY(-50%);
  background: var(--line);
}

.output-resizer:hover::before {
  background: var(--accent);
}

.preview-wrap {
  min-height: 0;
  padding: 0 10px 10px;
}

#preview-frame {
  width: 100%;
  height: 100%;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}

.monaco-editor .scrollbar .slider {
  border-radius: 999px !important;
}

.monaco-editor .scrollbar.vertical,
.monaco-editor .scrollbar.horizontal {
  background: transparent !important;
}

.console-panel {
  min-height: 0;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: var(--bg-panel);
}

.console-head {
  justify-content: space-between;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-size: 0.68rem;
}

.console-list {
  max-height: 100%;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.console-entry {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-card);
  border: 1px solid var(--line);
  color: var(--text-soft);
  font: 0.72rem var(--font-code);
}

.console-entry.error {
  border-color: var(--danger-line);
  color: var(--danger);
}

.statusbar {
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  background: var(--bg-status);
  border-top: 1px solid var(--line);
  color: var(--status-text);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
}

.statusbar-group,
.statusbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.statusbar-actions {
  justify-content: flex-end;
}

.status-toggle {
  min-height: 20px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--status-text);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.status-toggle:hover,
.status-toggle.active {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.32);
}

.hidden {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--overlay);
  backdrop-filter: blur(6px);
  z-index: 20;
}

.modal-card {
  width: min(430px, 100%);
  border-radius: 14px;
  background: var(--surface-card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.modal-form {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.modal-form label {
  display: grid;
  gap: 8px;
  color: var(--text-soft);
  font-size: 0.72rem;
}

.workbench.hide-explorer {
  grid-template-columns: minmax(0, 1fr) var(--output-panel-width);
  grid-template-areas: "editor output";
}

.workbench.hide-explorer .sidebar {
  display: none;
}

.workbench.hide-output {
  grid-template-columns: var(--sidebar-panel-width) minmax(0, 1fr);
  grid-template-areas: "sidebar editor";
}

.workbench.hide-output .output-panel {
  display: none;
}

.bottom-panels.console-only .notes-resizer,
.bottom-panels.notes-only .notes-resizer {
  display: none;
}

.workbench.hide-explorer.hide-output {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "editor";
}

@media (max-width: 1180px) {
  .workbench,
  .workbench.hide-explorer,
  .workbench.hide-output,
  .workbench.hide-explorer.hide-output {
    grid-template-columns: var(--sidebar-panel-width) minmax(0, 1fr);
  }

  .sidebar,
  .output-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .workbench {
    grid-template-areas:
      "editor editor"
      "sidebar output";
  }

  .editor-stack {
    grid-area: editor;
  }

  .sidebar {
    grid-area: sidebar;
  }

  .output-panel {
    grid-area: output;
  }

  .bottom-panels {
    grid-template-columns: 1fr;
  }

  .notes-resizer {
    display: none;
  }

  .output-resizer {
    display: none;
  }

  .solution-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 780px) {
  .explorer-resizer {
    display: none;
  }

  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    max-height: none;
    min-height: 100dvh;
    overflow: visible;
  }

  .titlebar {
    flex-direction: column;
    align-items: stretch;
    padding: 8px 10px;
  }

  .mobile-panel-switcher {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    padding: 8px 10px 10px;
    background: var(--bg-titlebar);
    border-bottom: 1px solid var(--line);
  }

  .title-actions {
    margin-left: 0;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .theme-switcher {
    width: 100%;
    min-width: 0;
  }

  .font-switcher {
    width: 100%;
    min-width: 0;
  }

  .theme-menu {
    width: 100%;
    max-height: 48vh;
  }

  .font-menu {
    width: 100%;
    max-height: 48vh;
  }

  .title-actions > button {
    width: 100%;
  }

  .workbench,
  .workbench.hide-explorer,
  .workbench.hide-output,
  .workbench.hide-explorer.hide-output {
    grid-template-columns: 1fr;
    grid-template-areas: "editor";
    overflow: visible;
  }

  .editor-stack {
    min-height: calc(100dvh - 210px);
    grid-template-rows: minmax(0, 1fr);
  }

  .editor-stack.bottom-collapsed {
    grid-template-rows: minmax(0, 1fr);
  }

  .editor-topline,
  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .editor-toolbar {
    width: 100%;
    justify-content: stretch;
  }

  .editor-toolbar > * {
    min-width: 0;
  }

  .editor-nav-actions {
    width: 100%;
  }

  .editor-nav-actions > button {
    flex: 1 1 calc(50% - 8px);
  }

  .meta-pills,
  .panel-actions {
    width: 100%;
  }

  .toolbar-btn,
  .meta-pills > *,
  .panel-actions > button {
    flex: 1;
  }

  .meta-pills {
    display: grid;
    grid-template-columns: 1fr;
  }

  .tree-actions {
    opacity: 1;
  }

  .debug-summary {
    grid-template-columns: 1fr;
  }

  .statusbar {
    flex-wrap: wrap;
    min-height: auto;
    padding: 8px 12px;
  }

  .statusbar-group,
  .statusbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .workbench[data-mobile-panel="editor"] .sidebar,
  .workbench[data-mobile-panel="editor"] .output-panel,
  .workbench[data-mobile-panel="workspace"] .editor-stack,
  .workbench[data-mobile-panel="workspace"] .output-panel,
  .workbench[data-mobile-panel="preview"] .editor-stack,
  .workbench[data-mobile-panel="preview"] .sidebar,
  .workbench[data-mobile-panel="console"] .sidebar,
  .workbench[data-mobile-panel="console"] .output-panel,
  .workbench[data-mobile-panel="notes"] .sidebar,
  .workbench[data-mobile-panel="notes"] .output-panel {
    display: none;
  }

  .workbench[data-mobile-panel="workspace"] .sidebar,
  .workbench[data-mobile-panel="preview"] .output-panel,
  .workbench[data-mobile-panel="editor"] .editor-stack,
  .workbench[data-mobile-panel="console"] .editor-stack,
  .workbench[data-mobile-panel="notes"] .editor-stack {
    display: grid;
  }

  .workbench[data-mobile-panel="editor"] .bottom-resizer,
  .workbench[data-mobile-panel="editor"] .bottom-panels {
    display: none;
  }

  .workbench[data-mobile-panel="console"] .editor-panel,
  .workbench[data-mobile-panel="notes"] .editor-panel,
  .workbench[data-mobile-panel="console"] .bottom-resizer,
  .workbench[data-mobile-panel="notes"] .bottom-resizer {
    display: none;
  }

  .workbench[data-mobile-panel="console"] .bottom-panels,
  .workbench[data-mobile-panel="notes"] .bottom-panels {
    display: grid;
    grid-template-columns: 1fr;
    min-height: calc(100dvh - 250px);
  }

  .workbench[data-mobile-panel="console"] .solution-panel,
  .workbench[data-mobile-panel="notes"] .terminal-panel {
    display: none;
  }

  .workbench[data-mobile-panel="console"] .terminal-panel,
  .workbench[data-mobile-panel="notes"] .solution-panel {
    display: grid;
  }

  .terminal-input-row {
    position: sticky;
    bottom: 0;
    background: var(--bg-terminal);
  }

  .bottom-tab-strip {
    width: 100%;
    justify-content: space-between;
  }

  .bottom-tab-btn {
    flex: 1 1 0;
    min-height: 38px;
    font-size: 0.72rem;
  }
}

@media (max-width: 560px) {
  .title-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .title-actions {
    gap: 8px;
  }

  .mobile-panel-switcher {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar,
  .output-panel {
    min-height: 300px;
  }

  .editor-wrap {
    min-height: 62vh;
  }

  #preview-frame {
    min-height: 52vh;
  }

  .statusbar-actions {
    gap: 8px;
    flex-wrap: wrap;
  }

  .modal-card {
    width: min(100%, 430px);
  }
}
