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

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background-color: #000;
  color: #fff;
  font-family: sans-serif;
}

/* ── Top Bar ── */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #1a1a1a;
  padding: 0 16px;
  height: 52px;
  border-bottom: 1px solid #333;
  flex-shrink: 0;
}

.top-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  height: 32px;
  padding: 0 8px;
  background-color: #2e2e2e;
  color: #f5c518;
  font-weight: bold;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  letter-spacing: 0.05em;
  cursor: pointer;
}

.lesson-title {
  font-size: 15px;
  font-weight: 500;
}

.hamburger-btn {
  font-size: 32px;
  background: none;
  border: none;
  color: #aaa;
  cursor: pointer;
}

.top-center {
  display: flex;
  align-items: center;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Side Menu ── */
.side-menu {
  position: fixed;
  top: 52px;
  right: -240px;
  width: 240px;
  background-color: #1a1a1a;
  border-left: 1px solid #333;
  border-bottom: 1px solid #333;
  z-index: 1000;
  transition: right 0.25s ease;
  padding: 12px 0;
}

.side-menu.open {
  right: 0;
}

.side-menu-list {
  list-style: disc;
  padding: 0 16px 0 32px;
  margin: 0;
}

.side-menu-list li {
  padding: 8px 0;
  border-bottom: 1px solid #2a2a2a;
}

.side-menu-list li:last-child {
  border-bottom: none;
}

.side-menu-item {
  color: #aaa;
  font-size: 14px;
  cursor: pointer;
}

.side-menu-item:hover {
  color: #f5c518;
}

/* ── Modal ── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 10000;
  align-items: center;
  justify-content: center;
}

.modal-backdrop.open {
  display: flex;
}

.modal-body {
  background-color: #1a1a1a;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 32px 40px;
  width: 66vmin;
  height: 66vmin;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
  text-align: center;
}

.modal-content a {
  color: #f5c518;
  text-decoration: none;
}

.modal-content a:hover {
  text-decoration: underline;
}

.modal-title {
  color: #f5c518;
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.modal-content {
  flex: 1;
  overflow-y: auto;
  color: #ccc;
  font-size: 18px;
  line-height: 1.8;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1em;
  align-items: center;
  text-align: center;
  width: 100%;
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  min-height: 0;
  background-color: #000;
  display: flex;
  gap: 16px;
  padding: 16px;
}

.panel {
  flex: 2;
  min-height: 0;
  background-color: #1a1a1a;
  border: 1px solid #f5c518;
  border-radius: 4px;
}

.panel-header {
  flex-shrink: 0;
  background-color: #2a2a2a;
  color: #888;
  font-size: 11px;
  font-weight: bold;
  padding: 4px 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid #333;
}

.panel-tests {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.tests-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lessons-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  padding: 6px 8px;
  background-color: #1a1a1a;
}

.tests-footer {
  position: absolute;
  bottom: 8px;
  right: 8px;
}

.reset-btn {
  background-color: #e67e22;
  color: #000;
  border: none;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
}

.reset-btn:hover {
  background-color: #d35400;
}

.test-pane-header {
  width: 90%;
  margin: 5% auto 0;
  padding: 10px 12px;
  font-size: 22px;
  font-weight: bold;
  color: #a8c8f0;
  background-color: transparent;
  border: none;
  border-radius: 0;
  text-align: center;
}

.test-pane-header-instructions {
  font-size: 13px;
  font-weight: normal;
  color: #7aadd4;
  margin-top: 6px;
}

.lesson-body {
  width: 90%;
  margin: 8px auto 0;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.7;
  color: #ccc;
  background-color: #0a1a2e;
  border: 1px solid #1a4a7a;
  border-radius: 4px;
}

.lesson-body b {
  color: #a8d0ff;
  font-weight: 900;
}

.test-pane {
  width: 90%;
  margin: 4px auto 0;
  padding: 8px 12px;
  font-size: 13px;
  color: #ccc;
  background-color: #2a0f0f;
  border: 1px solid #7a2020;
  border-radius: 4px;
}

.test-pane.test-pane-intro {
  background-color: #1a1a2e;
  border-color: #3a3a6a;
  color: #a8a8cc;
  font-style: italic;
  text-align: center;
}

.help-link {
  display: block;
  width: 90%;
  margin: 12px auto 8px;
  text-align: center;
  font-size: 12px;
  color: #f5c518;
  text-decoration: none;
}

.help-link:hover {
  text-decoration: underline;
}

.test-pane.test-pass {
  background-color: #0a2a0f;
  border-color: #2ecc71;
  color: #fff;
}

.test-pane.test-fail {
  background-color: #2a0a0a;
  border-color: #e74c3c;
  color: #fff;
}

.test-error {
  font-size: 11px;
  color: #ff6961;
  margin-top: 4px;
}

.panel:first-child {
  flex: 1;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-nav-content {
  flex: 1;
  overflow-y: auto;
  scrollbar-gutter: stable;
  display: flex;
  flex-direction: column;
}

.panel-right {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: none;
  border: none;
  padding: 0;
}

.divider-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 16px;
  flex-shrink: 0;
  cursor: ns-resize;
}

.divider-knob {
  width: 40px;
  height: 40px;
  background-color: #1a1a1a;
  border: 1px solid #f5c518;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: #f5c518;
  line-height: 1.2;
  user-select: none;
  position: relative;
  z-index: 9999;
}

.panel-sub {
  flex: 1;
  background-color: #1a1a1a;
  border: 1px solid #f5c518;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aaa;
  font-size: 14px;
  overflow: hidden;
}

.panel-code {
  flex: 2;
  padding: 0;
  align-items: stretch;
  flex-direction: column;
  position: relative;
}

.code-footer {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.save-indicator {
  width: 16px;
  height: 16px;
  fill: #666;
  flex-shrink: 0;
}

.run-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.run-hint {
  font-size: 11px;
  color: #666;
  font-weight: normal;
}

.run-hint.run-hint-complete {
  color: #77dd77;
}

.run-btn {
  background-color: #2ecc71;
  color: #000;
  border: none;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10;
}

.run-btn:hover {
  background-color: #27ae60;
}

.panel-terminal {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  position: relative;
}

.panel-terminal .panel-header {
  align-self: stretch;
  text-align: left;
}

.terminal-output {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  font-family: monospace;
  font-size: 13px;
  text-align: left;
  width: 100%;
  box-sizing: border-box;
}

.terminal-footer {
  position: absolute;
  bottom: 8px;
  right: 8px;
}

.clear-btn {
  background-color: #2ecc71;
  color: #000;
  border: none;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10;
}

.clear-btn:hover {
  background-color: #27ae60;
}

.terminal-line {
  color: #ccc;
  margin-bottom: 4px;
}

.terminal-error {
  color: #ff6961;
  margin-bottom: 4px;
}

.panel-code .CodeMirror {
  flex: 1;
  height: 100%;
  font-size: 14px;
  border-radius: 4px;
}

.CodeMirror-cursor {
  border-left-width: 0.55em !important;
  border-left-color: #ffb86c !important;
  background-color: #ffb86c !important;
  opacity: 0.5 !important;
}

.question-group {
  width: 90%;
  margin: 5% auto 0;
  border: 1px solid #7a2020;
  border-radius: 4px;
  background-color: #1a0808;
}

.question-group-header {
  padding: 10px 12px;
  color: #f5c518;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.question-group-count {
  font-size: 12px;
  opacity: 0.8;
}

.question-group-header:hover {
  background-color: #3a1515;
}

.question-sublist {
  display: none;
  padding: 0 0 8px 0;
}

.question-group.open .question-sublist {
  display: block;
}

.question-item {
  width: 90%;
  margin: 5px auto 0;
  padding: 7px 10px;
  font-size: 13px;
  color: #ccc;
  cursor: pointer;
  border: 1px solid #5a1818;
  border-radius: 4px;
  background-color: #2a0f0f;
  display: block;
}

.question-item:hover {
  background-color: #3a1515;
  color: #fff;
}

.question-item.question-item-lesson {
  background-color: #0a1a2e;
  border-color: #1a4a7a;
  color: #7ab8f5;
}

.question-item.question-item-lesson:hover {
  background-color: #0f2540;
  color: #a8d0ff;
}

.question-item.question-item-lesson.question-item-active {
  background-color: #0f2540;
  border-color: #4488cc;
  color: #fff;
}

.question-item.question-item-active {
  background-color: #3d1515;
  border-color: #cc4444;
  color: #fff;
}

.question-item.question-item-active.question-item-complete {
  background-color: #0f3a15;
  border-color: #44cc66;
  color: #fff;
}

.question-item.question-item-complete {
  background-color: #0a2a0f;
  border-color: #1a7a30;
  color: #77dd77;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.question-item.question-item-complete::after {
  content: '✓';
  flex-shrink: 0;
  margin-left: 8px;
}

.question-item.question-item-complete:hover {
  background-color: #0f3a15;
}

.question-group.question-group-partial {
  background-color: #1a1a08;
  border-color: #7a7a00;
}

.question-group.question-group-partial .question-group-header {
  color: #f5e623;
}

.question-group.question-group-complete {
  background-color: #081a08;
  border-color: #1a5a20;
}

.question-group.question-group-complete .question-group-header {
  color: #77dd77;
}

.question-group.question-group-complete .question-group-count::after {
  content: ' ✓';
  color: #77dd77;
  font-size: 14px;
}


/* ── Bottom Bar ── */
.bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #1a1a1a;
  padding: 0 16px;
  height: 48px;
  border-top: 1px solid #333;
  flex-shrink: 0;
}

.bottom-left {
  flex: 1;
}

.bottom-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.progress {
  font-size: 14px;
  color: #aaa;
}

.bottom-right {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.nav-btn {
  background-color: transparent;
  border: 1px solid #f5c518;
  color: #f5c518;
  padding: 6px 16px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
}

.nav-btn:hover {
  background-color: #f5c518;
  color: #000;
}

/* ── Clear Save ── */
.clear-save-btn {
  background-color: #7a2020;
  color: #ffaaaa;
  border: none;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
}

.clear-save-btn:hover {
  background-color: #a02828;
}

.confirm-body {
  background-color: #1a1a1a;
  border: 1px solid #7a2020;
  border-radius: 6px;
  padding: 32px 40px;
  max-width: 480px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.confirm-title {
  color: #ff6961;
  font-size: 22px;
  font-weight: bold;
}

.confirm-message {
  color: #ccc;
  font-size: 14px;
  line-height: 1.6;
}

.confirm-buttons {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.confirm-cancel-btn {
  background-color: #333;
  color: #aaa;
  border: 1px solid #555;
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
}

.confirm-cancel-btn:hover {
  background-color: #444;
  color: #fff;
}

.confirm-delete-btn {
  background-color: #7a2020;
  color: #ffaaaa;
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
}

.confirm-delete-btn:hover {
  background-color: #a02828;
}

/* ── Intro.js Tour ── */
.introjs-tooltip {
  background-color: #fff !important;
  color: #333 !important;
  border: 1px solid #ccc !important;
  border-radius: 6px !important;
}

.introjs-tooltip-title {
  color: #000 !important;
}

.introjs-tooltiptext {
  color: #333 !important;
}
