:root {
  --w3-green: #04aa6d;
  --w3-green-hover: #059862;
  --w3-dark: #282a35;
  --w3-dark-hover: #1d1f27;
  --w3-gray-box: #e7e9eb;
}

/* Main header nav */
.main-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.main-nav::-webkit-scrollbar {
  display: none;
}

.main-nav a {
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.main-nav a:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.main-nav a.active {
  background: var(--w3-green);
  color: #ffffff;
}

/* Interactive learning tiles on index */
.interactive-section {
  padding: 2rem 0 0.5rem;
}

.interactive-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.interactive-head h2 {
  margin: 0;
  font-size: 1.25rem;
}

.interactive-head p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.interactive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 0.95rem;
}

.interactive-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: var(--shadow-sm);
}

.interactive-tile-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.interactive-tile-head img {
  width: 38px;
  height: 38px;
  border-radius: 8px;
}

.interactive-tile-head strong {
  display: block;
  font-size: 1rem;
}

.interactive-tile-head small {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.interactive-tile-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: auto;
}

.interactive-tile-actions > * {
  width: 100%;
  white-space: nowrap;
}

.exam-main .card-actions,
.catalog-section .card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

.exam-main .card-actions > *,
.catalog-section .card-actions > * {
  width: 100%;
  white-space: nowrap;
}

.catalog-section .card-actions > :last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

/* Green W3-style primary button */
.btn-w3 {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  background: var(--w3-green);
  color: #ffffff;
  border: 1px solid var(--w3-green);
  border-radius: 10px;
  padding: 0.52rem 0.85rem;
  min-height: 38px;
  line-height: 1.2;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn-w3:hover:not(:disabled) {
  background: var(--w3-green-hover);
}

.btn-w3:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Learn page layout */
.learn-page {
  background: #ffffff;
}

.learn-header {
  position: sticky;
  top: 0;
  z-index: 30;
}

.learn-brand-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}

.learn-brand-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  gap: 1rem;
}

.sidebar-toggle {
  display: none;
  background: var(--w3-dark);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.course-tab-bar {
  background: var(--w3-dark);
  color: #ffffff;
}

.course-tabs-scroll {
  width: min(1400px, 100%);
  margin-inline: auto;
  display: flex;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
}

.course-tabs-scroll::-webkit-scrollbar {
  display: none;
}

.course-tab {
  color: #f1f5f9;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.65rem 1.1rem;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.course-tab:hover {
  background: #000000;
}

.course-tab.active {
  background: var(--w3-green);
  color: #ffffff;
}

.learn-shell {
  width: min(1400px, 100%);
  margin-inline: auto;
  display: grid;
  grid-template-columns: 260px 1fr;
  flex: 1;
}

.learn-sidebar {
  background: #e7e9eb;
  border-right: 1px solid var(--border);
  position: sticky;
  top: 102px;
  height: calc(100vh - 102px);
  overflow-y: auto;
  padding: 1rem 0 2rem;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem 0.65rem;
}

.sidebar-head h2 {
  margin: 0;
  font-size: 1.08rem;
}

.sidebar-close {
  display: none;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.2rem 0.45rem;
}

.sidebar-links {
  display: flex;
  flex-direction: column;
}

.sidebar-section {
  padding: 0.75rem 1rem 0.25rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
  margin-top: 0.35rem;
}

.clang-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  background: #dbeafe;
  color: #1e40af;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 0.35rem;
}

.out-ok {
  color: #86efac;
  font-weight: 600;
}

.sidebar-link {
  display: block;
  padding: 0.48rem 1rem;
  text-decoration: none;
  font-size: 0.92rem;
  color: var(--text);
  transition: background-color 0.12s ease;
}

.sidebar-link:hover {
  background: #d5d8dc;
}

.sidebar-link.active {
  background: var(--w3-green);
  color: #ffffff;
  font-weight: 600;
}

.sidebar-divider {
  border: 0;
  border-top: 1px solid #cbd5e1;
  margin: 0.85rem 1rem;
}

.sidebar-extra {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-extra-link {
  display: block;
  padding: 0.48rem 1rem;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.sidebar-extra-link:hover {
  background: #d5d8dc;
}

.learn-main {
  padding: 1.75rem clamp(1rem, 3vw, 2.5rem) 3.5rem;
  min-width: 0;
}

.lesson-article {
  max-width: 860px;
}

.lesson-title {
  margin: 0.5rem 0 1.25rem;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.3;
}

.lesson-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.lesson-nav-top {
  margin-bottom: 1rem;
}

.lesson-nav-bottom {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.lesson-h2 {
  margin: 1.75rem 0 0.75rem;
  font-size: 1.35rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.lesson-p {
  margin: 0 0 1rem;
  font-size: 1rem;
  color: #1e293b;
}

.lesson-p code,
.lesson-note code {
  background: #f1f5f9;
  color: #b91c1c;
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.lesson-list {
  margin: 0 0 1.15rem;
  padding-left: 1.4rem;
}

.lesson-list li {
  margin-bottom: 0.4rem;
}

.lesson-note {
  background: #ffffcc;
  border-left: 5px solid #ffeb3b;
  padding: 0.9rem 1.1rem;
  margin: 1.15rem 0;
  border-radius: 0 8px 8px 0;
}

.w3-example {
  background: var(--w3-gray-box);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  margin: 1.25rem 0;
}

.w3-example-head h3 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.w3-code,
.lesson-code-box {
  background: #ffffff;
  border-left: 4px solid var(--w3-green);
  border-radius: 4px;
  overflow-x: auto;
}

.lesson-code-box {
  border: 1px solid var(--border);
  border-left: 4px solid var(--w3-green);
  margin: 1rem 0;
}

.w3-code pre,
.lesson-code-box pre {
  margin: 0;
  padding: 0.85rem 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.5;
}

.w3-example-foot {
  margin-top: 0.85rem;
}

.finish-cta {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 12px;
  padding: 1.25rem;
  margin-top: 2rem;
}

.finish-cta h3 {
  margin: 0 0 0.35rem;
}

.finish-cta p {
  margin: 0 0 0.9rem;
  color: var(--text-muted);
}

/* Try-it page */
.try-page {
  height: 100vh;
  overflow: hidden;
  background: #e7e9eb;
}

.try-topbar {
  background: var(--w3-dark);
  color: #ffffff;
  padding: 0.55rem 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.try-topbar-left,
.try-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.try-brand {
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.98rem;
  margin-right: 0.35rem;
}

.btn-try-run {
  background: var(--w3-green);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 0.45rem 1rem;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-try-run:hover {
  background: var(--w3-green-hover);
}

.try-select,
.try-tool-btn {
  background: #38444d;
  color: #ffffff;
  border: 1px solid #4c5a65;
  border-radius: 6px;
  padding: 0.42rem 0.75rem;
  font: inherit;
  font-size: 0.86rem;
  text-decoration: none;
  cursor: pointer;
}

.try-tool-btn:hover {
  background: #475569;
}

.try-ex-title {
  font-size: 0.86rem;
  color: #cbd5e1;
}

.try-notice {
  background: #fef3c7;
  color: #92400e;
  padding: 0.45rem 1rem;
  font-size: 0.88rem;
  border-bottom: 1px solid #fde68a;
}

.try-workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px;
}

.try-pane {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.try-pane-header {
  background: #f1f5f9;
  border-bottom: 1px solid var(--border);
  padding: 0.42rem 0.8rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.try-shortcut {
  font-weight: 400;
  font-size: 0.78rem;
}

.try-editor-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
}

.try-editor-wrap textarea {
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95rem;
  resize: none;
}

.try-editor-wrap .CodeMirror {
  height: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
}

.try-stdin {
  border-top: 1px solid var(--border);
  background: #f8fafc;
  padding: 0.45rem 0.75rem;
}

.try-stdin summary {
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
}

.try-stdin textarea {
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
  resize: vertical;
}

.try-output {
  flex: 1;
  margin: 0;
  padding: 0.9rem 1rem;
  background: #0f172a;
  color: #f8fafc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95rem;
  line-height: 1.55;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.out-error {
  color: #fca5a5;
}

.out-muted {
  color: #94a3b8;
}

.try-preview {
  flex: 1;
  width: 100%;
  border: 0;
  background: #ffffff;
}

.try-runner-note {
  margin: 0;
  padding: 0.45rem 0.8rem;
  background: #f8fafc;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Exam page */
.exam-main {
  padding: 2rem 0 3.5rem;
}

.exam-hero {
  margin-bottom: 1.5rem;
}

.exam-hero h1 {
  margin: 0 0 0.35rem;
}

.exam-hero p {
  margin: 0;
  color: var(--text-muted);
}

.score-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.16rem 0.55rem;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
}

.score-badge.muted {
  background: var(--surface-alt);
  color: var(--text-muted);
}

.exam-card {
  max-width: 780px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.exam-intro {
  text-align: center;
}

.exam-intro h1 {
  margin: 0.25rem 0 0.5rem;
}

.exam-prev-score {
  color: var(--w3-green-hover);
}

.exam-intro-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.exam-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.exam-progress-bar {
  height: 8px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1.35rem;
}

.exam-progress-fill {
  height: 100%;
  background: var(--w3-green);
  transition: width 0.2s ease;
}

.exam-question {
  margin: 0 0 1rem;
  font-size: 1.2rem;
  line-height: 1.45;
}

.exam-code {
  background: #0f172a;
  color: #f8fafc;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  margin: 0 0 1.15rem;
}

.exam-choices {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.exam-choice {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  background: var(--surface-alt);
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  font: inherit;
  font-size: 0.98rem;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.exam-choice:hover {
  background: #e2e8f0;
}

.exam-choice.selected {
  background: #ecfdf5;
  border-color: var(--w3-green);
  font-weight: 600;
}

.choice-radio {
  color: var(--w3-green);
  font-size: 1.05rem;
  line-height: 1.4;
}

.exam-nav {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.result-banner {
  text-align: center;
  padding: 1.35rem;
  border-radius: 12px;
}

.result-banner.pass {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
}

.result-banner.fail {
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.result-banner h1 {
  margin: 0 0 0.35rem;
}

.result-score {
  font-size: 1.25rem;
  margin: 0 0 0.25rem;
}

.review-heading {
  margin: 1.75rem 0 0.9rem;
  font-size: 1.15rem;
}

.review-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.review-item {
  border: 1px solid var(--border);
  border-left: 5px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
}

.review-item.ok {
  border-left-color: var(--w3-green);
}

.review-item.bad {
  border-left-color: #dc2626;
}

.review-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.review-tag {
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.review-item.ok .review-tag {
  color: #166534;
}

.review-item.bad .review-tag {
  color: #b91c1c;
}

.review-user,
.review-correct,
.review-explain {
  margin: 0.3rem 0;
  font-size: 0.92rem;
}

.ans-ok {
  color: #166534;
  font-weight: 600;
}

.ans-bad {
  color: #b91c1c;
  font-weight: 600;
}

.review-explain {
  color: var(--text-muted);
}

@media (max-width: 900px) {
  .sidebar-toggle {
    display: inline-flex;
  }

  .learn-shell {
    grid-template-columns: 1fr;
  }

  .learn-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    height: 100vh;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .learn-sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close {
    display: inline-block;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 40;
  }
}

@media (max-width: 800px) {
  .try-page {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .try-workspace {
    grid-template-columns: 1fr;
    min-height: 85vh;
  }

  .try-editor-wrap {
    min-height: 300px;
  }

  .try-output,
  .try-preview {
    min-height: 260px;
  }
}

/* Practical coding exam */
.exam-main .card-actions > :last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.practice-callout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: linear-gradient(135deg, #ecfdf5 0%, #eff6ff 100%);
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  padding: 1.15rem 1.35rem;
  margin-bottom: 1.5rem;
}

.practice-callout h2 {
  margin: 0 0 0.25rem;
  font-size: 1.12rem;
}

.practice-callout p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.practice-callout-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.practice-main {
  flex: 1;
  padding: 2rem 0 3.5rem;
}

.practice-workspace-body {
  height: 100vh;
  overflow: hidden;
  background: #e7e9eb;
}

.practice-workspace-body .practice-main {
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.practice-catalog-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.35rem;
}

.practice-catalog-head h1 {
  margin: 0 0 0.35rem;
}

.practice-catalog-head p {
  margin: 0;
  color: var(--text-muted);
  max-width: 62ch;
}

.practice-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.practice-filters {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1.35rem;
}

.practice-card-actions {
  grid-template-columns: 1fr !important;
}

.mode-badge {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.16rem 0.55rem;
  border-radius: 999px;
}

.mode-badge-fill {
  background: #fef3c7;
  color: #92400e;
}

.mode-badge-write {
  background: #e0e7ff;
  color: #3730a3;
}

.practice-bar {
  background: var(--w3-dark);
  color: #ffffff;
  padding: 0.55rem 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.practice-bar-left,
.practice-bar-right {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.practice-bar-title {
  font-weight: 700;
  font-size: 0.95rem;
}

.practice-counter {
  font-size: 0.82rem;
  background: #38444d;
  color: #e2e8f0;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

.practice-workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 8px;
  padding: 8px;
}

.practice-left,
.practice-right {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.practice-left {
  overflow-y: auto;
  padding: 1rem;
  gap: 0.85rem;
}

.practice-info-card h1 {
  margin: 0.45rem 0 0.5rem;
  font-size: 1.3rem;
  line-height: 1.35;
}

.practice-prompt {
  margin: 0 0 0.85rem;
  color: #1e293b;
}

.practice-hint {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.8rem;
  margin-top: 0.65rem;
}

.practice-hint summary {
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}

.practice-hint p {
  margin: 0.45rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.solution-pre {
  background: #0f172a;
  color: #f8fafc;
  padding: 0.75rem;
  border-radius: 6px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  margin: 0.6rem 0;
}

.btn-sm {
  padding: 0.38rem 0.7rem;
  min-height: 32px;
  font-size: 0.82rem;
}

.practice-run-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 170px;
}

.practice-mini-out {
  min-height: 120px;
  max-height: 260px;
}

.practice-feedback {
  padding: 0.85rem 1rem;
  border-radius: 8px;
  font-size: 0.92rem;
  border: 1px solid var(--border);
  background: #f8fafc;
}

.practice-feedback.ok {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.practice-feedback.bad {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.fill-code-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 1rem;
  background: #f8fafc;
}

.fill-code {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95rem;
  line-height: 2;
  white-space: pre-wrap;
  word-break: break-word;
}

.blank-input {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.14rem 0.45rem;
  margin: 0 2px;
  border: 2px solid #94a3b8;
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  text-align: center;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.blank-input.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.blank-input.blank-ok {
  border-color: var(--w3-green);
  background: #dcfce7;
  color: #166534;
}

.blank-input.blank-bad {
  border-color: #dc2626;
  background: #fee2e2;
  color: #991b1b;
}

.word-bank-section {
  border-top: 1px solid var(--border);
  padding: 0.75rem 1rem;
  background: #ffffff;
}

.word-bank-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.word-chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: var(--surface-alt);
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.word-chip:hover {
  background: #dbeafe;
  border-color: var(--primary);
}

.practice-actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: #f8fafc;
}

.practice-editor-wrap {
  min-height: 240px;
}

.practice-tests-preview h3,
.practice-checklist-box h3 {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
}

.practice-checklist-box ul {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.9rem;
}

.test-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.test-table th,
.test-table td {
  border: 1px solid var(--border);
  padding: 0.42rem 0.55rem;
  text-align: left;
}

.test-table th {
  background: var(--surface-alt);
}

.test-results-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.65rem;
}

.test-result-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
  font-size: 0.88rem;
}

.test-result-card.ok {
  border-left-color: var(--w3-green);
  background: #f0fdf4;
}

.test-result-card.bad {
  border-left-color: #dc2626;
  background: #fef2f2;
}

.test-diff {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.84rem;
  margin-top: 0.35rem;
}

.test-diff span {
  color: var(--text-muted);
  font-weight: 600;
}

.test-detail-msg {
  font-size: 0.84rem;
  color: var(--text-muted);
}

@media (max-width: 860px) {
  .practice-workspace-body {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .practice-workspace {
    grid-template-columns: 1fr;
  }

  .practice-editor-wrap {
    min-height: 300px;
  }
}

/* Exam Proctor Timer & Anti-Tab-Switch */
.proctor-rules-box {
  text-align: left;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 5px solid #f59e0b;
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  margin: 1rem 0 0.5rem;
  font-size: 0.92rem;
}

.proctor-rules-box p {
  margin: 0.3rem 0;
  color: #78350f;
}

.proctor-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  margin-bottom: 1rem;
}

.proctor-timer {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  font-weight: 700;
  background: #1e293b;
  color: #f8fafc;
  padding: 0.25rem 0.65rem;
  border-radius: 8px;
}

.proctor-timer.warn {
  background: #d97706;
  color: #ffffff;
}

.proctor-timer.danger {
  background: #dc2626;
  color: #ffffff;
}

.proctor-shield {
  font-size: 0.82rem;
  font-weight: 600;
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
}

.result-banner.disqualified {
  background: #fef2f2;
  border: 2px solid #dc2626;
  color: #7f1d1d;
}

.disq-reason {
  font-weight: 600;
  color: #b91c1c;
  margin: 0.4rem 0;
}

.practice-gate-wrap {
  padding: 2rem 1rem;
}

.practice-gate-card {
  max-width: 640px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.practice-gate-card h1 {
  margin: 0.5rem 0;
  font-size: 1.45rem;
}

.blank-input:disabled {
  opacity: 0.92;
  cursor: not-allowed;
}

.word-chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.practice-actions-bar button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.practice-locked-note {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.86rem;
  font-weight: 600;
}

.fill-review-blanks {
  list-style: none;
  margin: 0.5rem 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.88rem;
}

.fill-review-blanks li {
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.7);
}

.fill-review-blanks li.ok strong {
  color: #166534;
}

.fill-review-blanks li.bad strong {
  color: #dc2626;
}

/* Try-it Project / Share Toolbar & Embed Mode */
.try-btn-save {
  background: #0d9488;
  border-color: #0f766e;
  color: #ffffff;
}

.try-btn-save:hover {
  background: #0f766e;
}

.try-btn-share {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #ffffff;
}

.try-btn-share:hover {
  background: #1d4ed8;
}

.try-notice-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.try-notice-btn {
  background: #04aa6d;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 0.25rem 0.7rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.try-notice-btn:hover {
  background: #059862;
}

body.try-embed .try-topbar-right #btn-my-projects,
body.try-embed .try-topbar-right #btn-back-lesson,
body.try-embed .try-runner-note {
  display: none;
}

/* OnlineGDB-style My Projects Page */
.gdb-page {
  margin: 0;
  min-height: 100vh;
  background: #eef1f4;
  color: #1f2937;
}

.gdb-mobile-bar {
  display: none;
  background: #1d5b8c;
  color: #ffffff;
  padding: 0.55rem 0.9rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.gdb-mobile-toggle {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  padding: 0.35rem 0.65rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.gdb-mobile-brand {
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
}

.gdb-shell {
  display: flex;
  min-height: 100vh;
}

.gdb-sidebar {
  width: 224px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #27689c 0%, #1c4e78 100%);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  padding: 1rem 0 0.75rem;
  box-shadow: 2px 0 10px rgba(15, 23, 42, 0.12);
}

.gdb-brand-box {
  padding: 0 1rem 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  text-align: center;
}

.gdb-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #ffffff;
  text-decoration: none;
  text-align: left;
}

.gdb-brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 1.1rem;
}

.gdb-brand-link strong {
  display: block;
  font-size: 1.05rem;
  line-height: 1.15;
}

.gdb-brand-link small {
  display: block;
  font-size: 0.72rem;
  color: #dbeafe;
}

.gdb-welcome {
  margin: 0.7rem 0 0;
  font-size: 0.84rem;
  color: #e2e8f0;
}

.gdb-welcome span {
  font-weight: 700;
  color: #ffffff;
}

.gdb-side-nav {
  display: flex;
  flex-direction: column;
  padding: 0.6rem 0;
  flex: 1;
}

.gdb-side-item {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
  padding: 0.62rem 1rem;
  text-align: center;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: background-color 0.12s ease;
}

.gdb-side-item:hover {
  background: rgba(255, 255, 255, 0.12);
}

.gdb-side-item.active {
  background: #153e61;
  border-left: 4px solid #5cb85c;
  color: #ffffff;
}

.gdb-side-divider {
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  margin: 0.5rem 1rem;
}

.gdb-badge {
  background: #ef4444;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
}

.gdb-side-footer {
  padding: 0.65rem 0.85rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  text-align: center;
  font-size: 0.72rem;
  color: #cbd5e1;
}

.gdb-side-footer p {
  margin: 0;
}

.gdb-sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 40;
}

.gdb-main {
  flex: 1;
  min-width: 0;
  padding: 1.25rem 1.5rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.gdb-header-card {
  background: #ffffff;
  border: 1px solid #dce3ea;
  border-radius: 6px;
  padding: 0.9rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.gdb-header-card h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 600;
  color: #334155;
}

.gdb-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.88rem;
}

.gdb-crumb-btn {
  background: none;
  border: none;
  color: #1d5b8c;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0.1rem 0.25rem;
}

.gdb-crumb-btn:hover {
  text-decoration: underline;
}

.gdb-crumb-sep {
  color: #94a3b8;
}

.gdb-crumb-current {
  font-weight: 700;
  color: #334155;
}

.gdb-content-card {
  background: #ffffff;
  border: 1px solid #dce3ea;
  border-radius: 6px;
  padding: 1.15rem 1.25rem 1.25rem;
}

.gdb-notice {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  padding: 0.55rem 0.9rem;
  border-radius: 6px;
  margin-bottom: 0.9rem;
  font-size: 0.9rem;
}

.gdb-notice.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.gdb-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.gdb-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.gdb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border-radius: 5px;
  padding: 0.45rem 0.85rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.gdb-btn-green {
  background: #5cb85c;
  border-color: #4cae4c;
  color: #ffffff;
}

.gdb-btn-green:hover {
  background: #4cae4c;
}

.gdb-btn-green.active-bin {
  background: #1d5b8c;
  border-color: #164870;
}

.gdb-btn-secondary {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}

.gdb-btn-secondary:hover {
  background: #e2e8f0;
}

.gdb-btn-danger {
  background: #dc2626;
  border-color: #b91c1c;
  color: #ffffff;
}

.gdb-btn-danger:hover {
  background: #b91c1c;
}

.gdb-btn-xs {
  padding: 0.28rem 0.55rem;
  font-size: 0.8rem;
}

.gdb-search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #475569;
}

.gdb-search-box input {
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  padding: 0.38rem 0.65rem;
  font: inherit;
  font-size: 0.88rem;
  min-width: 210px;
}

.gdb-search-box input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.gdb-table-wrap {
  overflow-x: auto;
}

.gdb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.gdb-table thead th {
  border-bottom: 2px solid #cbd5e1;
  padding: 0.65rem 0.6rem;
  text-align: left;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
}

.gdb-sort-btn {
  background: none;
  border: none;
  font: inherit;
  font-weight: 700;
  color: inherit;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.sort-caret {
  font-size: 0.72rem;
  color: #94a3b8;
}

.gdb-table thead th.sorted .sort-caret {
  color: #1d5b8c;
}

.gdb-table tbody tr {
  border-bottom: 1px solid #e2e8f0;
  transition: background-color 0.1s ease;
}

.gdb-table tbody tr:hover {
  background: #f8fafc;
}

.gdb-table tbody td {
  padding: 0.7rem 0.6rem;
  vertical-align: middle;
}

.gdb-name-cell {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.gdb-grip {
  color: #94a3b8;
  font-weight: 700;
  user-select: none;
}

.gdb-item-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: #1e293b;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
}

.gdb-item-link:hover {
  color: #1d5b8c;
  text-decoration: underline;
}

.gdb-lang-tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.42rem;
  border-radius: 4px;
  background: #e2e8f0;
  color: #334155;
  font-size: 0.74rem;
  font-weight: 700;
}

.gdb-actions-grid {
  display: inline-grid;
  grid-template-columns: repeat(4, 28px);
  gap: 4px;
}

.gdb-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 26px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #1e293b;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.gdb-icon-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.gdb-icon-btn.danger:hover {
  background: #fee2e2;
  color: #dc2626;
}

.gdb-bin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.gdb-empty-cell {
  text-align: center;
  padding: 2.2rem 1rem !important;
  color: #64748b;
}

.gdb-empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.gdb-entries-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.85rem;
  font-size: 0.86rem;
  color: #475569;
}

.gdb-local-hint {
  font-size: 0.8rem;
  color: #64748b;
}

/* Modals (Projects & Share) */
.gdb-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}

.gdb-modal-backdrop.hidden {
  display: none;
}

.gdb-modal {
  background: #ffffff;
  color: #1e293b;
  width: 100%;
  max-width: 520px;
  border-radius: 10px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.25);
  overflow: hidden;
}

.share-modal {
  max-width: 600px;
}

.gdb-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.15rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.gdb-modal-head h2 {
  margin: 0;
  font-size: 1.08rem;
}

.gdb-modal-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: #64748b;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
}

.gdb-modal-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.gdb-modal-body {
  padding: 1rem 1.15rem;
}

.gdb-form-group,
.share-field {
  margin-bottom: 0.9rem;
}

.gdb-form-group:last-child,
.share-field:last-child {
  margin-bottom: 0;
}

.gdb-form-group label,
.share-field label {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: #334155;
}

.gdb-form-group input,
.gdb-form-group select,
.share-field input,
.share-field textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0.5rem 0.7rem;
  font: inherit;
  font-size: 0.9rem;
  box-sizing: border-box;
}

.share-field input,
.share-field textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  background: #f8fafc;
}

.share-subtitle {
  margin: 0 0 0.85rem;
  font-weight: 600;
  color: #1d5b8c;
}

.share-input-row {
  display: flex;
  gap: 0.45rem;
  align-items: stretch;
}

.share-embed-row {
  align-items: flex-start;
}

.share-status {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
  color: #64748b;
}

.gdb-modal-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.8rem 1.15rem;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

@media (max-width: 860px) {
  .gdb-mobile-bar {
    display: flex;
  }

  .gdb-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .gdb-sidebar.open {
    transform: translateX(0);
  }

  .gdb-main {
    padding: 0.9rem 0.75rem 2rem;
  }
}
