:root {
  --bg: #0b0f14;
  --panel: #111824;
  --panel-2: #0f1520;
  --text: #e6edf3;
  --muted: #9fb1c5;
  --accent: #6ea8fe;
  --accent-2: #8ed1fc;
  --success: #2ecc71;
  --error: #ff6b6b;
  --warn: #f7b955;
  --border: #1f2a3a;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: radial-gradient(1200px 800px at 80% -20%, #152033 0%, #0b0f14 60%);
  color: var(--text);
}

.app-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #0f1520, #0b0f14);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 700; letter-spacing: 0.2px; }
.subtitle { color: var(--muted); font-size: 14px; }

.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: calc(100vh - 68px);
}

.sidebar {
  border-right: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.sidebar-header { padding: 12px; border-bottom: 1px solid var(--border); }
.sidebar-header h2 { margin: 4px 0 8px; font-size: 16px; }
.sidebar-header input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
}

.exercise-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  overflow: auto;
}
.exercise-list li {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0d1625;
  padding: 10px 12px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.exercise-list li.active { outline: 2px solid var(--accent); }
.exercise-list li .title { font-weight: 600; }
.exercise-list li .right { display: flex; align-items: center; gap: 8px; }
.exercise-list li .badge { font-size: 12px; color: var(--muted); }
.exercise-list li.completed { background: #0f1e2f; }
.exercise-list li .check { color: var(--success); font-weight: 700; }

.workspace { display: flex; flex-direction: column; min-width: 0; }
.exercise-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.exercise-header h1 { margin: 0; font-size: 20px; }
.controls { display: flex; gap: 8px; align-items: center; }
input.auth, button.auth { height: 36px; }
input.auth {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
}

button {
  appearance: none;
  border: 1px solid var(--border);
  background: #0f1726;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
}
button.primary { background: linear-gradient(180deg, #1b2a44, #0f1726); border-color: #2a3b58; }
button:disabled { opacity: 0.6; cursor: not-allowed; }

.exercise-description { padding: 16px 20px; color: var(--muted); border-bottom: 1px solid var(--border); background: #0e1422; }

.editor-panel { padding: 12px 20px; }
.editor-label { display: block; margin-bottom: 8px; color: var(--muted); }
#codeEditor {
  width: 100%;
  min-height: 300px;
  height: 40vh;
  background: #0a0f18;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.ace_editor { border-radius: 10px; }

.output-panel { border-top: 1px solid var(--border); background: var(--panel); padding: 12px 20px 20px; }
.output-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.output-column h3 { margin: 8px 0; font-size: 14px; color: var(--muted); }
.results, .console {
  background: #0a0f18;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  min-height: 120px;
  max-height: 260px;
  overflow: auto;
}
.results .test { padding: 8px 10px; border-bottom: 1px dashed var(--border); }
.results .test:last-child { border-bottom: none; }
.results .ok { color: var(--success) !important; }
.results .fail { color: var(--error) !important; }
.results .test.pass { color: var(--success) !important; }
.results .test.fail { color: var(--error) !important; }
.console { white-space: pre-wrap; color: #cbd5e1; }

.app-footer { border-top: 1px solid var(--border); padding: 12px 20px; color: var(--muted); background: #0f1520; }

/* Spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.hidden { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { height: 220px; }
  .workspace { height: calc(100vh - 68px - 220px); }
  .output-columns { grid-template-columns: 1fr; }
}


