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

/* ── Global: hide all scrollbars while keeping content scrollable ── */
*,
*::before,
*::after {
  scrollbar-width: none;           /* Firefox */
  -ms-overflow-style: none;        /* IE / Edge */
}
*::-webkit-scrollbar {
  display: none;                   /* Chrome / Safari / Opera */
}

:root {
  /* Slightly smaller footer so it doesn't dominate the UI */
  --footer-height: 30px;
  --topbar-height: 36px;
  /* Smaller header so the main canvas/panels have more vertical room */
  --header-height: 90px;

  /* Visual breathing room between main layout and the footer tabs */
  --footer-gap: 10px;
}

body {
  font-family: "Inter", "Segoe UI", sans-serif;
  background: #f2f6ff;
  color: #0f172a;
  height: 100vh;
  display: flex;
  flex-direction: column;
  /* Footer is fixed; keep content clear of it and add a small gap above it */
  padding-bottom: calc(var(--footer-height) + var(--footer-gap));
  font-size: 0.9rem; /* global base font size requested by user */
  overflow: hidden;
}

/* Enforce a consistent, slightly smaller text scale across the UI.
   This intentionally overrides component-level font-sizes so everything
   renders at ~0.85rem as requested. If you'd prefer a less aggressive
   approach, we can remove the !important and selectively adjust rules. */
/* body * {
  font-size: 0.85rem !important;
} */

.topbar {
  background: linear-gradient(135deg, #0b1020, #111827 60%);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  padding: 0.4rem 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.menu-bar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.menu {
  position: relative;
}

.menu-button {
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #f8fafc;
  padding: 0.35rem 0.8rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.menu-section {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

/* Cleaner layout for tour content */
.introjs-tooltip.prism-tour .tour-title {
  font-weight: 700;
  font-size: 1.1rem;
  text-align: center;
  margin-bottom: 6px;
  color: #0f172a;
}
.introjs-tooltip.prism-tour .tour-list {
  margin: 6px 0 0 1.1rem;
  padding: 0;
}
.introjs-tooltip.prism-tour .tour-list li {
  margin: 4px 0;
  line-height: 1.35;
}

/* Tour: footer step pinned to bottom (avoids transform/scroll positioning issues) */
.introjs-tooltip.prism-tour-footer {
  position: fixed !important;
  left: 50% !important;
  bottom: calc(var(--footer-height) + 14px) !important;
  top: auto !important;
  transform: translateX(-50%) !important;
  margin: 0 !important;
  max-width: min(520px, calc(100vw - 24px)) !important;
  z-index: 999999 !important;
}

/* Ensure the arrow doesn't show in a strange place for the pinned tooltip */
.introjs-tooltip.prism-tour-footer .introjs-arrow {
  display: none !important;
}
 
/* Restored menu dropdown and item styles */
.menu-dropdown {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.2);
  padding: 0.5rem;
  min-width: 180px;
  display: none;
  z-index: 20;
}

.menu-dropdown.open { display: block; }

.menu-item {
  display: flex;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  color: #0f172a;
}


.tab-dirty {
  color: #ffffff;
  font-size: 1.35rem;
  line-height: 1;
}
.menu-item:hover {
  background: #e2e8f0;
}

.menu-item.active {
  background: #1d4ed8;
  color: #f8fafc;
}

.roadmap-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%;
  background: #ffffff;
}

.roadmap-beta-banner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.7rem;
  background: linear-gradient(135deg, #fff7ed, #fffbeb);
  border: 1px solid #fed7aa;
  border-radius: 12px;
  color: #9a3412;
  box-shadow: 0 6px 14px rgba(251, 146, 60, 0.06);
}

.roadmap-beta-banner strong {
  font-size: 0.95rem;
  line-height: 1.25;
}

.roadmap-beta-banner p {
  margin-top: 0.05rem;
  color: #9a3412;
  line-height: 1.35;
  font-size: 0.82rem;
}

.roadmap-beta-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 0.18rem 0.46rem;
  border-radius: 999px;
  background: #f97316;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.roadmap-center-view {
  position: absolute;
  inset: 0;
  padding: 0.6rem;
  overflow: auto;
  background: #ffffff;
}

.roadmap-progress-card,
.roadmap-subtopic-card,
.roadmap-locked-card,
.roadmap-topic-item {
  background: #ffffff;
  border: 1px solid #dbe4f0;
  border-radius: 16px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.07);
}

.roadmap-main,
.roadmap-progress {
  min-height: 0;
}

.roadmap-progress,
.roadmap-main {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.roadmap-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.roadmap-count,
.roadmap-level-count {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 600;
}

.roadmap-topic-list,
.roadmap-detail {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  overflow: auto;
  background: #ffffff;
}

.roadmap-topic-item {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  width: 100%;
  padding: 0.85rem;
  cursor: pointer;
  text-align: left;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.roadmap-topic-item:hover {
  transform: translateY(-1px);
  border-color: #93c5fd;
  box-shadow: 0 16px 30px rgba(59, 130, 246, 0.12);
}

.roadmap-topic-item.active {
  border-color: #3b82f6;
  box-shadow: 0 14px 28px rgba(59, 130, 246, 0.14);
}

.roadmap-topic-order {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 800;
  flex-shrink: 0;
}

.roadmap-topic-copy {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.roadmap-topic-copy strong {
  font-size: 0.95rem;
  line-height: 1.2;
  color: #0f172a;
}

.roadmap-topic-copy small {
  color: #64748b;
  line-height: 1.35;
  font-size: 0.8rem;
}

.roadmap-locked-hint {
  color: #9a3412;
  font-weight: 700;
}

/* Learn mode: left panel tabs + question list */
/* Header layout for Learn: keep collapse button left, center the toggle */
#left-panel .panel-header {
  position: relative;
}

#left-panel .panel-header #toggle-left-panel {
  position: relative;
  z-index: 2;
}

.learn-left-tabs {
  display: flex;
  gap: 0;
  justify-content: center;
  align-items: center;
}

/* Make Learn left tabs look like the right panel toggle (pill group) */
.learn-left-tabs {
  background: rgba(226, 232, 240, 0.7);
  border: 1px solid rgba(203, 213, 225, 0.85);
  border-radius: 999px;
  width: fit-content;
  /* center inside header */
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.06);
}

.learn-right-panel-tip-list{
  margin-left: 1.1rem;
  color: #334155;
  line-height: 1.5;
}

.roadmap-locked-card {
  padding: 1rem;
  background: linear-gradient(180deg, #fff7ed, #ffffff);
  border-style: dashed;
}

.roadmap-locked-card p {
  color: #7c2d12;
  margin: 0.5rem 0 0.9rem;
  line-height: 1.45;
}

.pricing-plan-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.55rem;
  align-items: stretch;
  width: 100%;
  visibility: visible;
  opacity: 1;
}

.pricing-plan-card {
  border: 2px solid #d9dde5;
  border-radius: 16px;
  background: #ffffff;
  padding: 1.75rem 1.35rem 1.55rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  box-shadow: none;
  position: relative;
  min-height: 100%;
  visibility: visible;
  opacity: 1;
}

.pricing-plan-card.recommended {
  border: 2px solid #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.03), 0 12px 24px rgba(37, 99, 235, 0.08);
}

.pricing-plan-card--free {
  background: linear-gradient(180deg, #f3f4f6 0%, #ffffff 62%);
}

.pricing-plan-card--basic {
  background: linear-gradient(180deg, #dbeafe 0%, #ecfeff 62%, #ffffff 100%);
}

.pricing-plan-card--pro {
  background: linear-gradient(180deg, #ede9fe 0%, #dbeafe 58%, #ffffff 100%);
}

.pricing-plan-card--elite {
  background: linear-gradient(180deg, #ffedd5 0%, #fce7f3 62%, #ffffff 100%);
}

.pricing-plan-card.current {
  background: linear-gradient(180deg, #f8fbff, #ffffff);
  border-color: #0f172a;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.pricing-plan-top-badge {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 112px;
  padding: 0.42rem 0.95rem;
  border-radius: 999px;
  background: #2563eb;
  color: #ffffff;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.15;
  box-shadow: none;
}

.pricing-plan-card-head {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  align-items: center;
  text-align: center;
}

.plan-name-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: center;
}

.pricing-current-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.plan-name-row h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 800;
  color: #0f172a;
}

.pricing-plan-price {
  display: block;
  margin: 0;
  color: #0f172a;
  font-size: 1.4rem;
  font-weight: 900;
  text-align: center;
}

.pricing-plan-blurb {
  color: #667085;
  line-height: 1.45;
  min-height: 0;
  margin: 0;
  font-size: 0.92rem;
}

.pricing-feature-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  color: #334155;
  padding: 0;
  margin: 0;
}

.pricing-feature-list li {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 0.8rem;
  align-items: start;
}

.feature-check {
  color: #16a34a;
  font-size: 1.12rem;
  font-weight: 900;
  line-height: 1.1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.feature-lock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.4rem;
}

.pricing-feature-list li div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.pricing-feature-list strong {
  color: #0f172a;
  font-size: 0.92rem;
}

.pricing-feature-list span {
  color: #475569;
  line-height: 1.35;
  font-size: 0.88rem;
}

.plan-action {
  margin-top: auto;
  padding-top: 0.2rem;
}

.plan-action .button {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  font-size: 0.94rem;
  font-weight: 700;
  box-shadow: none;
}

.plan-action .button:not(.primary) {
  background: #f3f4f6;
  border-color: #f3f4f6;
  color: #111827;
}

.plan-action .button:disabled {
  opacity: 1;
}

.learn-question-item.is-locked {
  border: 1px dashed #fdba74;
  background: linear-gradient(180deg, #fff7ed, #ffffff);
}

.learn-lock-pill {
  background: #fff1f2;
  color: #be123c;
}

.learn-lock-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid #d7dce5;
  background: linear-gradient(180deg, #f8fafc, #eef2f7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  color: #475467;
  flex-shrink: 0;
}

.learn-lock-icon-badge svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

@media (max-width: 1200px) {
  .pricing-plan-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .pricing-plan-grid {
    grid-template-columns: 1fr;
  }

  .pricing-plan-card {
    padding-top: 2rem;
  }
}
.learn-left-tabs .tab-button {
  border: 0;
  background: transparent;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  color: #334155;
}

.learn-left-tabs .tab-button.active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 10px 22px rgba(2, 6, 23, 0.10);
}

.learn-left-tabs .tab-button:focus {
  outline: 2px solid rgba(99, 102, 241, 0.40);
  outline-offset: 2px;
}

.learn-left-design .learn-design-controls {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 12px;
  /* background: rgba(241, 245, 249, 0.75); */
}

.learn-design-filter {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: #334155;
  font-weight: 700;
}

#learn-difficulty-filter {
  padding: 8px 12px;
  border: 1px solid rgba(148, 163, 184, 0.85);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  font-size: 14px;
  font-weight: 600;
  min-width: 120px;
}

.learn-question-list {
  max-height: calc(100vh - 240px);
  overflow: auto;
  /* padding-right: 4px; */
}

.learn-question-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 12px;
  border: 1px solid rgba(226,232,240,0.95);
  border-radius: 14px;
  /* Neutral default (very light) */
  background: linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(241,245,249,0.9) 100%);
  margin-bottom: 12px;
  cursor: pointer;
}

/* Difficulty-tinted cards (subtle, readable) */
.learn-question-item[data-difficulty="easy"] {
  border-color: rgba(134, 239, 172, 0.45);
  background: linear-gradient(180deg, rgba(255,255,255,0.99) 0%, rgba(220,252,231,0.40) 100%);
}

.learn-question-item[data-difficulty="medium"] {
  border-color: rgba(253, 230, 138, 0.55);
  background: linear-gradient(180deg, rgba(255,255,255,0.99) 0%, rgba(254,243,199,0.48) 100%);
}

.learn-question-item[data-difficulty="hard"] {
  border-color: rgba(252, 165, 165, 0.55);
  background: linear-gradient(180deg, rgba(255,255,255,0.99) 0%, rgba(254,226,226,0.55) 100%);
}

.learn-question-item:hover {
  border-color: rgba(99,102,241,0.45);
  box-shadow: 0 10px 24px rgba(2,6,23,0.08);
}

.learn-question-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.learn-question-title {
  font-weight: 700;
  font-size: 14px;
  color: #0f172a;
}

.learn-question-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: #475569;
}

.learn-diff-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid rgba(226,232,240,0.9);
  background: rgba(241,245,249,0.8);
}

.learn-diff-pill.easy { color: #166534; background: rgba(220,252,231,0.7); border-color: rgba(134,239,172,0.8); }
.learn-diff-pill.medium { color: #92400e; background: rgba(254,243,199,0.7); border-color: rgba(253,230,138,0.9); }
.learn-diff-pill.hard { color: #991b1b; background: rgba(254,226,226,0.8); border-color: rgba(252,165,165,0.85); }

.learn-question-desc {
  font-size: 13px;
  line-height: 1.4;
  color: #475569;
}

/* Bump left-panel base readability a bit (Learn + general) */
#left-panel {
  font-size: 15px;
}

#left-panel h2,
#left-panel .panel-header h2 {
  font-size: 16px;
  letter-spacing: 0.2px;
}

.roadmap-empty-state {
  padding: 1rem;
  border: 1px dashed #bfd1ea;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  color: #475569;
}

.roadmap-empty-state h4,
.roadmap-progress-card h4,
.roadmap-topic-detail-header h3,
.roadmap-subtopic-card h5 {
  font-size: 0.95rem;
}

.roadmap-empty-state p,
.roadmap-progress-card p,
.roadmap-level-count,
.roadmap-content-block p,
.roadmap-content-block ul,
.roadmap-notes-list {
  font-size: 0.92rem;
}

.roadmap-content-block ul {
  margin: 0.35rem 0 0.2rem 1.1rem;
  padding-left: 0.25rem;
  line-height: 1.55;
}

.roadmap-content-block li {
  margin: 0.2rem 0;
}

.roadmap-topic-detail-header,
.roadmap-level-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.roadmap-topic-detail-header h3 {
  margin: 0;
  line-height: 1.2;
  color: #0f172a;
}

.roadmap-topic-level {
  font-size: 0.9rem;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
}

.roadmap-level-header {
  justify-content: flex-end;
}

.roadmap-level-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.roadmap-subtopic-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.roadmap-subtopic-card,
.roadmap-locked-card,
.roadmap-progress-card {
  padding: 0.9rem 0.95rem;
}

.roadmap-subtopic-card h5 {
  margin: 0;
  line-height: 1.2;
  color: #0f172a;
}

.roadmap-subtopic-title {
  text-align: center;
}

.roadmap-subtopic-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.9rem;
}

.roadmap-learn-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.roadmap-learn-link:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  transform: translateY(-1px);
}

.roadmap-content-block {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.85rem;
}

.roadmap-content-block p,
.roadmap-locked-card,
.roadmap-progress-card p {
  color: #334155;
  line-height: 1.55;
}

.roadmap-notes-list {
  margin: 0.75rem 0 0 1rem;
  color: #334155;
  line-height: 1.6;
}

.roadmap-notes-list li + li {
  margin-top: 0.4rem;
}

.roadmap-content-block ul {
  margin-left: 1rem;
  color: #334155;
  line-height: 1.55;
}

.roadmap-content-block li + li {
  margin-top: 0.3rem;
}

@media (max-width: 1280px) {
  .roadmap-center-view {
    padding: 0.5rem;
  }
}

/* ------------------------------
   Pricing modal
--------------------------------*/
.pricing-modal {
  max-width: 1020px;
  width: min(1020px, 96vw);
  border-radius: 22px;
}

#pricing-modal .modal-content {
  width: min(1060px, calc(100vw - 32px));
  max-width: 1060px;
  border-radius: 20px;
  padding: 2rem 2rem 1.45rem;
  background: #ffffff;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
}

/* Pricing comparison table */
.pricing-cards {
  margin-top: 1.5rem;
  min-height: 220px;
  display: block;
  width: 100%;
  visibility: visible;
  opacity: 1;
  overflow: visible;
}

.pricing-comparison-section {
  margin-top: 1.75rem;
}

.pricing-comparison-title {
  margin: 0 0 0.8rem;
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
}

.pricing-comparison-table {
  width: 100%;
}

.pricing-compare-scroll {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  background: #ffffff;
}

.pricing-compare-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.pricing-compare-table th,
.pricing-compare-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: middle;
}

.pricing-compare-table thead th {
  background: #f8fafc;
  color: #0f172a;
  font-size: 0.92rem;
  font-weight: 800;
}

.pricing-compare-table tbody td:first-child {
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
}

.pricing-compare-table tbody tr:last-child td {
  border-bottom: none;
}

.pricing-table-value {
  color: #475569;
  font-size: 0.92rem;
  line-height: 1.4;
}

#pricing-modal .modal-header {
  align-items: flex-start;
  text-align: left;
  gap: 0.85rem;
  padding-right: 2rem;
}

#pricing-modal .modal-header h2 {
  margin: 0;
  font-size: 1.85rem;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: #0f172a;
}

#pricing-modal .modal-message {
  margin: 0;
  max-width: 560px;
  color: #475467;
  font-size: 0.96rem;
  line-height: 1.45;
}

.pricing-beta-note {
  margin: 0.5rem auto 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(59, 130, 246, 0.2));
  color: #1d4ed8;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.12);
}

#pricing-modal .modal-close {
  top: 20px;
  right: 20px;
  color: #6b7280;
}

.pricing-plan-empty {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  min-height: 220px;
  border: 1px dashed #cbd5e1;
  border-radius: 18px;
  background: #f8fafc;
  color: #475569;
  text-align: center;
  padding: 1.25rem;
}

.pricing-footer {
  margin-top: 1rem;
  gap: 0.55rem;
}

.pricing-footer .modal-helper {
  color: #64748b;
}

#pricing-current-plan {
  display: block;
  font-size: 0.98rem;
  color: #0f172a;
  font-weight: 700;
  text-transform: uppercase;
}

#pricing-current-plan strong {
  font-weight: 900;
  letter-spacing: 0.04em;
}

#pricing-trial-note {
  display: none;
}

#usage-widget {
  margin-top: 0.35rem;
}

.pricing-plan-empty h3 {
  color: #0f172a;
  font-size: 1rem;
}

/* The core layout: fixed column widths so every row aligns perfectly */
.pricing-compare {
  display: table;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 18px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.09);
  border: 1px solid #e2e8f0;
}

.pricing-compare-head,
.pricing-compare-body {
  display: table-row-group;
}

.pricing-compare-row {
  display: table-row;
}

.pricing-compare-cell {
  display: table-cell;
  vertical-align: middle;
  padding: 11px 18px;
  border-bottom: 1px solid #e9eef6;
  font-size: 0.93rem;
  color: #0f172a;
}

/* Column widths via first row */
.pricing-compare-cell:first-child  { width: 42%; }
.pricing-compare-cell:nth-child(2) { width: 19%; }
.pricing-compare-cell:nth-child(3) { width: 19%; }
.pricing-compare-cell:nth-child(4) { width: 20%; }

/* Header row */
.pricing-compare-header .pricing-compare-cell {
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  padding: 14px 18px;
}

.pricing-compare-header .feature-col {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: #64748b;
}

/* Plan name cells in header */
.plan-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}

.plan-name {
  font-size: 1.2rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
}

/* Pro column highlighted throughout */
.pricing-compare-cell.col-pro {
  background: rgba(29, 78, 216, 0.04);
}

.pricing-compare-header .col-pro {
  background: rgba(29, 78, 216, 0.08);
  border-bottom: 2px solid rgba(29, 78, 216, 0.3);
}

.pricing-compare-header .col-pro .plan-name {
  color: #1d4ed8;
}

/* Feature label column */
.pricing-compare-cell.feature-col {
  font-weight: 600;
  color: #1e293b;
  font-size: 0.93rem;
}

/* Tick cells: centred */
.pricing-compare-body .pricing-compare-cell:not(.feature-col) {
  text-align: center;
}

/* Alternate row striping */
.pricing-compare-body .pricing-compare-row:nth-child(even) .pricing-compare-cell {
  background: rgba(241, 245, 249, 0.5);
}
.pricing-compare-body .pricing-compare-row:nth-child(even) .pricing-compare-cell.col-pro {
  background: rgba(29, 78, 216, 0.05);
}

/* Ticks */
.tick {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 900;
  font-size: 0.93rem;
  line-height: 1;
  border: 1.5px solid transparent;
}

.tick.on {
  color: #16a34a;
  background: rgba(22, 163, 74, 0.10);
  border-color: rgba(22, 163, 74, 0.30);
}

.tick.off {
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.08);
  border-color: rgba(148, 163, 184, 0.20);
}

/* Bottom action row */
.pricing-compare-actions .pricing-compare-cell {
  background: #f8fafc;
  border-top: 2px solid #e2e8f0;
  border-bottom: none;
  padding: 16px 18px;
}

.pricing-compare-actions .col-pro {
  background: rgba(29, 78, 216, 0.06);
  border-top: 2px solid rgba(29, 78, 216, 0.3);
}

.plan-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.plan-price {
  font-size: 0.88rem;
  color: #334155;
  font-weight: 700;
}

.plan-action .button {
  width: 100%;
  padding: 9px 10px;
  border-radius: 14px;
  font-size: 0.9rem;
  font-weight: 700;
}

.plan-action .button.primary {
  box-shadow: 0 6px 16px rgba(29, 78, 216, 0.28);
}

.pricing-footer {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

@media (max-width: 680px) {
  .pricing-modal {
    width: 98vw;
  }

  #pricing-modal .modal-content {
    width: calc(100vw - 16px);
    padding: 1.25rem 1rem 1rem;
  }

  #pricing-modal .modal-header h2 {
    font-size: 1.55rem;
  }

  .pricing-compare-cell {
    padding: 10px 10px;
  }
  .pricing-compare-cell.feature-col {
    font-size: 0.82rem;
  }
}

@media (max-width: 760px) {
  .pricing-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .pricing-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.pricing-card {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #ffffff;
  padding: 14px;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pricing-card.featured {
  border-color: rgba(29, 78, 216, 0.35);
  background: linear-gradient(180deg, rgba(29, 78, 216, 0.06), #ffffff 40%);
}

.pricing-card-top h3 {
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.pricing-price {
  font-weight: 800;
  color: #0f172a;
}

.pricing-tag {
  color: #475569;
  font-size: 0.85rem;
}

.pricing-features {
  list-style: none;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #0f172a;
}

.pricing-features li {
  position: relative;
  padding-left: 18px;
  line-height: 1.35;
}

.pricing-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: #16a34a;
  font-weight: 800;
}

/* Pricing feature toggle (green tick vs gray tick) */
.pricing-features li.feature-on::before {
  content: "✓";
  color: #16a34a;
}

.pricing-features li.feature-off {
  color: #64748b;
}

.pricing-features li.feature-off::before {
  content: "✓";
  color: #94a3b8;
}

.pricing-footer {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 0.35rem 0.4rem;
}

.menu-section {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.menu-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  padding: 0.2rem 0.6rem 0.1rem;
}

.header {
  padding: 0.6rem 1.2rem;
  background: linear-gradient(135deg, #0b1020, #111827 60%);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.header h1 {
  font-size: 1.4rem;
  margin-bottom: 0.1rem;
  color: #f8fafc;
}

.header p {
  color: #d1d5db;
}

.header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
}

.auth-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  position: relative;
}

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #334155;
  background: rgba(89, 132, 232, 0.6);
  color: #f8fafc;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.user-avatar:hover {
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.25);
}

.profile-dropdown {
  right: 0;
  left: auto;
  min-width: 200px;
}

.mode-toggle {
  display: inline-flex;
  background: #1f2937;
  border-radius: 999px;
  padding: 4px;
  border: 1px solid #334155;
  gap: 4px;
}

.mode-button {
  border: none;
  background: transparent;
  color: #cbd5f5;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.35rem 0.9rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 140px;
}

.mode-button.active {
  background: #f8fafc;
  color: #3b6eb9;
}

.preset-picker select {
  /* Ensure consistent styling across Windows/Chromium */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-color: #326aee;
  color: #f8fafc;
  border-radius: 30px;
  border: 1px solid #334155;
  padding: 0.35rem 2.1rem 0.35rem 0.9rem; /* extra space for chevron */
  font-size: 0.9rem;
  min-width: 240px;
  line-height: 1.25rem;
  /* Custom chevron */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5.5 7.5L10 12l4.5-4.5' stroke='%23f8fafc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 12px;
}

.preset-picker select option,
.stage-picker select option {
  background: #ffffff;
  color: #0f172a;
}

.preset-picker select:focus {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

.learn-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.learn-controls .mode-button {
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 30px;
}

.learn-controls .mode-button.active,
.learn-controls .mode-button[aria-pressed="true"] {
  background: #38bdf8;
  color: #0f172a;
}

.stage-picker select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-color: #0f172a;
  color: #f8fafc;
  border-radius: 30px;
  border: 1px solid #334155;
  padding: 0.35rem 2.1rem 0.35rem 0.9rem; /* extra space for chevron */
  font-size: 0.9rem;
  min-width: 250px;
  line-height: 1.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5.5 7.5L10 12l4.5-4.5' stroke='%23cbd5e1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 12px;
}

/* Hide default arrow on IE/legacy Edge */
select::-ms-expand {
  display: none;
}

/* Focus state for accessibility */
.preset-picker select:focus,
.stage-picker select:focus {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

/* High contrast/forced-colors mode: let OS colors win for readability */
@media (forced-colors: active) {
  .preset-picker select,
  .stage-picker select {
    background-color: Canvas;
    color: CanvasText;
    border-color: CanvasText;
    background-image: none;
  }
}

.hidden {
  display: none !important;
}

.badge {
  background: #f97316;
  color: #fff7ed;
  padding: 0.32rem 0.6rem;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.layout {
  /* Allow a narrower left panel (especially useful for Learn question list) */
  --left-panel-w: clamp(190px, 16vw, 280px);
  --right-panel-w: clamp(220px, 18vw, 300px);
  display: grid;
  grid-template-columns: var(--left-panel-w) 1fr var(--right-panel-w);
  gap: clamp(0.5rem, 1.2vw, 1.5rem);
  padding: clamp(0.5rem, 0.8vw, 1.1rem) clamp(0.5rem, 1vw, 1.5rem) clamp(0.8rem, 1vw, 1.5rem);
  flex: 1;
  height: calc(100vh - var(--header-height) - var(--topbar-height) - var(--footer-height));
  align-items: stretch;
}

.layout.left-collapsed {
  grid-template-columns: 0 1fr var(--right-panel-w);
}

.layout.right-collapsed {
  grid-template-columns: var(--left-panel-w) 1fr 0;
}

.layout.left-collapsed.right-collapsed {
  grid-template-columns: 0 1fr 0;
}

/* Left-panel drag-to-resize handle */
#left-resize-handle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 10;
  background: transparent;
  transition: background 0.15s;
}
#left-resize-handle:hover,
#left-resize-handle.dragging {
  background: rgba(99, 102, 241, 0.25);
}

/* Right-panel drag-to-resize handle */
#right-resize-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  z-index: 10;
  background: transparent;
  transition: background 0.15s;
}
#right-resize-handle:hover,
#right-resize-handle.dragging {
  background: rgba(99, 102, 241, 0.25);
}

#left-panel {
  position: relative;
  transition: all 0.25s ease;
}

#right-panel {
  position: relative;
  transition: all 0.25s ease;
}

#right-panel {
  gap: 1rem;
}

#right-panel .panel-header h2,
#right-panel h2 {
  font-size: 0.9rem;
  letter-spacing: 0.06em;
}

#right-panel .output {
  font-size: 0.9rem;
  color: #475569;
  flex: 1;
  min-height: 0;
  overflow: auto;
  scrollbar-width: none;
}

#right-panel .output::-webkit-scrollbar {
  width: 0;
  height: 0;
}

#right-panel .result-block {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.06);
}

#right-panel .result-block h4 {
  font-size: 0.85rem;
}

/* Password checklist shown during signup */
.pw-checklist {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 360px;
  font-size: 0.93rem;
  color: #5b6270;
}
.pw-checklist .pw-rule {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: transparent;
  transition: all 220ms ease;
}
.pw-checklist .pw-rule::before {
  content: '\2716'; /* cross when unmet */
  display: inline-block;
  width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 50%;
  background: #f1f5f9;
  color: #334155;
  font-size: 0.8rem;
}
.pw-checklist .pw-rule.met {
  color: #065f46;
  opacity: 0.85;
}
.pw-checklist .pw-rule.met::before {
  content: '\2714'; /* check mark */
  background: #bbf7d0;
  color: #065f46;
}
.pw-checklist .pw-rule.removed {
  opacity: 0;
  transform: translateX(8px) scale(0.98);
}

/* Screen-reader only utility */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* ── Intro.js tour overrides ──────────────────────────────────────────────── */

/* Never let the tooltip go above the viewport */
.introjs-tooltip {
  max-width: 340px !important;
  min-width: 220px !important;
  border-radius: 12px !important;
  box-shadow: 0 8px 32px rgba(2,6,23,0.16) !important;
  font-family: inherit !important;
  font-size: 0.88rem !important;
}

/* When Intro.js places the tooltip above an element it adds .introjs-top —
   if that would go off-screen (header at y=0) force it below instead */
.introjs-tooltip.introjs-top {
  margin-top: 0 !important;
}

/* Prevent the floating tooltip from ever rendering with a negative top */
.introjs-fixedTooltip {
  top: max(8px, var(--introjs-top, 8px)) !important;
}

/* Progress bar */
.introjs-progressbar {
  background: #3b82f6 !important;
}

/* Buttons */
.introjs-button {
  border-radius: 8px !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
}
.introjs-nextbutton {
  background: #3b82f6 !important;
  color: #fff !important;
  border-color: #3b82f6 !important;
  text-shadow: none !important;
}
.introjs-nextbutton:hover {
  background: #2563eb !important;
}
.introjs-prevbutton {
  color: #334155 !important;
  background: #f1f5f9 !important;
  border-color: #e2e8f0 !important;
  text-shadow: none !important;
}

/* Tour rich-content styles used inside intro HTML */
.tour-canvas { padding: 2px 0; }
.tour-title { font-weight: 700; font-size: 0.93rem; margin-bottom: 6px; color: #0f172a; }
.tour-list { margin: 0; padding-left: 18px; }
.tour-list li { margin-bottom: 4px; line-height: 1.45; }

/* Practice Setup (Simulation panel) */
#simulate-view {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

#simulate-view .simulation-panel {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* practice-content: flex column, fills available space, does NOT scroll itself */
#practice-content {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Sticky header: design dropdown + stage picker — never moves */
.learn-sticky-header {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  /* background: #f8fafc; */
  padding-bottom: 10px;
  z-index: 2;
}

/* Practice mode: header row inside sticky header (mirror right-panel .panel-header) */
.practice-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

.practice-header-title {
  margin: 0;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0f172a;
}

/* Stage theory: the only part that scrolls */
.stage-theory {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 10px 0 10px;
  border-top: 1px solid #e6eefc;
  /* margin-top: 4px; */
}
.stage-theory.hidden { display: none; }

#simulation-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.simulation-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.practice-setup {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 0 8px 0; /* slightly reduced bottom padding to tighten spacing */
}

/* Learn mode: hide the entire practice setup area in the right panel */
.practice-setup.hidden {
  display: none;
}

/* Learn mode: right-panel tip (shown before a question is selected) */
.learn-right-panel-tip {
  margin: 10px 10px 0 10px;
  padding: 14px 14px;
  border-radius: 16px;
  border: 1px solid rgba(203, 213, 225, 0.7);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(241, 245, 249, 0.85) 100%);
  box-shadow: 0 14px 30px rgba(2, 6, 23, 0.06);
}

.learn-right-panel-tip.hidden {
  display: none;
}

.learn-right-panel-tip h4 {
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 6px;
}

.learn-right-panel-tip p {
  color: #475569;
  line-height: 1.45;
  font-size: 0.9rem;
}
.practice-setup label {
  font-weight: 700;
  color: #0f172a;
}
.practice-setup select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #0f172a;
  padding: 0.45rem 2.1rem 0.45rem 0.8rem; /* extra space for chevron */
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  min-width: 240px;
  max-width: 420px;
  line-height: 1.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5.5 7.5L10 12l4.5-4.5' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 12px;
}
.practice-setup select:focus {
  outline: 2px solid rgba(147, 197, 253, 0.9);
  outline-offset: 2px;
}
.practice-setup select:disabled {
  opacity: 0.6;
}
/* Stronger selector to ensure the practice dropdown uses the Evaluate-like styling
   even if other select rules (e.g. .preset-picker select) are present. */
#practice-preset-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: rgba(148, 163, 184, 0.15) !important;
  border: 1px solid rgba(148, 163, 184, 0.3) !important;
  color: #0f172a !important;
  padding: 0.45rem 2.1rem 0.45rem 0.8rem !important;
  border-radius: 10px !important;
  font-size: 0.85rem !important;
  /* font-weight: 600; */
  min-width: 240px;
  max-width: 420px;
  line-height: 1.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5.5 7.5L10 12l4.5-4.5' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  background-size: 12px 12px !important;
}
#practice-preset-select:focus {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 2px;
}

/* Learn mode stage picker (now lives in the right panel) */
.learn-stage-picker {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 0 4px 0;
  /* No divider above the stage picker — it should sit flush under the header */
  border-top: none;
  margin-top: 0;
}
/* In Learn mode the "What are you designing?" label is hidden via JS;
   tighten the select so it sits flush under the sticky header edge */
.learn-sticky-header .practice-setup {
  padding-bottom: 2px;
}
.learn-sticky-header .practice-setup label.hidden {
  display: none;
}
.learn-stage-picker label {
  font-weight: 700;
  color: #0f172a;
  font-size: 0.85rem;
}
.learn-stage-picker select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #0f172a;
  padding: 0.45rem 2.1rem 0.45rem 0.8rem;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 240px;
  max-width: 420px;
  line-height: 1.25rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5.5 7.5L10 12l4.5-4.5' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 12px;
}

/* Right panel header: keep the Simulate/FAQ pill centered even with the close button */
#right-panel .panel-header {
  position: relative;
}

#right-panel #right-panel-tabs {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.learn-stage-picker select:focus {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 2px;
}
.learn-stage-hint {
  font-size: 0.85rem;
  color: #64748b;
  margin: 0;
  line-height: 1.4;
}

/* Learn mode: show selected problem statement name at top-center of canvas */
.learn-problem-title {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  max-width: min(720px, calc(100% - 180px));
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(203, 213, 225, 0.85);
  background: rgba(226, 232, 240, 0.75);
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.06);
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  color: #0f172a;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preset-info-card {
  background: #ffffff;
  border: 1px solid #e6eefc;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 6px 18px rgba(2,6,23,0.04);
  color: #0f172a;
}
.preset-info-card h4 {
  margin: 0 0 6px 0;
  font-size: 0.85rem;
  line-height: 1.15;
  font-weight: 700;
}
.preset-info-card .meta {
  color: #475569;
  font-size: 0.85rem;
  margin-bottom: 2px;
}
.preset-info-card .checklist {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.preset-info-card .checklist li {
  list-style: none;
  padding-left: 0;
}
.preset-info-card .difficulty {
  /* stack difficulty as its own row under the preset text */
  display: block;
  margin-top: 8px;
}

/* difficulty bar (3 segments). Use data-level="1|2|3" to indicate fill */
.difficulty-graph {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.difficulty-graph .seg {
  width: 26px;
  height: 8px;
  border-radius: 6px;
  background: #eef4ff;
  box-shadow: inset 0 -1px 0 rgba(15,23,42,0.02);
}
.difficulty-graph[data-level="1"] .seg:nth-child(-n+1),
.difficulty-graph[data-level="2"] .seg:nth-child(-n+2),
.difficulty-graph[data-level="3"] .seg:nth-child(-n+3) {
  background: linear-gradient(90deg,#60a5fa,#3b82f6);
}
.difficulty-label {
  font-size: 0.7rem;
  color: #0f172a;
  font-weight: 700;
  padding-left: 8px;
}

/* Practice task cards (question prompts) */
.practice-tasks {
  /* margin-top: 4px; */
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 5px;
}
.practice-task-card {
  background: #ffffff;
  border: 1px solid #eef4ff;
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 6px 18px rgba(15,23,42,0.05);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  /* min-height: 58px; */
  /* Animated collapse */
  overflow: hidden;
  max-height: 300px;
  opacity: 1;
  transform: translateY(0) scale(1);
  transition:
    max-height 0.35s ease,
    opacity 0.25s ease,
    transform 0.25s ease,
    margin-bottom 0.35s ease,
    padding 0.35s ease,
    box-shadow 0.2s ease;
}
.practice-task-card.completing {
  max-height: 0;
  opacity: 0;
  transform: translateY(-6px) scale(0.97);
  margin-bottom: 0 !important;
  padding-top: 0;
  padding-bottom: 0;
  box-shadow: none;
  pointer-events: none;
}
.practice-task-card .question {
  margin: 0;
  font-size: 0.88rem;
  color: #0b1220;
  line-height: 1;
  flex: 1 1 auto;
  word-break: break-word;
}
.practice-task-card .question strong {
  color: #0b1220;
}
.practice-task-card .task-actions {
  margin-left: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.practice-task-card .task-actions .task-done {
  width: 18px;
  height: 18px;
  appearance: none;
  border-radius: 50%;
  border: 2px solid #cfe0ff;
  background: #ffffff;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(15,23,42,0.02);
}
.practice-task-card .task-actions .task-done:checked {
  background: linear-gradient(90deg,#60a5fa,#3b82f6);
  border-color: #60a5fa;
}

/* Hint icon + tooltip */
.task-hint-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.task-hint-icon {
  width: 18px;
  height: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.55;
  transition: opacity 0.15s ease, transform 0.15s ease;
  user-select: none;
  flex-shrink: 0;
}
.task-hint-icon svg {
  width: 15px;
  height: 15px;
  display: block;
}
.task-hint-wrap:hover .task-hint-icon {
  opacity: 1;
  transform: scale(1.15);
}

/* Global floating tooltip — appended to <body> so overflow:hidden/auto never clips it */
#task-hint-floating-tooltip {
  position: fixed;
  z-index: 9999;
  width: 230px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.78rem !important;
  line-height: 1.5;
  padding: 9px 11px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15,23,42,0.28);
  pointer-events: none;
  white-space: normal;
  word-break: break-word;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
#task-hint-floating-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}
#task-hint-floating-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 12px;
  border: 6px solid transparent;
  border-top-color: #0f172a;
}

.practice-tasks-header {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: #0f172a;
}
.practice-tasks-empty-note {
  color: #667085;
  font-size: 0.84rem;
  padding: 8px 4px;
}

/* Tasks panel - separate scrollable box */
.preset-tasks-panel {
  margin-top: 4px; /* tightened gap between preset info and tasks */
  background: #ffffff;
  border: 1px solid #eef4ff;
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 6px 18px rgba(15,23,42,0.04);
  /* Let the tasks panel take available space inside the simulation panel
     and scroll internally so it doesn't push other UI (like the Simulate button). */
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

/* On very tall screens the panel will naturally expand; rely on flex sizing. */

/* Ensure the output area inside the simulation panel doesn't grow and push
   the actions row down; it should stay below tasks and be sized naturally. */
.simulation-panel > #output { flex: 0 0 auto; }

/* reduce vertical spacing between info and tasks header */
.practice-tasks-header { margin-bottom: 4px; }

.panel-tabs {
  justify-content: center;
  align-items: center;
  display: inline-flex;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.12), rgba(99, 102, 241, 0.25));
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 999px;
  /* padding: 5px; */
  width: max-content;
  align-self: center;
  margin: 0;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(6px);
}

.tab-button {
  border: none;
  background: transparent;
  color: #1f2937;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-button.active {
  background: #f8fafc;
  color: #0f172a;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.2);
}

.panel-view {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: 0.8rem;
  flex: 1;
  min-height: 0;
}

/* Evaluation right panel: allow scrolling within the panel and hide scrollbars */
#evaluate-view {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 0;
  scrollbar-width: none;          /* Firefox */
}
#evaluate-view::-webkit-scrollbar { /* Chrome/Safari */
  display: none;
}

/* Evaluation right panel: allow scrolling within the panel and hide scrollbars */
#evaluate-view {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 0;
  scrollbar-width: none;          /* Firefox */
}
#evaluate-view::-webkit-scrollbar { /* Chrome/Safari */
  display: none;
}

.evaluation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.evaluation-timer {
  background: #4272e4;
  color: #f8fafc;
  border-radius: 12px;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  /* gap: 0.15rem; */
  font-size: 0.7rem;
  /* letter-spacing: 0.08em; */
  text-transform: uppercase;
  transition: background 0.4s ease, color 0.4s ease;
  align-items: center;
}

/* Timer state colors (default is blue via .evaluation-timer) */
.evaluation-timer.timer-warning {
  background: #f59e0b; /* yellow/amber */
  color: #111827;
}

.evaluation-timer.timer-danger {
  background: #dc2626; /* red */
  color: #fff7ed;
}

.evaluation-timer strong {
  font-size: 1.2rem;
  letter-spacing: 0.06em;
}


/* When in question phase hide canvas and left panel for focused Q&A */
body.evaluation-questions-only #left-panel,
body.evaluation-questions-only .canvas-wrapper {
  display: none !important;
}

body.evaluation-questions-only .layout {
  grid-template-columns: 0 1fr var(--right-panel-w) !important;
}

#evaluation-timer {
  margin-top: 0.35rem;
}

/* Backwards compatibility: if the timer-warning class is accidentally applied
   to the inner span, at least don't break layout. */
#evaluation-timer.timer-warning,
#evaluation-timer.timer-danger {
  background: transparent;
  color: inherit;
}

#evaluation-reset.button.ghost,
#evaluation-start.button.primary,
#evaluation-finish.button.primary {
  margin-left: 0;
  padding: 0.5rem;
  border-radius: 12px;
}

/* Button state colors (requested): grey when disabled, blue when active */
#evaluation-next.next-inactive,
#evaluation-finish.next-inactive {
  background: #e5e7eb !important;
  border-color: #cbd5e1 !important;
  color: #334155 !important;
  box-shadow: none !important;
  cursor: not-allowed;
  opacity: 1; /* keep readable */
}

#evaluation-next.next-active,
#evaluation-finish.next-active {
  background: #2563eb !important;
  border-color: #1d4ed8 !important;
  color: #ffffff !important;
}

#evaluation-reset.button.ghost {
  background: rgba(148, 163, 184, 0.2);
  border-color: rgba(148, 163, 184, 0.6);
  color: #1f2a44;
}

.evaluation-controls {
  display: flex;
  flex-wrap: wrap;
  text-align: left;
  padding-top: 0.8rem;
  gap: 0.9rem;
}

.evaluation-error {
  grid-column: 1 / -1;
  font-size: 0.78rem;
  color: #b91c1c;
  min-height: 1rem;
}

.evaluation-controls label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1f2a44;
}

.evaluation-controls select {
  border: 1px solid #cbd5f5;
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  font-size: 0.9rem;
  background: #f8fafc;
}

.evaluation-question {
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  min-height: 0;
}

.evaluation-question-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  overflow: auto;
  padding-right: 0.35rem;
  flex: 1;
  min-height: 0;
  scrollbar-width: none;
}

.evaluation-question-list::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* Active problem banner — shown during design + question phases */
.evaluation-active-problem {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, #eef2ff 0%, #f0f9ff 100%);
  border: 1px solid #c7d7fd;
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 10px;
}

.active-problem-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #6366f1;
}

.active-problem-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e293b;
  flex: 1;
  text-align: center;
}

.active-problem-diff {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 20px;
  background: #1d4ed8;
  color: #ffffff;
  text-transform: capitalize;
  white-space: nowrap;
}

.evaluation-problem-summary {
  width: 100%;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #475569;
  margin-top: 4px;
}

/* ── Pre-start problem preview ────────────────────────────── */
.evaluation-preview {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  overflow-y: auto;
  max-height: 420px;
}
.eval-preview-title {
  margin: 0 0 6px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e293b;
}
.eval-preview-summary {
  margin: 0 0 12px;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #475569;
}
/* ── Key points bullet list ──────────────────────────────── */
.eval-preview-keypoints {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
}
.eval-preview-points {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.eval-preview-points li {
  font-size: 0.76rem;
  line-height: 1.45;
  color: #334155;
}
.eval-preview-points li::marker {
  color: #6366f1;
}
/* ── Collapsible header (active evaluation) ──────────────── */
.eval-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  gap: 8px;
}
.eval-preview-header .eval-preview-title {
  margin: 0;
  flex: 1;
}
.eval-preview-toggle {
  font-size: 0.9rem;
  color: #94a3b8;
  transition: transform 0.25s ease;
  flex-shrink: 0;
}
.evaluation-preview.collapsed .eval-preview-toggle {
  transform: rotate(-90deg);
}
.eval-preview-body {
  transition: max-height 0.3s ease, opacity 0.25s ease;
  overflow: hidden;
}
.evaluation-preview.collapsed .eval-preview-body {
  max-height: 0;
  opacity: 0;
  margin: 0;
  padding: 0;
}
.eval-preview-components {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.eval-preview-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6366f1;
}
.eval-preview-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.eval-preview-chip {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: #eef2ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
  text-align: center;
}

.evaluation-reqs {
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.evaluation-reqs h3 {
  font-size: 0.9rem;
  color: #0f172a;
}

.evaluation-reqs textarea {
  height: 110px;            /* consistent default size */
  min-height: 100px;        /* don't collapse too small */
  max-height: 160px;        /* hard cap so fields never push footer */
  resize: none;             /* prevent manual resizing completely */
  overflow: auto;           /* scroll inside if content exceeds */
  width: 100%;
  border: 1px solid #cbd5f5;
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  font-size: 0.85rem;
  color: #0f172a;
  background: #ffffff;
  box-sizing: border-box;
}

/* Ensure content never hides behind sticky footer (Next button) */
.evaluation-reqs { margin-bottom: 12px; }

.evaluation-question-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.evaluation-question-card.answered {
  border-color: #38bdf8;
  box-shadow: 0 8px 18px rgba(14, 116, 144, 0.15);
}

.evaluation-question-card h4 {
  font-size: 0.85rem;
  color: #0f172a;
}

.evaluation-question-card p {
  font-size: 0.82rem;
  color: #475569;
}

.evaluation-actions {
  position: sticky;
  bottom: 0;
  background: #ffffff;
  padding-bottom: 0.35rem;
}

.evaluation-question h3 {
  font-size: 0.93rem;
  color: #0f172a;
}

.evaluation-question p {
  font-size: 0.9rem;
  color: #475569;
}

.evaluation-meta {
  font-size: 0.72rem;
  color: #64748b;
}

.evaluation-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.evaluation-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  font-size: 0.82rem;
  color: #1f2a44;
}

.evaluation-option input {
  accent-color: #2563eb;
}

/* ------------------------------
   Trade-offs / Architectural Questions (right panel)
--------------------------------*/
.evaluation-tradeoff-box {
  background: #ffffff;
  /*border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px; */
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Used by the "Generating evaluation scores" panel */
.evaluation-tradeoff-sub strong {
  color: #0f172a;
}

/* If a parent container uses `color: transparent` for skeleton loading,
   our sub text can become invisible. Force an explicit color. */
.evaluation-tradeoff-box,
.evaluation-tradeoff-box * {
  color: inherit;
}

.evaluation-tradeoff-title {
  font-size: 0.9rem;
  font-size: 0.9rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.evaluation-tradeoff-sub {
  margin-top: -6px;
  font-size: 0.85rem;
  font-size: 0.85rem;
  color: #64748b;
}

/* Make the first line in the scoring panel readable as a "title" */
.evaluation-tradeoff-box .evaluation-tradeoff-sub:first-child {
  margin-top: 0;
  font-size: 0.9rem;   /* tone down headline size for a more professional look */
  font-weight: 700;
  font-size: 0.9rem;   /* tone down headline size for a more professional look */
  font-weight: 700;
  color: #0f172a;
}

.evaluation-tradeoff-card {
  /* background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%); */
  /* border: 1px solid #e2e8f0; */
  /* border-radius: 12px; */
  /* padding: 12px; */
  display: flex;
  flex-direction: column;
  gap: 10px;
  /* box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06); */
}

.evaluation-tradeoff-q {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  padding: 10px;
  background: #ffffff;
}


.evaluation-tradeoff-qtext {
  font-size: 0.85rem;   /* reduce bulkiness of the question text */
  font-size: 0.85rem;   /* reduce bulkiness of the question text */
  line-height: 1.35;
  color: #0f172a;
  font-weight: 650;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
}

.evaluation-tradeoff-answer {
  width: 100%;
  border: 1px solid #cbd5f5;
  background: #ffffff;
  border-radius: 10px;
  padding: 10px 11px;
  resize: vertical;
  min-height: 92px;
  max-height: 170px;
  font-size: 0.85rem;
  font-size: 0.85rem;
  line-height: 1.35;
  color: #0f172a;
  outline: none;
}

.evaluation-tradeoff-answer:focus {
  border-color: rgba(37, 99, 235, 0.8);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.evaluation-feedback {
  font-size: 0.85rem;
  font-size: 0.85rem;
  color: #0f172a;
  min-height: 1rem;
}

.evaluation-score {
  font-size: 0.85rem;
  font-size: 0.85rem;
  color: #475569;
}

.footer-tabs {
  display: flex;
  font-size: 0.1rem;
  align-items: center;
  gap: 10px;
  padding: 0.3rem 1.05rem;
  background: linear-gradient(135deg, #0b1020, #111827 60%);
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  height: var(--footer-height);
}

.footer-label {
  font-size: 0.78rem; /* ~10% smaller */
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #94a3b8;
  font-weight: 700;
}

.footer-tabs .tab-list {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
  font-size: 0.78rem;
}

.footer-tabs .tab-list::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.footer-tabs .tab-item {
  background: rgba(248, 250, 252, 0.28);
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  padding: 0.2rem 0.6rem;
  font-size: 0.78rem; /* ~10% smaller */
  font-weight: 600;
  cursor: pointer;
  color: #e2e8f0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 200px;
}

.footer-tabs .tab-item.active {
  background: #0f172a;
  color: #f8fafc;
  border-color: #475569;
  box-shadow: 0 10px 20px rgba(2, 6, 23, 0.55);
}

.footer-tabs .tab-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.footer-tabs .tab-close {
  font-size: 0.85rem; /* ~10% smaller */
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.35);
  color: #e2e8f0;
}

.footer-tabs .tab-item.active .tab-close {
  background: rgba(148, 163, 184, 0.35);
  color: #e2e8f0;
}

.footer-tabs .tab-add {
  border: none;
  background: #38bdf8;
  color: #0f172a;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font-size: 1.2rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 2000;
}

.modal-content {
  /* cleaner, more professional card style */
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  border-radius: 12px;
  padding: 1.75rem;
  width: min(420px, 92vw);
  box-shadow: 0 12px 30px rgba(2, 6, 23, 0.12);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Auth modal: cap height and make it scrollable so it never overflows viewport */
#auth-modal .modal-content {
  max-height: min(92vh, 700px);
  overflow-y: auto;
  gap: 0.65rem;
  padding: 1.4rem 1.6rem 1.6rem;
}

#auth-modal .modal-header {
  margin-bottom: 0;
}

#auth-modal .modal-header h2 {
  font-size: 1.1rem;
}

#auth-modal .modal-message {
  font-size: 0.82rem;
  margin-top: 0.2rem;
}

#auth-modal .modal-form {
  gap: 0.55rem;
}

#auth-modal .modal-form label {
  gap: 0.2rem;
  font-size: 0.78rem;
}

#auth-modal .modal-form input {
  padding: 0.42rem 0.6rem;
  font-size: 0.86rem;
}

#auth-modal .modal-tabs {
  margin-top: 0;
}

/* Tighten pw checklist in auth modal */
#auth-modal .pw-checklist {
  gap: 2px;
  margin-top: 0;
}

#auth-modal .pw-checklist .pw-rule {
  font-size: 0.74rem;
  padding: 1px 0;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: none;
  background: transparent;
  font-size: 1.1rem;
  cursor: pointer;
  color: #64748b;
}

.modal-header h2 {
  font-size: 1.4rem;
}

.modal-message {
  color: #475569;
  font-size: 0.93rem;
  margin-top: 0.35rem;
}

.modal-helper {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 0.6rem;
}

.modal-tabs {
  display: inline-flex;
  gap: 0.5rem;
  background: #e2e8f0;
  border-radius: 999px;
  padding: 0.35rem;
  align-self: flex-start;
  justify-content: center;
  align-self: center;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.modal-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: #1f2a44;
  font-weight: 600;
}

.modal-form input {
  border: 1px solid #cbd5f5;
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  font-size: 0.93rem;
}
.modal-form textarea {
  border: 1px solid #cbd5f5;
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  font-size: 0.93rem;
  min-height: 120px;
  resize: vertical;
}
/* Make selects inside modals match input styling */
.modal-form select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border: 1px solid #cbd5f5;
  border-radius: 8px;
  padding: 0.5rem 2rem 0.5rem 0.6rem; /* space for chevron */
  font-size: 0.93rem;
  background: #ffffff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M6 8l4 4 4-4' stroke='%2362748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px 14px;
}

/* Consistent focus states in modals */
.modal-form input:focus,
.modal-form textarea:focus,
.modal-form select:focus {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
  border-color: #93c5fd;
}

/* Feedback modal specific width and spacing */
#feedback-modal .modal-content {
  width: min(640px, 94vw);
}

#feedback-modal .modal-header h2 {
  font-size: 1.25rem;
}

#feedback-modal .modal-message {
  color: #475569;
  font-size: 1rem;
}

#feedback-modal .modal-form label {
  font-size: 0.9rem;
}

.open-modal {
  width: min(520px, 92vw);
}

.black-box-modal {
  width: min(620px, 94vw);
}


.evaluation-instructions {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  font-size: 0.93rem;
  color: #1f2937;
}

.evaluation-instructions h3 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  margin-top: 0.35rem;
}

.evaluation-instructions ul {
  margin-left: 0;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  list-style: none;
}

.evaluation-instructions li {
  position: relative;
  padding-left: 1.3rem;
  line-height: 1.35;
}

.evaluation-instructions li::before {
  content: "•";
  position: absolute;
  left: 0;
  top: 0;
  color: #2563eb;
  font-weight: 700;
}

.evaluation-goodluck {
  font-weight: 600;
  color: #0f172a;
  text-align: center;
  padding-top: 0.25rem;
}

.modal-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ── Stylish confirm modal (mentor + proceed dialogs) ───────────────────── */
/* Only affects the lightweight runtime-injected confirm modal. */
.ui-confirm-card {
  width: min(560px, 92vw);
  border-radius: 16px;
  padding: 1.85rem 1.85rem 1.55rem;
  box-shadow:
    0 22px 60px rgba(2, 6, 23, 0.18),
    0 2px 10px rgba(2, 6, 23, 0.06);
  border: 1px solid rgba(148, 163, 184, 0.35);
  overflow: hidden;
}

/* Subtle top accent bar */
.ui-confirm-card .ui-confirm-accent {
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: linear-gradient(90deg, #2563eb 0%, #06b6d4 50%, #a78bfa 100%);
}

.ui-confirm-card .modal-header h2 {
  font-size: 2.1rem;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.ui-confirm-card .modal-message {
  font-size: 1.05rem;
  line-height: 1.55;
  margin-top: 0.65rem;
  color: #334155;
}

.ui-confirm-card .modal-actions {
  margin-top: 1.35rem;
  gap: 0.8rem;
}

/* Make the two-button layout feel balanced (like your screenshot) */
.ui-confirm-card .modal-actions .button {
  min-width: 140px;
  padding: 0.65rem 1.1rem;
  border-radius: 12px;
  font-weight: 700;
}

/* Slightly softer secondary button */
.ui-confirm-card .modal-actions .button:not(.primary) {
  background: #e2e8f0;
  border-color: #e2e8f0;
  color: #0f172a;
}

.ui-confirm-card .modal-actions .button:not(.primary):hover {
  background: #dbe6f5;
}


.modal-actions .button + .button {
  margin-left: 0.25rem;
}

.black-box-flow {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.9rem;
}

.flow-step {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  color: #0f172a;
}

.flow-label {
  background: #e2e8f0;
  color: #1f2937;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.flow-arrow {
  text-align: center;
  color: #64748b;
  font-size: 1rem;
}

.black-box-note {
  font-size: 0.9rem;
  color: #475569;
}

.open-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  max-height: 340px;
  overflow: auto;
}

.open-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}

.open-modal {
  /* 10% larger than before (520px -> ~572px) */
  width: min(572px, 92vw);
}
.black-box-modal {
  /* 10% larger than before (620px -> ~682px) */
  width: min(682px, 94vw);
}
.evaluation-modal {
  /* 10% larger than before (640px -> ~704px) */
  width: min(704px, 94vw);
}

/* Ensure open-modal variant uses the same light card styling (override any theme/dark-mode overrides) */
.modal-content.open-modal {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%) !important;
  color: #0f172a !important;
  box-shadow: 0 12px 30px rgba(2, 6, 23, 0.12) !important;
}

.modal-content.open-modal .modal-message {
  color: #475569 !important;
}

.open-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.open-tag {
  font-size: 0.7rem;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: #1f2a44;
  font-weight: 600;
}

.open-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.open-button,
.open-delete {
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.8rem;
  border-radius: 10px;
  cursor: pointer;
}

.open-button {
  background: #2563eb;
  color: #f8fafc;
}

.open-button:hover {
  background: #1d4ed8;
}

.open-delete {
  background: #dc2626;
  color: #fff7f7;
  padding: 0.35rem 0.6rem;
}

.open-delete:hover {
  background: #b91c1c;
}

.open-empty {
  font-size: 0.9rem;
  color: #64748b;
}

.toast-container {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 50;
}

.toast {
  min-width: 220px;
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #0f172a;
  background: #f1f5f9;
  border: 1px solid #cbd5f5;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.15);
}

.toast.success {
  background: #dcfce7;
  border-color: #86efac;
  color: #14532d;
}

.toast.error {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #7f1d1d;
}

.view-only .palette,
.view-only #canvas-content,
.view-only #connections {
  pointer-events: none;
}

.view-only .palette {
  opacity: 0.6;
}

.view-only #inspector input,
.view-only #inspector select,
.view-only #inspector textarea,
.view-only #inspector button {
  pointer-events: none;
  opacity: 0.6;
}

body.evaluation-locked .topbar,
body.evaluation-locked .header,
body.evaluation-locked .footer-tabs {
  pointer-events: auto;
  cursor: not-allowed;
}

body.evaluation-locked .topbar *,
body.evaluation-locked .header *,
body.evaluation-locked .footer-tabs * {
  pointer-events: none;
}

.modal-error {
  min-height: 1rem;
  font-size: 0.85rem;
  color: #b91c1c;
}

/* ── Auth loading state ─────────────────────────────────────────────────── */
#auth-modal.auth-loading-active .modal-form,
#auth-modal.auth-loading-active .sso-buttons,
#auth-modal.auth-loading-active .modal-tabs,
#auth-modal.auth-loading-active .modal-close {
  opacity: 0.65;
  pointer-events: none;
}

#auth-modal.auth-loading-active .auth-loading {
  opacity: 1;
  pointer-events: auto;
}

.auth-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #334155;
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 6px;
}

.auth-loading-spinner,
.btn-spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(37, 99, 235, 0.25);
  border-top-color: rgba(37, 99, 235, 0.95);
  animation: spin 0.8s linear infinite;
}

/* inline spinner inside button */
.btn-spinner {
  display: none;
  margin-left: 8px;
}

button.is-loading .btn-spinner {
  display: inline-block;
}

button.is-loading .btn-label {
  opacity: 0.9;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ── SSO buttons ──────────────────────────────────────────────────────────── */
.sso-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0;
}

.sso-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.sso-github {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}
.sso-github:hover {
  background: #1e293b;
  box-shadow: 0 2px 8px rgba(15,23,42,0.18);
}

.sso-google {
  background: #fff;
  color: #1e293b;
  border-color: #e2e8f0;
}
.sso-google:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.sso-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 2px;
  color: #94a3b8;
  font-size: 0.85rem;
}
.sso-divider::before,
.sso-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}


.validation-panel {
  margin-top: 0.8rem;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #9f1239;
  border-radius: 10px;
  padding: 0.8rem;
  font-size: 0.9rem;
}

.validation-panel ul {
  margin: 0.25rem 0 0 1rem;
}

/* Extra actionable guidance shown above validation errors */
.validation-hint {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  padding: 0.6rem 0.7rem;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: #0f172a;
  font-size: 0.92rem;
  line-height: 1.45;
  font-weight: 500;
}

.validation-hint div + div {
  margin-top: 0.25rem;
}

.layer-flow-list {
  margin: 0.4rem 0 0 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  font-size: 0.9rem;
  color: #1f2937;
}

.layer-flow-list li {
  line-height: 1.5;
}

.layer-desc {
  display: block;
  font-size: 0.78rem;
  color: #6b7280;
  margin-top: 0.1rem;
}

.layer-hint {
  margin-top: 1rem;
  font-size: 1.2rem;
  color: #6b7280;
  border-top: 1px solid #e5e7eb;
  padding: 1rem;
}

/* .layer-flow-list li::marker {
  color: #22c55e;
} */

.result-block-blackbox h4 {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
}

.faq-content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-top: 0.25rem;
  font-size: 0.9rem;
  color: #475569;
  scrollbar-width: none;
}

.faq-content::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* ── Stage Guide Panel ─────────────────────────────────────── */
.guide-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-top: 0.25rem;
  font-size: 0.5rem;
  color: #475569;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.guide-content::-webkit-scrollbar { width: 0; height: 0; }

.guide-empty {
  color: #94a3b8;
  font-size: 0.83rem;
  text-align: center;
  padding: 1.5rem 0.5rem;
}

/* Stage header: Stage N pill + title */
.guide-stage-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  align-content: center;
  gap: 8px;
  margin-bottom: 2px;
}
.guide-stage-pill {
  background: #10469c;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 7px 9px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  text-align: center;
  width: fit-content;
  align-items: center;
  align-self: center;
}
.guide-stage-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}

/* Learning goal banner */
.guide-goal {
  background: #eff6ff;
  border-left: 3px solid #3b82f6;
  border-radius: 0 8px 8px 0;
  padding: 7px 10px;
  font-size: 0.85rem;
  color: #1d4ed8;
  font-style: italic;
  line-height: 1.4;
}

/* Section label */
.guide-section-label {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #64748b;
  margin: 5px 0px;
}

/* Component row */
.guide-components {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.guide-component-row {
  display: flex;
  align-items: flex-start;
  gap: 25px;
  background: #ffffff;
  border: 1px solid #e6eefc; 
  border-radius: 8px;
  padding: 5px;
}
.guide-component-badge {
  flex: 0 0 auto;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 6px;
  padding: 2px 7px;
  margin-top: 1px;
  white-space: nowrap;
  letter-spacing: 0.03em;
  text-align: center;
  /* width: fit-content; */
}
/* Badge colours per component type */
.guide-badge-user       { background: #e0f2fe; color: #0369a1; }
.guide-badge-server     { background: #fef3c7; color: #92400e; }
.guide-badge-database   { background: #fce7f3; color: #9d174d; }
.guide-badge-cache      { background: #d1fae5; color: #065f46; }
.guide-badge-loadbalancer { background: #ede9fe; color: #5b21b6; }
.guide-badge-queue      { background: #fef9c3; color: #713f12; }
.guide-badge-worker     { background: #fef9c3; color: #713f12; }
.guide-badge-cdn        { background: #dbeafe; color: #1d4ed8; }
.guide-badge-ratelimiter { background: #fee2e2; color: #991b1b; }
.guide-badge-apigateway { background: #e0f2fe; color: #0369a1; }
.guide-badge-edge       { background: #f0fdf4; color: #166534; }
.guide-badge-monolith   { background: #f1f5f9; color: #334155; }
.guide-badge-searchindex { background: #fdf4ff; color: #7e22ce; }
.guide-badge-blobstorage { background: #fff7ed; color: #c2410c; }
.guide-badge-default    { background: #f1f5f9; color: #334155; }

.guide-component-info {
  flex: 1 1 auto;
  min-width: 0;
}
.guide-component-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}
.guide-component-desc {
  font-size: 0.85rem;
  color: #64748b;
  margin-top: 2px;
  line-height: 1.4;
}

/* Sub-label ("Carried over from previous stages") */
.guide-section-sublabel {
  font-size: 0.85rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  /* margin: 4px 0 3px 0; */
}

/* Full knowledge card for components — collapsible via <details>/<summary> */
.guide-component-card {
  background: #ffffff;
  border: 1px solid #e6eefc;
  border-radius: 10px;
  overflow: hidden;
}
.guide-component-card[open] {
  border-color: #93c5fd;
}
.guide-new-card {
  border-color: #bfdbfe;
  background: linear-gradient(135deg, #f0f7ff 0%, #ffffff 100%);
}
.guide-new-card[open] {
  border-color: #3b82f6;
}
.guide-component-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  font-size: 0.85rem;
  overflow: hidden;
}
.guide-card-comp-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #0f172a;
  flex: 1 1 auto;
  overflow: hidden;
  text-align: center;
  width: fit-content;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Remove default triangle on all browsers */
.guide-component-card-header::-webkit-details-marker { display: none; }
.guide-component-card-header::marker { display: none; }
.guide-component-card:hover .guide-component-card-header {
  background: #f0f7ff;
}
/* Chevron — rotates when open */
.guide-card-chevron {
  margin-left: auto;
  font-size: 0.85rem;
  color: #94a3b8;
  transition: transform 0.2s ease;
  flex: 0 0 auto;
}
.guide-component-card[open] .guide-card-chevron {
  transform: rotate(90deg);
  color: #3b82f6;
}
/* Body revealed on open */
.guide-card-body {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 10px;
  border-top: 1px solid #e6eefc;
}
.guide-component-card[open] .guide-card-body {
  border-top-color: #bfdbfe;
}

/* Knowledge-base rows inside a card */
.guide-kb-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
  border-radius: 10px;
  background: #f8fafc;
  border-left: 3px solid #e2e8f0;
}
.guide-kb-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02rem;
}
.guide-kb-label.why   { color: #1d4ed8; border-color: #93c5fd; }
.guide-kb-label.role  { color: #065f46; border-color: #6ee7b7; }
.guide-kb-label.helps { color: #5b21b6; border-color: #c4b5fd; }
.guide-kb-label.alts  { color: #92400e; border-color: #fcd34d; }
/* Apply border colour to the parent row via label sibling trick */
.guide-kb-row:has(.guide-kb-label.why)   { border-left-color: #93c5fd; }
.guide-kb-row:has(.guide-kb-label.role)  { border-left-color: #6ee7b7; }
.guide-kb-row:has(.guide-kb-label.helps) { border-left-color: #c4b5fd; }
.guide-kb-row:has(.guide-kb-label.alts)  { border-left-color: #fcd34d; }
.guide-kb-value {
  font-size: 0.85rem;
  color: #334155;
  line-height: 1.5;
}

/* Connection rows */
.guide-connections {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.guide-connection-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 5px 9px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
}
.guide-conn-arrow {
  font-size: 0.85rem;
  color: #3b82f6;
  flex: 0 0 auto;
  margin-top: 1px;
}
.guide-conn-text {
  font-size: 0.78rem;
  color: #1e293b;
  line-height: 1.4;
}
.guide-conn-text strong {
  color: #0f172a;
}

/* What changed box (new in this stage) */
.guide-new-badge {
  display: inline-block;
  background: #dcfce7;
  color: #15803d;
  font-size: 8px;
  font-weight: 600;
  border-radius: 999px;
  padding: 1px 7px;
  letter-spacing: 0.03em;
  vertical-align: middle;
  margin-left: 5px;
}
.guide-new-row {
  border-left: 3px solid #22c55e !important;
  background: #f0fdf4 !important;
}

/* Breakdown cards */
.guide-breakdown {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.guide-breakdown-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 7px 10px;
}
.guide-breakdown-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 3px;
}
.guide-breakdown-label.added   { color: #16a34a; }
.guide-breakdown-label.risk    { color: #dc2626; }
.guide-breakdown-label.trade   { color: #d97706; }
.guide-breakdown-label.scale   { color: #2563eb; }
.guide-breakdown-label.missing { color: #92400e; }
.guide-breakdown-label.perf    { color: #5b21b6; }
.guide-breakdown-label.rely    { color: #065f46; }
.guide-breakdown-label.fault   { color: #991b1b; }
.guide-breakdown-value {
  font-size: 0.85rem;
  color: #334155;
  line-height: 1.45;
}

.faq-item {
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  padding: 0.6rem;
  margin-bottom: 0.5rem;
}

.faq-item h4 {
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
  color: #0f172a;
}

.faq-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.faq-topic {
  background: #e2e8f0;
  color: #1f2937;
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
}

.layout.left-collapsed #left-panel {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-12px);
}

.layout.right-collapsed #right-panel {
  opacity: 0;
  pointer-events: none;
  transform: translateX(12px);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

/* Center titles in both side panels */
.panel-header h2 {
  flex: 1 1 auto;
  text-align: center;
}

/* Divider only on the left panel header (right panel already has its own divider) */
#left-panel .panel-header {
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

/* Learn mode: left header only shows the collapse + Learn/Build pill, no divider */
body.learn-mode #left-panel .panel-header {
  border-bottom: none;
  padding-bottom: 0;
}

#right-panel .panel-header {
  align-items: center;
}


.panel-header h2 {
  margin: 0;
}

.icon-button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #94a3b8;
  background: #cbd5e1;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.icon-button:hover {
  background: #2b4067;
}

.panel {
  background: white;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  /* gap: 1rem; */
  border: 1px solid #e2e8f0;
  max-height: calc(100vh - 120px);
  overflow: hidden;
}

.panel section {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.assessment-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}
.assessment-table th,
.assessment-table td {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid #e2e8f0;
  color: #1f2937;
}
.assessment-table th {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
}
.assessment-table tr:last-child td {
  border-bottom: none;
}

#left-panel {
  gap: 1rem;
}

#left-panel section {
  font-size: 0.93rem;
}

#left-panel .panel-header h2,
#left-panel h2 {
  font-size: 0.9rem;
  letter-spacing: 0.06em;
}

#left-panel .panel-section {
  flex: 1 1 0;
  min-height: 120px;
  overflow: hidden;
}

#left-panel .components-section {
  flex: 0 0 25%;
  min-height: 180px;
  border: 1px solid #e2e8f0;
  padding: 0.2rem;
  /* padding: 10px 20px; */
  border-radius: 10px;
  /* allow palette-item tooltips to overflow outside the rounded panel
     so labels are not clipped by the panel container */
  overflow: visible;
}

/* Keep the component icons in the original wrapped grid.
   When the panel is narrow, icons naturally reflow to 3-per-row or 2-per-row.
   To avoid the panel growing tall and pushing other sections down,
   we make the *components section body* scrollable vertically. */
#left-panel .components-section {
  overflow: hidden; /* keep tooltips controlled; inner box will scroll */
}

#left-panel .components-section .section-body {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

#left-panel .components-section .palette {
  /* Ensure wrapping remains enabled (default), and rows pack to top */
  flex-wrap: wrap;
  align-content: flex-start;
  justify-content: center;
  overflow: visible; /* scrolling happens on section-body */
}

/* In evaluation mode we still show Components + Inspector.
   Give Components a stable height so the Inspector doesn't look squashed
   or inconsistent as content changes. */
body.evaluation-mode #left-panel .components-section {
  flex: 0 0 30% !important;
  min-height: 0px;
  
}

body.evaluation-mode #left-panel .inspector-section {
  flex: 1 1 70% !important;
  min-height: 180px;
}

body.evaluation-mode #left-panel .inspector-section > h2 {
  display: none;
}

body.evaluation-mode .palette {
  /* allow the palette to expand to fill the components section */
  max-height: none;
}

#left-panel .inspector-section {
  flex: 1 1 70%;
  min-height: 0;
  overflow: auto;
  font-size: 0.85rem;
}

#left-panel .actions-section {
  flex: 0 0 auto;
  min-height: 0;
}

#left-panel .section-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow: hidden;
  padding-right: 0.25rem;
  flex: 1;
  min-height: 0;
  height: auto;
  scrollbar-width: none;
}

/* Inspector scroll contract:
   Keep the inspector border fixed within the left panel.
   Everything inside the inspector should scroll. */
#left-panel .inspector-section .section-body {
  overflow: auto;
  flex: 1;
  min-height: 0;
}

#left-panel .section-body::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.action-footer {
  margin-top: auto;
  display: grid;
  gap: 0.5rem;
}

.inspector-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  font-size: 0.85rem;
}

.inspector-fields .field-description {
  grid-column: 1 / -1;
}

.panel h2 {
  font-size: 0.85rem;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.panel section + section {
  padding-top: 0.5rem;
  border-top: 1px solid #e2e8f0;
}

#left-panel .inspector-section {
  padding-top: 0;
  border-top: none;
  min-height: 0;
}

.palette {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  max-height: 350px;
  overflow-y: auto;
  overflow-x: visible;
  /* padding-right: 0.25rem;
  padding-bottom: 0.35rem; */
  height: 100%;
  scrollbar-width: none;
  /* Pack rows to the top when the container is tall (avoid evenly spaced rows). */
  align-content: flex-start;
  align-items: center;
  justify-content: center;
  padding: 10px 0px;
}

/* Components panel grid density
   Default: target 4 icons per row.
   When the left panel is narrowed, allow it to naturally drop to 3/2 per row.
   We do this by ensuring a smaller default gap, so 4 can fit at typical widths. */
#left-panel .components-section .palette {
  gap: 0.5rem;
}

@media (max-width: 1100px) {
  /* narrower layouts: revert to slightly larger spacing */
  #left-panel .components-section .palette {
    gap: 0.65rem;
  }
}

/* Components panel grid density

  .pricing-compare-table {
    min-width: 680px;
  }
   Default: target 4 icons per row.
   When the left panel is narrowed, allow it to naturally drop to 3/2 per row.
   We do this by ensuring a smaller default gap, so 4 can fit at typical widths. */
#left-panel .components-section .palette {
  gap: 0.5rem;
}

@media (max-width: 1100px) {
  /* narrower layouts: revert to slightly larger spacing */
  #left-panel .components-section .palette {
    gap: 0.65rem;
  }
}

.palette::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.canvas-reset {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 35px;
  height: 35px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  /* color: #0f172a; */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.1);
  z-index: 6;
  transition: all 0.2s ease;
}

.canvas-toolbar {
  position: absolute;
  top: 10px; /* align vertically with the info and reset buttons */
  /* sit between the left info button and right clear button */
  left: 56px; /* leaves room for the info button */
  right: 56px; /* leaves room for the reset/clear button */
  display: flex;
  gap: 0.8rem;
  align-items: center;
  justify-content: flex-start; /* anchor controls to the left so adding/removing a control doesn't recenter everything */
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0 8px;
  box-shadow: none;
  backdrop-filter: none;
  z-index: 8;
}

/* Ensure all toolbar children (selects and buttons) share the same height and alignment */
.canvas-toolbar > * {
  display: inline-flex;
  align-items: center;
  height: 36px; /* match the info/reset buttons */
  min-height: 36px;
}

.canvas-toolbar .preset-picker select,
.canvas-toolbar .stage-picker select {
  background: linear-gradient(135deg, #111827, #1f2937);
  color: #f8fafc;
  border: 1px solid #475569;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.14);
  width: 180px;
  /* text-overflow: ellipsis; */
  overflow: hidden;
  justify-content: center;
  text-align: center;
  align-items: center;
}

.canvas-toolbar .preset-picker select:focus,
.canvas-toolbar .stage-picker select:focus {
  outline: 2px solid rgba(59, 130, 246, 0.5);
  outline-offset: 2px;
  width: 180px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
}

.canvas-toolbar .learn-controls .mode-button {
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #f8fafc;
  border: 1px solid rgba(59, 130, 246, 0.6);
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.22);
  height: 36px;
  padding: 0 12px;
  min-height: 36px;
}

.canvas-toolbar .learn-controls .mode-button.active,
.canvas-toolbar .learn-controls .mode-button[aria-pressed="true"] {
  background: linear-gradient(135deg, #0f172a, #1f2937);
  color: #e2e8f0;
  border-color: rgba(100, 116, 139, 0.7);
}

.canvas-reset:hover {
  /* background: #f8fafc; */
  border-color: #94a3b8;
  transform: translateY(-1px);
}

#right-panel section {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  flex: 1;
  min-height: 0;
}

.panel-actions {
  display: flex;
  justify-content: center;
  gap: 0.8rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

/* Make buttons in the right panel more prominent and easier to tap */
#right-panel .panel-actions .button {
  padding: 0.8rem 1.1rem;
  font-size: 0.9rem;
  border-radius: 12px;
  flex: 1;
  width: max-content;
}

#right-panel .panel-actions .button.primary {
  padding: 0.8rem 1.4rem;
}

.palette-item {
  padding: 0.5rem;
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  background: #f1f5f9;
  cursor: grab;
  text-align: center;
  transition: all 0.2s ease;
  font-size: 0.7rem;
  font-weight: 600;
  color: #0453d2;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-width: 46px;
  height: 46px;
}

/* When the components panel is at a normal width, slightly reduce
   icon tile size so 4 fit in a row. On narrow panels, wrapping will
   naturally fall back to 3/2 per row. */
#left-panel .components-section .palette-item {
  min-width: 42px;
  height: 42px;
  padding: 0.45rem;
}

#left-panel .components-section .palette-item .icon {
  width: 23px;
  height: 23px;
}

@media (max-width: 1100px) {
  #left-panel .components-section .palette-item {
    min-width: 46px;
    height: 46px;
    padding: 0.5rem;
  }

  #left-panel .components-section .palette-item .icon {
    width: 25px;
    height: 25px;
  }
}

/* When the components panel is at a normal width, slightly reduce
   icon tile size so 4 fit in a row. On narrow panels, wrapping will
   naturally fall back to 3/2 per row. */
#left-panel .components-section .palette-item {
  min-width: 42px;
  height: 42px;
  padding: 0.45rem;
}

#left-panel .components-section .palette-item .icon {
  width: 23px;
  height: 23px;
}

@media (max-width: 1100px) {
  #left-panel .components-section .palette-item {
    min-width: 46px;
    height: 46px;
    padding: 0.5rem;
  }

  #left-panel .components-section .palette-item .icon {
    width: 25px;
    height: 25px;
  }
}
.palette-item .icon {
  width: 25px;
  height: 25px;
  display: inline-block;
  object-fit: contain;
}

.palette-item::after {
  content: attr(data-label);
  position: absolute;
  top: 110%;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #f8fafc;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.7rem;
  white-space: nowrap;
  /* Hide floating palette labels globally — we show component names in the inspector instead */
  display: none !important;
  z-index: 10;
}

/* Show labels while in evaluation mode (small font) */
/* Show labels on hover while in evaluation mode (small font, inline) */
body.evaluation-mode .palette-item::after {
  /* keep hidden by default even in evaluation mode */
  display: none !important;
}

body.evaluation-mode .palette-item:hover::after {
  display: block !important;
  font-size: 11px !important;
  /* Render as a tooltip bubble so it doesn't visually overlap icons awkwardly */
  background: rgba(0,0,0,0.85) !important;
  color: #ffffff !important;
  padding: 0.18rem 0.45rem !important;
  border-radius: 6px !important;
  box-shadow: 0 6px 14px rgba(15,23,42,0.08) !important;
  white-space: nowrap !important; /* keep on single line */
  /* Overlay directly on the component tile (centered) so labels remain
     visible even near the panel edges. */
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  z-index: 60 !important;
  pointer-events: none !important;
}

/* In practice/learn when a system component is selected, show the same
   tooltip-style hover label on palette items. This is activated by the
   `body.system-selected` class set from JS when a non-User node is selected. */
body.system-selected .palette-item::after {
  display: none !important;
}

body.system-selected .palette-item:hover::after {
  display: block !important;
  font-size: 11px !important;
  background: rgba(0,0,0,0.85) !important;
  color: #ffffff !important;
  padding: 0.18rem 0.45rem !important;
  border-radius: 6px !important;
  box-shadow: 0 6px 14px rgba(15,23,42,0.08) !important;
  white-space: nowrap !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  z-index: 60 !important;
  pointer-events: none !important;
}

/* In evaluation mode we still show the Inspector, but keep it restricted
   via JS to name/description only. Hide only the Actions section. */
body.evaluation-mode #left-panel .actions-section {
  display: none !important;
}

/* floating labels removed */

.palette-item:hover {
  border-color: #134ecd;
  background: #dbeafe;
}

.inspector {
  background: #ffffff;
  border-radius: 10px;
  padding: 0.8rem 0.8rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  max-width: none;
  font-size: 0.85rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.inspector p {
  font-size: 0.85rem;
  color: #64748b;
  gap: 0.6rem;
  line-height: 1.2rem;
}

.canvas-wrapper {
  /* background: #ffffff; */
  border-radius: 12px;
  padding: 0;
  position: relative;
  min-height: 560px;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.08);
}

body.roadmap-mode .canvas-wrapper {
  background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
  border: 1px solid #dbe4f0;
  border-radius: 24px;
  padding: 0;
}

.floating-toggle {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 110px;
  border-radius: 999px;
  border: 1px solid #94a3b8;
  background: #cbd5e1;
  color: #0f172a;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.12);
  z-index: 5;
}

.floating-toggle.left {
  left: 10px;
}

.floating-toggle.right {
  right: 10px;
}

.floating-toggle:hover {
  background: #b6c2d9;
  border-color: #64748b;
}

/* Canvas info button (top-left) */
.canvas-info-button {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(99,102,241,0.12);
  background: #ffffff;
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  cursor: default;
  box-shadow: 0 6px 18px rgba(15,23,42,0.08);
  z-index: 12;
}

.canvas-info-button:hover { background: #fbfdff; }

.canvas-info-popover {
  position: absolute;
  top: 56px;
  left: 10px;
  width: 360px;
  max-width: calc(100% - 40px);
  /* stronger visible bluish card so it reads clearly against the white canvas */
  background: linear-gradient(180deg, rgba(235,243,255,0.98), rgba(242,247,255,0.98)) !important;
  background-color: #f3f8ff !important;
  border-radius: 12px;
  border: 1px solid rgba(59,130,246,0.18) !important;
  padding: 18px;
  box-shadow: 0 32px 64px rgba(2,6,23,0.16) !important;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 60 !important;
  pointer-events: none;
  color: #07103a;
  font-size: 14px;
  line-height: 1.25;
}

.canvas-info-popover .popover-title { font-weight: 800; font-size: 18px; margin: 0 0 12px 0; }
.canvas-info-popover .popover-list { margin: 0 0 6px 0; padding-left: 18px; }
.canvas-info-popover .popover-list li { margin-bottom: 10px; }
.canvas-info-popover.hidden { display: none; }

.layout.left-collapsed .floating-toggle.left {
  display: inline-flex;
}

.layout.right-collapsed .floating-toggle.right {
  display: inline-flex;
}

.canvas {
  position: relative;
  height: 100%;
  width: 100%;
  border: 2px dashed #c7d2fe;
  border-radius: 12px;
  overflow: hidden;
  padding: 0;
  background-color: #ffffff;
  background-image:
    linear-gradient(to right, rgba(148, 163, 184, 0.16) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.16) 1px, transparent 1px);
  background-size: 24px 24px;
}

.canvas-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: translate(0, 0);
}

.connections {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  overflow: visible;
}

body.connect-mode .connections {
  pointer-events: none;
}

.connection-path {
  pointer-events: stroke;
  transition: stroke-width 120ms ease;
}

.connection-path:hover {
  stroke-width: 5; /* Make it easier to target and remove on hover */
  cursor: pointer;
  filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.25));
}

.connection-path.selected {
  stroke: #0f172a;
  stroke-width: 6;
}

.connection-handle {
  fill: #ffffff;
  stroke: #2563eb;
  stroke-width: 2;
  cursor: grab;
  filter: drop-shadow(0 4px 8px rgba(37, 99, 235, 0.2));
}

.connection-handle:active {
  cursor: grabbing;
}

.node {
  position: absolute;
  padding: 0.22rem 0.38rem;
  border-radius: 10px;
  color: white;
  font-weight: 600;
  font-size: 0.68rem;
  cursor: pointer;
  user-select: none;
  background: #334155;
  box-shadow: 0 10px 18px rgba(31, 42, 68, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  resize: both;
  overflow: visible;
  min-width: 68px;
  min-height: 34px;
}

.node-ports {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.node-port {
  position: absolute;
  width: 13px;
  height: 13px;
  border-radius: 999px;
  border: 2px solid #ffffff;
  background: #1d4ed8;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.25);
  opacity: 0;
  pointer-events: auto;
  transition: transform 0.15s ease, opacity 0.15s ease;
  cursor: crosshair;
  transform: translate(-50%, -50%);
}

.node:hover .node-port,
.node.selected .node-port {
  opacity: 1;
}


.node-port:hover {
  transform: translate(-45%, -55%) scale(1.25);
}

.node-port-top {
  top: 0;
  left: 50%;
}

.node-port-right {
  left: 100%;
  top: 50%;
}

.node-port-bottom {
  top: 100%;
  left: 50%;
}

.node-port-left {
  left: 0;
  top: 50%;
}

.node-label {
  padding: 0 0.55rem;
  pointer-events: none;
}

.node-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: #f8fafc;
  color: #0f172a;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  opacity: 0;
  transition: all 0.15s ease;
  transform: none;
}

.node:hover .node-close {
  opacity: 1;
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.2);
}

.node-close:hover {
  background: #f1f5f9;
  border-color: rgba(100, 116, 139, 0.9);
  transform: translateY(-2px);
}

.node-close:focus-visible {
  outline: 2px solid #0f172a;
  outline-offset: 1px;
}

.node.selected {
  outline: 2px solid #0f172a;
  outline-offset: 2px;
}

.node.bottleneck {
  border: 4px solid #eb3131;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25), 0 10px 18px rgba(31, 42, 68, 0.18);
}

.node.connect-source {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.45);
}

.node-user {
  background: #14b8a6;
}

.node-server {
  background: #2563eb;
}

.node-database {
  background: #f97316;
}

.node-loadbalancer {
  background: #8b5cf6;
}

.node-cache {
  background: #22c55e;
}

.node-cdn {
  background: #38bdf8;
}

.node-ratelimiter {
  background: #facc15;
  color: #1f2937;
}

.node-idgenerator {
  background: #f472b6;
}

.node-worker {
  background: #a3e635;
  color: #1f2937;
}

.node-apigateway,
.node-gateway {
  background: #0ea5e9;
}

.node-matchingengine,
.node-locationservice,
.node-tripservice,
.node-transactionservice,
.node-mlinferenceservice,
.node-ruleengine,
.node-chatserver,
.node-inventoryservice {
  background: #3b82f6;
}

.node-notificationservice {
  background: #f59e0b;
}

.node-featurestore,
.node-messagestore,
.node-mediastore,
.node-searchindex {
  background: #fb7185;
}

.node-paymentgateway {
  background: #f472b6;
}

.node-inventorylocking {
  background: #a855f7;
}

.node-eventstream,
.node-tokenbucket,
.node-distributedsync {
  background: #38bdf8;
  color: #1f2937;
}

.node-queue {
  background: #0ea5e9;
}

.decoration-arrow {
  position: absolute;
  font-size: 1.5rem;
  cursor: grab;
  user-select: none;
}

.inspector label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: #1e293b;
  padding-bottom: 0.15rem;
}

.inspector input {
  padding: 0.4rem 0.55rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.7rem;
  color: #0f172a;
  background: #f8fafc;
  transition: border 0.15s, box-shadow 0.15s;
  box-shadow: none;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}
.inspector input:focus {
  border-color: #93b4f5;
  box-shadow: 0 0 0 2.5px rgba(37,99,235,0.10);
}

.inspector textarea {
  padding: 0.4rem 0.55rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  resize: vertical;
  min-height: 30px;
  font-family: inherit;
  font-size: 0.7rem;
  color: #0f172a;
  line-height: 1.5;
  background: #f8fafc;
  transition: border 0.15s, box-shadow 0.15s;
  box-shadow: none;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}
.inspector textarea:focus {
  border-color: #93b4f5;
  box-shadow: 0 0 0 2.5px rgba(37,99,235,0.10);
}
.inspector textarea::placeholder {
  color: #c1c8d4;
  font-style: italic;
  font-weight: 400;
}

/* Inspector select styling */
.inspector select {
  padding: 0.4rem 0.55rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.85rem;
  color: #0f172a;
  background: #f8fafc;
  transition: border 0.15s, box-shadow 0.15s;
  box-shadow: none;
  outline: none;
  cursor: pointer;
  width: 100%;
}
.inspector select:focus {
  border-color: #93b4f5;
  box-shadow: 0 0 0 2.5px rgba(37,99,235,0.10);
}

/* ── Inspector header ─────────────────────────────────── */
.inspector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.3rem 0.2rem;
  font-size: 1.2rem;
  border-bottom: 1px solid #e8ecf1;
}
.inspector-header-left {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  font-size: 0.93rem;
}
.inspector-header-icon {
  width: 25px;
  height: 25px;
  flex-shrink: 0;
  opacity: 0.75;
}
.inspector-header-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: 0.85rem;
}
.inspector-header-type {
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.inspector-header-id {
  font-size: 0.7rem;
  font-weight: 500;
  color: #64748b;
  /* line-height: 1.25; */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Toggle switch ────────────────────────────────────── */
.inspector-toggle {
  display: flex;
  flex-direction: row;
  align-items: center;
  /* gap: 0.35rem; */
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  margin-bottom: 0;
}
.inspector-toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.inspector-toggle-track {
  position: relative;
  width: 28px;
  height: 16px;
  background: #94a3b8;
  border-radius: 999px;
  transition: background 0.2s ease;
  flex-shrink: 0;
}
.inspector-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.12);
  transition: transform 0.2s ease;
}
.inspector-toggle input:checked + .inspector-toggle-track {
  background: #3b82f6;
}
.inspector-toggle input:checked + .inspector-toggle-track .inspector-toggle-thumb {
  transform: translateX(12px);
}
.inspector-toggle input:focus-visible + .inspector-toggle-track {
  box-shadow: 0 0 0 2px rgba(59,130,246,0.2);
}
.inspector-toggle-text {
  font-size: 10.5px;
  font-weight: 500;
  color: #1f2d41;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

/* ── Inspector field layout ───────────────────────────── */
.inspector-fields-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Name + Description group */
.inspector-meta-fields {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-bottom: 0.6rem;
  font-size: 0.85rem;
}

/* Parameters / Advanced section wrapper */
.inspector-params-section {
  padding-top: 0.15rem;
  padding-bottom: 0.25rem;
}

.inspector-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: #1e293b;
  margin-bottom: 0;
}

.inspector-field-name,
.inspector-field-desc {
  grid-column: 1 / -1;
}

.inspector-label {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  white-space: nowrap;
  font-size: 0.85rem;
  font-weight: 600;
  color: #1e293b;
  letter-spacing: 0.01em;
}

.inspector-unit {
  font-weight: 400;
  font-size: 0.7rem;
  color: #64748b;
  margin-left: 2px;
}

/* Tooltip hint */
.inspector-field[title] {
  cursor: help;
}

/* Section dividers */
.inspector-section-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #021c40;
  padding: 10px 0px;
  padding-bottom: 10px;
  border-bottom: none;
  text-align: center;
}

.helper-text {
  font-size: 0.6rem;
  color: #64748b;
}

.inspector-extra {
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  /* Start hidden and slide up when revealed for a smooth preview transition */
  opacity: 0;
  transform: translateY(6px);
  /* animate collapse via max-height to avoid layout jumps; keep transitions short for snappy hide */
  max-height: 0;
  overflow: hidden;
  transition: opacity 100ms cubic-bezier(.2,.9,.2,1), transform 100ms cubic-bezier(.2,.9,.2,1), max-height 120ms cubic-bezier(.2,.9,.2,1);
}

.inspector-extra.visible {
  opacity: 1;
  transform: translateY(0);
  max-height: 600px;
}
.inspector-system #inspector-system-name {
  display: block;
  font-size: 0.93rem; /* default size */
  font-weight: 700;
  color: #0f172a;
  line-height: 1.1;
}
/* Larger/bolder when inspector is showing a hover preview */
.inspector.hovering .inspector-system #inspector-system-name {
  font-size: 0.93rem; /* ~18px to match screenshot */
  font-weight: 800;
  color: #0b1426;
  text-align: center;
}

.inspector-extra {
  /* background: #f8fafc; */
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  /* Start hidden and slide up when revealed for a smooth preview transition */
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 220ms cubic-bezier(.2,.9,.2,1), transform 220ms cubic-bezier(.2,.9,.2,1);
}

.inspector-extra.visible {
  opacity: 1;
  transform: translateY(0);
}

.inspector-extra-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  font-weight: 600;
  font-size: 14ipx;
  text-align: center;
  position: relative;
  padding-bottom: 20px;
}
.inspector-extra-title::after {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 4px;
  height: 6px;
  border-radius: 6px;
  background: linear-gradient(90deg,
    rgba(15,23,42,0) 0%,
    rgba(15,23,42,0.05) 30%,
    rgba(15,23,42,0.12) 50%,
    rgba(15,23,42,0.05) 70%,
    rgba(15,23,42,0) 100%);
}

.inspector-extra-body {
  font-size: 0.85rem;
  color: #334155;
}

.node-id {
  font-size: 0.85rem;
  color: #64748b;
}

.button {
  padding: 10px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  background: #e2e8f0;
  color: #1f2a44;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-size: 0.8rem;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(31, 42, 68, 0.12);
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  pointer-events: auto;
}

.button:disabled:hover {
  transform: none;
  box-shadow: none;
}

.button.primary {
  background: #2563eb;
  color: white;
}

.button.small {
  padding: 0.3rem 0.5rem;
  font-size: 0.7rem;
}

.button.ghost {
  background: rgba(148, 163, 184, 0.2);
  border: 1px solid rgba(148, 163, 184, 0.6);
  color: #f8fafc;
  opacity: 1;
}

.header .button.ghost {
  background: rgba(248, 250, 252, 0.08);
  border-color: rgba(248, 250, 252, 0.7);
  color: #f8fafc;
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.6);
}

.output {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.output pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 0.8rem;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.78rem;
}

.result-block,
.result-block-blackbox {
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.06);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  overflow: hidden;
  padding: 10px;
}

.result-block:hover,
.result-block-blackbox:hover {
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.12);
  border-color: #cbd5f5;
}

/* Collapsible header styling */
.result-block-header,
.result-block-blackbox-header {
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  display: flex;
  /* gap: 0.5rem; */
  align-items: center;
  user-select: none;
  /* background: #f8fafc; */
  transition: background 0.2s ease;
}

.result-block-header:hover,
.result-block-blackbox-header:hover {
  background: #f1f5f9;
  border-radius: 10px;
}

.result-block-header h5,
.result-block-blackbox-header h5 {
  margin-bottom: 0;
  font-size: 0.9rem;
  color: #1e293b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
}

.result-block-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-left: auto;
  transition: transform 0.2s ease;
  font-size: 0.85rem;
  color: #64748b;
}

.result-block.collapsed .result-block-toggle {
  transform: rotate(-90deg);
}

.result-block-content,
.result-block-blackbox-content {
  padding: 0 0.8rem;
  line-height: 1.3rem;
  max-height: 5000px;
  overflow: hidden;
  font-size: 0.85rem;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.result-block.collapsed .result-block-content,
.result-block-blackbox.collapsed .result-block-blackbox-content {
  max-height: 0;
  padding: 0 0.8rem;
}
/* 
.result-block h5,
.result-block-blackbox h5 {
  margin-bottom: 0.1rem;
} */

.result-block h5::before,
.result-block-blackbox h5::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #0c71ff;
  box-shadow: 0 0 0 4px rgba(7, 64, 145, 0.2);
}

.result-block:nth-of-type(1) h5::before {
  background: #fb923c;
  box-shadow: 0 0 0 4px rgba(251, 146, 60, 0.2);
}

.result-block:nth-of-type(2) h5::before {
  background: #6a5ae4;
  box-shadow: 0 0 0 4px rgba(94, 56, 248, 0.2);
}

.result-block:nth-of-type(3) h5::before {
  background: #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.2);
}

.result-block:nth-of-type(4) h5::before {
  background: #ed2c2c;
  box-shadow: 0 0 0 4px rgba(250, 139, 139, 0.2);
}
.result-block:nth-of-type(5) h5::before {
  background: #8bb7fa;
  box-shadow: 0 0 0 4px rgba(167, 139, 250, 0.2);
}

.result-block ul {
  padding-left: 1rem;
  color: #475569;
}

.result-block li {
  margin-bottom: 0.35rem;
}

.violation-severity {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: #ef4444;
  margin-left: 0.35rem;
}

.violation-detail {
  font-size: 0.85rem;
  color: #475569;
  margin-top: 0.2rem;
}

.result-section {
  margin-bottom: 0.8rem;
  line-height: 1.2rem;
}

.result-section h3 {
  font-size: 1.2rem;
  color: #1e293b;
  margin-bottom: 0.35rem;
}

/* Structural errors — clearer spacing and blue background for component examples */
.structural-errors {
  padding-left: 1.1rem;
  margin: 0.4rem 0 0.2rem 0;
}
.structural-errors li {
  margin: 10px 0 14px 0; /* little gap between lines */
  line-height: 1.45;
}
.structural-errors .violation-detail {
  margin-top: 6px;
}
.structural-errors .missing-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  padding: 8px;
  border-radius: 10px;
  background: #e9f2ff; /* soft blue */
  border: 1px solid #cfe0ff;
}
.structural-errors .missing-list .chip {
  background: #ffffff;
  border-color: #dbeafe;
}

.result-section p {
  font-size: 0.9rem;
  color: #475569;
}



.result-block-blackbox h4::before {
  background: #2479f1;
}


/* --- Intro.js (tour) professional theme overrides --- */
.introjs-overlay {
  background: rgba(2, 6, 23, 0.45);
  backdrop-filter: blur(2px);
}

.introjs-helperLayer.prism-tour-highlight {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.45), 0 12px 24px rgba(15, 23, 42, 0.25) !important;
  border-radius: 14px !important;
}

.introjs-tooltip.prism-tour {
  background: #ffffff !important;
  border-radius: 14px !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18) !important;
  padding: 0.7rem 0.9rem !important; /* reduced overall height */
  max-width: 360px;
}

/* Arrow/caret: match white background */
.introjs-tooltip.prism-tour .introjs-arrow.top,
.introjs-tooltip.prism-tour .introjs-arrow.top-right,
.introjs-tooltip.prism-tour .introjs-arrow.top-middle {
  border-bottom-color: #ffffff !important;
}
.introjs-tooltip.prism-tour .introjs-arrow.bottom,
.introjs-tooltip.prism-tour .introjs-arrow.bottom-right,
.introjs-tooltip.prism-tour .introjs-arrow.bottom-middle {
  border-top-color: #ffffff !important;
}
.introjs-tooltip.prism-tour .introjs-arrow.left {
  border-right-color: #ffffff !important;
}
.introjs-tooltip.prism-tour .introjs-arrow.right {
  border-left-color: #ffffff !important;
}

/* Helper highlight layer — remove blue tint */
.introjs-helperLayer {
  background: rgba(255,255,255,0.08) !important;
  border: 2px solid rgba(59,130,246,0.6) !important;
  box-shadow: 0 0 0 2000px rgba(2,6,23,0.45) !important;
  border-radius: 6px !important;
}

.introjs-tooltip.prism-tour .introjs-tooltiptext {
  font-size: 0.93rem; /* slightly smaller */
  color: #0f172a;
  line-height: 1.35; /* tighter line-height to reduce height */
}

.introjs-tooltip.prism-tour .introjs-tooltip-title {
  font-weight: 700;
  color: #0f172a;
}

.introjs-tooltip.prism-tour .introjs-progress {
  height: 4px; /* slimmer */
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.35rem; /* less spacing */
}

.introjs-tooltip.prism-tour .introjs-progressbar {
  background: linear-gradient(90deg, #3b82f6, #22c55e);
}

.introjs-tooltip.prism-tour .introjs-button {
  border-radius: 10px !important;
  border: 1px solid #dbeafe !important;
  background: #1d4ed8 !important;
  color: #f8fafc !important;
  font-weight: 600 !important; /* crisper text */
  padding: 0.34rem 0.8rem !important; /* smaller button */
  box-shadow: none !important; /* remove heavy glow that can layer text visually */
  text-shadow: none !important; /* ensure no layered text look */
}

.introjs-tooltip.prism-tour .introjs-button:hover {
  background: #2563eb !important;
}

.introjs-tooltip.prism-tour .introjs-prevbutton {
  background: #ffffff !important;
  color: #1f2937 !important;
  border-color: #e5e7eb !important;
  box-shadow: none !important;
}

.introjs-tooltip.prism-tour .introjs-skipbutton {
  background: transparent !important;
  color: #6b7280 !important;
  border: none !important;
  box-shadow: none !important;
}

.introjs-tooltip.prism-tour .introjs-tooltipbuttons {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.4rem !important; /* tighten */
  margin-top: 0.3rem !important;  /* tighten */
  border-top: 1px solid #edf2f7 !important; /* subtle separator */
}

/* Small intro banners for palette items (one-time on first open) */
.element-intro-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* allow clicks to pass through */
  z-index: 70;
}
.element-intro-banner {
  position: absolute;
  pointer-events: auto; /* banner can receive pointer events for dismissal */
  max-width: 300px;
  background: #ffffff;
  border-radius: 12px;
  padding: 10px 12px;
  color: #0f172a;
  box-shadow: 0 14px 36px rgba(2,6,23,0.18);
  border: 1px solid #e6eefc;
  font-size: 0.93rem;
  line-height: 1.25;
}
.element-intro-banner strong {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
}
.element-intro-banner .desc {
  color: #475569;
  font-size: 0.82rem;
}

@media (max-width: 800px) {
  .element-intro-banner { max-width: 220px; font-size: 0.9rem; }
}

/* ── Responsive layout for smaller / higher-DPI laptop screens ── */
/* Screens narrower than 1280px (common on 15.6" @ 125% DPI):
   tighten panels and typography so nothing gets cut off at 100% zoom. */
@media (max-width: 1280px) {
  .layout {
    --left-panel-w: clamp(200px, 16vw, 260px);
    --right-panel-w: clamp(200px, 16vw, 260px);
    gap: 0.8rem;
    padding: 0.6rem 0.8rem 0.8rem;
  }
  body * {
    font-size: 0.85rem !important;
  }
}

/* Very tight screens (e.g. 1366px wide @ 125% DPI = ~1092px effective):
   collapse to narrower panels and reduce chrome further. */
@media (max-width: 1100px) {
  .layout {
    --left-panel-w: clamp(180px, 15vw, 230px);
    --right-panel-w: clamp(180px, 15vw, 230px);
    gap: 0.5rem;
    padding: 0.4rem 0.5rem 0.5rem;
  }
  body * {
    font-size: 0.85rem !important;
  }
  .topbar {
    padding: 0.3rem 0.8rem;
  }
}

/* Evaluation Next button states: visually indicate locked vs ready.
   These classes are toggled by the frontend JS: .next-inactive when locked
   and .next-active when the button becomes available. Also style the
   disabled state for accessibility. */
.next-inactive {
  background: #f3f4f6; /* gray-100 */
  color: #6b7280;      /* gray-500 */
  border: 1px solid #d1d5db; /* gray-300 */
  box-shadow: none;
  cursor: not-allowed;
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.next-active {
  background: linear-gradient(180deg, #2563eb, #1d4ed8); /* blue-600 -> blue-700 */
  color: #ffffff;
  border: 1px solid rgba(29, 78, 216, 0.9);
  box-shadow: 0 8px 24px rgba(29, 78, 216, 0.18);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 160ms ease;
}

/* Ensure the native disabled attribute still looks consistent */
.next-inactive[disabled],
.next-active[disabled] {
  opacity: 0.95;
}

/* Slight hover/active affordance for the active state */
.next-active:hover:not([disabled]) {
  transform: translateY(-1px);
}

/* ── Usage quota widget (inside pricing modal footer) ──────────────────── */
.usage-widget {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
}

.usage-widget-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}

.usage-widget-label {
  font-size: 0.85rem;
  color: var(--text-muted, #64748b);
  font-weight: 500;
}

.usage-widget-fraction {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text, #1e293b);
}

.usage-progress-track {
  height: 8px;
  background: var(--border, #e2e8f0);
  border-radius: 999px;
  overflow: hidden;
}

.usage-progress-bar {
  height: 100%;
  background: #22c55e; /* green-500 */
  border-radius: 999px;
  transition: width 400ms ease, background 300ms ease;
}

.usage-progress-bar.warn {
  background: #f59e0b; /* amber-500 */
}

.usage-progress-bar.danger {
  background: #ef4444; /* red-500 */
}

.usage-widget-reset {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--text-muted, #64748b);
}

/* ── Theory open bar (inside stage-theory area) ──────────────────────────── */


.theory-open-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  border: 1px;
  border-radius: 8px;
  padding: 10px;
  color: var(--text-muted, #000000);
  background: transparent;
  cursor: pointer;
  transition: border-color 150ms, color 150ms, background 150ms;
  background-color: #a4c0ed;
}

.theory-open-btn:hover {
  border-color: var(--accent, #3b82f6);
  color: var(--accent, #3b82f6);
  background: rgba(59, 130, 246, 0.05);
}

/* Compact inline variant used inside the sticky learn header */
.theory-open-inline .theory-open-btn {
  width: auto;
  padding: 10px;
  font-size: 0.75rem;
  border-radius: 6px;
  background-color: #dfeeff;
  color: var(--text-default, #07103a);
}
.theory-open-inline { display: flex; align-items: center; margin-left: 12px; }
.theory-open-inline .theory-open-btn:hover { background-color: #c6dbff; }

/* Floating top-center theory button inside the canvas wrapper */
.floating-stage-picker {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 65;
  display: flex;
  align-items: center;
  gap: 8px;
  /* Allow pseudo-element caret on the wrapper */
  pointer-events: none;
}

/* Always-visible dropdown caret (wrapper pseudo-element)
   Some browsers/themes can ignore background-image arrows on <select>.
   This guarantees the caret is visible on top of the white canvas. */
.floating-stage-picker::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid rgba(2, 6, 23, 0.72);
  opacity: 0.9;
  pointer-events: none;
}

.floating-stage-picker select {
  pointer-events: auto;
}
.floating-stage-picker select {
  min-width: 300px;
  max-width: 520px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(2, 6, 23, 0.18);
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.96) 0%, rgba(226, 232, 240, 0.94) 100%);
  box-shadow:
    0 12px 30px rgba(2, 6, 23, 0.10),
    0 1px 0 rgba(255, 255, 255, 0.55) inset;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-weight: 600;
  font-size: 0.95rem;
  color: #0f172a;

  /* Make it read like an actual dropdown */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 42px;
  background-image:
    /* main surface */
    linear-gradient(180deg, rgba(248, 250, 252, 0.96) 0%, rgba(226, 232, 240, 0.94) 100%),
    /* stronger "caret well" + divider on right for contrast */
    linear-gradient(90deg,
      rgba(148, 163, 184, 0.00) 0%,
      rgba(148, 163, 184, 0.00) 58%,
      rgba(148, 163, 184, 0.55) 59%,
      rgba(241, 245, 249, 0.95) 60%,
      rgba(226, 232, 240, 0.95) 100%
    ),
    /* caret (filled triangle for maximum visibility) */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 6 5-6z' fill='%23011122'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: auto, 54px 100%, 22px 22px;
  background-position: 0 0, right 0 center, right 16px center;
}

.floating-stage-picker select:hover {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow:
    0 14px 36px rgba(2, 6, 23, 0.12),
    0 1px 0 rgba(255, 255, 255, 0.55) inset;
}

.floating-stage-picker select:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow:
    0 16px 40px rgba(2, 6, 23, 0.14),
    0 0 0 4px rgba(37, 99, 235, 0.16);
}

.floating-stage-picker select option {
  color: #0f172a;
}

/* Floating theory button now bottom-center and more prominent */
.floating-theory-button {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  align-items: center;
  pointer-events: auto;
}
.floating-theory-button .theory-open-btn {
  padding: 10px 18px;
  font-size: 0.95rem;
  border-radius: 999px;
  background: linear-gradient(90deg, #2563eb 0%, #4f46e5 100%);
  color: #ffffff;
  box-shadow: 0 14px 26px rgba(37, 99, 235, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.18);
  letter-spacing: 0.01em;
}
.floating-theory-button .theory-open-btn:hover {
  filter: brightness(1.02);
  transform: translateY(-1px);
}
.floating-theory-button.hidden { display: none !important; }

@media (max-width: 900px) {
  .floating-stage-picker select { min-width: 220px; max-width: 320px; padding: 8px 12px; padding-right: 40px; font-size: 0.92rem; background-position: 0 0, right 0 center, right 14px center; background-size: auto, 50px 100%, 20px 20px; }
  .floating-stage-picker::after {
    right: 16px;
    border-left-width: 5px;
    border-right-width: 5px;
    border-top-width: 7px;
  }
  .floating-theory-button { bottom: 12px; }
  .floating-theory-button .theory-open-btn { padding: 9px 14px; font-size: 0.92rem; }
}

/* ── Theory full-page overlay ────────────────────────────────────────────── */
.theory-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
  animation: theory-fade-in 180ms ease;
}

@keyframes theory-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

body.theory-overlay-open {
  overflow: hidden;
}

.theory-overlay-inner {
  background: var(--surface, #ffffff);
  border-radius: 14px;
  width: 100%;
  max-width: 780px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: theory-slide-up 200ms ease;
}

@keyframes theory-slide-up {
  from { transform: translateY(18px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* Header */
.theory-overlay-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 24px 28px 18px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  background: var(--surface-2, #f8fafc);
}

.theory-overlay-meta {
  flex: 1;
  min-width: 0;
}

.theory-difficulty-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 6px;
  background: #e2e8f0;
  color: #475569;
}

.theory-difficulty-badge.diff-easy         { background: #dcfce7; color: #16a34a; }
.theory-difficulty-badge.diff-intermediate { background: #fef9c3; color: #ca8a04; }
.theory-difficulty-badge.diff-hard         { background: #fee2e2; color: #dc2626; }
.theory-difficulty-badge.diff-advanced     { background: #ede9fe; color: #7c3aed; }

.theory-overlay-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text, #0f172a);
  margin: 0 0 6px;
  line-height: 1.25;
}

.theory-overlay-desc {
  font-size: 0.88rem;
  color: var(--text-muted, #64748b);
  line-height: 1.55;
  margin: 0;
}

.theory-close-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border, #e2e8f0);
  background: var(--surface, #fff);
  color: var(--text-muted, #64748b);
  font-size: 0.93rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 140ms, color 140ms;
}

.theory-close-btn:hover {
  background: #fee2e2;
  color: #dc2626;
  border-color: #fca5a5;
}

/* Body */
.theory-overlay-body {
  padding: 24px 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  overflow-y: auto;
  max-height: calc(100vh - 220px);
}

/* Section */
.theory-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.theory-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text, #0f172a);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.theory-section-icon {
  font-size: 1.2rem;
}

.theory-section-hint {
  font-size: 0.78rem;
  color: var(--text-muted, #94a3b8);
  margin: 0;
}

/* FR list */
.theory-req-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.theory-req-item.fr-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  font-size: 0.86rem;
  color: var(--text, #1e293b);
  line-height: 1.5;
}

.req-index {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #dbeafe;
  color: #2563eb;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.req-text {
  flex: 1;
}

/* NFR list */
.theory-req-list.nfr {
  gap: 8px;
}

.theory-req-item.nfr-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  border-left: 3px solid currentColor;
  background: var(--surface-2, #f8fafc);
  border-top: 1px solid var(--border, #e2e8f0);
  border-right: 1px solid var(--border, #e2e8f0);
  border-bottom: 1px solid var(--border, #e2e8f0);
}

.nfr-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  line-height: 1.4;
}

.nfr-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nfr-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted, #64748b);
}

.nfr-detail {
  font-size: 0.9rem;
  color: var(--text, #1e293b);
  line-height: 1.5;
}

/* NFR colour variants */
.nfr-item.nfr-green  { color: #16a34a; }
.nfr-item.nfr-blue   { color: #2563eb; }
.nfr-item.nfr-purple { color: #7c3aed; }
.nfr-item.nfr-orange { color: #ea580c; }
.nfr-item.nfr-teal   { color: #0d9488; }
.nfr-item.nfr-yellow { color: #ca8a04; }
.nfr-item.nfr-red    { color: #dc2626; }
.nfr-item.nfr-gray   { color: #475569; }

.theory-req-empty {
  font-size: 0.83rem;
  color: var(--text-muted, #94a3b8);
  font-style: italic;
  padding: 8px 0;
}

/* Architecture notes */
.theory-arch-dl {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}

.theory-arch-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  font-size: 0.9rem;
}

.theory-arch-key {
  font-weight: 600;
  color: var(--text-muted, #64748b);
  font-size: 0.85rem;
  text-transform: capitalize;
  margin: 0;
}

.theory-arch-val {
  color: var(--text, #1e293b);
  line-height: 1.5;
  margin: 0;
}

/* Concept chips */
.theory-concepts-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.theory-concept-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
}

@media (max-width: 600px) {
  .theory-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .theory-overlay-inner {
    border-radius: 14px 14px 0 0;
    max-width: 100%;
  }
  .theory-overlay-header,
  .theory-overlay-body {
    padding-left: 16px;
    padding-right: 16px;
  }
  .theory-arch-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}


