:root {
  color-scheme: light;
  --bg: #f7f9fc;
  --panel: #ffffff;
  --panel-soft: #f2f6fa;
  --panel-glass: rgb(255 255 255 / 92%);
  --text: #17202d;
  --muted: #667487;
  --line: #dbe3ec;
  --line-strong: #c8d4e1;
  --primary: #18a9dc;
  --primary-strong: #0787bc;
  --primary-soft: #e7f8fe;
  --success: #26a269;
  --warning: #d78a13;
  --danger: #d94d5c;
  --editor: #0e1622;
  --editor-line: #273446;
  --editor-text: #e8eef7;
  --shadow: 0 18px 55px rgb(30 57 82 / 12%);
  --problem-width: 43%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080d14;
  --panel: #101822;
  --panel-soft: #162230;
  --panel-glass: rgb(16 24 34 / 92%);
  --text: #edf4fb;
  --muted: #99aabc;
  --line: #263748;
  --line-strong: #34495e;
  --primary: #36c4ee;
  --primary-strong: #77daf7;
  --primary-soft: #102d39;
  --success: #52d493;
  --warning: #f1b654;
  --danger: #ff7885;
  --editor: #080d14;
  --editor-line: #263748;
  --editor-text: #eef5fc;
  --shadow: 0 22px 65px rgb(0 0 0 / 38%);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); }
body, button, input, select, textarea { font: inherit; }
button, select, summary { cursor: pointer; }
button, input, select, textarea { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 34%, transparent);
  outline-offset: 2px;
}
[hidden] { display: none !important; }
.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; }
.skip-link { position: fixed; z-index: 1000; top: 8px; left: 8px; padding: 9px 13px; border-radius: 8px; background: var(--text); color: var(--panel); transform: translateY(-160%); }
.skip-link:focus { transform: none; }

.app-header {
  position: sticky;
  z-index: 80;
  top: 0;
  display: grid;
  min-height: 68px;
  grid-template-columns: minmax(280px, 1fr) auto minmax(280px, 1fr);
  align-items: center;
  gap: 18px;
  padding: 7px clamp(14px, 2.2vw, 34px);
  border-bottom: 1px solid var(--line);
  background: var(--panel-glass);
  backdrop-filter: blur(18px);
}
.brand { display: flex; min-width: 0; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.product-mark { display: grid; width: 43px; height: 43px; flex: 0 0 auto; place-items: center; border: 1px solid color-mix(in srgb, var(--primary) 42%, transparent); border-radius: 50%; background: radial-gradient(circle at 38% 32%, #72ddfa, var(--primary) 42%, #105d83 100%); color: #fff; font-weight: 900; box-shadow: 0 0 0 5px color-mix(in srgb, var(--primary) 9%, transparent), 0 7px 18px color-mix(in srgb, var(--primary) 22%, transparent); }
.brand-copy { display: grid; min-width: 0; line-height: 1.1; }
.brand-eyebrow, .pane-kicker, .dialog-kicker { color: var(--muted); font-size: .61rem; font-weight: 850; letter-spacing: .11em; }
.brand-title { margin: 2px 0 3px; font-size: 1.03rem; font-weight: 860; }
.brand-title small { margin-left: 5px; color: var(--muted); font-size: .62rem; font-weight: 700; }
.runtime-line { display: flex; min-width: 0; align-items: center; gap: 6px; color: var(--muted); font-size: .66rem; }
.runtime-line > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#runtime-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--warning); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warning) 13%, transparent); }
body.ollama-ready #runtime-dot { background: var(--success); box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 13%, transparent); }
body.ollama-error #runtime-dot { background: var(--danger); box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 13%, transparent); }

.mode-switch { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-soft); }
.mode-switch button { min-width: 112px; padding: 9px 13px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: .77rem; font-weight: 780; }
.mode-switch button.is-active { background: var(--panel); color: var(--text); box-shadow: 0 2px 10px rgb(28 53 77 / 10%); }
.header-actions { display: flex; justify-content: flex-end; gap: 8px; }
.icon-button, .pane-icon { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); color: var(--muted); }
.icon-button:hover, .pane-icon:hover { border-color: color-mix(in srgb, var(--primary) 48%, var(--line)); color: var(--primary); }
.connection-glyph { position: relative; width: 19px; height: 13px; border: 2px solid currentColor; border-top: 0; border-radius: 0 0 10px 10px; }
.connection-glyph::before, .connection-glyph::after { content: ""; position: absolute; top: -5px; width: 6px; height: 6px; border: 2px solid currentColor; border-bottom: 0; border-radius: 7px 7px 0 0; }
.connection-glyph::before { left: -2px; }.connection-glyph::after { right: -2px; }
body.ollama-ready .connection-button { border-color: color-mix(in srgb, var(--success) 42%, var(--line)); color: var(--success); }

.connection-banner { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 10px clamp(16px, 2.2vw, 34px); border-bottom: 1px solid color-mix(in srgb, var(--warning) 35%, var(--line)); background: color-mix(in srgb, var(--warning) 9%, var(--panel)); }
.connection-banner > div { display: flex; align-items: center; gap: 11px; }
.connection-banner strong { font-size: .82rem; }.connection-banner p { margin: 2px 0 0; color: var(--muted); font-size: .72rem; }
.connection-banner button { padding: 8px 12px; border: 1px solid color-mix(in srgb, var(--warning) 40%, var(--line)); border-radius: 8px; background: var(--panel); font-size: .73rem; font-weight: 800; }
.status-icon { display: grid; width: 27px; height: 27px; place-items: center; border-radius: 50%; background: var(--warning); color: #1d1405; font-size: .8rem; font-weight: 900; }

.workspace { position: relative; display: grid; min-height: calc(100vh - 68px); grid-template-columns: minmax(300px, var(--problem-width)) 16px minmax(420px, 1fr); padding: clamp(10px, 1.35vw, 20px); }
.workspace-pane { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); box-shadow: 0 8px 25px rgb(35 60 83 / 5%); }
.pane-header { display: flex; min-height: 68px; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 15px 11px 20px; border-bottom: 1px solid var(--line); }
.pane-header h1, .pane-header h2 { margin: 2px 0 0; font-size: 1.45rem; letter-spacing: -.035em; }
.pane-icon { width: 37px; height: 37px; border-radius: 50%; }
.problem-content { height: calc(100vh - 158px); overflow: auto; padding: clamp(20px, 2.5vw, 36px); }
.mission-controls { display: grid; grid-template-columns: minmax(120px, .72fr) minmax(180px, 1.35fr); gap: 10px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: .68rem; font-weight: 760; }
select, input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-soft); padding: 9px 11px; }
select:hover, input:hover, textarea:hover { border-color: var(--line-strong); }
.problem-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-top: 30px; }
.problem-title-row h2 { margin: 3px 0; font-size: clamp(1.35rem, 2.1vw, 2rem); letter-spacing: -.04em; }
.problem-number { margin: 0; color: var(--primary-strong); font-size: .7rem; font-weight: 850; letter-spacing: .08em; }
.difficulty { flex: 0 0 auto; padding: 5px 8px; border-radius: 999px; background: color-mix(in srgb, var(--success) 12%, transparent); color: var(--success); font-size: .65rem; font-weight: 850; }
.difficulty[data-level="hard"] { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); }
.difficulty[data-level="medium"] { background: color-mix(in srgb, var(--warning) 12%, transparent); color: var(--warning); }
.problem-focus { color: var(--muted); font-size: .92rem; line-height: 1.72; white-space: pre-wrap; }
.objective-card { margin: 25px 0 18px; padding: 16px 17px; border: 1px solid color-mix(in srgb, var(--primary) 24%, var(--line)); border-radius: 12px; background: var(--primary-soft); }
.objective-card span { color: var(--primary-strong); font-size: .66rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.objective-card p { margin: 7px 0 0; font-size: .88rem; line-height: 1.6; }
.problem-link { color: var(--primary-strong); font-size: .78rem; font-weight: 800; }
.progress-row { display: flex; align-items: center; gap: 10px; margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .72rem; }
.progress-row > span { margin-right: auto; }.text-button { padding: 6px 8px; border: 0; background: transparent; color: var(--primary-strong); font-size: .7rem; font-weight: 750; }

.splitter { position: relative; cursor: col-resize; touch-action: none; }
.splitter span { position: absolute; top: 14px; bottom: 14px; left: 50%; width: 3px; border-radius: 99px; background: var(--line); transform: translateX(-50%); transition: background .15s, width .15s; }
.splitter:hover span, .splitter:focus span, body.is-resizing .splitter span { width: 5px; background: var(--primary); }
body.is-resizing { cursor: col-resize; user-select: none; }

.code-pane { display: flex; min-height: 760px; flex-direction: column; background: var(--editor); color: var(--editor-text); }
.code-header, .editor-toolbar { border-color: var(--editor-line); }
.code-header .pane-kicker { color: #75d8f6; }
.language-switch { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--editor-line); border-radius: 9px; background: #121e2c; }
.language-switch button { padding: 6px 10px; border: 0; border-radius: 6px; background: transparent; color: #91a3b7; font-size: .68rem; font-weight: 800; }
.language-switch button.is-active { background: #24364a; color: #fff; }
.editor-toolbar { display: flex; justify-content: space-between; gap: 12px; padding: 9px 18px; border-bottom: 1px solid var(--editor-line); color: #91a3b7; font: 11px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.code-editor { min-height: 410px; flex: 1 1 auto; resize: vertical; border: 0; border-radius: 0; outline: 0; background: transparent; color: var(--editor-text); padding: 23px 27px; font: 13px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; tab-size: 4; white-space: pre; overflow-wrap: normal; overflow-x: auto; }
.editor-help { margin: 0; padding: 7px 20px; border-top: 1px solid var(--editor-line); color: #7f91a5; font-size: .64rem; }
.test-settings { margin: 10px 14px 0; padding: 10px 12px; border: 1px solid var(--editor-line); border-radius: 10px; background: #111d2a; }
.test-settings summary { font-size: .72rem; font-weight: 800; }.test-settings label { margin-top: 10px; color: #91a3b7; }
.test-settings input, .test-settings select, .test-settings textarea { border-color: #2b3b4d; background: #0d1722; color: #e7eef7; font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.test-grid { display: grid; grid-template-columns: 1fr 90px; gap: 9px; }
.run-actions { display: flex; gap: 9px; padding: 12px 14px; }
.run-actions button { flex: 1; padding: 10px 12px; border: 1px solid #34475c; border-radius: 9px; background: #182536; color: #e7eef7; font-size: .75rem; font-weight: 800; }
.primary-button, .run-actions .primary-button { border-color: transparent !important; background: linear-gradient(115deg, var(--primary), #42d4e9) !important; color: #06202a !important; font-weight: 850 !important; }
.secondary-button { border: 1px solid var(--line); background: var(--panel); }
.run-result { min-height: 0; max-height: 180px; overflow: auto; margin: 0 14px 14px; padding: 0; border-radius: 9px; background: #071019; color: #b9c9da; font: 11px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; transition: padding .15s, min-height .15s; }
.run-result:not(:empty) { min-height: 64px; padding: 12px; border: 1px solid var(--editor-line); }

.jarvis-launcher { position: fixed; z-index: 90; right: 22px; bottom: 20px; display: flex; align-items: center; gap: 10px; padding: 7px 13px 7px 7px; border: 1px solid color-mix(in srgb, var(--primary) 38%, var(--line)); border-radius: 999px; background: var(--panel-glass); color: var(--text); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.jarvis-launcher img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 14px color-mix(in srgb, var(--primary) 35%, transparent); }
.jarvis-launcher span { display: grid; text-align: left; }.jarvis-launcher strong { font-size: .75rem; letter-spacing: .05em; }.jarvis-launcher small { color: var(--muted); font-size: .59rem; text-transform: uppercase; }
.jarvis-launcher:hover { transform: translateY(-2px); }
.jarvis-panel { position: fixed; z-index: 120; right: 22px; bottom: 84px; display: grid; width: min(390px, calc(100vw - 28px)); min-width: 310px; height: min(570px, calc(100vh - 112px)); min-height: 360px; grid-template-rows: auto 1fr auto; overflow: hidden; resize: both; border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--line)); border-radius: 16px; background: var(--panel-glass); box-shadow: 0 28px 90px rgb(10 33 50 / 28%); backdrop-filter: blur(22px); }
.mentor-header { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-bottom: 1px solid var(--line); cursor: grab; user-select: none; }
.mentor-header:active { cursor: grabbing; }.mentor-header img { width: 43px; height: 43px; border-radius: 50%; object-fit: cover; }.mentor-header div { display: grid; }.mentor-header span { font-size: .74rem; font-weight: 900; letter-spacing: .06em; }.mentor-header strong { color: var(--muted); font-size: .59rem; text-transform: uppercase; }
.mentor-header button { margin-left: auto; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 1.25rem; }
.messages { overflow: auto; padding: 14px; }
.message { display: grid; grid-template-columns: 27px 1fr; gap: 9px; margin-bottom: 12px; }
.message > span { display: grid; width: 27px; height: 27px; place-items: center; border-radius: 50%; background: var(--primary); color: #fff; font-size: .58rem; font-weight: 900; }
.message.user > span { background: var(--text); color: var(--panel); }.message p { margin: 0; padding: 10px 11px; border-radius: 3px 12px 12px; background: var(--panel-soft); font-size: .78rem; line-height: 1.55; white-space: pre-wrap; }
.chat-form { display: grid; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }.chat-form textarea { min-height: 72px; resize: vertical; }.chat-form > div { display: flex; justify-content: space-between; gap: 8px; }.chat-form button { padding: 8px 12px; border-radius: 8px; }

.app-dialog { width: min(620px, calc(100vw - 28px)); max-height: min(820px, calc(100vh - 28px)); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); color: var(--text); box-shadow: 0 35px 110px rgb(7 24 37 / 35%); }
.app-dialog::backdrop { background: rgb(5 17 27 / 52%); backdrop-filter: blur(5px); }
.dialog-frame { display: grid; gap: 15px; padding: 20px; }
.dialog-frame > header { display: flex; align-items: center; justify-content: space-between; gap: 20px; }.dialog-frame h2 { margin: 3px 0 0; font-size: 1.55rem; letter-spacing: -.035em; }.dialog-close { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--panel-soft); color: var(--muted); font-size: 1.25rem; }
.diagnostic-card { display: grid; grid-template-columns: 46px 1fr; align-items: center; gap: 13px; padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel-soft); }.diagnostic-card strong { display: block; font-size: .9rem; }.diagnostic-card p { margin: 4px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.5; }
.diagnostic-icon { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--warning) 12%, transparent); color: var(--warning); font-weight: 900; }.diagnostic-icon::after { content: "…"; }.diagnostic-icon[data-status="ready"] { background: color-mix(in srgb, var(--success) 12%, transparent); color: var(--success); }.diagnostic-icon[data-status="ready"]::after { content: "✓"; }.diagnostic-icon[data-status="error"] { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); }.diagnostic-icon[data-status="error"]::after { content: "!"; }
.dialog-section { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }.dialog-section p { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.55; }.dialog-section button, .primary-link { display: block; padding: 10px 13px; border-radius: 9px; text-align: center; text-decoration: none; font-size: .78rem; }.primary-link { background: linear-gradient(115deg, var(--primary), #42d4e9); color: #06202a; font-weight: 850; }.fine-print { font-size: .68rem !important; }
.command-row { display: grid; grid-template-columns: 1fr auto; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); }.command-row code { overflow: auto; padding: 10px; font-size: .68rem; white-space: nowrap; }.command-row button { border: 0; border-left: 1px solid var(--line); border-radius: 0; background: var(--panel-soft); }
.dialog-section progress { width: 100%; accent-color: var(--primary); }.privacy-details { padding: 2px 4px; }.privacy-details summary { color: var(--muted); font-size: .72rem; font-weight: 760; }.privacy-details p { color: var(--muted); font-size: .7rem; line-height: 1.55; }
.settings-dialog { width: min(420px, calc(100vw - 28px)); }.settings-dialog .dialog-frame > label { margin-top: 3px; }
.toast { position: fixed; z-index: 220; left: 50%; bottom: 20px; max-width: min(520px, calc(100vw - 28px)); padding: 10px 14px; border-radius: 10px; background: var(--text); color: var(--panel); box-shadow: var(--shadow); font-size: .75rem; transform: translateX(-50%); }

@media (max-width: 900px) {
  .app-header { grid-template-columns: 1fr auto; }.mode-switch { order: 3; grid-column: 1 / -1; justify-self: center; }.mode-switch button { min-width: 125px; }.workspace { min-height: auto; grid-template-columns: 1fr; }.splitter { display: none; }.workspace-pane { min-height: 620px; }.problem-content { height: auto; max-height: none; }.code-pane { min-height: 780px; }.connection-banner { align-items: flex-start; }.connection-banner p { max-width: 60ch; }
}
@media (max-width: 620px) {
  .app-header { position: relative; min-height: auto; gap: 10px; padding: 9px 12px; }.brand-eyebrow, .brand-title small { display: none; }.runtime-line { max-width: 180px; }.header-actions { gap: 5px; }.icon-button { width: 38px; height: 38px; }.mode-switch { width: 100%; }.mode-switch button { flex: 1; min-width: 0; }.connection-banner { display: grid; padding: 11px 13px; }.connection-banner button { width: 100%; }.workspace { padding: 8px; }.workspace-pane { border-radius: 11px; }.mission-controls { grid-template-columns: 1fr; }.problem-content { padding: 20px 17px; }.progress-row { align-items: flex-start; flex-wrap: wrap; }.progress-row > span { width: 100%; }.code-editor { min-height: 360px; padding: 18px 16px; font-size: 12px; }.test-grid { grid-template-columns: 1fr; }.run-actions { flex-direction: column; }.jarvis-launcher { right: 12px; bottom: 12px; }.jarvis-launcher span { display: none; }.jarvis-panel { right: 7px !important; bottom: 7px !important; left: 7px !important; top: auto !important; width: auto !important; min-width: 0; height: min(78vh, 620px); resize: none; }.dialog-frame { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
