/* ═══════════════════════════════════════════════════════════
   Sugar Activity on Demand — Frontend Demo
   Exact replica of the real AOD UI
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --accent-fill: #f0a000;
  --accent-stroke: #6b6b00;
  --accent-soft: #efd8a8;
  --accent-soft-dark: #c4a060;
  --accent-text: #4a5a2a;
  --accent-border: #b0a870;
  --neutral-dark: #2a2a2a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, sans-serif;
  background: #e8e8e8;
  overflow: hidden;
}

/* ── Sugar Desktop Frame ────────────────────────────────── */
.sugar-frame-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  background: #2b2b2b;
  padding: 0 16px;
  z-index: 100;
}
.frame-left { display: flex; align-items: center; gap: 10px; }
.sugar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #eeeeee;
  border-radius: 20px;
  padding: 6px 14px;
  width: 240px;
}
.search-icon { font-size: 12px; color: #888; }
.search-input {
  border: none;
  background: transparent;
  font-size: 12px;
  font-family: inherit;
  color: #444;
  outline: none;
  width: 120px;
}
.search-input::placeholder { color: #999; }
.frame-center { flex: 1; text-align: center; }
.frame-right { display: flex; gap: 8px; align-items: center; }
.frame-icon-btn {
  background: transparent; border: none; color: #fff;
  width: 32px; height: 32px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 150ms;
}
.frame-icon-btn.active-icon { background: #555555; }
.frame-icon-btn:hover { background: #444; }
.circle-dot {
  width: 14px; height: 14px;
  border: 2px solid #ffffff; border-radius: 50%;
  position: relative;
}
.circle-dot::after {
  content: ''; position: absolute;
  width: 4px; height: 4px; border-radius: 50%;
  background: #ffffff; top: 50%; left: 50%; transform: translate(-50%, -50%);
}
.hamburger { display: flex; flex-direction: column; gap: 3px; }
.hamburger span { width: 15px; height: 2px; background: #ffffff; border-radius: 1px; }
.white-plus {
  width: 18px; height: 18px; background: #ffffff; color: #2b2b2b;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: bold; line-height: 1;
}

/* ── AOD Window ─────────────────────────────────────────── */
.aod-window {
  height: calc(100vh - 44px);
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

/* ── Page System ────────────────────────────────────────── */
.aod-page {
  display: none;
  background-color: #f4f4f4;
  min-height: 100%;
  padding: 36px 32px;
}
.aod-page.active { display: block; }

.aod-heading { color: #222222; font-size: 26px; font-weight: 700; text-align: center; margin-bottom: 6px; }
.aod-subtitle { color: #5a5a5a; font-size: 16px; text-align: center; margin-bottom: 22px; }

/* ── MODE CARDS (Page 1) ────────────────────────────────── */
.mode-cards { display: flex; gap: 16px; justify-content: center; margin-bottom: 24px; flex-wrap: wrap; }
.mode-card {
  background: #ffffff; border: 1px solid #d9d9d9; border-radius: 18px;
  padding: 22px 28px; text-align: center; cursor: pointer; width: 210px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05); transition: box-shadow 180ms ease-out, border-color 180ms ease-out, background-color 180ms ease-out;
}
.mode-card:hover { background: #fcfcfc; border-color: var(--accent-border); box-shadow: 0 6px 16px rgba(0,0,0,0.08); }
.mode-card:active { background: var(--accent-soft); }
.mode-card.selected { border-color: var(--accent-stroke); box-shadow: 0 0 0 2px var(--accent-soft); }
.mode-title { font-size: 14px; font-weight: 700; color: #2e2e2e; margin-bottom: 4px; }
.mode-tagline { font-size: 13px; font-weight: 600; color: var(--accent-stroke); margin-bottom: 8px; }
.mode-desc { font-size: 12px; color: #636363; line-height: 1.5; }

.mode-steps { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 12px; }
.step-label { font-size: 11px; color: #5a5a5a; text-align: center; line-height: 1.3; }
.step-arrow { font-size: 16px; color: #999; }

/* ── PROMPT PAGE (Page 2) ───────────────────────────────── */
.pillars { display: flex; gap: 10px; justify-content: center; margin-bottom: 18px; }
.pillar {
  color: #4f4f4f; font-size: 11px; border-radius: 12px;
  border: 1px solid #d9d9d9; background: #f7f7f7; padding: 4px 10px; font-weight: 500;
}

.controls-row { display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.control-group { display: flex; align-items: center; gap: 6px; }
.control-label { color: #5a5a5a; font-size: 12px; font-weight: 500; }
.control-select {
  color: #444; background: #f6f6f6; border-radius: 11px;
  border: 1px solid #d9d9d9; padding: 4px 10px; font-size: 12px;
  font-family: inherit; cursor: pointer; transition: all 160ms;
}
.control-select:hover { background: #ededed; border-color: #cfcfcf; }
.settings-btn {
  color: #4c4c4c; background: #f6f6f6; border-radius: 11px;
  border: 1px solid #d9d9d9; padding: 4px 10px; font-size: 12px;
  font-family: inherit; cursor: pointer; transition: all 160ms;
}
.settings-btn:hover { background: #ededed; border-color: #cfcfcf; }
.template-hint { color: #6a6a6a; font-size: 11px; text-align: center; margin-bottom: 4px; }
.planner-hint { color: #6a6a6a; font-size: 11px; text-align: center; margin-bottom: 16px; }
.spec-button {
  display: block; margin: 0 auto 18px; color: #4c4c4c; background: #f6f6f6;
  border-radius: 11px; border: 1px solid #d9d9d9; padding: 6px 14px;
  font-size: 12px; font-family: inherit; cursor: pointer; transition: all 160ms;
}
.spec-button:hover { background: #ededed; border-color: #cfcfcf; }

.prompt-card {
  max-width: 680px; margin: 0 auto; background: #ffffff; border-radius: 18px;
  border: 1px solid #d9d9d9; padding: 14px 18px; box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  transition: box-shadow 180ms ease-out, border-color 180ms ease-out, background-color 180ms ease-out;
}
.prompt-card:focus-within { border-color: var(--accent-border); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.prompt-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.field-label { color: #4a4a4a; font-size: 13px; font-weight: 500; }
.char-count { color: #777; font-size: 12px; }
.prompt-input-wrap { margin-bottom: 8px; }
.prompt-input {
  width: 100%; min-height: 60px; resize: vertical; border: none; outline: none;
  font-family: inherit; font-size: 16px; color: #222; background: transparent; line-height: 1.5;
}
.prompt-input::placeholder { color: #7a7a7a; font-size: 14px; }
.prompt-actions { display: flex; align-items: center; gap: 8px; }
.idea-btn {
  background: #f6f6f6; color: #4a4a4a; border-radius: 13px; border: 1px solid #d9d9d9;
  padding: 6px 10px; font-size: 14px; font-family: inherit; cursor: pointer; transition: all 160ms;
}
.idea-btn:hover { background: #ededed; border-color: #cfcfcf; }
.idea-hint { flex: 1; color: #606060; font-size: 13px; }
.state-label {
  font-size: 11px; border-radius: 10px; border: 1px solid #d9d9d9;
  padding: 4px 8px; color: #4f4f4f; background: #f6f6f6;
}
.state-label.ready { border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent-text); }
.send-btn {
  background: var(--accent-soft); color: var(--accent-text); border-radius: 14px;
  border: 1px solid var(--accent-border); padding: 6px 10px; min-width: 34px; min-height: 30px;
  cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 160ms;
}
.send-btn:hover:not(:disabled) { background: var(--accent-soft-dark); color: #fff; }
.send-btn:disabled { background: #cfcfcf; color: #f3f3f3; border: 1px solid #cfcfcf; cursor: default; }

.starter-row { max-width: 680px; margin: 18px auto 0; display: flex; gap: 6px; align-items: center; }
.starter-hint { color: #606060; font-size: 13px; flex-shrink: 0; }
.starter-ideas { display: flex; gap: 6px; flex-wrap: wrap; }
.starter-chip {
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid #d9d9d9;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  color: #2e2e2e;
  padding: 6px 14px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: box-shadow 160ms ease-out, border-color 160ms ease-out, background-color 160ms ease-out;
}
.starter-chip:hover {
  background: #fcfcfc;
  border-color: var(--accent-border);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}
.starter-chip:active {
  background: var(--accent-soft);
}

/* ═══════════════════════════════════════════════════════════
   PAGE 3: Studio — 3-Column Layout (exact AOD replica)
   ═══════════════════════════════════════════════════════════ */
#studioPage { padding: 0; }

.studio-3col {
  display: flex;
  height: calc(100vh - 44px);
  overflow: hidden;
}

.studio-chat-sidebar {
  width: 340px;
  min-width: 340px;
  background-color: #f7f7f7;
  border-right: none;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 12px;
  overflow-y: auto;
}

.chat-bubble {
  border-radius: 14px;
  padding: 9px 12px;
  font-size: 13px;
  line-height: 1.45;
  color: #2f2f2f;
  max-width: 85%;
  word-wrap: break-word;
}
.chat-bubble.user {
  background-color: #ecdbf5;
  color: #2a2a2a;
  border: 1px solid #dec8ea;
  align-self: flex-end;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}
.chat-bubble.assistant {
  background-color: #fff8e6;
  color: #2f2f2f;
  border: 1px solid #ead7b0;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.chat-bubble.muted {
  background-color: transparent;
  color: #808080;
  font-size: 11px;
  padding: 0 4px;
  margin: -4px 0;
  border: none;
  align-self: flex-start;
  max-width: 100%;
  font-style: italic;
}
.chat-bubble.grounding {
  background-color: #f3f9f3;
  color: #2f2f2f;
  border: 1px solid #dce8dc;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  font-size: 12px;
}
.chat-bubble.tip {
  background-color: #fdf5df;
  color: #2f2f2f;
  border: 1px solid #f2e2be;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  font-size: 12px;
}

.chat-composer-shell {
  margin-top: auto;
  background-color: #ffffff;
  border-radius: 14px;
  border: 1px solid #d9d9d9;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.composer-prompt-echo {
  font-size: 11px;
  color: #9a9a9a;
  line-height: 1.4;
  font-style: italic;
}
.composer-input-row {
  border: 1px solid #d9d9d9;
  border-radius: 10px;
  padding: 6px 8px;
  background: #ffffff;
  min-height: 28px;
  display: flex;
  align-items: center;
}
.composer-caret {
  color: #222222;
  font-weight: 300;
  animation: blink 1s step-end infinite;
}
@keyframes blink {
  50% { opacity: 0; }
}

/* ── Center: Classroom Preview ──────────────────────────── */
.studio-center {
  flex: 1;
  background: #f5f4ef; /* Slight grey/beige sugar bg */
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow-y: auto;
}

.center-top-bar {
  display: flex;
  align-items: center;
  padding: 6px 16px;
  border-bottom: 1px solid #eee;
  font-size: 12px;
  color: #666;
  gap: 12px;
}
.center-label { font-weight: 500; color: #555; }
.center-spacer { flex: 1; }
.center-link {
  color: #888;
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.center-link:hover { color: #555; }
.center-status { color: #888; font-size: 11px; font-style: italic; }

.preview-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 16px 4px;
}
.preview-tab {
  padding: 5px 14px;
  font-size: 12px;
  font-family: inherit;
  border-radius: 8px;
  border: 1px solid #d0d0d0;
  background: #f4f4f4;
  color: #4a4a4a;
  cursor: pointer;
  transition: all 160ms;
}
.preview-tab.active {
  background: var(--accent-soft);
  color: var(--accent-text);
  border-color: var(--accent-border);
  font-weight: 600;
}
.preview-tab:hover:not(.active) { background: #ededed; }

.pillars-small {
  display: flex;
  gap: 6px;
  padding: 4px 16px 8px;
}
.pillar-small {
  font-size: 10px;
  color: #fff;
  background: var(--accent-fill);
  border-radius: 10px;
  padding: 2px 8px;
  font-weight: 500;
}

/* Build progress area */
.preview-build-area {
  flex: 1;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
  margin-bottom: 16px;
  position: relative;
}

.build-icon {
  font-size: 68px;
  color: #bbb;
  margin-bottom: 14px;
  line-height: 1;
}
.build-heading {
  font-size: 22px;
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
}
.build-sub {
  font-size: 14px;
  color: #777;
  margin-bottom: 18px;
}

.build-progress-bar {
  width: 250px;
  height: 9px;
  background: #E8E8E8;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 30px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}
.build-progress-fill {
  height: 100%;
  width: 0%;
  background: #888;
  border-radius: 6px;
  transition: width 800ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.build-steps-list {
  text-align: left;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 250px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 10px;
}
.build-step {
  font-size: 15px;
  color: #888;
  display: flex;
  align-items: center;
  gap: 8px;
}
.build-step b {
  font-size: 13px;
  width: 16px;
  text-align: center;
}
.build-step.done {
  color: #333;
  font-weight: 500;
}
.build-step.done b {
  color: #111;
}
.build-step.active {
  color: #666;
  font-weight: 500;
}

.build-cursor {
  /* Creating an SVG data URI for a tilted black arrow exactly like the screenshot */
  width: 38px;
  height: 38px;
  background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M5.5 2 L19.4 11.2 A1 1 0 0 1 19.3 12.8 L14 15.6 L17.5 21 L13.5 23 L10.5 17.5 L6.5 22 A1 1 0 0 1 5 21 Z" fill="%23000"/></svg>');
  background-size: contain;
  background-repeat: no-repeat;
  margin-left: 140px; /* Offset to the right like in screenshot */
  margin-bottom: 20px;
  position: relative;
}
@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.build-notice {
  font-size: 12px;
  color: #888;
  display: flex;
  align-items: center;
  gap: 4px;
}
.lock-icon { font-size: 12px; }

/* Live edit mode */
.live-edit-section {
  background: #fdfdf5;
  border: 1px solid #e2e4c9;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}
.live-edit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 14px;
  color: #222;
}
.live-edit-desc {
  font-size: 11px;
  color: #777;
  margin-bottom: 6px;
}
.live-edit-status {
  font-size: 11px;
  color: #999;
  background: #f4f4f4;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 5px 8px;
  margin-bottom: 8px;
}
.live-edit-status.target-filled {
  background: #e3c4f2;
  border: 1px solid #c8a2e2;
  color: #5c3d7f;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 12px;
}
.live-edit-prompt-row {
  display: flex;
  gap: 6px;
}
.live-edit-input {
  flex: 1;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-family: inherit;
  color: #333;
  outline: none;
}
.live-edit-input.active {
  background: #ffffff;
  border: 1px solid #e1e3b6;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  color: #444;
}
.live-edit-input:disabled { background: #f4f4f4; color: #aaa; }
.live-edit-apply {
  padding: 6px 12px;
  font-size: 11px;
  font-family: inherit;
  border-radius: 8px;
  border: 1px solid #d2d2d2;
  background: #f4f4f4;
  color: #888;
  cursor: pointer;
  white-space: nowrap;
}
.live-edit-apply.active {
  background: #e2cff4;
  border: 1px solid #cbb8e0;
  color: #5d386b;
  font-weight: 700;
  padding: 12px 18px;
  border-radius: 12px;
}
.live-edit-apply:disabled { opacity: 0.5; cursor: default; }

/* Toggle switch */
.live-toggle-pill {
  position: relative; display: flex; align-items: center; cursor: pointer;
  background-color: #f2e5cc; border-radius: 14px;
  border: 1px solid #dfcdb3; width: 56px; height: 26px; box-sizing: border-box; overflow: hidden;
  transition: all 200ms;
}
.live-toggle-text {
  font-size: 13px; color: #3b5062; font-weight: 600;
  position: absolute; right: 10px; z-index: 2; transition: all 200ms;
}

/* Off state */
.live-toggle-track {
  display: none; /* track hidden in off state */
}
.live-toggle-knob {
  width: 20px; height: 20px; background: #ffffff;
  border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,0.2), 0 0 1px rgba(0,0,0,0.1);
  position: absolute; left: 2px; z-index: 3; transition: transform 200ms ease;
}

/* On state */
.live-toggle-pill.on-state {
  background-color: #f0e6cf; border-color: #e0cead;
}
.live-toggle-pill.on-state .live-toggle-text {
  left: 12px; right: auto; color: #2f4f6b;
}
.live-toggle-pill.on-state .live-toggle-track {
  display: flex; align-items: center; background: #baddf9;
  position: absolute; right: 0; top: 0; height: 100%; width: 34px;
  padding: 0 3px 0 8px; box-sizing: border-box; z-index: 1;
}
.track-tick {
  color: #131411; font-size: 13px; font-weight: 600;
  transform: scaleX(0.7); margin-right: 2px; z-index: 2;
}
.live-toggle-pill.on-state .live-toggle-knob {
  transform: translateX(30px);
}

/* Actions logic */
.live-edit-actions {
  display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; 
}
.save-val-btn {
  background: #fdfdfd; border: 1px solid #e5e5e5; border-radius: 10px;
  color: #ccc; padding: 6px 12px; font-size: 11px; cursor: default;
}
.run-btn {
  background: #dfcbef; border: 1px solid #cbb8e0; border-radius: 10px;
  color: #6f509e; padding: 6px 16px; font-weight: 600; font-size: 11.5px; cursor: pointer;
}
.gtk-bottom-footer {
  display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px;
  padding: 12px 20px; background: #f5f5f5;
  margin-left: -24px; margin-right: -24px; margin-bottom: -24px;
  border-top: 1px solid #ccc; border-bottom-left-radius: 12px; border-bottom-right-radius: 12px;
}
.gtk-footer-btn {
  background: #ffffff; border: 1px solid #d0d0d0; border-radius: 14px;
  padding: 6px 14px; color: #555; font-size: 11.5px; font-weight: 500; cursor: pointer;
}
.rebuild-btn { background: #666; color: #fff; border-color: #666; }
.install-btn { background: #ebdcf9; color: #6a4c9c; font-weight: 600; border-color: #dac7eb; }



/* ── Right: Learning Sidebar ────────────────────────────── */
.studio-learning-sidebar {
  width: 340px;
  min-width: 340px;
  background: #fdfdfd;
  border-left: 1px solid #e5e5e5;
  padding: 16px 20px;
  overflow-y: auto;
  transition: width 200ms, min-width 200ms, padding 200ms, opacity 200ms;
}
.studio-learning-sidebar.hidden {
  width: 0;
  min-width: 0;
  padding: 0;
  opacity: 0;
  overflow: hidden;
}

.learning-header { margin-bottom: 10px; }
.learning-title-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 3px;
}
.learning-title { font-size: 13px; font-weight: 600; color: #2f2f2f; flex: 1; }
.sidebar-expand-btn, .sidebar-close-btn {
  background: none; border: 1px solid #d9d9d9; border-radius: 5px;
  padding: 1px 5px; font-size: 11px; color: #888; cursor: pointer;
}
.sidebar-expand-btn:hover, .sidebar-close-btn:hover { background: #eee; }
.learning-subtitle {
  font-size: 10px;
  color: #777;
  line-height: 1.4;
}

.learning-section { margin-top: 6px; }
.learning-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  font-size: 11.5px;
  color: #333;
}
.learning-section-sub {
  font-size: 10px;
  color: #888;
  margin-bottom: 8px;
}
.aod-learning-rail {
  background-color: #ffffff;
  border-radius: 14px;
  border: 1px solid #e6e6e6;
  padding: 14px;
  margin-top: 12px;
}
.waiting-badge {
  font-size: 9.5px; color: #555; background: #f4f4f4;
  border-radius: 10px; border: 1px solid #e0e0e0;
  padding: 2px 8px; font-weight: 600;
}

.learning-tabs {
  display: flex; gap: 4px; margin-bottom: 12px;
}
.learning-tab {
  padding: 6px 0; font-size: 10px; font-family: inherit;
  border-radius: 8px; border: 1px solid #e4e4e4;
  background: #f9f9f9; color: #666; cursor: pointer;
  font-weight: 500; flex: 1; text-align: center;
  transition: all 160ms;
}
.learning-tab.active {
  background: #eadff5; color: #6b4c8a;
  border-color: #dac7eb; font-weight: 600;
}
.learning-tab:hover:not(.active) { background: #f0f0f0; }

.learning-empty-state {
  background: #ffffff; border-radius: 10px;
  border: 1px solid #e8e8e8; padding: 16px 14px;
}
.empty-state-title {
  font-size: 11.5px; font-weight: 600; color: #333; margin-bottom: 4px;
}
.empty-state-desc {
  font-size: 10px; color: #777; line-height: 1.4;
}
.populated-badge {
  font-size: 9px; color: #555; background: #fcfcfc;
  border-radius: 10px; border: 1px solid #e0e0e0;
  padding: 3px 8px; font-weight: 600;
}
.learning-scroll-list {
  max-height: calc(100vh - 280px);
  overflow-y: auto;
  border-top: 1px solid #e6e6e6;
  padding-top: 12px;
  margin-top: 4px;
  margin-right: -10px;
  padding-right: 6px;
}
.learning-scroll-list::-webkit-scrollbar {
  width: 6px;
}
.learning-scroll-list::-webkit-scrollbar-thumb {
  background-color: #999;
  border-radius: 10px;
}
.learning-scroll-list::-webkit-scrollbar-track {
  background-color: transparent;
}
.level-header {
  font-size: 10px; font-weight: 600; color: #666; margin-bottom: 12px;
}
.challenge-card {
  background: #ffffff; border: 1px solid #eaeaea; border-radius: 8px;
  padding: 10px 12px; margin-bottom: 8px;
}
.challenge-type {
  font-size: 9.5px; color: #666; font-weight: 500; margin-bottom: 2px;
}
.challenge-desc {
  font-size: 10.5px; color: #333; margin-bottom: 8px; line-height: 1.3; font-weight: 500;
}
.challenge-actions {
  display: flex; gap: 6px;
}
.chal-hint {
  background: #fdfdfd; border: 1px solid #dcdcdc; border-radius: 10px;
  color: #666; padding: 2px 10px; font-size: 9.5px; cursor: pointer;
}
.chal-done {
  background: #d9c9ed; border: 1px solid #cbbae0; border-radius: 10px;
  color: #6d4d9b; font-weight: 600; padding: 2px 10px; font-size: 9.5px; cursor: pointer;
}

/* ── Review Mode Container ──────────────────────────────── */
.review-container {
  display: flex;
  flex: 1;
  min-height: calc(100vh - 160px);
  background: #fff;
  border-radius: 8px;
  border: 1px solid #ddd;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  margin-top: 8px;
  overflow: hidden; /* To keep inner elements inside the border radius */
}
.review-sidebar {
  width: 140px;
  background: #fff;
  border-right: 1px solid #eee;
}
.review-editor {
  flex: 1;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.review-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
}
.review-header-title {
  font-size: 11px;
  color: #777;
}
.review-header-buttons {
  display: flex;
  gap: 8px;
}
.review-btn {
  background: #fdfdfd;
  border: 1px solid #eaeaea;
  border-radius: 12px;
  padding: 4px 12px;
  font-size: 10px;
  color: #555;
  cursor: pointer;
}
.review-editor-subheader {
  padding: 8px 16px 16px;
  border-bottom: 1px solid #eee;
  font-size: 10.5px;
  color: #333;
}
.muted-text {
  color: #888;
  font-weight: normal;
}
.review-code-area {
  padding: 12px 0;
  font-family: monospace;
  font-size: 11px;
}
.code-line {
  display: flex;
  padding: 3px 16px;
  min-height: 19px;
}
.code-line.active-line {
  background: #f0f0f0;
}
.line-num {
  width: 24px;
  color: #888;
  text-align: right;
  margin-right: 12px;
}
.code-text {
  color: #333;
  white-space: pre;
}

.learning-scroll-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.level-header {
  font-size: 11px;
  font-weight: 600;
  color: #444;
  margin: 4px 0 2px;
}
.challenge-card {
  background: #fff;
  border: 1px solid #dcdcdc;
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.challenge-type {
  font-size: 9.5px;
  color: #666;
  margin-bottom: 4px;
}
.challenge-desc {
  font-size: 11px;
  color: #333;
  line-height: 1.4;
  margin-bottom: 8px;
}
.challenge-actions {
  display: flex;
  gap: 6px;
}
.chal-hint, .chal-done {
  padding: 3px 10px;
  font-size: 10px;
  font-family: inherit;
  border-radius: 12px;
  border: 1px solid #d0d0d0;
  background: #f4f4f4;
  color: #555;
  cursor: pointer;
}
.chal-done {
  background: #e2c0e8;
  border-color: #d0a8d6;
  color: #444;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .studio-3col { flex-direction: column; }
  .studio-chat-sidebar, .studio-learning-sidebar { width: 100%; min-width: 0; }
  .mode-cards { flex-direction: column; align-items: center; }
}

/* ── Custom GTK Scrollbars ──────────────────────────────── */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: #f0f0f0; 
  border-radius: 8px;
}
::-webkit-scrollbar-thumb {
  background: #ccc; 
  border-radius: 8px;
  border: 2px solid #f0f0f0; /* adds track padding */
}
::-webkit-scrollbar-thumb:hover {
  background: #aaa; 
}

/* ═══════════════════════════════════════════════════════════
   Versions Tab — Version Tracking, View Source & Diff View
   ═══════════════════════════════════════════════════════════ */

.versions-container {
  display: flex;
  flex: 1;
  min-height: calc(100vh - 160px);
  background: #fff;
  border-radius: 8px;
  border: 1px solid #ddd;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  margin-top: 8px;
  overflow: hidden;
}

/* Version List Sidebar */
.versions-sidebar {
  width: 180px;
  min-width: 180px;
  background: #fafafa;
  border-right: 1px solid #eee;
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.versions-sidebar-title {
  font-size: 11px;
  font-weight: 700;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e8e8e8;
}
.version-card {
  background: #fff;
  border: 1px solid #e4e4e4;
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  transition: all 160ms;
}
.version-card:hover {
  border-color: #ccc;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.version-card.active {
  border-color: var(--accent-border);
  background: #fdf8ee;
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.version-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.version-badge {
  font-size: 12px;
  font-weight: 700;
  color: #5a3d8a;
  background: #ece0f7;
  border-radius: 6px;
  padding: 1px 7px;
}
.version-time {
  font-size: 10px;
  color: #999;
}
.version-prompt {
  font-size: 10.5px;
  color: #555;
  line-height: 1.3;
  margin-bottom: 6px;
}
.version-view-btn {
  width: 100%;
  padding: 4px 0;
  font-size: 10px;
  font-family: inherit;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid #d2c4e8;
  background: #ece0f7;
  color: #5a3d8a;
  cursor: pointer;
  transition: all 160ms;
}
.version-view-btn:hover {
  background: #ddd0ee;
  border-color: #bba8d8;
}

/* Versions Main Content */
.versions-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.versions-sub-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 14px 6px;
  border-bottom: 1px solid #eee;
}
.versions-sub-tab {
  padding: 5px 14px;
  font-size: 11px;
  font-family: inherit;
  border-radius: 8px;
  border: 1px solid #d0d0d0;
  background: #f4f4f4;
  color: #4a4a4a;
  cursor: pointer;
  transition: all 160ms;
  font-weight: 500;
}
.versions-sub-tab.active {
  background: #ece0f7;
  color: #5a3d8a;
  border-color: #d2c4e8;
  font-weight: 600;
}
.versions-sub-tab:hover:not(.active) {
  background: #ededed;
}

/* Source Viewer */
.versions-source-panel {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}
.versions-source-title {
  padding: 10px 16px;
  font-size: 11.5px;
  font-weight: 600;
  color: #444;
  background: #f8f8f8;
  border-bottom: 1px solid #eee;
}
.versions-code-area {
  padding: 8px 0;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  overflow-y: auto;
  max-height: calc(100vh - 260px);
}

/* Diff Viewer */
.versions-diff-panel {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}
.diff-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #f8f8f8;
  border-bottom: 1px solid #eee;
}
.diff-label {
  font-size: 11px;
  font-weight: 600;
  color: #555;
}
.diff-select {
  font-size: 11px;
  font-family: inherit;
  padding: 3px 8px;
  border-radius: 8px;
  border: 1px solid #d0d0d0;
  background: #fff;
  color: #333;
  cursor: pointer;
}
.diff-arrow {
  font-size: 14px;
  color: #888;
}
.diff-summary {
  padding: 6px 16px;
  font-size: 11px;
  font-weight: 600;
  color: #666;
  background: #fafafa;
  border-bottom: 1px solid #eee;
}
.diff-code-area {
  padding: 4px 0;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  overflow-y: auto;
  max-height: calc(100vh - 300px);
}
.diff-line {
  display: flex;
  padding: 2px 16px;
  min-height: 20px;
  align-items: center;
}
.diff-line.add {
  background: #e6ffec;
  border-left: 3px solid #2da44e;
}
.diff-line.remove {
  background: #ffebe9;
  border-left: 3px solid #cf222e;
  text-decoration: line-through;
  text-decoration-color: rgba(207, 34, 46, 0.4);
}
.diff-line.same {
  background: transparent;
  border-left: 3px solid transparent;
}
.diff-prefix {
  width: 20px;
  font-weight: 700;
  flex-shrink: 0;
  user-select: none;
}
.diff-line.add .diff-prefix { color: #2da44e; }
.diff-line.remove .diff-prefix { color: #cf222e; }
.diff-line.same .diff-prefix { color: #ccc; }

/* Syntax Highlighting */
.kw { color: #0550ae; font-weight: 600; }
.str { color: #0a3069; }
.fn { color: #8250df; }
.cmt { color: #6e7781; font-style: italic; }

