:root {
  --bg: #f4efe5;
  --panel: rgba(255, 250, 241, 0.92);
  --panel-strong: #fffdf8;
  --line: #d8ccbc;
  --text: #1d1a17;
  --muted: #6e6255;
  --accent: #ba4a00;
  --accent-strong: #8d3200;
  --shadow: 0 24px 60px rgba(64, 34, 15, 0.12);
  --radius: 18px;
  --editor-bg: #1e1f22;
  --editor-gutter: #18191c;
  --editor-line: #2b2d31;
  --editor-text: #d7dae0;
  --editor-muted: #7f848e;
  --editor-keyword: #cf8e6d;
  --editor-string: #6aab73;
  --editor-number: #2aacb8;
  --editor-comment: #7a7e85;
  --editor-function: #56a8f5;
  --editor-class: #c77dff;
  --editor-constant: #c9a26d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 208, 155, 0.55), transparent 26%),
    radial-gradient(circle at bottom right, rgba(186, 74, 0, 0.12), transparent 22%),
    linear-gradient(135deg, #f8f1e3, #efe4d2 45%, #f6f0e9);
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  --main-left-width: 48%;
  --sidebar-width: 320px;
  --sidebar-collapsed-width: 52px;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: 10px;
  height: 100vh;
  padding: 20px;
  overflow: hidden;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed-width) 1fr;
  gap: 6px;
}

.sidebar,
.panel {
  border: 1px solid rgba(141, 50, 0, 0.14);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
  min-height: 0;
  overflow: hidden;
  transition: padding 140ms ease, border-color 140ms ease, background 140ms ease;
}

.sidebar-content {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 20px;
}

.sidebar-toggle {
  position: absolute;
  top: 18px;
  right: 16px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 30px;
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.sidebar-toggle-brand {
  display: none;
  min-width: 30px;
  padding: 6px 0;
  border: 1px solid rgba(141, 50, 0, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--accent-strong);
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.sidebar-toggle:hover {
  background: rgba(186, 74, 0, 0.08);
  color: var(--accent);
}

.sidebar-toggle-icon {
  display: block;
  font-size: 20px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.12em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell.sidebar-collapsed .sidebar {
  align-items: center;
  padding: 18px 0 12px;
  border-color: rgba(141, 50, 0, 0.12);
  background: rgba(255, 250, 241, 0.45);
  box-shadow: none;
  backdrop-filter: blur(6px);
}

.app-shell.sidebar-collapsed .sidebar::after {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-content {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-toggle {
  position: static;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: auto;
  min-height: 92px;
  padding: 0;
  border-radius: 0;
  transform: none;
}

.app-shell.sidebar-collapsed .sidebar-toggle-icon {
  order: -1;
}

.app-shell.sidebar-collapsed .sidebar-toggle:hover {
  background: transparent;
}

.app-shell.sidebar-collapsed .sidebar-toggle-icon {
  padding: 4px 0 0;
  font-size: 16px;
}

.app-shell.sidebar-collapsed .sidebar-toggle-brand {
  display: block;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  color: var(--accent);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: 30px;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
}

h3 {
  margin-bottom: 0;
  font-size: 15px;
}

.sidebar-copy,
.hint,
.muted-label {
  color: var(--muted);
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  flex: 1;
}

.problem-list-shell {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.sidebar-select {
  max-width: 160px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
}

.problem-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.problem-group {
  margin-top: 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.problem-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.problem-card:hover,
.problem-card.active {
  transform: translateY(-1px);
  border-color: rgba(186, 74, 0, 0.45);
  background: var(--panel-strong);
}

.problem-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.problem-count {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: right;
}

.sidebar-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 8px;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(280px, var(--main-left-width)) 6px minmax(380px, 1fr);
  gap: 5px;
  min-height: 0;
  overflow: hidden;
}

.main-split-handle {
  width: 6px;
  cursor: col-resize;
  border-radius: 999px;
  background: transparent;
  transition: background 120ms ease;
}

.main-split-handle::after {
  content: "";
  display: block;
  width: 2px;
  height: 100%;
  margin: 0 auto;
  border-radius: 999px;
  background: transparent;
  transition: background 120ms ease, width 120ms ease;
}

.main-split-handle:hover {
  background: rgba(186, 74, 0, 0.04);
}

.main-split-handle:hover::after {
  width: 3px;
  background: rgba(186, 74, 0, 0.35);
}

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 18px 18px 16px;
  overflow: hidden;
}

.panel-statement {
  min-height: 78vh;
}

.panel-editor {
  min-height: 78vh;
}

.editor-content {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.section-header,
.toolbar,
.terminal-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-header {
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-header-compact {
  margin-bottom: 10px;
}

.toolbar {
  flex-wrap: wrap;
}

.primary-button,
.ghost-button,
.mode-button {
  border-radius: 999px;
  border: 1px solid rgba(141, 50, 0, 0.2);
  padding: 8px 14px;
  cursor: pointer;
}

.primary-button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff9f1;
}

.ghost-button,
.mode-button {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
}

.mode-button.active {
  background: #2a251f;
  border-color: #2a251f;
  color: #fff;
}

.statement-view,
.editor,
.terminal-output,
.command-block {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
}

.statement-view,
.terminal-output {
  padding: 16px;
  overflow: auto;
}

.statement-view {
  flex: 1;
  min-height: 0;
  line-height: 1.55;
}

.statement-view h3 {
  margin: 18px 0 8px;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

.statement-view p {
  margin: 0 0 12px;
}

.statement-view ul {
  margin: 0 0 14px 18px;
  padding: 0;
}

.statement-view li {
  margin-bottom: 8px;
}

.statement-view code {
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(186, 74, 0, 0.08);
  font-family: "Courier New", monospace;
  font-size: 13px;
}

.statement-meta strong {
  color: var(--accent-strong);
}

.statement-code-block {
  margin: 0 0 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  font-family: "Courier New", monospace;
  font-size: 13px;
  white-space: pre-wrap;
}

.editor {
  width: 100%;
  flex: 1;
  resize: none;
  padding: 18px;
  line-height: 1.55;
  font-family: "Courier New", monospace;
  font-size: 14px;
}

.code-editor-shell {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  border: 1px solid #121316;
  border-radius: 18px;
  overflow: hidden;
  background: var(--editor-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--editor-line);
  background: linear-gradient(180deg, #25272c, #1b1c20);
}

.editor-topbar-left,
.editor-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.editor-pill,
.editor-meta {
  color: #d8dbe1;
  font-family: "Courier New", monospace;
  font-size: 12px;
}

.editor-meta {
  color: var(--editor-muted);
}

.language-picker {
  display: flex;
  align-items: center;
  gap: 10px;
}

.editor-mode-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--editor-muted);
  font-weight: 700;
  transition: color 120ms ease;
}

.editor-mode-button:hover {
  color: #f0d8c7;
}

.editor-mode-button.active {
  color: #f4efe5;
}

.editor-mode-separator {
  color: var(--editor-muted);
}

.editor-reset-button {
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  color: #f0d8c7;
  font-size: 24px;
  line-height: 1;
  border: 0;
  transform: translateY(-2px) scaleX(-1);
}

.editor-reset-button:hover:not(:disabled) {
  background: transparent;
  border: 0;
}

.editor-reset-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.editor-topbar .editor-reset-button,
.editor-topbar .editor-reset-button:hover:not(:disabled) {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0 !important;
  outline: 0;
  background: transparent !important;
  box-shadow: none;
  font-size: 30px !important;
  transform: translateY(-2px) scaleX(-1);
}

.language-select {
  min-width: 120px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #f1f3f7;
}

.code-editor-frame {
  display: flex;
  flex: 1;
  min-height: 0;
  align-items: stretch;
  background: var(--editor-bg);
}

.editor-alt {
  flex: 1;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: var(--editor-bg);
  color: var(--editor-text);
  font-family: "Courier New", monospace;
}

.line-numbers {
  flex: 0 0 56px;
  width: 56px;
  min-height: 100%;
  padding: 16px 10px 16px 0;
  overflow: hidden;
  text-align: right;
  border-right: 1px solid var(--editor-line);
  background: var(--editor-gutter);
  color: var(--editor-muted);
  font-family: "Courier New", monospace;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre;
  user-select: none;
}

.editor-layer {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.highlight-layer,
.code-input {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 16px 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-family: "Courier New", monospace;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre;
  overflow: auto;
}

.highlight-layer {
  pointer-events: none;
  color: var(--editor-text);
}

.code-input {
  color: transparent;
  caret-color: #f5f7fa;
  resize: none;
}

.code-input::selection {
  background: rgba(86, 168, 245, 0.35);
}

.code-input:focus,
.whiteboardEditor:focus {
  outline: none;
}

.token-keyword {
  color: var(--editor-keyword);
}

.token-string {
  color: var(--editor-string);
}

.token-number {
  color: var(--editor-number);
}

.token-comment {
  color: var(--editor-comment);
}

.token-function {
  color: var(--editor-function);
}

.token-class {
  color: var(--editor-class);
}

.token-constant {
  color: var(--editor-constant);
}

.terminal-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.agent-chat-shell {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  margin-bottom: 12px;
  border: 1px solid #121316;
  border-radius: 16px;
  background: #15171b;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.agent-session-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #2a2d33;
  background: #121419;
  flex: 0 0 auto;
}

.agent-session-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow: auto hidden;
}

.agent-session-tab-shell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.agent-session-tab {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #8f949d;
  cursor: pointer;
  font-weight: 700;
  text-transform: lowercase;
  transition: color 120ms ease;
}

.agent-session-tab:hover {
  color: #d7dae0;
}

.agent-session-tab.active {
  color: #f4efe5;
}

.agent-session-tab-label {
  pointer-events: none;
}

.agent-session-tab-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #8f949d;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease, color 120ms ease, border-color 120ms ease, background 120ms ease;
}

.agent-session-tab-shell:hover .agent-session-tab-close,
.agent-session-tab-shell:focus-within .agent-session-tab-close {
  opacity: 1;
  pointer-events: auto;
}

.agent-session-tab-close:hover {
  color: #f4efe5;
  border-color: transparent;
  background: rgba(255, 255, 255, 0.08);
}

.agent-session-tab-add {
  border: 0;
  background: transparent;
  color: #8f949d;
  cursor: pointer;
  font-weight: 700;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  transition: color 120ms ease;
}

.agent-session-tab-add:hover {
  color: #f4efe5;
}

.agent-session-separator {
  color: #676c75;
}

.agent-session-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.agent-live-label {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  white-space: nowrap;
}

.agent-live-label::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #37c871;
  box-shadow: 0 0 0 3px rgba(55, 200, 113, 0.18);
}

.terminal-chat-shell {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  margin-bottom: 12px;
  border: 1px solid #121316;
  border-radius: 16px;
  background: #15171b;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.terminal-session-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #2a2d33;
  background: #121419;
  flex: 0 0 auto;
}

.terminal-tab {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  color: #8f949d;
  font-weight: 700;
  text-transform: lowercase;
  transition: color 120ms ease;
}

.terminal-tab:hover {
  color: #d7dae0;
}

.terminal-tab.active {
  color: #f4efe5;
}

.terminal-tab-shell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.terminal-tab-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #8f949d;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease, color 120ms ease, background 120ms ease;
}

.terminal-tab-shell:hover .terminal-tab-close,
.terminal-tab-shell:focus-within .terminal-tab-close {
  opacity: 1;
  pointer-events: auto;
}

.terminal-tab-close:hover {
  color: #f4efe5;
  background: rgba(255, 255, 255, 0.08);
}

.terminal-tab-separator {
  color: #676c75;
}

.terminal-tab-add {
  border: 0;
  background: transparent;
  color: #8f949d;
  cursor: pointer;
  font-weight: 700;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  transition: color 120ms ease;
}

.terminal-tab-add:hover {
  color: #f4efe5;
}

.terminal-session-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.terminal-output {
  flex: 1;
  margin: 0 0 12px;
  font-family: "Courier New", monospace;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  min-height: 220px;
}

.terminal-live-output {
  margin: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 0;
  background: #0d1117;
  color: #d6deeb;
  box-shadow: none;
  overflow: hidden;
  outline: none;
}

.terminal-live-output:focus {
  border-color: #2d7ff9;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 0 0 1px rgba(45, 127, 249, 0.18);
}

.terminal-live-output .xterm {
  height: 100%;
  width: 100%;
}

.terminal-live-output .xterm-screen,
.terminal-live-output .xterm-helpers,
.terminal-live-output .xterm-viewport {
  width: 100%;
}

.terminal-live-output .xterm-viewport {
  scrollbar-color: #2d333b #0d1117;
  scrollbar-width: thin;
}

.agent-output {
  padding: 14px 16px;
  white-space: normal;
  line-height: 1.55;
  border: 0;
  background: transparent;
  color: #d7dae0;
  box-shadow: none;
  margin: 0;
}

.agent-message {
  margin-bottom: 14px;
}

.agent-message-role {
  display: block;
  margin-bottom: 6px;
  color: #aeb4c0;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.agent-message-role-user {
  color: #f0c5a9;
}

.agent-message-role-agent {
  color: #9dc7ff;
}

.agent-message-role-meta {
  color: #7f848e;
}

.agent-message-body {
  color: #d7dae0;
}

.agent-message-body p {
  margin: 0 0 10px;
}

.agent-message-body p:last-child {
  margin-bottom: 0;
}

.agent-message-body code {
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #f3d7c4;
}

.agent-message-body pre {
  margin: 10px 0 0;
  padding: 12px 14px;
  border: 1px solid #2a2d33;
  border-radius: 12px;
  background: #111318;
  color: #d7dae0;
  white-space: pre-wrap;
  overflow: auto;
}

.agent-form-busy #agentInput,
#agentInput {
  border-color: #2a2d33;
  background: #111318;
  color: #eef1f6;
}

.agent-form-busy #agentInput,
#agentInput:disabled {
  opacity: 0.72;
}

.agent-send-busy {
  min-width: 72px;
}

.test-drawer,
.terminal-drawer {
  --drawer-height: 280px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
}

.drawer-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid transparent;
}

.drawer-title-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
}

.drawer-title-tab,
.drawer-collapse-button {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  transition: color 120ms ease;
}

.drawer-title-tab {
  color: var(--muted);
  font-weight: 700;
}

.drawer-title-tab:hover {
  color: var(--accent);
}

.drawer-title-tab.active {
  color: var(--text);
}

.drawer-title-separator {
  color: var(--muted);
}

.drawer-body {
  display: flex;
  flex-direction: column;
  height: var(--drawer-height);
  min-height: 0;
  border-top: 1px solid var(--line);
}

.test-drawer.collapsed .drawer-body,
.terminal-drawer.collapsed .drawer-body {
  display: none;
}

.drawer-resize-handle {
  position: relative;
  flex: 0 0 14px;
  margin: 6px 0 4px;
  cursor: ns-resize;
  background: transparent;
}

.drawer-resize-handle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 6px;
  width: calc(100% - 24px);
  height: 2px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: transparent;
  transition: background 120ms ease, height 120ms ease;
}

.drawer-resize-handle:hover {
  background: rgba(186, 74, 0, 0.03);
}

.drawer-resize-handle:hover::after {
  background: rgba(186, 74, 0, 0.3);
}

.drawer-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 14px;
  overflow: hidden;
}

.drawer-output {
  margin: 0;
  flex: 1;
  min-height: 0;
}

.test-output-rich {
  padding: 14px 16px;
  border: 0;
  border-radius: 0;
  background: #0d1217;
  color: #d7dae0;
  box-shadow: none;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  overflow: auto;
  scrollbar-color: #2d333b #0d1217;
  scrollbar-width: thin;
}

.test-line {
  display: block;
  color: #d7dae0;
}

.test-traceback,
.test-frame {
  color: #8ab4f8;
}

.test-caret {
  color: #f2cc60;
}

.test-exception,
.test-failure {
  color: #ff938a;
}

.test-success {
  color: #7ee787;
}

.test-meta {
  color: #a5b4c3;
}

.test-blank {
  height: 0.75em;
}

.test-summary {
  color: var(--accent-strong);
  font-weight: 700;
}

.test-case {
  color: var(--editor-text);
}

.test-case-pass {
  color: var(--accent-strong);
}

.test-case-fail {
  color: #d45b62;
}

.testcase-cases {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow: auto;
}

.testcase-case {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.76);
}

.testcase-case-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.testcase-case-title {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.testcase-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.testcase-label {
  font-family: "Courier New", monospace;
  font-size: 13px;
  color: var(--muted);
}

.testcase-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.92);
  font-family: "Courier New", monospace;
  font-size: 14px;
}

#testOutput {
  border: 1px solid #202a34;
  background: #0d1217;
  color: #d7dae0;
  box-shadow: none;
}

.terminal-form input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.85);
}

.command-block {
  margin: 0;
  padding: 12px 14px;
  font-family: "Courier New", monospace;
}

.hidden {
  display: none;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .main-grid {
    grid-template-columns: 1fr;
  }

  .main-split-handle {
    display: none;
  }

  .sidebar-toggle {
    position: static;
    align-self: flex-end;
    transform: none;
  }

  .app-shell.sidebar-collapsed .sidebar {
    padding: 18px;
    border-color: rgba(141, 50, 0, 0.14);
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
  }

  .app-shell.sidebar-collapsed .sidebar::after {
    display: none;
  }

  .app-shell.sidebar-collapsed .sidebar-content {
    display: none;
  }

  .app-shell.sidebar-collapsed .sidebar-toggle {
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.75);
  }
}

@media (max-width: 800px) {
  .drawer-toggle {
    gap: 12px;
  }
}

/* Dark SaaS workspace theme */
:root {
  --bg: #080b0f;
  --panel: #10151b;
  --panel-strong: #151c24;
  --line: #26313c;
  --text: #edf2f7;
  --muted: #8793a1;
  --accent: #62d5b0;
  --accent-strong: #8ce8ca;
  --editor-bg: #0f141b;
  --editor-gutter: #0c1116;
  --editor-line: #26313c;
  --editor-text: #d7dae0;
  --editor-muted: #7f8995;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  --radius: 10px;
}

body {
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea,
select {
  font-family: inherit;
}

.app-shell {
  --sidebar-width: 292px;
  --sidebar-collapsed-width: 54px;
  gap: 12px;
  padding: 14px;
}

.sidebar,
.panel {
  border-color: var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: none;
}

.sidebar {
  gap: 18px;
  padding: 20px;
}

.sidebar-content {
  gap: 18px;
}

.sidebar-toggle {
  top: 14px;
  right: 12px;
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
}

.sidebar-toggle-brand {
  border-color: var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--accent);
}

.sidebar-toggle:hover {
  background: #19232c;
  color: var(--accent);
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

h1 {
  margin-bottom: 8px;
  font-size: 24px;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 14px;
  letter-spacing: 0.01em;
}

.sidebar-copy {
  max-width: 230px;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.section-header {
  margin-bottom: 12px;
}

.sidebar-section {
  gap: 10px;
}

.sidebar-section > .section-header {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.sidebar-select,
.language-select,
.testcase-input,
.terminal-form input {
  border-color: var(--line);
  border-radius: 8px;
  background: #0c1116;
  color: var(--text);
}

.sidebar-select {
  width: 100%;
  max-width: none;
  padding: 7px 10px;
  font-size: 12px;
}

.problem-list {
  gap: 6px;
}

.problem-group {
  margin-top: 12px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.problem-card {
  padding: 12px;
  border-color: transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}

.problem-card p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.problem-card:hover {
  transform: none;
  border-color: #263541;
  background: #151d25;
}

.problem-card.active {
  transform: none;
  border-color: rgba(98, 213, 176, 0.35);
  background: rgba(98, 213, 176, 0.1);
  box-shadow: inset 3px 0 0 var(--accent);
}

.problem-card.active p {
  color: #a9b8c5;
}

.problem-count {
  color: #687582;
  font-size: 10px;
  letter-spacing: 0.1em;
}

.main-grid {
  gap: 8px;
}

.panel {
  padding: 16px;
}

.main-split-handle:hover {
  background: rgba(98, 213, 176, 0.06);
}

.main-split-handle:hover::after {
  background: rgba(98, 213, 176, 0.45);
}

.muted-label {
  color: var(--muted);
  font-size: 12px;
}

.primary-button,
.ghost-button,
.mode-button {
  border-radius: 7px;
  border-color: var(--line);
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 650;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.primary-button {
  background: var(--accent);
  border-color: var(--accent);
  color: #07110f;
}

.primary-button:hover:not(:disabled) {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  transform: translateY(-1px);
}

.ghost-button,
.mode-button {
  background: #151c23;
  color: #bdc8d2;
}

.ghost-button:hover:not(:disabled),
.mode-button:hover:not(:disabled) {
  border-color: #40505d;
  background: #1b2630;
  color: var(--text);
}

.mode-button.active {
  background: #27343e;
  border-color: #3d4e5b;
  color: var(--accent-strong);
}

.statement-view,
.editor,
.terminal-output,
.command-block {
  border-color: var(--line);
  border-radius: 8px;
  background: #0d1217;
}

.statement-view {
  padding: 18px;
  color: #cbd5df;
  font-size: 12px;
  line-height: 1.55;
}

.statement-view h3 {
  margin-top: 20px;
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.1em;
}

.statement-view code {
  border-radius: 4px;
  background: rgba(98, 213, 176, 0.1);
  color: var(--accent-strong);
}

.statement-meta strong {
  color: var(--accent-strong);
}

.statement-code-block {
  border-color: var(--line);
  border-radius: 7px;
  background: #111820;
  color: #cbd5df;
}

.code-editor-shell,
.agent-chat-shell,
.terminal-chat-shell {
  border-color: #202a34;
  border-radius: 9px;
}

.editor-topbar,
.agent-session-bar,
.terminal-session-bar {
  background: #121920;
  border-color: #26313c;
}

.editor-topbar {
  padding: 9px 12px;
}

.editor-mode-button.active {
  color: var(--accent-strong);
}

.editor-mode-button:hover {
  color: #d7f6eb;
}

.language-select {
  min-width: 112px;
  padding: 6px 10px;
}

.agent-chat-shell,
.terminal-chat-shell {
  background: #0d1217;
}

.agent-session-tab.active,
.terminal-tab.active {
  color: var(--accent-strong);
}

.agent-session-tab:hover,
.terminal-tab:hover {
  color: #dce7ee;
}

.agent-live-label::before {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(98, 213, 176, 0.14);
}

.agent-output {
  color: #d3dde5;
}

.agent-message-role-user {
  color: #f0c58e;
}

.agent-message-role-agent {
  color: #8fc5ff;
}

.agent-message-body code {
  background: #18232b;
  color: #bcebdc;
}

.agent-form-busy #agentInput,
#agentInput {
  border-color: #293641;
  background: #0b1015;
}

.test-drawer,
.terminal-drawer {
  border-color: var(--line);
  border-radius: 8px;
  background: #10161c;
}

.drawer-toggle {
  padding: 11px 13px;
  background: #131a21;
}

.drawer-body {
  border-color: var(--line);
}

.drawer-title-tab {
  color: var(--muted);
  font-size: 12px;
}

.drawer-title-tab:hover,
.drawer-title-tab.active {
  color: var(--accent-strong);
}

.testcase-case {
  border-color: var(--line);
  border-radius: 8px;
  background: #131a21;
}

.testcase-label,
.testcase-case-title {
  color: var(--muted);
}

.testcase-input {
  padding: 10px 12px;
}

.terminal-form input {
  padding: 9px 12px;
}

.terminal-empty-state,
.agent-empty-state {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 24px;
  color: #677583;
  font-family: inherit;
  font-size: 13px;
  text-align: center;
}

.terminal-empty-state {
  background: #0b1015;
}

.agent-empty-state {
  flex: 1;
  min-height: 0;
  height: 100%;
  border: 0;
  border-radius: 0;
  background: #0b1015;
  overflow: hidden;
}

.agent-output:has(.agent-empty-state) {
  overflow: hidden;
  background: #0b1015;
}

.agent-form-busy #agentInput:disabled,
#agentInput:disabled {
  color: #667482;
  cursor: not-allowed;
}

.terminal-tab,
.agent-session-tab {
  font-size: 12px;
  font-weight: 600;
}

.terminal-session-bar,
.agent-session-bar {
  min-height: 52px;
  height: 52px;
  padding: 0 14px;
  align-items: center;
}

.terminal-tabs,
.agent-session-tabs {
  align-items: center;
  min-height: 32px;
  margin: 0;
}

.terminal-tab {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
}

.agent-session-tab-label,
.terminal-tab {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

input:focus,
select:focus,
button:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(98, 213, 176, 0.55);
  outline-offset: 2px;
}

@media (max-width: 1100px) {
  .app-shell {
    padding: 10px;
  }

  .sidebar,
  .panel {
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
  }
}

@media (max-width: 800px) {
  .app-shell {
    gap: 10px;
  }

  .sidebar {
    padding: 16px;
  }

  .panel {
    padding: 12px;
  }

  .section-header {
    align-items: flex-start;
    gap: 8px;
  }

  .agent-session-bar,
  .terminal-session-bar {
    align-items: flex-start;
  }
}

.problem-card strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-split-handle {
  position: relative;
}

.main-split-handle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 42px;
  border-radius: 999px;
  background: #33424e;
  opacity: 0.75;
  transform: translate(-50%, -50%);
}

.agent-panel .terminal-form {
  gap: 8px;
  margin-top: 0;
}

.agent-panel .terminal-form input {
  min-width: 0;
  height: 38px;
  border-radius: 7px;
  font: inherit;
  font-size: 12px;
  line-height: 1.55;
}

.agent-panel .terminal-form input::placeholder {
  font-size: 14px !important;
  opacity: 0.72;
}

#agentInput {
  font-size: 14px !important;
}

.editor-meta {
  font-family: inherit;
}

.agent-message-body {
  font-size: 12px;
  line-height: 1.55;
}

.test-output-rich {
  font-family: "Courier New", monospace;
  font-size: 14px;
  line-height: 1.55;
}

.test-output-rich.test-output-empty {
  display: grid;
  place-items: center;
  color: #677583;
  font-family: inherit;
  font-size: 13px;
  text-align: center;
}

.editor-topbar .editor-mode-button {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--muted);
  transition: color 120ms ease;
}

.editor-topbar .editor-mode-button:hover,
.editor-topbar .editor-mode-button.active {
  border: 0;
  background: transparent;
  color: var(--accent-strong);
}

.editor-topbar .editor-reset-button {
  color: var(--muted);
}

.editor-topbar .editor-reset-button:hover:not(:disabled) {
  color: var(--accent-strong);
}

.editor-topbar .editor-reset-button,
.editor-topbar .editor-reset-button:hover:not(:disabled) {
  transform: translateY(-4px) scaleX(-1);
}

.agent-panel .terminal-form .primary-button {
  min-width: 72px;
  height: 38px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: rgba(124, 92, 227, 0.12);
  color: var(--muted);
  cursor: pointer;
  font-size: 19px;
  line-height: 1;
  font-size: 12px;
  font-weight: 650;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}

.theme-toggle:hover {
  border-color: transparent;
  color: var(--accent-strong);
  background: rgba(124, 92, 227, 0.22);
}

.sidebar-brand-row .theme-toggle {
  transform: translateY(2px);
}

.sidebar-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sidebar-brand-row h1 {
  margin: 0;
}

body.light-theme {
  --bg: #f5f5f7;
  --panel: #ffffff;
  --panel-strong: #fafafd;
  --line: #d9d8e1;
  --text: #292734;
  --muted: #706e7c;
  --accent: #7c5ce3;
  --accent-strong: #6242c4;
  --editor-bg: #ffffff;
  --editor-gutter: #f4f4f7;
  --editor-line: #dedde5;
  --editor-text: #292734;
  --editor-muted: #777584;
  background: var(--bg);
  color: var(--text);
}

body.light-theme .sidebar,
body.light-theme .panel {
  background: var(--panel);
  border-color: var(--line);
  box-shadow: 0 18px 48px rgba(39, 77, 63, 0.1);
}

body.light-theme .sidebar-copy,
body.light-theme .problem-count,
body.light-theme .muted-label,
body.light-theme .drawer-title-tab,
body.light-theme .drawer-title-separator,
body.light-theme .editor-mode-separator {
  color: var(--muted);
}

body.light-theme .statement-view,
body.light-theme .editor,
body.light-theme .terminal-output,
body.light-theme .command-block {
  background: #ffffff;
  border-color: var(--line);
  color: var(--text);
}

body.light-theme .editor-topbar,
body.light-theme .agent-session-bar,
body.light-theme .terminal-session-bar,
body.light-theme .drawer-toggle {
  background: #ffffff;
  border-color: var(--line);
}

body.light-theme .code-editor-shell,
body.light-theme .agent-chat-shell,
body.light-theme .terminal-chat-shell {
  border-color: var(--line);
}

body.light-theme .agent-chat-shell,
body.light-theme .terminal-chat-shell {
  background: #ffffff;
}

body.light-theme .agent-output:has(.agent-empty-state),
body.light-theme .agent-empty-state {
  background: #ffffff;
  color: var(--muted);
  border: 0;
}

body.light-theme .agent-output,
body.light-theme .agent-message-body,
body.light-theme .test-output-rich {
  color: var(--text);
}

body.light-theme .agent-message-role {
  color: var(--muted);
}

body.light-theme .agent-message-role-user {
  color: #9b5d29;
}

body.light-theme .agent-message-role-agent {
  color: #286a9e;
}

body.light-theme .agent-message-body code {
  background: #f0eefb;
  color: var(--accent-strong);
  border-color: #d8cff7;
}

body.light-theme .editor-topbar .editor-reset-button:hover:not(:disabled) {
  color: var(--accent-strong) !important;
  background: transparent !important;
  border: 0 !important;
}

body.light-theme #agentInput,
body.light-theme .terminal-form input,
body.light-theme .testcase-input,
body.light-theme .sidebar-select,
body.light-theme .language-select {
  background: #ffffff;
  border-color: var(--line);
  color: var(--text);
}

body.light-theme #testOutput {
  background: #ffffff;
  color: var(--text);
  border-color: var(--line);
}

body.light-theme .terminal-live-output,
body.light-theme .terminal-live-output .xterm-viewport {
  background: #ffffff;
  color: var(--text);
}

body.light-theme .test-drawer,
body.light-theme .terminal-drawer,
body.light-theme .testcase-panel,
body.light-theme .terminal-panel {
  background: #ffffff;
  border-color: var(--line);
}

body.light-theme .testcase-case {
  background: #f8fcfa;
  border-color: var(--line);
}

body.light-theme .drawer-body {
  background: #ffffff;
  border-color: var(--line);
}

body.light-theme .test-output-rich.test-output-empty,
body.light-theme .agent-empty-state,
body.light-theme .terminal-empty-state {
  background: #ffffff;
  color: var(--muted);
}

.terminal-empty-state,
.agent-empty-state,
.test-output-rich.test-output-empty {
  display: grid;
  place-items: center;
  color: #677583;
  font-family: inherit;
  font-size: 13px;
  line-height: normal;
  text-align: center;
}

.test-output-rich.test-output-empty {
  min-height: 220px;
  background: #0b1015;
}

.test-output-rich.test-output-active {
  font-family: "Courier New", monospace !important;
  font-size: 14px !important;
  line-height: 1.55 !important;
  text-align: left;
  white-space: pre;
  tab-size: 4;
  color: var(--editor-text);
}

body.light-theme .test-output-rich.test-output-empty {
  background: #ffffff;
}

.app-shell.sidebar-collapsed .sidebar {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 0 1fr;
  gap: 0;
}

.app-shell.sidebar-collapsed .sidebar-split-handle {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar {
  width: 0;
  min-width: 0;
  overflow: visible;
}

.app-shell.sidebar-collapsed .sidebar-toggle {
  position: fixed;
  top: 14px;
  left: 10px;
  z-index: 20;
}

.app-shell.sidebar-collapsed .sidebar-toggle:hover {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.app-shell:not(.sidebar-collapsed) .sidebar-toggle {
  display: none;
}

.sidebar,
.sidebar-toggle {
  transition: none !important;
}

.main-grid {
  grid-template-rows: 42px minmax(0, 1fr);
}

.app-top-nav {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--accent);
  color: #08130f;
}

.app-nav-brand {
  margin-right: 6px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.app-nav-button,
.app-nav-icon-button {
  border: 0;
  border-radius: 6px;
  padding: 5px 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 12px;
  font-weight: 550;
}

.app-nav-icon-button {
  min-width: 26px;
  padding: 5px 6px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
}

#randomProblemButton {
  font-size: 21px;
}

.app-nav-button:hover,
.app-nav-icon-button:hover {
  background: rgba(0, 0, 0, 0.14);
}

.app-nav-separator {
  opacity: 0.55;
}

.app-nav-spacer {
  flex: 1;
}

.app-top-nav .nav-theme-toggle {
  width: auto;
  height: 30px;
  gap: 7px;
  border-radius: 6px;
  padding: 5px 8px;
  background: transparent;
  color: inherit;
  font-size: 12px;
}

.app-top-nav .nav-theme-toggle:hover {
  background: rgba(0, 0, 0, 0.14);
  color: inherit;
}

.panel-statement {
  grid-column: 1;
  grid-row: 2;
}

.main-split-handle {
  grid-column: 2;
  grid-row: 2;
}

.panel-editor {
  grid-column: 3;
  grid-row: 2;
}

body.light-theme .app-top-nav {
  color: #ffffff;
  background: #6242c4;
}

.terminal-tab:hover,
.agent-session-tab:hover,
.terminal-tab-close:hover,
.agent-session-tab-close:hover,
.terminal-tab-add:hover {
  color: var(--accent-strong) !important;
}

.terminal-tab-close:hover,
.agent-session-tab-close:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

body.light-theme .sidebar-select:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 2px rgba(124, 92, 227, 0.16);
}

body.light-theme .sidebar-select option:checked {
  background: #f0eefb;
  color: var(--accent-strong);
}

body.light-theme .drawer-title-tab,
body.light-theme .drawer-title-tab:hover,
body.light-theme .drawer-title-tab.active {
  background: transparent !important;
  color: var(--muted) !important;
}

body.light-theme .drawer-title-tab:hover,
body.light-theme .drawer-title-tab.active {
  color: var(--accent-strong) !important;
}

.app-top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  width: 100vw;
  height: 42px;
  border-radius: 0;
}

.app-shell:not(.sidebar-collapsed) .sidebar {
  height: calc(100vh - 78px);
  margin-top: 50px;
}

.app-shell:not(.sidebar-collapsed) .sidebar-split-handle {
  margin-top: 50px;
}

@media (max-width: 1100px) {
  .main-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 42px minmax(280px, 1fr) minmax(280px, 1fr);
  }

  .panel-statement {
    grid-column: 1;
    grid-row: 2;
  }

  .main-split-handle {
    display: none;
  }

  .panel-editor {
    grid-column: 1;
    grid-row: 3;
  }
}

.app-shell.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed-width) 6px 1fr;
  gap: 8px;
}

.app-shell.sidebar-collapsed .sidebar-split-handle {
  display: block;
}

.app-shell.sidebar-collapsed .sidebar {
  width: auto;
  min-width: 0;
  overflow: hidden;
}

.app-shell.sidebar-collapsed .sidebar-toggle {
  position: static;
  top: auto;
  left: auto;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 0 0 1fr;
  gap: 0;
  padding-left: 0;
}

.app-shell.sidebar-collapsed .sidebar-split-handle {
  display: block;
  width: 0;
  min-width: 0;
}

.app-shell.sidebar-collapsed .sidebar {
  width: 0;
  min-width: 0;
  overflow: visible;
}

.app-shell.sidebar-collapsed .sidebar-toggle {
  position: fixed;
  top: 14px;
  left: 0;
  width: 30px;
  min-width: 30px;
  height: 34px;
  border-radius: 0 8px 8px 0;
  z-index: 20;
}

.app-shell.sidebar-collapsed .sidebar-toggle {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--panel-strong);
  color: var(--muted);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.app-shell.sidebar-collapsed .sidebar-toggle:hover {
  background: var(--panel-strong);
  color: var(--accent-strong);
}

.app-shell.sidebar-collapsed .sidebar-toggle-brand {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-toggle-icon {
  padding: 0;
  font-size: 18px;
}

.empty-state-message {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  line-height: normal !important;
  letter-spacing: 0 !important;
  color: #677583 !important;
  opacity: 1 !important;
  text-align: center;
}

.terminal-empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 0;
}

body.light-theme .highlight-layer {
  color: #292734;
}

body.light-theme .problem-card:hover {
  border-color: #c8bdf0;
  background: #f0eefb;
  color: var(--text);
}

body.light-theme .problem-card.active {
  border-color: rgba(124, 92, 227, 0.38);
  background: rgba(124, 92, 227, 0.1);
  box-shadow: inset 3px 0 0 var(--accent);
  color: var(--text);
}

body.light-theme .problem-card.active p {
  color: var(--muted);
}

body.light-theme .statement-code-block,
body.light-theme .agent-message-body pre {
  background: #f5f5f7;
  border-color: var(--line);
  color: var(--text);
}

body.light-theme .ghost-button,
body.light-theme .mode-button {
  background: #f5f5f7;
  border-color: var(--line);
  color: var(--muted);
}

body.light-theme .ghost-button:hover:not(:disabled),
body.light-theme .mode-button:hover:not(:disabled) {
  background: #f0eefb;
  border-color: var(--accent);
  color: var(--text);
}

body.light-theme .editor-topbar .editor-mode-button,
body.light-theme .editor-topbar .editor-mode-button:hover,
body.light-theme .editor-topbar .editor-mode-button.active,
body.light-theme .drawer-title-tab,
body.light-theme .drawer-title-tab:hover,
body.light-theme .drawer-title-tab.active {
  background: transparent;
  border: 0;
}

body.light-theme .editor-topbar .editor-mode-button:hover,
body.light-theme .editor-topbar .editor-mode-button.active,
body.light-theme .drawer-title-tab:hover,
body.light-theme .drawer-title-tab.active {
  color: var(--accent-strong);
}

body.light-theme .primary-button {
  color: #ffffff;
}

body.light-theme .testcase-case {
  background: #ffffff;
}

body.light-theme .agent-live-label::before {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 92, 227, 0.14);
}

body.light-theme .test-success {
  color: var(--accent-strong);
}

/* Keep the editable layer transparent while ensuring highlighted code stays visible. */
.editor-layer {
  isolation: isolate;
}

.highlight-layer {
  z-index: 1;
  display: block;
  color: #d7dae0;
  background: transparent;
}

.code-input {
  z-index: 2;
  color: transparent;
  -webkit-text-fill-color: transparent;
  background: transparent;
}

.app-shell {
  grid-template-columns: var(--sidebar-width) 6px 1fr;
  gap: 8px;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed-width) 6px 1fr;
}

.app-shell.sidebar-collapsed .sidebar {
  border-color: var(--line);
  background: var(--panel);
  box-shadow: none;
  backdrop-filter: none;
}

.sidebar-footer {
  margin-top: auto;
  flex-direction: row;
  align-items: center;
  justify-content: center;
}

.problem-count {
  text-align: center;
  font-size: 10px;
}

.app-shell.sidebar-collapsed .sidebar-toggle-brand {
  border-color: transparent;
  background: transparent;
  color: var(--text);
}

.main-split-handle::before,
.main-split-handle::after {
  display: none;
}

.main-split-handle:hover,
.main-split-handle:hover::after {
  background: transparent;
}

.main-split-handle:hover::after {
  display: block;
  width: 2px;
  background: var(--accent);
}

.sidebar-split-handle {
  position: relative;
  width: 6px;
  min-width: 6px;
  cursor: col-resize;
  background: transparent;
}

.sidebar-split-handle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: transparent;
  transform: translate(-50%, -50%);
  transition: width 120ms ease, background 120ms ease;
}

.sidebar-split-handle:hover::after {
  width: 2px;
  background: var(--accent);
}

.main-split-handle.is-resizing::after,
.sidebar-split-handle.is-resizing::after {
  display: block;
  width: 2px;
  background: var(--accent);
}

.drawer-resize-handle:hover,
.drawer-resize-handle.is-resizing {
  background: transparent;
}

.drawer-resize-handle:hover::after,
.drawer-resize-handle.is-resizing::after {
  background: var(--accent);
}

@media (max-width: 1100px) {
  .app-shell,
  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar-split-handle {
    display: none;
  }
}

body.light-theme .highlight-layer {
  color: #292734 !important;
}

body.light-theme .line-numbers {
  color: #777584 !important;
}

body.light-theme .highlight-layer {
  z-index: 2 !important;
  color: #292734 !important;
}

body.light-theme .code-input {
  z-index: 1 !important;
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
}

.statement-code-block {
  background: var(--editor-gutter) !important;
  border-color: var(--editor-line) !important;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 6px 1fr !important;
  gap: 8px !important;
  padding-left: 8px !important;
}

.app-shell.sidebar-collapsed .sidebar-split-handle {
  display: block !important;
  width: 6px;
  min-width: 6px;
  cursor: col-resize;
}

.app-shell.sidebar-collapsed .sidebar {
  position: fixed !important;
  top: 0;
  left: 0;
  width: 0 !important;
  height: 0;
  min-width: 0 !important;
  padding: 0;
  overflow: visible !important;
  border: 0;
}

.app-shell.sidebar-collapsed .sidebar-toggle {
  position: fixed !important;
  top: 14px;
  left: 2px;
  width: 18px;
  min-width: 18px;
  height: 30px;
  border-radius: 0;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  z-index: 20;
}

/* Keep panel scrollbars quiet and consistent with the active surface. */
:root {
  --scrollbar-track: #11161c;
  --scrollbar-thumb: #303943;
  --scrollbar-thumb-hover: #46515e;
}

body.light-theme {
  --scrollbar-track: #f4f4f7;
  --scrollbar-thumb: #c5c3d0;
  --scrollbar-thumb-hover: #aaa6bb;
}

.problem-list,
.statement-view,
.highlight-layer,
.code-input,
.testcase-cases,
.test-output-rich,
.agent-output,
.terminal-live-output .xterm-viewport {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.problem-list::-webkit-scrollbar,
.statement-view::-webkit-scrollbar,
.highlight-layer::-webkit-scrollbar,
.code-input::-webkit-scrollbar,
.testcase-cases::-webkit-scrollbar,
.test-output-rich::-webkit-scrollbar,
.agent-output::-webkit-scrollbar,
.terminal-live-output .xterm-viewport::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.problem-list::-webkit-scrollbar-track,
.statement-view::-webkit-scrollbar-track,
.highlight-layer::-webkit-scrollbar-track,
.code-input::-webkit-scrollbar-track,
.testcase-cases::-webkit-scrollbar-track,
.test-output-rich::-webkit-scrollbar-track,
.agent-output::-webkit-scrollbar-track,
.terminal-live-output .xterm-viewport::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 999px;
}

.problem-list::-webkit-scrollbar-thumb,
.statement-view::-webkit-scrollbar-thumb,
.highlight-layer::-webkit-scrollbar-thumb,
.code-input::-webkit-scrollbar-thumb,
.testcase-cases::-webkit-scrollbar-thumb,
.test-output-rich::-webkit-scrollbar-thumb,
.agent-output::-webkit-scrollbar-thumb,
.terminal-live-output .xterm-viewport::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border: 2px solid var(--scrollbar-track);
  border-radius: 999px;
}

.problem-list::-webkit-scrollbar-thumb:hover,
.statement-view::-webkit-scrollbar-thumb:hover,
.highlight-layer::-webkit-scrollbar-thumb:hover,
.code-input::-webkit-scrollbar-thumb:hover,
.testcase-cases::-webkit-scrollbar-thumb:hover,
.test-output-rich::-webkit-scrollbar-thumb:hover,
.agent-output::-webkit-scrollbar-thumb:hover,
.terminal-live-output .xterm-viewport::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

.terminal-live-output .xterm,
.terminal-live-output .xterm-viewport,
.terminal-live-output .xterm-scrollable-element,
.terminal-live-output .xterm-screen {
  background: #0d1117 !important;
}

.terminal-live-output .xterm .xterm-scrollable-element > .xterm-scrollbar > .xterm-scra {
  background-color: var(--scrollbar-thumb);
}

.terminal-live-output .xterm .xterm-scrollable-element > .xterm-shadow {
  box-shadow: none;
}

body.light-theme .terminal-live-output .xterm,
body.light-theme .terminal-live-output .xterm-viewport,
body.light-theme .terminal-live-output .xterm-scrollable-element,
body.light-theme .terminal-live-output .xterm-screen {
  background: #ffffff !important;
}

body.light-theme .terminal-live-output .xterm .xterm-scrollable-element > .xterm-scrollbar > .xterm-scra {
  background-color: var(--scrollbar-thumb);
}
