body {
  box-sizing: border-box;
}

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

html,
body {
  height: 100%;
  width: 100%;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #7ba8bd 0%, #a8d5e2 50%, #88c5d8 100%);
  color: #2d3748;
  position: relative;
}

.bg-float {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  user-select: none;
  opacity: 0;
  animation: bgFloat var(--dur) ease-in-out var(--delay) infinite alternate;
  font-size: var(--size);
}

@keyframes bgFloat {
  0%   { transform: translate(0, 0) rotate(var(--r0)); opacity: 0; }
  10%  { opacity: var(--op); }
  90%  { opacity: var(--op); }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--r1)); opacity: 0; }
}

body.dark-mode .bg-float { --op: 0.18; }

body.dark-mode {
  background: linear-gradient(135deg, #0d1620 0%, #1a2332 100%);
  color: #e8f4f8;
}

body.dark-mode::before {
  opacity: 0.18;
}

.app-wrapper {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.header {
  background: linear-gradient(135deg, #003b5c 0%, #4a90a4 100%);
  padding: 0;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}

body.dark-mode .header {
  background: linear-gradient(135deg, #001f3f 0%, #003b5c 100%);
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 40px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.header-brand:hover {
  transform: translateY(-2px);
}

.header-brand-text {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-brand-icon {
  display: flex;
  align-items: center;
}

/* Responsive header logo (DMEG) */
.header-logo-img {
  width: clamp(40px, 6vw, 72px);
  height: auto;
  max-height: 72px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.22));
}

/* Icon images in sidebar/nav */
.sidebar-icon-img,
.nav-icon-img {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-right: 10px;
  flex: 0 0 20px;
}

.sidebar-icon-img__img,
.nav-icon-img__img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  display: block;
}

.menu-toggle {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 24px;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.menu-toggle:hover {
  background: rgba(255, 255, 255, 0.3);
}

@media (min-width: 769px) {
  .menu-toggle {
    display: none;
  }
}

.header h1 {
  font-size: 24px;
  color: white;
  margin: 0;
}

.header .tagline {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.header-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.header-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.header-btn .btn-icon {
  display: none;
}

.header-btn .btn-text {
  display: inline;
}

.header-btn.nav-toggle-btn {
  display: block;
}

@media (max-width: 768px) {
  .header-btn.nav-toggle-btn {
    display: none;
  }
}

/* Mobile responsive styles */
@media (max-width: 768px) {
  .header-brand-text > div:last-child {
    display: none;
  }

  .header-top {
    padding: 12px 20px;
  }

  .header h1 {
    font-size: 20px;
  }

  .header .tagline {
    font-size: 12px;
  }

  .header-btn .btn-text {
    display: none;
  }

  .header-btn .btn-icon {
    display: inline;
  }

  .header-btn {
    padding: 10px;
    min-width: 40px;
  }
}

/* ===== Header lockup improvements (for your exact HTML) ===== */

/* Layout: let brand + actions share space nicely */
.header-top{
  gap: 18px;
}

/* Brand: ensure it can shrink properly without breaking */
.header-brand{
  min-width: 0;
}

/* Keep menu icon + brand aligned */
.header-brand-text{
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0; /* critical: prevents overflow issues */
}

/* Logo shouldn't shrink */
.header-brand-icon{
  flex: 0 0 auto;
}

/* Text column next to logo */
.header-brand-text > div:not(.header-brand-icon){
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 0; /* allows ellipsis */
}

/* Title polish */
.header-brand-text h1{
  font-weight: 780;
  letter-spacing: 0.2px;
  line-height: 1.05;
  font-size: clamp(18px, 2.1vw, 32px);
  margin: 0;

  /* Optional: if title gets too long, keep it in one line */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 52vw; /* prevents pushing actions off-screen */
}

/* Tagline polish */
.header-brand-text .tagline{
  margin: 0;
  font-size: clamp(12px, 1.15vw, 16px);
  line-height: 1.25;
  color: rgba(255,255,255,0.88);

  /* keep line length readable */
  max-width: 52ch;

  /* graceful trim if space is tight */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Actions: don't force-wrap too early */
.header-actions{
  flex: 0 0 auto;
  gap: 10px;
}

/* Optional: a subtle divider line for a more “product” feel */
.header{
  border-bottom: 1px solid rgba(255,255,255,0.10);
}

/* Tablet: allow 2-line title if you prefer readability over ellipsis */
@media (max-width: 980px){
  .header-brand-text h1{
    white-space: normal;      /* allow wrap */
    line-height: 1.1;
    max-width: 56vw;
  }
}

/* Mobile: you already hide the tagline container; keep title readable */
@media (max-width: 768px){
  .header-brand-text h1{
    font-size: 20px;
    max-width: 60vw;
  }

  /* If you want tagline to still appear on mobile, remove your existing rule
     that hides the entire text block and instead just hide tagline:
     .header-brand-text .tagline { display:none; }
  */
}

.nav-menu {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  padding: 0;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}

.nav-menu.open {
  max-height: 300px;
  padding: 16px 40px;
}

.nav-links {
  display: flex;
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.nav-links li {
  margin: 0;
}

.nav-links a {
  color: white;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 6px;
  transition: all 0.3s ease;
  display: block;
}

.nav-links a:hover {
  background: rgba(255, 255, 255, 0.2);
}

.sidebar {
  position: fixed;
  left: -280px;
  top: 0;
  width: 280px;
  height: 100%;
  background: #2d3748;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.2);
  transition: left 0.3s ease;
  z-index: 200;
  overflow-y: auto;
}

.sidebar.open {
  left: 0;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-title {
  font-size: 20px;
  font-weight: 700;
  color: white;
  margin: 0;
}

.sidebar-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  font-size: 24px;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.sidebar-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.question-controls {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-bottom: 15px;
}

.icon-btn {
  background: #f0f4f8;
  border: 2px solid #3f8fa6;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 18px;
  cursor: pointer;
  transition: 0.2s ease;
}

.icon-btn:hover {
  background: #d9edf2;
}

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


.sidebar-section {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-section-title {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

.sidebar-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-menu li {
  margin-bottom: 8px;
}

.sidebar-menu a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 15px;
  padding: 10px 12px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.3s ease;
}

.sidebar-menu a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.sidebar-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 150;
  display: none;
}

.sidebar-overlay.open {
  display: block;
}

/* ── AI Disclosure ── */
.ai-disclosure-section {
  background: #f7f9fc;
  padding: 40px 24px;
  border-top: 3px solid #2d6a8f;
}
body.dark-mode .ai-disclosure-section {
  background: #1a202c;
  border-top-color: #4a90a4;
}
.ai-disclosure-inner {
  max-width: 760px;
  margin: 0 auto;
}
.ai-disclosure-title {
  font-size: 20px;
  font-weight: 700;
  color: #1a3a4a;
  margin: 0 0 4px;
}
body.dark-mode .ai-disclosure-title { color: #e2e8f0; }
.ai-disclosure-subtitle {
  font-size: 13px;
  color: #718096;
  margin: 0 0 20px;
}
.ai-disclosure-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px 24px;
}
body.dark-mode .ai-disclosure-card {
  background: #2d3748;
  border-color: #4a5568;
}
.ai-disclosure-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 8px 0;
}
.ai-disclosure-divider {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 8px 0;
}
body.dark-mode .ai-disclosure-divider { border-color: #4a5568; }
.ai-disc-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
}
.ai-disc-icon--ai {
  background: #e6f7f5;
  color: #2d9e8f;
  border: 1px solid #b2e4df;
}
.ai-disc-icon--check {
  background: #fff8e6;
  color: #d69e2e;
  border: 1px solid #f6e0a0;
}
.ai-disc-text {
  font-size: 14px;
  color: #4a5568;
  line-height: 1.6;
  margin: 0;
  padding-top: 6px;
}
body.dark-mode .ai-disc-text { color: #a0aec0; }
body.dark-mode .ai-disc-icon--ai  { background: #1a3a38; border-color: #2d6b65; }
body.dark-mode .ai-disc-icon--check { background: #3a2e10; border-color: #7a5c10; }

.footer {
  background: #2d3748;
  color: white;
  padding: 40px 20px 20px;
  margin-top: auto;
  border-top: 3px solid #d6d6d6;
}

body.dark-mode .footer {
  border-top-color: #1a2332;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 32px;
  margin-bottom: 32px;
}

.footer-section h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #4a90a4;
}

body.dark-mode .footer-section h3 {
  color: #7dd3c0;
}

.footer-section p {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 12px;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: 10px;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.3s ease;
}

.footer-links a:hover {
  color: #4a90a4;
}

body.dark-mode .footer-links a:hover {
  color: #7dd3c0;
}

.footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
}
.footer-ai-disclosure-link {
  display: inline-block;
  margin-top: 8px;
  color: #4ecdc4;
  font-size: 13px;
  text-decoration: none;
}
.footer-ai-disclosure-link:hover { text-decoration: underline; }

.main-content {
  flex: 1;
  padding: 40px 20px;
  width: 100%;
  display: flex;
  gap: 30px;
  max-width: 1600px;
  margin: 0 auto;
}

@media (max-width: 1024px) {
  .main-content {
    flex-direction: column;
  }
}

.content-area {
  flex: 1;
  min-width: 0;
}

.right-sidebar {
  width: 350px;
  flex-shrink: 0;
  display: none;
}

@media (min-width: 1025px) {
  .right-sidebar {
    display: block;
  }
}

.right-sidebar-card {
  background: #fffef7;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid #d6d6d6;
  margin-bottom: 24px;
  position: sticky;
  top: 90px;
}

body.dark-mode .right-sidebar-card {
  background: #1a2332;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border-color: #2d3748;
}

.sidebar-card-title {
  font-size: 20px;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

body.dark-mode .sidebar-card-title {
  color: #e8f4f8;
}

.sidebar-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 2px solid #d6d6d6;
  padding-bottom: 0;
}

body.dark-mode .sidebar-tabs {
  border-bottom-color: #2d3748;
}

.sidebar-tab {
  background: transparent;
  border: none;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #718096;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
  margin-bottom: -2px;
}

body.dark-mode .sidebar-tab {
  color: #a8c5d1;
}

.sidebar-tab.active {
  color: #4a90a4;
  border-bottom-color: #4a90a4;
}

body.dark-mode .sidebar-tab.active {
  color: #7dd3c0;
  border-bottom-color: #7dd3c0;
}

.sidebar-leaderboard-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-leaderboard-item {
  display: flex;
  align-items: center;
  padding: 12px;
  margin-bottom: 8px;
  background: #fffef7;
  border: 2px solid #d6d6d6;
  border-radius: 8px;
  transition: all 0.3s ease;
}

body.dark-mode .sidebar-leaderboard-item {
  background: #0d1620;
  border-color: #2d3748;
}

.sidebar-leaderboard-item:hover {
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sidebar-leaderboard-item.current-user {
  border-color: #4a90a4;
  background: rgba(74, 144, 164, 0.05);
}

body.dark-mode .sidebar-leaderboard-item.current-user {
  border-color: #7dd3c0;
  background: rgba(125, 211, 192, 0.1);
}

.sidebar-rank {
  font-size: 16px;
  font-weight: 700;
  color: #718096;
  min-width: 30px;
  text-align: center;
}

body.dark-mode .sidebar-rank {
  color: #a8c5d1;
}

.sidebar-rank.rank1 {
  color: #f6ad55;
}

.sidebar-rank.rank2 {
  color: #cbd5e0;
}

.sidebar-rank.rank3 {
  color: #ed8936;
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #4a90a4;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  margin: 0 12px;
}

body.dark-mode .sidebar-avatar {
  background: #003b5c;
}

.sidebar-info {
  flex: 1;
  min-width: 0;
}

.sidebar-name {
  font-size: 14px;
  font-weight: 600;
  color: #2d3748;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.dark-mode .sidebar-name {
  color: #e8f4f8;
}

.sidebar-score {
  font-size: 14px;
  font-weight: 700;
  color: #4a90a4;
}

body.dark-mode .sidebar-score {
  color: #7dd3c0;
}

.view-all-link {
  display: block;
  text-align: center;
  padding: 12px;
  color: #4a90a4;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  transition: all 0.3s ease;
  margin-top: 12px;
}

body.dark-mode .view-all-link {
  color: #7dd3c0;
}

.view-all-link:hover {
  background: rgba(74, 144, 164, 0.1);
}

body.dark-mode .view-all-link:hover {
  background: rgba(125, 211, 192, 0.1);
}

.view {
  display: none;
  width: 100%;
}

.view.active {
  display: block;
}

/* Homepage Styles */
.homepage-container {
  max-width: 1200px;
  margin: 0 auto;
}

.homepage-hero {
  text-align: center;
  padding: 60px 20px;
  margin-bottom: 40px;
}

.homepage-title {
  font-size: 48px;
  font-weight: 800;
  color: white;
  margin-bottom: 20px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  line-height: 1.2;
}

.homepage-subtitle {
  font-size: 20px;
  color: rgba(255, 255, 255, 0.95);
  margin-bottom: 32px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
  line-height: 1.6;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.homepage-cta {
  background: white;
  color: #4a90a4;
  border: none;
  padding: 16px 40px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body.dark-mode .homepage-cta {
  background: #003b5c;
  color: white;
}

.homepage-cta:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
}

body.dark-mode .homepage-cta:hover {
  background: #4a90a4;
}

/* ── Title progression ladder ── */
.header-title-ladder-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 20px;
  background: rgba(0,0,0,0.15);
  border-top: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
}
.header-title-ladder-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.45);
  white-space: nowrap;
  flex-shrink: 0;
}
.title-ladder {
  display: flex;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
  gap: 2px;
  flex: 1;
  padding-bottom: 0;
}
.title-ladder::-webkit-scrollbar { display: none; }
.title-rung {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: none;
  border: none;
  border-radius: 8px;
  padding: 3px 6px;
  cursor: default;
  transition: transform 0.2s;
  min-width: 48px;
  flex-shrink: 0;
}
.title-rung:hover {
  transform: translateY(-2px);
}
.title-rung-icon { font-size: 16px; line-height: 1; }
.title-rung--active {
  position: relative;
}
.title-rung--active .title-rung-icon {
  filter: drop-shadow(0 0 5px rgba(255, 220, 80, 1));
  transform: scale(1.5);
  display: inline-block;
}
.title-rung--active::after {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffd700;
  margin: 3px auto 0;
  box-shadow: 0 0 6px rgba(255, 215, 0, 0.8);
}
.title-rung-arrow {
  font-size: 14px;
  color: rgba(255,255,255,0.30);
  line-height: 1;
  flex-shrink: 0;
  align-self: center;
}
body.dark-mode .title-rung {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.15);
}
body.dark-mode .title-rung:hover { background: rgba(255,255,255,0.16); }

.scroll-down-button {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.9);
  border: 3px solid #4a90a4;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  cursor: pointer;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  animation: bounce 2s infinite;
}

body.dark-mode .scroll-down-button {
  background: rgba(26, 35, 50, 0.95);
  border-color: #7dd3c0;
}

.scroll-down-button:hover {
  transform: translateX(-50%) translateY(-5px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
  animation: none;
}

.scroll-down-button.hidden {
  opacity: 0;
  pointer-events: none;
}

@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  40% {
    transform: translateX(-50%) translateY(-15px);
  }
  60% {
    transform: translateX(-50%) translateY(-7px);
  }
}

@media (max-width: 768px) {
  .scroll-down-button {
    bottom: 25px;
    width: 50px;
    height: 50px;
    font-size: 24px;
  }
}

.topics-section-title {
  font-size: 32px;
  font-weight: 700;
  color: white;
  text-align: center;
  margin-bottom: 40px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  margin-bottom: 60px;
}

.topic-card {
  background: #fffef7;
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  border: 3px solid transparent;
  position: relative;
  overflow: hidden;
}

body.dark-mode .topic-card {
  background: #1a2332;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.topic-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  border-color: #4a90a4;
}

body.dark-mode .topic-card:hover {
  border-color: #7dd3c0;
}

.topic-card.locked {
  opacity: 0.7;
  cursor: not-allowed;
}

.topic-card.locked:hover {
  transform: translateY(-4px);
}

.topic-icon {
  font-size: 64px;
  margin-bottom: 20px;
  display: block;
}

.topic-title {
  font-size: 24px;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 12px;
}

body.dark-mode .topic-title {
  color: #e8f4f8;
}

.topic-description {
  font-size: 15px;
  color: #718096;
  margin-bottom: 20px;
  line-height: 1.6;
  min-height: 72px;
}

body.dark-mode .topic-description {
  color: #a8c5d1;
}

.topic-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  padding-top: 16px;
  border-top: 2px solid #d6d6d6;
}

body.dark-mode .topic-meta {
  border-top-color: #2d3748;
}

.topic-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #718096;
}

body.dark-mode .topic-meta-item {
  color: #a8c5d1;
}

.topic-meta-icon {
  font-size: 16px;
}

.topic-button {
  background: #4a90a4;
  color: white;
  border: none;
  padding: 14px 24px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: all 0.3s ease;
}

body.dark-mode .topic-button {
  background: #003b5c;
}

.topic-button:hover {
  background: #003b5c;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 144, 164, 0.3);
}

body.dark-mode .topic-button:hover {
  background: #4a90a4;
}

.topic-card.locked .topic-button {
  background: #cbd5e0;
  color: #718096;
  cursor: not-allowed;
}

body.dark-mode .topic-card.locked .topic-button {
  background: #2d3748;
  color: #4a5568;
}

.topic-card.locked .topic-button:hover {
  transform: none;
  box-shadow: none;
}

.lock-badge {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(203, 213, 224, 0.9);
  color: #2d3748;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

body.dark-mode .lock-badge {
  background: rgba(45, 55, 72, 0.9);
  color: #a8c5d1;
}

@media (max-width: 768px) {
  .homepage-title {
    font-size: 36px;
  }

  .homepage-subtitle {
    font-size: 18px;
  }

  .topics-grid {
    grid-template-columns: 1fr;
  }
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 30px;
  width: 100%;
}

.skill-card {
  background-color: #fffef7;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  border: 3px solid transparent;
  min-height: 150px;
}

.skill-card-content {
  margin-bottom: 20px;
}

.mode-buttons {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.mode-button {
  flex: 1;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  text-align: center;
}

.practice-mode-btn {
  background: #48bb78;
  color: white;
  border-color: #48bb78;
}

.practice-mode-btn:hover {
  background: #38a169;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

.challenge-mode-btn {
  background: #ed8936;
  color: white;
  border-color: #ed8936;
}

.challenge-mode-btn:hover {
  background: #dd6b20;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(237, 137, 54, 0.3);
}

body.dark-mode .practice-mode-btn {
  background: #2f855a;
  border-color: #2f855a;
}

body.dark-mode .practice-mode-btn:hover {
  background: #48bb78;
}

body.dark-mode .challenge-mode-btn {
  background: #c05621;
  border-color: #c05621;
}

body.dark-mode .challenge-mode-btn:hover {
  background: #ed8936;
}

body.dark-mode .skill-card {
  background-color: #1a2332;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.skill-card:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* Coming-soon placeholder card */
.skill-card.skill-coming-soon {
  border: 2px dashed #cbd5e0;
  background: repeating-linear-gradient(
    135deg,
    transparent,
    transparent 6px,
    rgba(0,0,0,0.018) 6px,
    rgba(0,0,0,0.018) 12px
  );
  opacity: 0.75;
}
.skill-card.skill-coming-soon .mode-button[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
.coming-soon-badge {
  display: inline-block;
  background: #ecc94b;
  color: #744210;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
body.dark-mode .skill-card.skill-coming-soon {
  border-color: #4a5568;
  background: repeating-linear-gradient(
    135deg,
    transparent,
    transparent 6px,
    rgba(255,255,255,0.03) 6px,
    rgba(255,255,255,0.03) 12px
  );
}
body.dark-mode .coming-soon-badge {
  background: #744210;
  color: #fefcbf;
}

/* Locked skill card (unmet prerequisites) */
.skill-card.skill-locked {
  opacity: 0.65;
  border-color: #cbd5e0;
  background-color: #f7f8fa;
  cursor: default;
}
.skill-card.skill-locked:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: none;
}
.skill-card.skill-locked .mode-button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}
body.dark-mode .skill-card.skill-locked {
  background-color: #111827;
  border-color: #374151;
}

/* Prerequisite badge */
.skill-prereqs {
  margin: 8px 0 4px;
  font-size: 12px;
}
.prereq-locked {
  color: #c05621;
  font-weight: 600;
}
.prereq-met {
  color: #38a169;
  font-weight: 500;
}
body.dark-mode .prereq-locked { color: #fbd38d; }
body.dark-mode .prereq-met   { color: #68d391; }

.skill-title {
  font-size: 20px;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 12px;
}

body.dark-mode .skill-title {
  color: #e8f4f8;
}

.skill-description {
  font-size: 14px;
  color: #718096;
  margin-bottom: 16px;
  line-height: 1.5;
}

body.dark-mode .skill-description {
  color: #a8c5d1;
}

.skill-progress {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #d6d6d6;
}

body.dark-mode .skill-progress {
  border-top-color: #2d3748;
}

.progress-bar-container {
  flex: 1;
  height: 8px;
  background: #d6d6d6;
  border-radius: 4px;
  overflow: hidden;
  margin-right: 12px;
}

body.dark-mode .progress-bar-container {
  background: #2d3748;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #48bb78, #38a169);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.score-badge {
  font-size: 14px;
  font-weight: 600;
  color: #4a90a4;
}

body.dark-mode .score-badge {
  color: #7dd3c0;
}

.section-title {
  font-size: 28px;
  color: white;
  margin-bottom: 20px;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  letter-spacing: 0.5px;
}

.back-button {
  background: #fffef7;
  color: #4a90a4;
  border: 2px solid #d6d6d6;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 20px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

body.dark-mode .back-button {
  background: #1a2332;
  color: #7dd3c0;
  border-color: #2d3748;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.back-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.practice-container {
  background: #fffef7;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  max-width: 800px;
  margin: 0 auto;
  border: 1px solid #d6d6d6;
}

body.dark-mode .practice-container {
  background: #1a2332;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  border-color: #2d3748;
}

.mode-indicator {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

.mode-indicator.practice {
  background: #c6f6d5;
  color: #22543d;
  border: 2px solid #48bb78;
}

.mode-indicator.challenge {
  background: #feebc8;
  color: #7c2d12;
  border: 2px solid #ed8936;
}

body.dark-mode .mode-indicator.practice {
  background: #1a3a2e;
  color: #9ae6b4;
}

body.dark-mode .mode-indicator.challenge {
  background: #3a2415;
  color: #fbd38d;
}

/* ---- Challenge HUD ---- */
.challenge-hud {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff8f0;
  border: 2px solid #ed8936;
  border-radius: 12px;
  padding: 10px 18px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

body.dark-mode .challenge-hud {
  background: #3a2415;
  border-color: #c05621;
}

.hud-lives {
  font-size: 20px;
  letter-spacing: 2px;
}

.hud-score {
  font-size: 20px;
  font-weight: 700;
  color: #c05621;
  margin-left: auto;
}

body.dark-mode .hud-score { color: #fbd38d; }

.hud-streak {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 18px;
  font-weight: 700;
  color: #e53e3e;
  animation: streakPulse 0.6s ease;
}

@keyframes streakPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* ---- Round Summary Modal ---- */
.round-summary-content {
  text-align: center;
}

.round-summary-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin: 24px 0;
}

.summary-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.summary-stat-value {
  font-size: 36px;
  font-weight: 800;
  color: #4a90a4;
}

body.dark-mode .summary-stat-value { color: #7dd3c0; }

.summary-stat-label {
  font-size: 13px;
  color: #718096;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.summary-pb-banner {
  background: linear-gradient(135deg, #f6c90e, #f39c12);
  color: #1a1a1a;
  font-weight: 700;
  font-size: 15px;
  padding: 8px 20px;
  border-radius: 20px;
  margin-bottom: 8px;
  animation: streakPulse 0.6s ease;
}

.summary-speed-banner {
  background: linear-gradient(135deg, #6ee7f7, #4a90a4);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 8px 20px;
  border-radius: 20px;
  margin-bottom: 8px;
  animation: streakPulse 0.6s ease;
}

.hud-pb-hint {
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: rgba(74, 144, 164, 0.75);
  border-radius: 20px;
  padding: 5px 14px;
  margin: -4px auto 8px;
  max-width: fit-content;
  animation: slideIn 0.4s ease;
}
body.dark-mode .hud-pb-hint { background: rgba(125, 211, 192, 0.25); }

.summary-pb-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}
.summary-pb-label { color: #718096; }
.summary-pb-value { font-weight: 700; color: #4a90a4; font-size: 16px; }
body.dark-mode .summary-pb-label { color: #a0aec0; }
body.dark-mode .summary-pb-value { color: #7dd3c0; }

.summary-title-earned {
  display: inline-block;
  background: linear-gradient(135deg, #f6e05e, #ed8936);
  color: #744210;
  font-weight: 700;
  font-size: 15px;
  padding: 5px 16px;
  border-radius: 20px;
  margin-bottom: 14px;
  letter-spacing: 0.5px;
}
body.dark-mode .summary-title-earned {
  background: linear-gradient(135deg, #d69e2e, #c05621);
  color: #fff;
}

.summary-message {
  font-size: 16px;
  color: #4a5568;
  margin-bottom: 24px;
}

body.dark-mode .summary-message { color: #a0aec0; }

.leader-title-badge {
  font-size: 12px;
  background: linear-gradient(135deg, #f6e05e44, #ed893644);
  border: 1px solid #ed893688;
  border-radius: 10px;
  padding: 1px 8px;
  font-weight: 600;
  color: #744210;
  margin-right: 4px;
}
body.dark-mode .leader-title-badge {
  background: linear-gradient(135deg, #d69e2e22, #c0562122);
  border-color: #c0562166;
  color: #f6e05e;
}

.summary-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.modal-button-secondary {
  background: #e2e8f0;
  color: #2d3748;
}

.modal-button-secondary:hover {
  background: #cbd5e0;
}

body.dark-mode .modal-button-secondary {
  background: #2d3748;
  color: #e2e8f0;
}

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #d6d6d6;
}

body.dark-mode .question-header {
  border-bottom-color: #2d3748;
}

.question-number {
  font-size: 18px;
  color: #718096;
  font-weight: 600;
}

.current-score {
  font-size: 24px;
  font-weight: 700;
  color: #4a90a4;
}

body.dark-mode .current-score {
  color: #7dd3c0;
}

.question-text {
  font-size: 24px;
  color: #2d3748;
  margin-bottom: 30px;
  line-height: 1.6;
  font-weight: 500;
}

body.dark-mode .question-text {
  color: #e8f4f8;
}

.question-diagram {
  margin: 30px 0;
  text-align: center;
}
body.dark-mode .question-diagram {
  margin: 30px 0;
  text-align: center;
  color: white;
}

.question-diagram svg {
  max-width: 100%;
  height: auto;
}

body.dark-mode .question-diagram svg {
  filter: invert(1) hue-rotate(180deg);
}

.answer-input {
  width: 100%;
  padding: 16px;
  font-size: 20px;
  border: 2px solid #d6d6d6;
  border-radius: 8px;
  margin-bottom: 20px;
  transition: border-color 0.3s ease;
  background: #fffef7;
}

body.dark-mode .answer-input {
  background: #0d1620;
  border-color: #2d3748;
  color: #e8f4f8;
}

.answer-input:focus {
  outline: none;
  border-color: #4a90a4;
}

body.dark-mode .answer-input:focus {
  border-color: #7dd3c0;
}

.answer-input:disabled {
  background: #f7fafc;
  color: #a0aec0;
  cursor: not-allowed;
}

body.dark-mode .answer-input:disabled {
  background: #0d1620;
  color: #4a5568;
}

.submit-button {
  background: #4a90a4;
  color: white;
  border: none;
  padding: 16px 32px;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
}

body.dark-mode .submit-button {
  background: #003b5c;
}

.submit-button:hover:not(:disabled) {
  background: #003b5c;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 144, 164, 0.3);
}

body.dark-mode .submit-button:hover:not(:disabled) {
  background: #4a90a4;
}

.submit-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.feedback {
  margin-top: 20px;
  padding: 16px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  display: none;
}

.feedback.show {
  display: block;
}

.feedback.correct {
  background: #c6f6d5;
  color: #22543d;
  border: 2px solid #48bb78;
}

.feedback.incorrect {
  background: #fed7d7;
  color: #742a2a;
  border: 2px solid #f56565;
}

.explanation {
  margin-top: 10px;
  font-size: 14px;
  opacity: 0.9;
}

.next-button {
  background: #48bb78;
  color: white;
  border: none;
  padding: 16px 32px;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  margin-top: 12px;
}

.next-button:hover {
  background: #38a169;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

/* Affective Input Panel Styles */
.affective-panel {
  margin-top: 30px;
  padding: 24px;
  background: linear-gradient(135deg, rgba(74, 144, 164, 0.08) 0%, rgba(125, 211, 192, 0.08) 100%);
  border: 2px solid #4a90a4;
  border-radius: 12px;
  animation: slideIn 0.4s ease;
}

body.dark-mode .affective-panel {
  background: linear-gradient(135deg, rgba(0, 59, 92, 0.3) 0%, rgba(125, 211, 192, 0.1) 100%);
  border-color: #7dd3c0;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.affective-title {
  font-size: 20px;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 24px;
  text-align: center;
}

body.dark-mode .affective-title {
  color: #e8f4f8;
}

.affective-inputs {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 24px;
}

.affective-input-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.affective-label {
  font-size: 16px;
  font-weight: 600;
  color: #4a5568;
  display: flex;
  align-items: center;
  gap: 8px;
}

body.dark-mode .affective-label {
  color: #e8f4f8;
}

.affective-icon {
  font-size: 20px;
}

.affective-slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: #d6d6d6;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

body.dark-mode .affective-slider {
  background: #2d3748;
}

.affective-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #4a90a4;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.affective-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  background: #003b5c;
}

body.dark-mode .affective-slider::-webkit-slider-thumb {
  background: #7dd3c0;
}

body.dark-mode .affective-slider::-webkit-slider-thumb:hover {
  background: #9ae6cf;
}

.affective-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #4a90a4;
  cursor: pointer;
  border: none;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.affective-slider::-moz-range-thumb:hover {
  transform: scale(1.15);
  background: #003b5c;
}

body.dark-mode .affective-slider::-moz-range-thumb {
  background: #7dd3c0;
}

body.dark-mode .affective-slider::-moz-range-thumb:hover {
  background: #9ae6cf;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #718096;
  padding: 0 4px;
}

body.dark-mode .slider-labels {
  color: #a8c5d1;
}

.emotion-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.emotion-btn {
  background: #fffef7;
  border: 2px solid #d6d6d6;
  border-radius: 12px;
  padding: 16px;
  font-size: 32px;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 70px;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.dark-mode .emotion-btn {
  background: #0d1620;
  border-color: #2d3748;
}

.emotion-btn:hover {
  transform: scale(1.1);
  border-color: #4a90a4;
  box-shadow: 0 4px 12px rgba(74, 144, 164, 0.3);
}

body.dark-mode .emotion-btn:hover {
  border-color: #7dd3c0;
  box-shadow: 0 4px 12px rgba(125, 211, 192, 0.3);
}

.emotion-btn.selected {
  border-color: #4a90a4;
  background: rgba(74, 144, 164, 0.15);
  transform: scale(1.05);
  box-shadow: 0 0 0 3px rgba(74, 144, 164, 0.2);
}

body.dark-mode .emotion-btn.selected {
  border-color: #7dd3c0;
  background: rgba(125, 211, 192, 0.2);
  box-shadow: 0 0 0 3px rgba(125, 211, 192, 0.2);
}

.submit-affective-btn {
  background: #4a90a4;
  color: white;
  border: none;
  padding: 14px 32px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
}

body.dark-mode .submit-affective-btn {
  background: #003b5c;
}

.submit-affective-btn:hover {
  background: #003b5c;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 144, 164, 0.3);
}

body.dark-mode .submit-affective-btn:hover {
  background: #4a90a4;
}

/* ── Fuzzy Engine Transparency Feedback ── */
.affective-feedback { margin-top: 12px; }

.fuzzy-feedback {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
}
body.dark-mode .fuzzy-feedback { background: #0f2a3a; border-color: #164e63; }

.fuzzy-feedback-header {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; margin-bottom: 8px;
}
.fuzzy-badge {
  font-size: 11px; font-weight: 700; border-radius: 99px;
  padding: 2px 8px; margin-left: auto;
}
.fuzzy-badge-increased  { background: #dcfce7; color: #166534; }
.fuzzy-badge-decreased  { background: #fee2e2; color: #991b1b; }
.fuzzy-badge-maintained { background: #fef9c3; color: #854d0e; }
body.dark-mode .fuzzy-badge-increased  { background: #14532d; color: #86efac; }
body.dark-mode .fuzzy-badge-decreased  { background: #450a0a; color: #fca5a5; }
body.dark-mode .fuzzy-badge-maintained { background: #422006; color: #fde68a; }

.fuzzy-feedback-body {
  margin-bottom: 6px; color: #374151;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
body.dark-mode .fuzzy-feedback-body { color: #d1d5db; }

.fuzzy-diff-chip {
  background: #4a90a4; color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 6px; padding: 2px 7px;
}

.fuzzy-feedback-reason {
  color: #6b7280; font-size: 12px; font-style: italic; margin-bottom: 8px;
}
body.dark-mode .fuzzy-feedback-reason { color: #9ca3af; }

.fuzzy-details { font-size: 12px; color: #6b7280; }
.fuzzy-details summary { cursor: pointer; color: #4a90a4; font-weight: 500; }
.fuzzy-inputs-grid {
  display: grid; grid-template-columns: 1fr auto;
  gap: 2px 16px; margin-top: 6px; padding: 8px;
  background: rgba(0,0,0,.04); border-radius: 6px;
}
body.dark-mode .fuzzy-inputs-grid { background: rgba(255,255,255,.05); }
.fuzzy-inputs-grid span:nth-child(even) { font-weight: 600; text-align: right; }

/* Adaptive Difficulty Indicator */
.difficulty-indicator {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  margin-left: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.difficulty-easy {
  background: #c6f6d5;
  color: #22543d;
}

.difficulty-medium {
  background: #feebc8;
  color: #7c2d12;
}

.difficulty-hard {
  background: #fed7d7;
  color: #742a2a;
}

body.dark-mode .difficulty-easy {
  background: #1a3a2e;
  color: #9ae6b4;
}

body.dark-mode .difficulty-medium {
  background: #3a2415;
  color: #fbd38d;
}

body.dark-mode .difficulty-hard {
  background: #3a1a1a;
  color: #fc8181;
}

.show-solution-button {
  background: transparent;
  color: #4a90a4;
  border: 2px solid #4a90a4;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  margin-top: 12px;
}

body.dark-mode .show-solution-button {
  color: #7dd3c0;
  border-color: #7dd3c0;
}

.show-solution-button:hover:not(:disabled) {
  background: #4a90a4;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 144, 164, 0.3);
}

body.dark-mode .show-solution-button:hover:not(:disabled) {
  background: #7dd3c0;
  color: #001f3f;
}

.show-solution-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: #cbd5e0;
  color: #cbd5e0;
}

.hint-button {
  background: transparent;
  color: #48bb78;
  border: 2px solid #48bb78;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  margin-top: 12px;
}

.hint-button:hover:not(:disabled) {
  background: #48bb78;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

.hint-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: #cbd5e0;
  color: #cbd5e0;
}

.hint-box {
  margin-top: 20px;
  padding: 20px;
  border-radius: 8px;
  background: #f0fff4;
  border: 2px solid #48bb78;
  display: none;
}

body.dark-mode .hint-box {
  background: #1a3a2e;
  border-color: #48bb78;
}

.hint-box.show {
  display: block;
}

.hint-title {
  font-size: 18px;
  font-weight: 700;
  color: #22543d;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

body.dark-mode .hint-title {
  color: #9ae6b4;
}

.hint-content {
  background: #f0fff4;
  padding: 16px;
  border-radius: 6px;
  font-size: 15px;
  line-height: 1.8;
  color: #2d3748;
  border: 1px solid #9ae6b4;
}

body.dark-mode .hint-content {
  background: #0f1f1a;
  border-color: #2d4a3e;
  color: #c6f6d5;
}

.hint-content strong {
  color: #22543d;
  display: block;
  margin-top: 12px;
  margin-bottom: 6px;
}

body.dark-mode .hint-content strong {
  color: #9ae6b4;
}

.hint-content strong:first-child {
  margin-top: 0;
}

.hint-formula {
  background: #e6f4ea;
  padding: 12px;
  border-radius: 6px;
  margin: 10px 0;
  font-family: "Courier New", monospace;
  border-left: 4px solid #48bb78;
}

body.dark-mode .hint-formula {
  background: #0a1510;
  color: #9ae6b4;
}

.solution-box {
  margin-top: 20px;
  padding: 20px;
  border-radius: 8px;
  background: #edf2f7;
  border: 2px solid #cbd5e0;
  display: none;
}

body.dark-mode .solution-box {
  background: #0d1620;
  border-color: #2d3748;
}

.solution-box.show {
  display: block;
}

.solution-title {
  font-size: 18px;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

body.dark-mode .solution-title {
  color: #e8f4f8;
}

.solution-steps {
  list-style: none;
  padding: 0;
}

.solution-step {
  padding: 12px;
  margin-bottom: 10px;
  background: #fffef7;
  border-radius: 6px;
  border-left: 4px solid #4a90a4;
  font-size: 15px;
  line-height: 1.6;
  color: #4a5568;
  border: 1px solid #d6d6d6;
  border-left: 4px solid #4a90a4;
}

body.dark-mode .solution-step {
  background: #1a2332;
  border-left-color: #7dd3c0;
  color: #a8c5d1;
  border-color: #2d3748;
}

.solution-step strong {
  color: #2d3748;
  display: block;
  margin-bottom: 4px;
}

body.dark-mode .solution-step strong {
  color: #e8f4f8;
}

.solution-final {
  margin-top: 16px;
  padding: 16px;
  background: #4a90a4;
  color: white;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
}

body.dark-mode .solution-final {
  background: #003b5c;
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 20px 0;
}

.modal-overlay.show {
  display: flex;
}

.modal-content {
  background: #fffef7;
  border-radius: 12px;
  padding: 40px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  text-align: center;
  border: 2px solid #d6d6d6;
  margin: auto;
  max-height: 90vh;
  overflow-y: auto;
}

body.dark-mode .modal-content {
  background: #1a2332;
  border-color: #2d3748;
}

.modal-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 24px;
  font-weight: 700;
  color: #742a2a;
  margin-bottom: 16px;
}

.modal-message {
  font-size: 16px;
  color: #4a5568;
  line-height: 1.6;
  margin-bottom: 20px;
}

.modal-link {
  display: inline-block;
  color: #4a90a4;
  text-decoration: underline;
  margin-bottom: 24px;
  font-weight: 600;
}

body.dark-mode .modal-link {
  color: #7dd3c0;
}

.modal-button {
  background: #4a90a4;
  color: white;
  border: none;
  padding: 14px 40px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

body.dark-mode .modal-button {
  background: #003b5c;
}

.modal-button:hover {
  background: #003b5c;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 144, 164, 0.3);
}

body.dark-mode .modal-button:hover {
  background: #4a90a4;
}

/* Auth Modal Styles */
.auth-modal {
  max-width: 450px;
  position: relative;
}

.auth-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: transparent;
  border: none;
  font-size: 24px;
  color: #718096;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.auth-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #2d3748;
}

body.dark-mode .auth-close {
  color: #a8c5d1;
}

body.dark-mode .auth-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #e8f4f8;
}

.auth-title {
  font-size: 28px;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 8px;
}

body.dark-mode .auth-title {
  color: #e8f4f8;
}

.auth-subtitle {
  font-size: 16px;
  color: #718096;
  margin-bottom: 32px;
}

body.dark-mode .auth-subtitle {
  color: #a8c5d1;
}

.auth-form {
  width: 100%;
}

.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 8px;
}

body.dark-mode .form-group label {
  color: #e8f4f8;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  border: 2px solid #d6d6d6;
  border-radius: 8px;
  transition: border-color 0.3s ease;
  background: #fffef7;
  color: #2d3748;
}

body.dark-mode .form-group input[type="text"],
body.dark-mode .form-group input[type="email"],
body.dark-mode .form-group input[type="password"] {
  background: #0d1620;
  border-color: #2d3748;
  color: #e8f4f8;
}

.form-group input:focus {
  outline: none;
  border-color: #4a90a4;
}

body.dark-mode .form-group input:focus {
  border-color: #7dd3c0;
}

.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  font-size: 14px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #4a5568;
  cursor: pointer;
  font-weight: 400;
}

body.dark-mode .checkbox-label {
  color: #a8c5d1;
}

.checkbox-label input[type="checkbox"] {
  cursor: pointer;
}

.auth-link {
  color: #4a90a4;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease;
}

.auth-link:hover {
  color: #003b5c;
  text-decoration: underline;
}

body.dark-mode .auth-link {
  color: #7dd3c0;
}

body.dark-mode .auth-link:hover {
  color: #9ae6cf;
}

.auth-button {
  width: 100%;
  background: #4a90a4;
  color: white;
  border: none;
  padding: 14px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 24px;
}

body.dark-mode .auth-button {
  background: #003b5c;
}

.auth-button:hover {
  background: #003b5c;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 144, 164, 0.3);
}

body.dark-mode .auth-button:hover {
  background: #4a90a4;
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 24px 0;
  color: #a0aec0;
  font-size: 14px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid #d6d6d6;
}

body.dark-mode .auth-divider::before,
body.dark-mode .auth-divider::after {
  border-bottom-color: #2d3748;
}

.auth-divider span {
  padding: 0 12px;
}

.auth-footer {
  text-align: center;
  font-size: 15px;
  color: #4a5568;
}

body.dark-mode .auth-footer {
  color: #a8c5d1;
}

/* User Menu */
.user-menu {
  position: relative;
  display: none;
  align-items: center;
  gap: 8px;
}

.user-menu.active {
  display: flex;
}

.nav-title-chip {
  display: none;
  align-items: center;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.30);
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  cursor: default;
  backdrop-filter: blur(4px);
  transition: background 0.2s;
}
.nav-title-chip:hover {
  background: rgba(255,255,255,0.26);
}
body.dark-mode .nav-title-chip {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.20);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #4a90a4;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.user-avatar:hover {
  background: #003b5c;
  border-color: white;
}

body.dark-mode .user-avatar {
  background: #003b5c;
}

body.dark-mode .user-avatar:hover {
  background: #4a90a4;
}

.user-dropdown {
  position: absolute;
  top: 50px;
  right: 0;
  background: #fffef7;
  border: 2px solid #d6d6d6;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  min-width: 200px;
  display: none;
  z-index: 100;
}

body.dark-mode .user-dropdown {
  background: #1a2332;
  border-color: #2d3748;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.user-dropdown.show {
  display: block;
}

.user-dropdown-header {
  padding: 16px;
  border-bottom: 1px solid #d6d6d6;
}

body.dark-mode .user-dropdown-header {
  border-bottom-color: #2d3748;
}

.user-dropdown-name {
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 4px;
}

body.dark-mode .user-dropdown-name {
  color: #e8f4f8;
}

.user-dropdown-email {
  font-size: 13px;
  color: #718096;
}

body.dark-mode .user-dropdown-email {
  color: #a8c5d1;
}

.user-dropdown-menu {
  list-style: none;
  padding: 8px 0;
  margin: 0;
}

.user-dropdown-menu li {
  margin: 0;
}

.user-dropdown-menu a,
.user-dropdown-menu button {
  display: block;
  width: 100%;
  padding: 12px 16px;
  text-align: left;
  font-size: 14px;
  color: #4a5568;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.3s ease;
}

body.dark-mode .user-dropdown-menu a,
body.dark-mode .user-dropdown-menu button {
  color: #a8c5d1;
}

.user-dropdown-menu a:hover,
.user-dropdown-menu button:hover {
  background: #f7fafc;
}

body.dark-mode .user-dropdown-menu a:hover,
body.dark-mode .user-dropdown-menu button:hover {
  background: #2d3748;
}

.user-dropdown-divider {
  height: 1px;
  background: #d6d6d6;
  margin: 8px 0;
}

body.dark-mode .user-dropdown-divider {
  background: #2d3748;
}

/* Avatar Selection Styles */
.avatar-section {
  margin-bottom: 24px;
  text-align: left;
}

.avatar-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 12px;
}

body.dark-mode .avatar-label {
  color: #e8f4f8;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.avatar-option {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.3s ease;
  background: #f7fafc;
}

body.dark-mode .avatar-option {
  background: #0d1620;
}

.avatar-option:hover {
  transform: scale(1.1);
  border-color: #4a90a4;
}

body.dark-mode .avatar-option:hover {
  border-color: #7dd3c0;
}

.avatar-option.selected {
  border-color: #4a90a4;
  background: rgba(74, 144, 164, 0.1);
  box-shadow: 0 0 0 2px rgba(74, 144, 164, 0.2);
}

body.dark-mode .avatar-option.selected {
  border-color: #7dd3c0;
  background: rgba(125, 211, 192, 0.1);
  box-shadow: 0 0 0 2px rgba(125, 211, 192, 0.2);
}

/* Leaderboard Styles */
.leaderboard-container {
  background: #fffef7;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  max-width: 900px;
  margin: 0 auto;
  border: 1px solid #d6d6d6;
}

body.dark-mode .leaderboard-container {
  background: #1a2332;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  border-color: #2d3748;
}

/* Leaderboard type switcher (Score / Badges) */
.leaderboard-type-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.leaderboard-type-tab {
  background: #e2e8f0;
  border: none;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  color: #4a5568;
  cursor: pointer;
  transition: all 0.2s ease;
}
.leaderboard-type-tab.active {
  background: #4a90a4;
  color: #fff;
}
.leaderboard-type-tab:hover:not(.active) { background: #cbd5e0; }
body.dark-mode .leaderboard-type-tab { background: #2d3748; color: #a8c5d1; }
body.dark-mode .leaderboard-type-tab.active { background: #4a90a4; color: #fff; }
body.dark-mode .leaderboard-type-tab:hover:not(.active) { background: #3d4a5c; }

.leaderboard-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 30px;
  border-bottom: 2px solid #d6d6d6;
  padding-bottom: 0;
}

body.dark-mode .leaderboard-tabs {
  border-bottom-color: #2d3748;
}

.leaderboard-tab {
  background: transparent;
  border: none;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 600;
  color: #718096;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
  margin-bottom: -2px;
}

body.dark-mode .leaderboard-tab {
  color: #a8c5d1;
}

.leaderboard-tab.active {
  color: #4a90a4;
  border-bottom-color: #4a90a4;
}

body.dark-mode .leaderboard-tab.active {
  color: #7dd3c0;
  border-bottom-color: #7dd3c0;
}

.leaderboard-tab:hover:not(.active) {
  color: #4a5568;
}

body.dark-mode .leaderboard-tab:hover:not(.active) {
  color: #e8f4f8;
}

.leaderboard-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  padding: 20px;
  margin-bottom: 12px;
  background: #fffef7;
  border: 2px solid #d6d6d6;
  border-radius: 8px;
  transition: all 0.3s ease;
}

body.dark-mode .leaderboard-item {
  background: #0d1620;
  border-color: #2d3748;
}

.leaderboard-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.leaderboard-item.current-user {
  border-color: #4a90a4;
  background: rgba(74, 144, 164, 0.05);
}

body.dark-mode .leaderboard-item.current-user {
  border-color: #7dd3c0;
  background: rgba(125, 211, 192, 0.1);
}

.leaderboard-rank {
  font-size: 24px;
  font-weight: 700;
  color: #718096;
  min-width: 50px;
  text-align: center;
}

body.dark-mode .leaderboard-rank {
  color: #a8c5d1;
}

.leaderboard-rank.top3 {
  font-size: 28px;
}

.leaderboard-rank.rank1 {
  color: #f6ad55;
}

.leaderboard-rank.rank2 {
  color: #cbd5e0;
}

.leaderboard-rank.rank3 {
  color: #ed8936;
}

.leaderboard-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #4a90a4;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  margin: 0 20px;
}

body.dark-mode .leaderboard-avatar {
  background: #003b5c;
}

.leaderboard-info {
  flex: 1;
}

.leaderboard-name {
  font-size: 18px;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 4px;
}

body.dark-mode .leaderboard-name {
  color: #e8f4f8;
}

.leaderboard-stats {
  font-size: 14px;
  color: #718096;
}

body.dark-mode .leaderboard-stats {
  color: #a8c5d1;
}

.leaderboard-score {
  font-size: 24px;
  font-weight: 700;
  color: #4a90a4;
  margin-left: 20px;
}

body.dark-mode .leaderboard-score {
  color: #7dd3c0;
}

/* Badges Styles */
.badges-container {
  background: #fffef7;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  max-width: 900px;
  margin: 0 auto;
  border: 1px solid #d6d6d6;
}

body.dark-mode .badges-container {
  background: #1a2332;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  border-color: #2d3748;
}

.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.badge-card {
  background: #fffef7;
  border: 2px solid #d6d6d6;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  transition: all 0.3s ease;
}

body.dark-mode .badge-card {
  background: #0d1620;
  border-color: #2d3748;
}

.badge-card.earned {
  border-color: #48bb78;
  background: rgba(72, 187, 120, 0.05);
}

body.dark-mode .badge-card.earned {
  background: rgba(72, 187, 120, 0.1);
}

.badge-card.locked {
  opacity: 0.5;
}

.badge-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.badge-icon {
  font-size: 64px;
  margin-bottom: 12px;
  filter: grayscale(100%);
}

.badge-card.earned .badge-icon {
  filter: grayscale(0%);
  animation: badgePop 0.5s ease;
}

@keyframes badgePop {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.badge-name {
  font-size: 18px;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 8px;
}

body.dark-mode .badge-name {
  color: #e8f4f8;
}

.badge-description {
  font-size: 14px;
  color: #718096;
  line-height: 1.5;
}

body.dark-mode .badge-description {
  color: #a8c5d1;
}

.badge-progress {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #d6d6d6;
}

body.dark-mode .badge-progress {
  border-top-color: #2d3748;
}

.badge-progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 8px;
}

body.dark-mode .badge-progress-bar {
  background: rgba(255, 255, 255, 0.1);
}

.badge-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4a90a4 0%, #003b5c 100%);
  border-radius: 10px;
  transition: width 0.5s ease;
}

body.dark-mode .badge-progress-fill {
  background: linear-gradient(90deg, #7dd3c0 0%, #4a90a4 100%);
}

.badge-card.earned .badge-progress-fill {
  background: linear-gradient(90deg, #48bb78 0%, #38a169 100%);
}

.badge-progress-text {
  font-size: 14px;
  color: #4a90a4;
  font-weight: 600;
  text-align: center;
}

body.dark-mode .badge-progress-text {
  color: #7dd3c0;
}

.badge-card.earned .badge-progress-text {
  color: #48bb78;
}
body.dark-mode .badge-progress {
  border-top-color: #2d3748;
  color: #7dd3c0;
}

.badge-card.earned .badge-progress {
  color: #48bb78;
}

.badge-earned-date {
  font-size: 12px;
  color: #718096;
  margin-top: 8px;
  font-style: italic;
}

body.dark-mode .badge-earned-date {
  color: #a8c5d1;
}

.stats-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: #fffef7;
  border: 2px solid #d6d6d6;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
}

body.dark-mode .stat-card {
  background: #0d1620;
  border-color: #2d3748;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: #4a90a4;
  margin-bottom: 8px;
}

body.dark-mode .stat-value {
  color: #7dd3c0;
}

.stat-label {
  font-size: 14px;
  color: #718096;
  font-weight: 600;
}

body.dark-mode .stat-label {
  color: #a8c5d1;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #718096;
}

body.dark-mode .empty-state {
  color: #a8c5d1;
}

.empty-state-icon {
  font-size: 64px;
  margin-bottom: 20px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
}

.empty-state-subtitle {
  font-size: 14px;
}

/* Teacher Styles */
.teacher-only {
  display: none !important;
}

body.teacher-mode .teacher-only {
  display: block !important;
}

body.teacher-mode .nav-links .teacher-only {
  display: list-item !important;
}

.teacher-dashboard {
  max-width: 1200px;
  margin: 0 auto;
}

.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.dashboard-card {
  background: #fffef7;
  border: 2px solid #d6d6d6;
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

body.dark-mode .dashboard-card {
  background: #1a2332;
  border-color: #2d3748;
}

.dashboard-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  border-color: #4a90a4;
}

body.dark-mode .dashboard-card:hover {
  border-color: #7dd3c0;
}

.dashboard-card-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.dashboard-card-title {
  font-size: 20px;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 12px;
}

body.dark-mode .dashboard-card-title {
  color: #e8f4f8;
}

.dashboard-card-value {
  font-size: 48px;
  font-weight: 700;
  color: #4a90a4;
  margin-bottom: 8px;
}

body.dark-mode .dashboard-card-value {
  color: #7dd3c0;
}

.dashboard-card-label {
  font-size: 14px;
  color: #718096;
}

body.dark-mode .dashboard-card-label {
  color: #a8c5d1;
}

.quick-actions {
  background: #fffef7;
  border: 2px solid #d6d6d6;
  border-radius: 12px;
  padding: 32px;
}

body.dark-mode .quick-actions {
  background: #1a2332;
  border-color: #2d3748;
}

.quick-actions h3 {
  font-size: 24px;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 20px;
}

body.dark-mode .quick-actions h3 {
  color: #e8f4f8;
}

.action-btn {
  background: #4a90a4;
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

body.dark-mode .action-btn {
  background: #003b5c;
}

.action-btn:hover {
  background: #003b5c;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 144, 164, 0.3);
}

body.dark-mode .action-btn:hover {
  background: #4a90a4;
}

.teacher-container {
  max-width: 1200px;
  margin: 0 auto;
}

.teacher-back {
  margin-bottom: 20px;
}

.classes-grid,
.lessons-grid,
.worksheets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

/* ── Lesson sequence builder ── */
.lesson-skill-adder { position: relative; }
.lesson-skill-adder input {
  width: 100%; padding: 10px 14px; border: 1px solid #d1d5db;
  border-radius: 8px; font-size: 14px; box-sizing: border-box;
}
.lesson-skill-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 200;
  background: #fff; border: 1px solid #d1d5db; border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12); max-height: 220px; overflow-y: auto;
}
body.dark-mode .lesson-skill-dropdown { background: #1e2d3d; border-color: #3d4f63; }
.lesson-skill-option {
  padding: 10px 14px; font-size: 13px; cursor: pointer; transition: background .15s;
}
.lesson-skill-option:hover { background: #f0f4ff; }
body.dark-mode .lesson-skill-option:hover { background: #2a3f55; }
.lesson-skill-option.already-added { opacity: .45; cursor: default; }
.lesson-seq-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: #4a90a4; color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 99px; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px;
}
.lesson-sequence { display: flex; flex-direction: column; gap: 6px; }
.lesson-seq-row {
  display: flex; align-items: center; gap: 10px;
  background: #f8fafc; border: 1px solid #e2e8f0;
  border-radius: 8px; padding: 8px 12px;
}
body.dark-mode .lesson-seq-row { background: #1a2d3e; border-color: #2d3f52; }
.lesson-seq-num {
  min-width: 22px; height: 22px; border-radius: 50%; background: #4a90a4;
  color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.lesson-seq-title { flex: 1; font-size: 13px; font-weight: 500; }
.lesson-seq-controls { display: flex; gap: 4px; }
.lesson-seq-btn {
  border: none; background: transparent; cursor: pointer; padding: 3px 6px;
  border-radius: 4px; font-size: 11px; color: #718096; transition: background .15s;
}
.lesson-seq-btn:hover:not(:disabled) { background: #e2e8f0; color: #2d3748; }
.lesson-seq-btn:disabled { opacity: .3; cursor: default; }
.lesson-seq-remove:hover:not(:disabled) { background: #fed7d7 !important; color: #c53030 !important; }

/* ── Lesson cards (richer layout) ── */
.lesson-card-header { margin-bottom: 10px; }
.lesson-card-title { font-size: 17px; font-weight: 700; margin: 0 0 4px; }
.lesson-card-meta { display: flex; gap: 16px; font-size: 12px; color: #718096; }
.lesson-seq-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.lesson-seq-chip {
  background: #eef2ff; color: #3730a3; font-size: 12px; font-weight: 500;
  border-radius: 6px; padding: 3px 9px;
}
body.dark-mode .lesson-seq-chip { background: #2d3a5e; color: #a5b4fc; }
.lesson-card-actions { display: flex; gap: 8px; margin-top: 4px; }
.lesson-deliver-btn {
  flex: 1; padding: 9px 0; background: #6b46c1; color: #fff; border: none;
  border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; transition: background .15s;
}
.lesson-deliver-btn:hover { background: #553c9a; }
.lesson-delete-btn {
  padding: 9px 14px; background: transparent; border: 1px solid #e2e8f0;
  border-radius: 8px; font-size: 14px; cursor: pointer; color: #718096; transition: all .15s;
}
.lesson-delete-btn:hover { background: #fed7d7; border-color: #fc8181; color: #c53030; }

/* ── Lesson nav bar in teach-view ── */
.teach-lesson-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: #4a90a4; color: #fff; padding: 8px 16px; gap: 12px;
}
body.dark-mode .teach-lesson-bar { background: #2a5f72; }
.teach-lesson-info { display: flex; flex-direction: column; align-items: center; flex: 1; }
.teach-lesson-name { font-size: 13px; font-weight: 700; }
.teach-lesson-pos { font-size: 11px; opacity: .8; }
.teach-lesson-nav-btn {
  background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.4);
  color: #fff; border-radius: 6px; padding: 5px 12px; font-size: 12px;
  font-weight: 600; cursor: pointer; transition: background .15s; white-space: nowrap;
}
.teach-lesson-nav-btn:hover:not(:disabled) { background: rgba(255,255,255,.35); }
.teach-lesson-nav-btn:disabled { opacity: .4; cursor: default; }

/* Teacher answer panel */
.teach-answer-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: 12px 0 4px;
  padding: 10px 16px;
  background: #fffbeb;
  border: 1.5px solid #f59e0b;
  border-radius: 8px;
  font-size: 0.95rem;
}
body.dark-mode .teach-answer-panel {
  background: #2d2408;
  border-color: #d97706;
}
.teach-answer-label {
  font-weight: 600;
  color: #92400e;
  white-space: nowrap;
}
body.dark-mode .teach-answer-label { color: #fbbf24; }
.teach-answer-value {
  font-family: monospace;
  font-size: 1rem;
  color: #1e40af;
  font-weight: 600;
  background: rgba(255,255,255,.6);
  padding: 2px 8px;
  border-radius: 4px;
}
body.dark-mode .teach-answer-value {
  color: #93c5fd;
  background: rgba(0,0,0,.3);
}
.teach-answer-hint {
  font-size: 0.82rem;
  color: #78716c;
  font-style: italic;
}
body.dark-mode .teach-answer-hint { color: #a8a29e; }

/* Answer input placeholder hint */
#answer-input::placeholder { color: #94a3b8; font-style: italic; }

.class-card,
.lesson-card,
.worksheet-card {
  background: #fffef7;
  border: 2px solid #d6d6d6;
  border-radius: 12px;
  padding: 24px;
  transition: all 0.3s ease;
}

body.dark-mode .class-card,
body.dark-mode .lesson-card,
body.dark-mode .worksheet-card {
  background: #1a2332;
  border-color: #2d3748;
}

.class-card:hover,
.lesson-card:hover,
.worksheet-card:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  border-color: #4a90a4;
}

body.dark-mode .class-card:hover,
body.dark-mode .lesson-card:hover,
body.dark-mode .worksheet-card:hover {
  border-color: #7dd3c0;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.card-title {
  font-size: 20px;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 8px;
}

body.dark-mode .card-title {
  color: #e8f4f8;
}

.card-code {
  background: #4a90a4;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
}

body.dark-mode .card-code {
  background: #003b5c;
}

.card-description {
  font-size: 14px;
  color: #718096;
  margin-bottom: 16px;
  line-height: 1.5;
}

body.dark-mode .card-description {
  color: #a8c5d1;
}

.card-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  padding-top: 16px;
  border-top: 1px solid #d6d6d6;
}

body.dark-mode .card-meta {
  border-top-color: #2d3748;
}

.card-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #718096;
}

body.dark-mode .card-meta-item {
  color: #a8c5d1;
}

.card-actions {
  display: flex;
  gap: 8px;
}

.card-btn {
  flex: 1;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  text-align: center;
}

.card-btn.primary {
  background: #4a90a4;
  color: white;
  border-color: #4a90a4;
}

body.dark-mode .card-btn.primary {
  background: #003b5c;
  border-color: #003b5c;
}

.card-btn.primary:hover {
  background: #003b5c;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 144, 164, 0.3);
}

body.dark-mode .card-btn.primary:hover {
  background: #4a90a4;
}

.card-btn.secondary {
  background: transparent;
  color: #4a90a4;
  border-color: #4a90a4;
}

body.dark-mode .card-btn.secondary {
  color: #7dd3c0;
  border-color: #7dd3c0;
}

.card-btn.secondary:hover {
  background: #4a90a4;
  color: white;
}

body.dark-mode .card-btn.secondary:hover {
  background: #7dd3c0;
  color: #001f3f;
}

.teacher-modal {
  max-width: 500px;
}

.large-modal {
  max-width: 700px;
}

.skills-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 300px;
  overflow-y: auto;
  padding: 16px;
  background: #f7fafc;
  border-radius: 8px;
  border: 1px solid #d6d6d6;
}

body.dark-mode .skills-checkboxes {
  background: #0d1620;
  border-color: #2d3748;
}

.skill-checkbox-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #fffef7;
  border-radius: 6px;
  border: 1px solid #d6d6d6;
  cursor: pointer;
  transition: all 0.3s ease;
}

body.dark-mode .skill-checkbox-item {
  background: #1a2332;
  border-color: #2d3748;
}

.skill-checkbox-item:hover {
  border-color: #4a90a4;
}

body.dark-mode .skill-checkbox-item:hover {
  border-color: #7dd3c0;
}

.skill-checkbox-item input[type="checkbox"] {
  cursor: pointer;
}

.skill-checkbox-label {
  flex: 1;
  cursor: pointer;
}

.skill-checkbox-title {
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 4px;
}

body.dark-mode .skill-checkbox-title {
  color: #e8f4f8;
}

.skill-checkbox-desc {
  font-size: 13px;
  color: #718096;
}

body.dark-mode .skill-checkbox-desc {
  color: #a8c5d1;
}

/* Chatbot Styles */
.chatbot-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4a90a4 0%, #003b5c 100%);
  color: white;
  border: none;
  font-size: 32px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(74, 144, 164, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  transition: all 0.3s ease;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

.chatbot-fab:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 6px 28px rgba(74, 144, 164, 0.5);
  animation: none;
}

body.dark-mode .chatbot-fab {
  background: linear-gradient(135deg, #003b5c 0%, #001f3f 100%);
  box-shadow: 0 4px 20px rgba(0, 59, 92, 0.6);
}

body.dark-mode .chatbot-fab:hover {
  box-shadow: 0 6px 28px rgba(0, 59, 92, 0.7);
}

@media (max-width: 768px) {
  .chatbot-fab {
    width: 56px;
    height: 56px;
    font-size: 28px;
    bottom: 20px;
    right: 20px;
  }
}

.chatbot-container {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  height: 550px;
  background: #fffef7;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  border: 2px solid #d6d6d6;
  display: none;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
}

.chatbot-container.open {
  display: flex;
}

body.dark-mode .chatbot-container {
  background: #1a2332;
  border-color: #2d3748;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.chatbot-header {
  background: linear-gradient(135deg, #003b5c 0%, #4a90a4 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #003b5c;
}

body.dark-mode .chatbot-header {
  background: linear-gradient(135deg, #001f3f 0%, #003b5c 100%);
}

.chatbot-header-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.chatbot-title-section h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 2px 0;
}

.chatbot-status {
  font-size: 12px;
  opacity: 0.9;
  margin: 0;
}

.chatbot-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 20px;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.chatbot-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chatbot-message {
  display: flex;
  gap: 12px;
  max-width: 85%;
  animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chatbot-message.user {
  margin-left: auto;
  flex-direction: row-reverse;
}

.chatbot-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #4a90a4;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

body.dark-mode .chatbot-message-avatar {
  background: #003b5c;
}

.chatbot-message.user .chatbot-message-avatar {
  background: #48bb78;
}

body.dark-mode .chatbot-message.user .chatbot-message-avatar {
  background: #2f855a;
}

.chatbot-message-bubble {
  background: #f7fafc;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  color: #2d3748;
  border: 1px solid #e2e8f0;
}

body.dark-mode .chatbot-message-bubble {
  background: #0d1620;
  color: #e8f4f8;
  border-color: #2d3748;
}

.chatbot-message.user .chatbot-message-bubble {
  background: #4a90a4;
  color: white;
  border-color: #4a90a4;
}

body.dark-mode .chatbot-message.user .chatbot-message-bubble {
  background: #003b5c;
  border-color: #003b5c;
}

.chatbot-typing {
  display: flex;
  gap: 4px;
  padding: 8px 0;
}

.chatbot-typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #718096;
  animation: typingBounce 1.4s infinite;
}

.chatbot-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.chatbot-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-8px);
  }
}

.chatbot-input-container {
  padding: 16px;
  border-top: 2px solid #d6d6d6;
  background: #fffef7;
}

body.dark-mode .chatbot-input-container {
  border-top-color: #2d3748;
  background: #0d1620;
}

.chatbot-input-wrapper {
  display: flex;
  gap: 8px;
}

.chatbot-input {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid #d6d6d6;
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.3s ease;
  background: #fffef7;
  color: #2d3748;
}

body.dark-mode .chatbot-input {
  background: #1a2332;
  border-color: #2d3748;
  color: #e8f4f8;
}

.chatbot-input:focus {
  border-color: #4a90a4;
}

body.dark-mode .chatbot-input:focus {
  border-color: #7dd3c0;
}

.chatbot-send-btn {
  background: #4a90a4;
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

body.dark-mode .chatbot-send-btn {
  background: #003b5c;
}

.chatbot-send-btn:hover:not(:disabled) {
  background: #003b5c;
  transform: scale(1.05);
}

body.dark-mode .chatbot-send-btn:hover:not(:disabled) {
  background: #4a90a4;
}

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

.chatbot-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chatbot-suggestion {
  background: rgba(74, 144, 164, 0.1);
  color: #4a90a4;
  border: 1px solid #4a90a4;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

body.dark-mode .chatbot-suggestion {
  background: rgba(125, 211, 192, 0.1);
  color: #7dd3c0;
  border-color: #7dd3c0;
}

.chatbot-suggestion:hover {
  background: #4a90a4;
  color: white;
}

body.dark-mode .chatbot-suggestion:hover {
  background: #7dd3c0;
  color: #001f3f;
}

@media (max-width: 768px) {
  .chatbot-container {
    width: calc(100% - 20px);
    height: calc(100% - 100px);
    bottom: 90px;
    right: 10px;
  }

  .chatbot-fab {
    bottom: 16px;
    right: 16px;
  }
}

@view-transition {
  navigation: auto;
}

.badge-card {
  border-radius: 10px;
  padding: 12px;
  background: #fff;
}

.badge-card.locked {
  opacity: 0.75;
}

.progress-bar {
  height: 6px;
  background: #eee;
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4ade80, #22c55e);
}

.solution-diagram {
  list-style: none;
  margin: 1rem 0;
  text-align: center;
}

.diagram-wrapper svg {
  max-width: 100%;
  height: auto;
}

/* ── Teacher Class Detail ── */
.class-detail-tabs { display:flex; gap:8px; margin:18px 0 0; flex-wrap:wrap; }
.class-tab {
  padding:10px 20px; border:2px solid #4a90a4; border-radius:8px;
  background:transparent; color:#4a90a4; font-weight:600; cursor:pointer;
  transition:all .2s;
}
.class-tab.active, .class-tab:hover { background:#4a90a4; color:#fff; }
body.dark-mode .class-tab { border-color:#7dd3c0; color:#7dd3c0; }
body.dark-mode .class-tab.active, body.dark-mode .class-tab:hover { background:#7dd3c0; color:#0d1620; }
.class-tab-panel { margin-top:20px; }
.tab-hint { color:#718096; font-size:14px; margin-bottom:14px; }

/* Roster */
.roster-card {
  display:flex; align-items:center; gap:14px;
  background:#fff; border:1px solid #e2e8f0; border-radius:10px;
  padding:14px 18px; margin-bottom:10px; cursor:pointer;
  transition:box-shadow .2s;
}
.roster-card:hover { box-shadow:0 4px 12px rgba(0,0,0,.08); }
body.dark-mode .roster-card { background:#0d1620; border-color:#2d3748; }
.roster-avatar { font-size:28px; width:44px; text-align:center; }
.roster-name { font-weight:700; font-size:16px; color:#2d3748; }
body.dark-mode .roster-name { color:#e8f4f8; }
.roster-meta { font-size:13px; color:#718096; margin-top:2px; }
.roster-skills { margin-left:auto; display:flex; gap:6px; align-items:center; flex-wrap:wrap; justify-content:flex-end; }
.risk-badge {
  padding:3px 10px; border-radius:20px; font-size:12px; font-weight:700;
}
.risk-badge.good  { background:#d1fae5; color:#065f46; }
.risk-badge.warn  { background:#fef3c7; color:#92400e; }
.risk-badge.risk  { background:#fee2e2; color:#991b1b; }
body.dark-mode .risk-badge.good  { background:#065f46; color:#d1fae5; }
body.dark-mode .risk-badge.warn  { background:#78350f; color:#fef3c7; }
body.dark-mode .risk-badge.risk  { background:#7f1d1d; color:#fee2e2; }

/* Heatmap */
.heatmap-row {
  display:flex; align-items:center; gap:12px;
  padding:10px 0; border-bottom:1px solid #e2e8f0;
}
body.dark-mode .heatmap-row { border-color:#2d3748; }
.heatmap-skill-name { width:200px; font-weight:600; font-size:14px; flex-shrink:0; }
.heatmap-bar-wrap { flex:1; background:#e2e8f0; border-radius:6px; height:18px; overflow:hidden; }
body.dark-mode .heatmap-bar-wrap { background:#2d3748; }
.heatmap-bar { height:100%; border-radius:6px; transition:width .4s; }
.heatmap-pct { width:48px; text-align:right; font-size:13px; font-weight:700; }

/* Assign Skills */
/* Assign skill collapsible picker */
.assign-picker {
  border: 2px solid #e2e8f0; border-radius: 10px; overflow: hidden;
  max-height: 340px; overflow-y: auto; background: #fff;
  margin-bottom: 2px;
}
body.dark-mode .assign-picker { background: #1a2535; border-color: #2d3748; }

.assign-grade-hdr {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; background: #f1f5f9; border: none; border-bottom: 1px solid #e2e8f0;
  cursor: pointer; font-size: 13px; font-weight: 700; color: #334155;
  text-align: left; user-select: none;
}
.assign-grade-hdr:hover { background: #e2e8f0; }
body.dark-mode .assign-grade-hdr { background: #1e293b; border-color: #2d3748; color: #94a3b8; }
body.dark-mode .assign-grade-hdr:hover { background: #263245; }

.assign-grade-arrow { font-size: 11px; color: #64748b; min-width: 12px; }
.assign-grade-count { margin-left: auto; font-size: 11px; font-weight: 500; color: #94a3b8; }

.assign-skill-item {
  padding: 8px 14px 8px 28px; font-size: 14px; color: #374151; cursor: pointer;
  border-bottom: 1px solid #f1f5f9; outline: none;
}
.assign-skill-item:last-child { border-bottom: none; }
.assign-skill-item:hover { background: #f0f9ff; }
.assign-skill-item:focus { background: #e0f2fe; }
.assign-skill-item.assign-skill-selected {
  background: #dbeafe; color: #1d4ed8; font-weight: 600;
}
body.dark-mode .assign-skill-item { color: #cbd5e1; border-color: #1e293b; }
body.dark-mode .assign-skill-item:hover { background: #1e3a5f; }
body.dark-mode .assign-skill-item.assign-skill-selected { background: #1e3a5f; color: #60a5fa; }

.assigned-skill-row {
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 14px; background:#f7fafc; border-radius:8px; margin-bottom:8px;
}
body.dark-mode .assigned-skill-row { background:#1a2535; }
.assigned-skill-name { font-weight:600; }

/* Assigned skills grouped by subject */
.asl-group { margin-bottom: 6px; }
.asl-group-hdr {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: #f1f5f9; border: 1px solid #e2e8f0;
  border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 700;
  color: #334155; text-align: left; user-select: none;
}
.asl-group-hdr[aria-expanded="true"] { border-radius: 8px 8px 0 0; border-bottom-color: transparent; }
.asl-group-hdr:hover { background: #e2e8f0; }
body.dark-mode .asl-group-hdr { background: #1e293b; border-color: #2d3748; color: #94a3b8; }
body.dark-mode .asl-group-hdr:hover { background: #263245; }
.asl-arrow { font-size: 11px; color: #64748b; min-width: 12px; }
.asl-group-title { flex: 1; }
.asl-group-count {
  background: #e2e8f0; color: #475569; font-size: 11px; font-weight: 700;
  padding: 1px 7px; border-radius: 99px; min-width: 20px; text-align: center;
}
body.dark-mode .asl-group-count { background: #2d3748; color: #94a3b8; }
.asl-group-body .assigned-skill-row {
  border-radius: 0; border: 1px solid #e2e8f0; border-top: none; margin-bottom: 0;
}
.asl-group-body .assigned-skill-row:last-child { border-radius: 0 0 8px 8px; }
body.dark-mode .asl-group-body .assigned-skill-row { border-color: #2d3748; }
.unassign-btn {
  background:#fee2e2; color:#991b1b; border:none; padding:4px 12px;
  border-radius:6px; cursor:pointer; font-size:13px; font-weight:600;
}
.unassign-btn:hover { background:#fecaca; }

/* Student skill detail modal */
.student-skill-row {
  display:flex; align-items:center; gap:10px;
  padding:10px 0; border-bottom:1px solid #e2e8f0;
}
body.dark-mode .student-skill-row { border-color:#2d3748; }
.stu-skill-name { width:190px; font-size:14px; font-weight:600; flex-shrink:0; }
.stu-skill-bar-wrap { flex:1; background:#e2e8f0; border-radius:6px; height:14px; overflow:hidden; }
body.dark-mode .stu-skill-bar-wrap { background:#2d3748; }
.stu-skill-bar { height:100%; border-radius:6px; }
.stu-skill-pct { width:42px; text-align:right; font-size:13px; font-weight:700; }
.stu-diff-badge {
  width:60px; text-align:center; font-size:12px; padding:2px 6px;
  border-radius:12px; background:#e0f2fe; color:#0369a1; font-weight:600;
}
body.dark-mode .stu-diff-badge { background:#0c4a6e; color:#bae6fd; }

/* ── Teacher Home View ── */
.th-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px; flex-wrap: wrap; gap: 12px;
}
.th-greeting { font-size: 26px; font-weight: 800; color: #2d3748; margin: 0; }
body.dark-mode .th-greeting { color: #e8f4f8; }
.th-subtitle { color: #718096; margin: 4px 0 0; font-size: 15px; }

.th-tiles {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px; margin-bottom: 28px;
}
@media (max-width: 900px) { .th-tiles { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .th-tiles { grid-template-columns: repeat(2, 1fr); } }

/* Quick actions bar */
.th-quick-actions {
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 14px;
  padding: 16px 20px; margin-top: 24px;
}
body.dark-mode .th-quick-actions { background: #0d1620; border-color: #2d3748; }
.th-qa-label {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: #718096; margin-bottom: 12px;
}
body.dark-mode .th-qa-label { color: #4a5568; }
.th-qa-grid {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.th-qa-btn {
  display: flex; align-items: center; gap: 7px;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;
  padding: 9px 16px; font-size: 13px; font-weight: 500; color: #374151;
  cursor: pointer; transition: background .15s, border-color .15s;
}
.th-qa-btn:hover { background: #f0f4ff; border-color: #a5b4fc; color: #3730a3; }
.th-qa-btn i { font-size: 15px; }
body.dark-mode .th-qa-btn { background: #1a2535; border-color: #2d3748; color: #cbd5e1; }
body.dark-mode .th-qa-btn:hover { background: #1e3a5f; border-color: #60a5fa; color: #93c5fd; }
.th-tile {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 14px;
  padding: 22px 18px; text-align: center; cursor: pointer;
  transition: box-shadow .2s, transform .15s;
}
.th-tile:hover { box-shadow: 0 6px 20px rgba(0,0,0,.09); transform: translateY(-2px); }
body.dark-mode .th-tile { background: #0d1620; border-color: #2d3748; }
.th-tile-warn { border-color: #fc8181; background: #fff5f5; }
body.dark-mode .th-tile-warn { background: #2d1a1a; border-color: #fc8181; }
.th-tile-icon { font-size: 28px; margin-bottom: 8px; }
.th-tile-value { font-size: 32px; font-weight: 800; color: #2d3748; line-height: 1; }
body.dark-mode .th-tile-value { color: #e8f4f8; }
.th-tile-warn .th-tile-value { color: #c53030; }
.th-tile-label { font-size: 13px; color: #718096; margin-top: 6px; font-weight: 500; }

.th-panels {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
@media (max-width: 900px) { .th-panels { grid-template-columns: 1fr; } }
.th-panel {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 22px;
}
body.dark-mode .th-panel { background: #0d1620; border-color: #2d3748; }
.th-panel-title { font-size: 16px; font-weight: 700; color: #2d3748; margin: 0 0 4px; }
body.dark-mode .th-panel-title { color: #e8f4f8; }
.th-panel-hint { font-size: 13px; color: #718096; margin: 0 0 16px; }
.th-loading { color: #718096; font-size: 14px; }

/* At-risk alert rows */
.th-alert-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid #f0f4f8; cursor: pointer;
}
.th-alert-row:last-child { border-bottom: none; }
body.dark-mode .th-alert-row { border-color: #2d3748; }
.th-alert-row:hover .th-alert-name { text-decoration: underline; }
.th-alert-avatar { font-size: 22px; width: 36px; text-align: center; }
.th-alert-info { flex: 1; min-width: 0; }
.th-alert-name { font-weight: 600; font-size: 14px; color: #2d3748; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.dark-mode .th-alert-name { color: #e8f4f8; }
.th-alert-meta { font-size: 12px; color: #718096; margin-top: 2px; }
.th-alert-badge { flex-shrink: 0; }

/* Weak skill rows */
.th-skill-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid #f0f4f8;
}
.th-skill-row:last-child { border-bottom: none; }
body.dark-mode .th-skill-row { border-color: #2d3748; }
.th-skill-name { width: 180px; font-size: 13px; font-weight: 600; color: #2d3748; flex-shrink: 0; }
body.dark-mode .th-skill-name { color: #e8f4f8; }
.th-skill-bar-wrap { flex: 1; background: #e2e8f0; border-radius: 6px; height: 14px; overflow: hidden; }
body.dark-mode .th-skill-bar-wrap { background: #2d3748; }
.th-skill-bar { height: 100%; border-radius: 6px; }
.th-skill-pct { width: 40px; text-align: right; font-size: 13px; font-weight: 700; }

/* Join requests badge on tab button */
.requests-badge {
  display: inline-block;
  background: #e53e3e;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 6px;
  margin-left: 4px;
  vertical-align: middle;
  min-width: 18px;
  text-align: center;
}

/* Roster toolbar */
.roster-toolbar { display: flex; justify-content: flex-end; margin-bottom: 14px; }

/* Remove button on roster cards */
.roster-remove-btn {
  background: none;
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  color: #a0aec0;
  font-size: 13px;
  padding: 3px 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  line-height: 1;
}
.roster-remove-btn:hover { background: #fee2e2; color: #c53030; border-color: #fc8181; }
body.dark-mode .roster-remove-btn { border-color: #4a5568; color: #718096; }
body.dark-mode .roster-remove-btn:hover { background: #7f1d1d; color: #fc8181; border-color: #e53e3e; }

/* Join-by-code bar in find-class-view */
.fc-code-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.fc-code-bar input {
  flex: 1;
  min-width: 160px;
  max-width: 260px;
  padding: 10px 14px;
  font-size: 15px;
  letter-spacing: 0.08em;
  border: 2px solid #d6d6d6;
  border-radius: 8px;
  font-family: inherit;
}
body.dark-mode .fc-code-bar input { background: #0d1620; border-color: #4a5568; color: #e8f4f8; }

/* Student class banner on homepage */
.student-class-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #ebf8ff 0%, #e0f2fe 100%);
  border: 1.5px solid #90cdf4;
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 22px;
}
body.dark-mode .student-class-banner {
  background: linear-gradient(135deg, #1a2f45 0%, #1e3a5f 100%);
  border-color: #2b6cb0;
}
.scb-icon { font-size: 22px; flex-shrink: 0; }
.scb-info { flex: 1; min-width: 0; }
.scb-class-name {
  font-size: 15px;
  font-weight: 700;
  color: #1a365d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.dark-mode .scb-class-name { color: #bee3f8; }
.scb-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #2b6cb0;
  margin-top: 2px;
}
body.dark-mode .scb-meta { color: #90cdf4; }
.scb-dot { opacity: 0.5; }
.scb-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.scb-link {
  font-size: 12px;
  font-weight: 600;
  color: #2b6cb0;
  text-decoration: none;
  white-space: nowrap;
}
.scb-link:hover { text-decoration: underline; }
body.dark-mode .scb-link { color: #90cdf4; }

/* ── Teacher Presentation (Teach) Mode ── */
/* ── Teach toolbar ── */
.teach-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: #1e293b;
  border-radius: 12px;
  margin-bottom: 28px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.teach-toolbar-left  { display: flex; align-items: center; gap: 10px; min-width: 0; }
.teach-toolbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Inline selects in toolbar */
.teach-select {
  background: rgba(255,255,255,0.12);
  color: #f1f5f9;
  border: 1.5px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  max-width: 220px;
}
.teach-select:focus { outline: none; border-color: rgba(255,255,255,0.5); }
.teach-diff-select { max-width: 100px; }
.teach-select option { background: #1e293b; color: #f1f5f9; }

.teach-exit-btn {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.25);
  color: #e2e8f0;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.teach-exit-btn:hover { background: rgba(255,255,255,0.1); }

.teach-meta { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; }

.teach-skill-badge {
  display: inline-block;
  background: #6b46c1;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

/* Shared control button style */
.teach-ctrl-btn {
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s, transform 0.1s;
}
.teach-ctrl-btn:hover { opacity: 0.85; transform: translateY(-1px); }
.teach-ctrl-btn:active { transform: translateY(0); }

.teach-ctrl-hint     { background: #fef3c7; color: #92400e; }
.teach-ctrl-solution { background: #dbeafe; color: #1e40af; }
.teach-ctrl-next     { background: #10b981; color: #fff; }
.teach-ctrl-fs       { background: #475569; color: #f1f5f9; }

/* Question container */
.teach-container {
  max-width: 860px;
  margin: 0 auto;
}
.teach-question-text {
  font-size: 1.25rem;
  line-height: 1.8;
  color: #1a202c;
  margin-bottom: 24px;
}
body.dark-mode .teach-question-text { color: #e8f4f8; }
#teach-question-diagram {
  margin: 20px 0;
  text-align: center;
}

/* Present Skill modal: difficulty picker */
.present-difficulty-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.present-diff-option {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.present-diff-option input[type="radio"] { accent-color: #6b46c1; }
.diff-chip {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.diff-chip.easy   { background: #d1fae5; color: #065f46; }
.diff-chip.medium { background: #fef3c7; color: #92400e; }
.diff-chip.hard   { background: #fee2e2; color: #991b1b; }
body.dark-mode .diff-chip.easy   { background: #065f46; color: #d1fae5; }
body.dark-mode .diff-chip.medium { background: #78350f; color: #fef3c7; }
body.dark-mode .diff-chip.hard   { background: #7f1d1d; color: #fee2e2; }

/* Teach view fullscreen — driven by JS class for reliability */
#teach-view.teach-fullscreen {
  background: #ffffff !important;
  padding: 0 0 48px !important;
  overflow-y: auto !important;
}
#teach-view.teach-fullscreen .teach-toolbar {
  border-radius: 0 !important;
  margin: 0 0 32px !important;
  padding: 14px 32px !important;
}
#teach-view.teach-fullscreen .teach-container {
  padding: 0 64px !important;
  max-width: 100% !important;
}
#teach-view.teach-fullscreen .teach-question-text {
  font-size: 1.9rem !important;
  line-height: 2.1 !important;
  color: #1a202c !important;
}
#teach-view.teach-fullscreen .hint-box,
#teach-view.teach-fullscreen .solution-box {
  background: #f8fafc !important;
  color: #1a202c !important;
}
#teach-view.teach-fullscreen .hint-title,
#teach-view.teach-fullscreen .solution-title {
  color: #2d3748 !important;
}
#teach-view.teach-fullscreen .hint-content,
#teach-view.teach-fullscreen .solution-steps,
#teach-view.teach-fullscreen .solution-final {
  color: #2d3748 !important;
}

/* Teach zoom controls */
.teach-zoom-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.08);
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 2px 6px;
}
.teach-ctrl-zoom {
  background: transparent !important;
  color: #f1f5f9 !important;
  border: none !important;
  padding: 5px 8px !important;
  font-size: 13px !important;
  font-weight: 700;
  border-radius: 6px;
  min-width: 30px;
}
.teach-ctrl-zoom:hover:not(:disabled) { background: rgba(255,255,255,0.15) !important; }
.teach-ctrl-zoom:disabled { opacity: 0.35; cursor: default; }
.teach-zoom-label {
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  min-width: 38px;
  text-align: center;
}

/* ── Worksheet Generator ─────────────────────────────────────────────────── */

/* Hide leaderboard sidebar while worksheet builder is open */
body.ws-mode .right-sidebar { display: none !important; }
body.ws-mode .main-content  { max-width: 100% !important; }

body.sim-mode .right-sidebar            { display: none !important; }
body.sim-mode .sidebar                  { display: none !important; }
body.sim-mode .header                   { display: none !important; }
body.sim-mode .header-title-ladder-wrap { display: none !important; }
body.sim-mode footer                    { display: none !important; }
body.sim-mode .main-content             { max-width: 100% !important; }
body.sim-mode .app-wrapper              { padding-top: 0 !important; }

/* Two-panel builder layout */
#worksheet-gen-view { display: none; flex-direction: column; height: 100vh; overflow: hidden; }
#worksheet-gen-view.active { display: flex; }

.ws-builder {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Left panel ─────────────────────────────────────────────────────────── */
.ws-left-panel {
  width: 280px;
  flex-shrink: 0;
  background: #1e293b;
  color: #f1f5f9;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ws-left-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.ws-left-title { font-weight: 700; font-size: 0.9rem; flex: 1; }

/* ── Accordions ─────────────────────────────────────────────────────────── */
.ws-accordion {
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.ws-accordion:last-child { flex: 1; display: flex; flex-direction: column; overflow: hidden; border-bottom: none; }
.ws-accordion:last-child .ws-accordion-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

.ws-accordion-hdr {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 9px 14px;
  cursor: pointer;
  text-align: left;
  user-select: none;
}
.ws-accordion-hdr:hover { color: #cbd5e1; background: rgba(255,255,255,0.04); }
.ws-accordion-arrow { font-size: 0.65rem; transition: transform 0.15s; }
.ws-accordion-hdr[aria-expanded="false"] .ws-accordion-arrow { transform: rotate(-90deg); }
.ws-accordion-badge {
  background: #3b82f6;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 10px;
  margin-left: 2px;
}
.ws-accordion-sub { color: #475569; font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 0.7rem; }

.ws-accordion-body { overflow: hidden; }
.ws-accordion-hdr[aria-expanded="false"] + .ws-accordion-body { display: none; }

/* ── Topic tree ─────────────────────────────────────────────────────────── */
.ws-tree {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}
.ws-sets-actions { padding: 6px 0 2px; }

.ws-tree-grade-hdr {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  cursor: pointer;
  user-select: none;
}
.ws-tree-grade-hdr:hover { color: #cbd5e1; }

.ws-tree-grade-body { display: none; }
.ws-tree-grade.open > .ws-tree-grade-body { display: block; }

.ws-tree-sec-hdr {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px 5px 20px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #7dd3fc;
  cursor: pointer;
  user-select: none;
}
.ws-tree-sec-hdr:hover { color: #bae6fd; }

.ws-tree-sec-body { display: none; }
.ws-tree-section.open > .ws-tree-sec-body { display: block; }

.ws-tree-skill {
  padding: 5px 14px 5px 32px;
  font-size: 0.82rem;
  color: #cbd5e1;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background 0.1s, border-color 0.1s;
}
.ws-tree-skill:hover {
  background: rgba(255,255,255,0.08);
  border-left-color: #60a5fa;
  color: #f1f5f9;
}

.ws-tree-arrow { font-size: 0.65rem; opacity: 0.7; }

/* ── Bottom status bar ──────────────────────────────────────────────────── */
.ws-bottom-bar {
  flex-shrink: 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 10px 14px;
  max-height: 200px;
  overflow-y: auto;
}

.ws-bottom-stats {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-bottom: 8px;
}
.ws-bottom-stats strong { color: #f1f5f9; }

.ws-sets-hdr {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-bottom: 5px;
}
.ws-sets-empty { font-size: 0.75rem; color: #475569; font-style: italic; padding: 4px 0; display: block; }
.ws-sets-list { padding: 6px 10px; overflow-y: auto; max-height: 240px; }
.ws-sets-actions { padding: 0 10px 8px; }

.ws-set-count-input {
  width: 36px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 3px;
  color: #cbd5e1;
  font-size: 0.7rem;
  text-align: center;
  padding: 1px 2px;
  -moz-appearance: textfield;
}
.ws-set-count-input::-webkit-inner-spin-button,
.ws-set-count-input::-webkit-outer-spin-button { opacity: 1; }

.ws-set-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  background: rgba(255,255,255,0.05);
  border-radius: 5px;
  margin-bottom: 3px;
  font-size: 0.75rem;
  cursor: grab;
}
.ws-set-item:active { cursor: grabbing; }
.ws-set-item.ws-set-dragging { opacity: 0.4; }
.ws-set-item.ws-set-drag-over {
  border: 1px dashed #60a5fa;
  background: rgba(96,165,250,0.1);
}
.ws-set-drag {
  color: #475569;
  font-size: 0.9rem;
  line-height: 1;
  cursor: grab;
  flex-shrink: 0;
}
.ws-set-title { flex: 1; color: #cbd5e1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-set-meta  { color: #64748b; white-space: nowrap; font-size: 0.7rem; }
.ws-set-remove {
  background: none; border: none; color: #475569;
  cursor: pointer; padding: 1px 4px; border-radius: 3px; font-size: 0.65rem;
}
.ws-set-remove:hover { background: rgba(239,68,68,0.2); color: #f87171; }

/* ── Add-questions modal ────────────────────────────────────────────────── */
.ws-builder { position: relative; }

.ws-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.ws-modal {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  width: min(860px, 92vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ws-modal-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.ws-modal-title { font-size: 1rem; font-weight: 700; color: #1e293b; }
.ws-modal-close {
  background: none; border: none; font-size: 1.1rem;
  color: #94a3b8; cursor: pointer; padding: 2px 6px; border-radius: 4px;
}
.ws-modal-close:hover { background: #f1f5f9; color: #475569; }

.ws-modal-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.ws-modal-left {
  width: 260px;
  flex-shrink: 0;
  padding: 18px;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.ws-modal-section { display: flex; flex-direction: column; gap: 8px; }
.ws-modal-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}

.ws-modal-count-input {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 1rem;
  width: 80px;
  color: #1e293b;
}
.ws-modal-count-input:focus { outline: 2px solid #3b82f6; border-color: transparent; }

.ws-preset-row { display: flex; gap: 6px; }
.ws-preset-btn {
  flex: 1;
  padding: 7px 4px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  color: #475569;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.ws-preset-btn:hover { background: #e0f2fe; border-color: #7dd3fc; color: #0369a1; }
.ws-preset-active { background: #2563eb !important; border-color: #2563eb !important; color: #fff !important; }

.ws-modal-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.ws-modal-btn-ok {
  background: #2563eb; color: #fff; border: none;
  border-radius: 7px; padding: 9px; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; transition: background 0.12s;
}
.ws-modal-btn-ok:hover { background: #1d4ed8; }
.ws-modal-btn-cont {
  background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0;
  border-radius: 7px; padding: 8px; font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: background 0.12s;
}
.ws-modal-btn-cont:hover { background: #dcfce7; }
.ws-modal-btn-cancel {
  background: none; color: #94a3b8; border: none;
  border-radius: 7px; padding: 6px; font-size: 0.82rem;
  cursor: pointer; text-align: center;
}
.ws-modal-btn-cancel:hover { color: #475569; }

.ws-modal-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.ws-sample-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  flex-shrink: 0;
}
.ws-sample-more-btn {
  background: none; border: 1px solid #cbd5e1; border-radius: 5px;
  color: #475569; font-size: 0.75rem; padding: 3px 8px; cursor: pointer;
}
.ws-sample-more-btn:hover { background: #f1f5f9; }

.ws-sample-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ws-sample-item { border-bottom: 1px solid #f1f5f9; padding-bottom: 14px; }
.ws-sample-item:last-child { border-bottom: none; }
.ws-sample-q   { font-size: 0.88rem; color: #1e293b; margin-bottom: 6px; line-height: 1.5; }
.ws-sample-diagram svg { max-width: 100%; height: auto; }
.ws-sample-diagram { margin: 6px 0; }
.ws-sample-ans { font-size: 0.8rem; color: #dc2626; font-weight: 600; }
.ws-sample-empty { font-size: 0.82rem; color: #94a3b8; font-style: italic; }

.ws-ctrl-new      { background: #475569 !important; color: #fff !important; }
.ws-ctrl-regen    { background: #0f766e !important; color: #fff !important; }
.ws-ctrl-print    { background: #059669 !important; color: #fff !important; }
.ws-ctrl-download { background: #7c3aed !important; color: #fff !important; }
.ws-ctrl-save     { background: #0369a1 !important; color: #fff !important; }
.ws-ctrl-present  { background: #b45309 !important; color: #fff !important; }

/* ── Saved worksheets panel ─────────────────────────────────────────────── */
.ws-load-btn {
  width: 100%;
  margin-top: 8px;
  padding: 6px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: #94a3b8;
  font-size: 0.75rem;
  cursor: pointer;
  text-align: left;
}
.ws-load-btn:hover { background: rgba(255,255,255,0.12); color: #cbd5e1; }

.ws-saved-bar {
  margin-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 8px;
}
.ws-saved-bar-close {
  background: none; border: none; color: #64748b;
  cursor: pointer; font-size: 0.7rem; padding: 0 2px;
}
.ws-saved-list { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; max-height: 140px; overflow-y: auto; }
.ws-saved-item {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.05);
  border-radius: 5px;
  padding: 5px 6px;
}
.ws-saved-info  { flex: 1; min-width: 0; }
.ws-saved-title { display: block; font-size: 0.75rem; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-saved-meta  { font-size: 0.65rem; color: #64748b; }
.ws-saved-load-btn {
  background: #2563eb; color: #fff; border: none;
  border-radius: 4px; padding: 3px 7px; font-size: 0.7rem; cursor: pointer; flex-shrink: 0;
}
.ws-saved-load-btn:hover { background: #1d4ed8; }
.ws-saved-del-btn {
  background: none; border: none; color: #475569;
  cursor: pointer; font-size: 0.65rem; padding: 2px 4px;
}
.ws-saved-del-btn:hover { color: #f87171; }

/* ── Toast notification ─────────────────────────────────────────────────── */
.ws-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #1e293b;
  color: #f1f5f9;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.88rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
}
.ws-toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.ws-toast-warn { background: #92400e; }

/* ── Presentation overlay ───────────────────────────────────────────────── */
.ws-present-overlay {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 200;
  overflow-y: auto;
  padding: 0 0 48px;
}
.ws-present-overlay .teach-toolbar {
  border-radius: 0;
  margin: 0 0 32px;
  padding: 14px 32px;
  position: sticky;
  top: 0;
}
.ws-present-overlay .teach-container {
  padding: 0 64px;
  max-width: 100%;
}
.ws-present-counter {
  font-size: 0.78rem;
  color: #94a3b8;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.ws-present-prev-btn { background: #6366f1; color: #fff; }
.ws-present-prev-btn:disabled { opacity: 0.3; cursor: default; }
.teach-ctrl-next:disabled    { opacity: 0.3; cursor: default; }

/* Fullscreen: hide browser chrome by going truly full */
.ws-present-fullscreen {
  position: fixed !important;
}
body.dark-mode .ws-present-overlay {
  background: #0f172a;
}
body.dark-mode .ws-present-overlay .teach-question-text { color: #e8f4f8; }

/* ── Right panel ────────────────────────────────────────────────────────── */
.ws-right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.ws-right-toolbar {
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  padding: 7px 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
@media (prefers-color-scheme: dark) {
  .ws-right-toolbar { background: #0f172a; border-bottom-color: #1e293b; }
}
.ws-hint-text { font-size: 0.8rem; color: #64748b; }
.ws-hint-text kbd {
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 0.75rem;
  font-family: monospace;
}
.ws-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.ws-tb-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.ws-tb-btn:hover { background: #f8fafc; border-color: #94a3b8; }
.ws-tb-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.ws-tb-check {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  color: #374151;
  cursor: pointer;
  white-space: nowrap;
  padding: 5px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
}
.ws-tb-check input[type="checkbox"] { cursor: pointer; }
@media (prefers-color-scheme: dark) {
  .ws-tb-btn { background: #1e293b; border-color: #334155; color: #e2e8f0; }
  .ws-tb-btn:hover { background: #273549; }
  .ws-tb-check { background: #1e293b; border-color: #334155; color: #e2e8f0; }
}

.ws-preview-wrap {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  padding: 24px;
  background: #e2e8f0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
@media (prefers-color-scheme: dark) { .ws-preview-wrap { background: #0f172a; } }

/* ── Printable sheet ─────────────────────────────────────────────────────── */
.ws-sheet {
  background: #fff;
  color: #111;
  width: 816px;
  min-height: 1248px;
  padding: 48px 54px 56px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  box-sizing: border-box;
  flex-shrink: 0;
}

/* Header */
.ws-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}
.ws-school-name { font-size: 11px; color: #6b7280; font-style: italic; }
.ws-meta-grid {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  gap: 4px 8px;
  font-size: 12px;
  align-items: end;
}
.ws-meta-label { font-weight: 600; white-space: nowrap; }
.ws-meta-line  { border-bottom: 1px solid #111; width: 120px; height: 14px; }
.ws-meta-short { width: 65px; }

/* Editable title on sheet */
.ws-title-bar  { text-align: center; margin: 6px 0 4px; }
.ws-title-input {
  border: none;
  outline: none;
  text-align: center;
  font-size: 19px;
  font-weight: 700;
  font-family: Arial, Helvetica, sans-serif;
  color: #111;
  background: transparent;
  width: 100%;
  letter-spacing: -0.3px;
}
.ws-title-input:focus { background: #fffbeb; border-radius: 3px; }

.ws-header-fields {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 4px;
}
.ws-header-field {
  border: none;
  border-bottom: 1px dashed #9ca3af;
  outline: none;
  font-size: 11px;
  color: #6b7280;
  font-family: Arial, Helvetica, sans-serif;
  background: transparent;
  text-align: center;
  width: 160px;
}
.ws-header-field:focus { border-bottom-color: #3b82f6; color: #111; }
.ws-header-field::placeholder { color: #d1d5db; }

.ws-rule { border: none; border-top: 2px solid #111; margin: 7px 0; }
.ws-directions { font-size: 12px; margin: 0 0 12px; }

.ws-empty-msg { color: #9ca3af; font-size: 13px; font-style: italic; }

/* Problems */
.ws-problems {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 26px;
  counter-reset: ws-item;
}
.ws-problem {
  counter-increment: ws-item;
  margin-bottom: 14px;
  break-inside: avoid;
  min-width: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 4px;
  padding: 4px;
  cursor: pointer;
  transition: border-color 0.12s;
  box-sizing: border-box;
}
.ws-problem:hover { border-color: #bfdbfe; }
.ws-problem-selected { border-color: #3b82f6 !important; background: #eff6ff; }

.ws-problem::before {
  content: counter(ws-item) ".";
  font-weight: 700;
  font-size: 13px;
  display: inline-block;
  width: 22px;
}
.ws-problem-q { display: inline; font-size: 12.5px; word-break: break-word; }
.ws-diagram { margin: 4px 0 0 22px; }
.ws-diagram svg { max-width: 100%; height: auto; }
.ws-work-box {
  margin: 5px 0 0 22px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  height: 68px;
  background: #fafafa;
}

/* Multiple choice */
.ws-mc-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
  margin: 6px 0 4px 22px;
  font-size: 12px;
}
.ws-mc-choices--single {
  grid-template-columns: 1fr;
}
.ws-mc-choice { display: flex; align-items: baseline; gap: 4px; }
.ws-mc-letter { font-weight: 700; min-width: 16px; }

/* Answer key */
.ws-key-section { margin-top: 14px; }
.ws-key-title   { font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.ws-key-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 24px;
  font-size: 12px;
  padding-left: 0;
  margin: 0;
  list-style: none;
}
.ws-key-item {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 8px;
}
.ws-key-qnum {
  font-weight: 700;
  min-width: 28px;
  padding-top: 2px;
}
.ws-key-body { flex: 1; }
.ws-key-question {
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 4px;
}
.ws-solution-steps {
  margin: 2px 0 4px 12px;
  padding-left: 12px;
  font-size: 11.5px;
  line-height: 1.6;
}
.ws-solution-steps li { margin-bottom: 3px; }
.ws-step-label {
  font-weight: 600;
  margin-right: 4px;
}
.ws-step-detail { display: block; margin-left: 8px; color: #374151; }
.ws-key-final {
  font-weight: 700;
  font-size: 12px;
  color: #1d4ed8;
  margin-top: 3px;
}
.ws-step-answer { margin: 0; }

/* ── Print ───────────────────────────────────────────────────────────────── */
@media print {
  nav, header, .sidebar, #sidebar-overlay,
  .ws-left-panel, .ws-right-toolbar { display: none !important; }

  .main-content { padding: 0 !important; margin: 0 !important; }
  .view { display: none !important; }
  #worksheet-gen-view { display: flex !important; height: auto !important; overflow: visible !important; }
  .ws-builder { display: block !important; }
  .ws-right-panel { display: block !important; overflow: visible !important; }

  .ws-preview-wrap {
    padding: 0 !important;
    background: none !important;
    overflow: visible !important;
    display: block !important;
  }
  .ws-sheet {
    width: 100% !important;
    min-height: unset !important;
    box-shadow: none !important;
    padding: 0.45in 0.55in !important;
    font-size: 11.5pt !important;
  }
  .ws-problem { border: none !important; background: none !important; cursor: default !important; }
  .ws-problem-selected { border: none !important; background: none !important; }
  .ws-work-box {
    height: 72pt !important;
    background: none !important;
    border-color: #999 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .ws-title-input, .ws-header-field { border: none !important; background: none !important; }
  @page { margin: 0; size: 8.5in 13in; }
}

/* ── Simulations ──────────────────────────────────────────────────────────── */
.sim-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.sim-card {
  background: var(--card-bg, #1e293b);
  border: 1px solid var(--border-color, rgba(255,255,255,0.08));
  border-radius: 14px;
  padding: 20px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sim-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  border-color: var(--accent, #4ecdc4);
}

.sim-card-icon {
  font-size: 2rem;
  line-height: 1;
}

.sim-card-body {
  flex: 1;
}

.sim-card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary, #f1f5f9);
  margin: 0 0 6px;
}

.sim-card-desc {
  font-size: 13px;
  color: var(--text-muted, #94a3b8);
  line-height: 1.55;
  margin: 0 0 10px;
}

.sim-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sim-tag {
  font-size: 11px;
  font-weight: 600;
  background: rgba(78,205,196,0.12);
  color: #4ecdc4;
  border-radius: 20px;
  padding: 2px 10px;
  border: 1px solid rgba(78,205,196,0.25);
}

.sim-card-launch {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent, #4ecdc4);
  text-align: right;
}

/* ── Simulation Runner layout ────────────────────────────────────────────── */
body.sim-mode .main-content {
  padding: 0 !important;
  margin: 0 !important;
  gap: 0 !important;
  height: 100vh;
  max-width: 100% !important;
}

body.sim-mode .content-area {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

#simulation-runner-view.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
}

#simulation-runner-view .teach-toolbar {
  margin-bottom: 0;
  flex-shrink: 0;
}

.sim-runner-frame {
  flex: 1;
  width: 100%;
  border: none;
  display: block;
  min-height: 0;
  background: #111827;
}
