[hidden] {
  display: none !important;
}

:root {
  --bg: #f5f7f4;
  --panel: #ffffff;
  --text: #18211b;
  --muted: #657066;
  --line: #dfe7df;
  --accent: #1f7a4d;
  --accent-dark: #145536;
  --danger: #b42318;
  --chat-bg: #111816;
  --chat-panel: #17211e;
  --chat-line: #26322f;
  --chat-text: #eef5f0;
  --chat-muted: #9caaa0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  background: var(--accent);
  color: white;
  border-radius: 10px;
  padding: 0.7rem 1rem;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button.secondary {
  background: #e8eee8;
  color: var(--text);
}

button.secondary:hover {
  background: #dbe5dc;
}

button.small {
  padding: 0.45rem 0.7rem;
  font-size: 0.9rem;
}

.view {
  min-height: 100vh;
}

.auth-view {
  display: grid;
  place-items: center;
  padding: 1rem;
  background-image: 
    url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E"),
    radial-gradient(circle, #383a39 0%, #111312 100%);
  background-image: 
    url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E"),
    radial-gradient(circle in oklab, #383a39 0%, #111312 100%);
}

.auth-card {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 2rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.brand {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 2rem;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: white;
  font-weight: 800;
  border-radius: 16px;
}

.brand h1,
.brand p {
  margin: 0;
}

.brand p {
  color: var(--muted);
}

.form {
  display: grid;
  gap: 1rem;
}

label {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.95rem;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  background: white;
  color: var(--text);
}

.error {
  color: var(--danger);
  margin: 0;
}

.success {
  color: var(--accent);
  margin: 0;
  font-weight: 600;
}

.auth-switch {
  text-align: center;
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-switch a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.auth-switch a:hover {
  text-decoration: underline;
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  background: white;
  color: var(--text);
  font-size: inherit;
}

.topbar {
  height: 40px;
  background: #111816;
  color: var(--chat-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.1rem;
}

.topbar strong {
  color: #ffffff;
}

.topbar button.secondary {
  background: var(--danger);
  color: white;
  border: 1px solid transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  padding: 0.35rem 1rem;
  border-radius: 999px;
}

.topbar button.secondary:hover {
  background: #901b13;
  border-color: transparent;
}

#userLabel {
  color: rgba(238, 245, 240, 0.65);
  font-size: 0.8rem;
  font-weight: 300;
  margin-left: 0.6rem;
}

.layout {
  height: calc(100vh - 40px);
  display: grid;
  grid-template-columns: 280px 38px minmax(0, 1fr) 38px 360px;
  transition: grid-template-columns 0.6s ease-in-out;
}

.sidebar {
  background: #111816;
  color: var(--chat-text);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 1rem;
  min-width: 0;
  transition: padding 0.6s ease-in-out, opacity 0.4s ease;
}

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

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

.course-list {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}

.course-card {
  border: 1px solid var(--chat-line);
  border-radius: 14px;
  background: #17211e;
  padding: 0.9rem;
  cursor: pointer;
}

.course-card:hover,
.course-card.active {
  border-color: var(--accent);
}

.course-card strong {
  display: block;
  color: var(--chat-text);
}

.course-card span {
  color: #aab8b0;
  font-size: 0.9rem;
}

.reader-column {
  min-width: 0;
  overflow: hidden;
}

.empty-state {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
}

#courseView {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.course-header {
  border-bottom: 1px solid var(--chat-line);
  background: #17211e;
  padding: 0.8rem 1rem 0.24rem 1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  color: var(--chat-text);
  flex-shrink: 0;
}

.course-header h2,
.course-header p {
  margin: 0;
}

.course-header p {
  color: #aab8b0;
}

.reader-wrap {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 240px 38px minmax(0, 1fr);
  transition: grid-template-columns 0.6s ease-in-out;
}

.page-nav {
  border-right: 1px solid var(--line);
  background: #e3eee7;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.8rem;
  min-width: 0;
  transition: padding 0.6s ease-in-out, opacity 0.4s ease;
}

.page-button {
  width: 100%;
  text-align: left;
  color: var(--text);
  background: transparent;
  border-radius: 10px;
  padding: 0.65rem;
}

.page-button:hover,
.page-button.active {
  background: #d1e3d7;
}

iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: white;
}

.chat-panel {
  min-width: 0;
  background: var(--chat-bg);
  color: var(--chat-text);
  display: grid;
  grid-template-rows: 1fr auto;
  transition: padding 0.6s ease-in-out, opacity 0.4s ease;
  overflow-x: hidden;
}

.chat-header {
  border-bottom: none;
  padding: 1rem;
}

.mentor-ai-header {
  margin: 0;
  font-size: 0.9rem;
}

.chat-header p {
  color: #aab8b0;
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

.chat-messages {
  overflow: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.message {
  display: flex;
}

.message.user {
  justify-content: flex-end;
}

.bubble {
  max-width: 92%;
  border-radius: 16px;
  padding: 0.75rem 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
  font-size: 0.75rem;
}

.message.ai .bubble {
  background: var(--chat-panel);
  border: 1px solid var(--chat-line);
}

.message.user .bubble {
  background: var(--accent);
  color: white;
}

/* Markdown styling within bubbles */
.bubble h1, .bubble h2, .bubble h3 {
  margin: 0.5rem 0 0.25rem 0;
  font-weight: 700;
  color: var(--text-primary);
}
.message.ai .bubble h1, .message.ai .bubble h2, .message.ai .bubble h3 {
  color: #6ed196; /* Deeper, vibrant green for AI headers */
}
.message.user .bubble h1, .message.user .bubble h2, .message.user .bubble h3 {
  color: #e3eee7; /* Keep pale for user bubble to contrast the dark green bg */
}
.message.ai .bubble strong {
  color: #8be0af; /* Bright green for AI bold text */
}
.message.user .bubble strong {
  color: #ffffff; /* White for user bold text */
}
.bubble h1 { font-size: 1.15em; }
.bubble h2 { font-size: 1.05em; }
.bubble h3 { font-size: 0.95em; }
.bubble strong { font-weight: 700; }
.bubble em { font-style: italic; opacity: 0.85; }

.image-preview-wrapper {
  margin: 0.8rem;
  margin-bottom: 0;
  position: relative;
  display: inline-block;
}

.image-preview-wrapper img {
  max-width: 150px;
  max-height: 150px;
  border-radius: 8px;
  border: 1px solid var(--chat-line);
  display: block;
}

.image-preview-wrapper .remove-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--chat-line);
  color: white;
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 12px;
}

.image-preview-wrapper .remove-btn:hover {
  background: var(--danger);
}

.chat-toolbar {
  padding: 0.6rem 0.8rem 0;
  display: flex;
  gap: 0.5rem;
}

.toolbar-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--chat-line);
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 0.75rem;
  font-family: inherit;
}

.toolbar-btn:hover:not(:disabled) {
  background: var(--chat-line);
  color: white;
}

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

.toolbar-btn.recording {
  color: var(--danger);
  border-color: var(--danger);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(180, 35, 24, 0.4); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 6px rgba(180, 35, 24, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(180, 35, 24, 0); }
}

.chat-form {
  border-top: none;
  padding: 0.8rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem;
  align-items: center;
}

.chat-form textarea {
  resize: none;
  min-height: 44px;
  max-height: 140px;
  background: #0f1513;
  border-color: var(--chat-line);
  color: var(--chat-text);
  font-size: 0.75rem;
}





/* Mentor panel collapse controls */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}







/* In-place collapsed Pages rail */
.page-rail-button {
  display: flex;
  width: 38px;
  height: 100%;
  border-radius: 0;
  padding: 0;
  background: #e3eee7;
  color: var(--accent-dark);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.page-rail-button:hover {
  background: #d1e3d7;
  color: var(--accent-dark);
}

body.pages-hidden .reader-wrap {
  grid-template-columns: 0px 38px minmax(0, 1fr);
}

body.pages-hidden #pageNav {
  padding-left: 0;
  padding-right: 0;
  border-right-width: 0;
  opacity: 0;
}



/* In-place collapsed Courses rail */
.course-rail-button {
  display: flex;
  width: 38px;
  height: 100%;
  border-radius: 0;
  padding: 0;
  background: #111816;
  color: #6ed196;
  border-right: 1px solid var(--chat-line);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.course-rail-button:hover {
  background: #17211e;
  color: white;
}

.chat-rail-button {
  display: flex;
  width: 38px;
  height: 100%;
  border-radius: 0;
  padding: 0;
  background: #111816;
  color: #6ed196;
  border-left: 1px solid var(--chat-line);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.chat-rail-button:hover {
  background: #17211e;
  color: white;
}

body.courses-hidden .layout {
  grid-template-columns: 0px 38px minmax(0, 1fr) 38px 360px;
}

body.chat-hidden .layout {
  grid-template-columns: 280px 38px minmax(0, 1fr) 38px 0px;
}

body.courses-hidden.chat-hidden .layout {
  grid-template-columns: 0px 38px minmax(0, 1fr) 38px 0px;
}

body.chat-hidden .chat-panel {
  padding-left: 0;
  padding-right: 0;
  border-left-width: 0;
  opacity: 0;
}

body.courses-hidden .sidebar {
  padding-left: 0;
  padding-right: 0;
  border-right-width: 0;
  opacity: 0;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 220px 38px minmax(0, 1fr);
  }

  body.courses-hidden .layout {
    grid-template-columns: 0px 38px minmax(0, 1fr);
  }

  .chat-panel {
    position: fixed;
    inset: auto 0 0 0;
    height: 42vh;
    z-index: 5;
    border-top: 1px solid var(--chat-line);
  }

  #courseView {
    height: calc(100% - 42vh);
  }

  .reader-wrap {
    grid-template-columns: 190px 38px minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .chat-view {
    right: 0;
    width: 100%;
  }

  .chat-view.hidden {
    transform: translateX(100%);
  }

  .chat-rail-button {
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    padding: 0;
    border-radius: 28px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  }

  .chat-rail-button span {
    display: none;
  }
}

.landing-page {
  padding: 3rem;
  max-width: 900px;
  margin: 0 auto;
  color: var(--text);
  overflow-y: auto;
  height: 100%;
  box-sizing: border-box;
}

.landing-header h1 {
  margin: 0;
  font-size: 2.2rem;
  color: var(--text);
}

.landing-header p {
  color: var(--muted);
  font-size: 1.1rem;
  margin-top: 0.5rem;
}

.landing-courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.landing-course-card {
  background: var(--chat-bg);
  border: 1px solid var(--chat-line);
  border-radius: 12px;
  padding: 1.5rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.landing-course-card:hover {
  border-color: var(--accent);
  background: #17211e;
}

.landing-course-card h3 {
  margin: 0;
  font-size: 1.15rem;
  color: white;
}

.landing-course-card p {
  margin: 0.5rem 0 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.progress-bar-wrap {
  background: var(--chat-line);
  height: 6px;
  border-radius: 3px;
  margin-top: 1rem;
  overflow: hidden;
}

.progress-bar-fill {
  background: var(--accent);
  height: 100%;
}

@media (max-width: 700px) {
  .course-rail-button,
  .page-rail-button {
    display: none;
  }

  .layout {
    height: auto;
    min-height: calc(100vh - 40px);
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: block;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 220px;
  }

  body.courses-hidden .layout {
    grid-template-columns: 1fr;
  }

  body.courses-hidden #courseRailButton {
    display: flex;
    width: 100%;
    height: 36px;
    writing-mode: horizontal-tb;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .reader-wrap {
    grid-template-columns: 1fr;
  }

  .topbar {
    height: auto;
    min-height: 40px;
    gap: 0.6rem;
    flex-wrap: wrap;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
  }

  .topbar-actions {
    flex-wrap: wrap;
  }

  .page-nav {
    display: block;
    max-height: 180px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  body.pages-hidden .reader-wrap {
    grid-template-columns: 1fr;
  }

  body.pages-hidden #pageRailButton {
    display: flex;
    width: 100%;
    height: 36px;
    writing-mode: horizontal-tb;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .course-header {
    height: auto;
    align-items: flex-start;
    flex-direction: column;
  }

  .chat-panel {
    position: static;
    height: 420px;
  }
}


/* Section-based collapsible page navigation */
.nav-group {
  display: block;
  margin-bottom: 0.25rem;
}

.nav-group-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  text-align: left;
  color: var(--text);
  background: #f1f6f2;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem;
  margin: 0.15rem 0;
  font-weight: 700;
}

.nav-group-row:hover {
  background: #e8f3ec;
}

.nav-caret {
  display: inline-block;
  width: 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.page-button[data-pacing="locked"] {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
  filter: grayscale(100%);
}

.page-button[data-pacing="locked"]::before {
  content: "🔒 ";
  display: inline-block;
  margin-right: 0.25rem;
}
.nav-group-children[hidden] {
  display: none !important;
}

.nav-group-children {
  display: block;
}

.section-page-button {
  margin-left: 1.35rem;
  width: calc(100% - 1.35rem);
  font-size: 0.9rem;
}



/* Metadata display */
.meta-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.08rem 0.42rem;
  font-size: 0.72rem;
  line-height: 1.25;
  color: var(--muted);
  background: #f8fbf8;
  white-space: nowrap;
}

.page-button-title {
  display: block;
}


.section-page-button {
  text-align: left;
}


/* Metadata hover/focus tooltip */
.page-button-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.45rem;
  position: relative;
}

.page-meta-indicator {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.68rem;
  line-height: 0.95rem;
  text-align: center;
  color: var(--muted);
  background: #f8fbf8;
  margin-top: 0.05rem;
}

.page-meta-tooltip {
  position: absolute;
  z-index: 50;
  left: calc(100% + 0.45rem);
  top: 0;
  min-width: 11rem;
  max-width: 16rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  font-size: 0.78rem;
  line-height: 1.35;
  white-space: pre-line;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-0.15rem);
  transition: opacity 120ms ease, transform 120ms ease;
}

.page-button {
  position: relative;
}

.page-button:hover .page-meta-tooltip,
.page-button:focus-visible .page-meta-tooltip {
  opacity: 1;
  transform: translateY(0);
}


/* Progress state display */
.progress-card {
  display: flex !important;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0 !important;
  font-size: 0.91rem;
  color: var(--chat-text);
}

#progressSummary {
  display: inline-block !important;
  color: white !important;
  font-size: 0.58rem !important;
  font-weight: 300 !important;
  visibility: visible !important;
  opacity: 1 !important;
  min-width: 50px;
}

#continueButton {
  padding: 0.28rem 0.51rem !important;
  font-size: 0.67rem !important;
  border-radius: 999px !important;
}

.page-button[data-status="completed"] {
  border-color: rgba(22, 101, 52, 0.35);
}

.page-button[data-status="started"] {
  border-color: rgba(37, 99, 235, 0.28);
}

.page-status-mark {
  position: absolute;
  right: 0.45rem;
  bottom: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
}


/* Soft pacing */
.page-button[data-pacing="upcoming"] {
  opacity: 0.68;
}

.page-button[data-pacing="upcoming"] .page-button-title::after {
  content: "Upcoming";
  display: inline-flex;
  margin-left: 0.4rem;
  padding: 0.05rem 0.35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.66rem;
  color: var(--muted);
  background: #f8fbf8;
  vertical-align: middle;
}

.page-button[data-pacing="this_week"] {
  box-shadow: inset 3px 0 0 rgba(22, 101, 52, 0.35);
}


/* Comprehension check card */
.check-panel {
  margin-top: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1rem;
  background: #fff;
}

.check-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.check-header h3 {
  margin: 0.1rem 0 0;
  font-size: 1rem;
}

.eyebrow {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.check-prompt {
  margin: 0.8rem 0;
  font-weight: 600;
}

.check-options {
  display: grid;
  gap: 0.45rem;
}

.check-option {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 0.65rem;
  cursor: pointer;
}

.check-option input {
  margin-top: 0.2rem;
}

.check-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.check-feedback {
  margin: 0;
  font-size: 0.9rem;
}

.check-feedback.correct {
  color: #166534;
}

.check-feedback.incorrect {
  color: #991b1b;
}


/* Page check status */
.page-check-mark {
  position: absolute;
  right: 1.35rem;
  bottom: 0.35rem;
  min-width: 1rem;
  height: 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  color: var(--muted);
  background: #fff;
}

.page-button[data-check-status="passed"] .page-check-mark {
  color: #166534;
  border-color: rgba(22, 101, 52, 0.35);
}

.page-button[data-check-status="pending"] .page-check-mark {
  color: #92400e;
  border-color: rgba(146, 64, 14, 0.35);
}


/* AI-mediated assessment modal */
.assessment-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.assessment-modal[hidden] {
  display: none;
}

.assessment-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 20, 16, 0.55);
}

.assessment-card {
  position: relative;
  width: min(760px, 100%);
  max-height: min(86vh, 820px);
  overflow: auto;
  border: 1px solid var(--chat-line);
  border-radius: 1.15rem;
  background: var(--chat-panel);
  color: var(--chat-text);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
  padding: 1.15rem;
}

.assessment-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--chat-line);
  padding-bottom: 0.8rem;
  margin-bottom: 0.9rem;
}

.assessment-card-header h2 {
  margin: 0.12rem 0 0;
  font-size: 1.2rem;
}

.assessment-modal-body {
  display: grid;
  gap: 0.85rem;
}

.assessment-summary,
.assessment-result-summary {
  display: grid;
  gap: 0.35rem;
  border: 1px solid var(--chat-line);
  border-radius: 0.9rem;
  background: var(--chat-bg);
  padding: 0.85rem;
}

.assessment-result-summary.passed {
  border-color: rgba(22, 101, 52, 0.35);
}

.assessment-result-summary.not-passed {
  border-color: rgba(146, 64, 14, 0.35);
}

.assessment-response-form {
  display: grid;
  gap: 1rem;
}

.assessment-question {
  display: grid;
  gap: 0.55rem;
}

.assessment-question-number {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--chat-muted);
}

.assessment-question-prompt {
  font-weight: 650;
  line-height: 1.45;
  color: #cdd8d1;
}

.assessment-question textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--chat-line);
  border-radius: 0.75rem;
  padding: 0.75rem;
  font: inherit;
  background: var(--chat-bg);
  color: var(--chat-text);
}

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

.assessment-score-card {
  border: 1px solid var(--chat-line);
  border-radius: 0.9rem;
  padding: 0.85rem;
  background: var(--chat-bg);
}

.assessment-score-card h3 {
  margin: 0 0 0.45rem;
  font-size: 0.98rem;
}


/* Assessment readiness status */
.assessment-status-card {
  margin-top: 0.72rem;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  padding: 0.91rem;
  background: #f8fbf8;
  display: grid;
  gap: 0.59rem;
  max-width: 676px;
}

.assessment-status-card[hidden] {
  display: none;
}

.assessment-status-card[data-status="due"] {
  border-color: rgba(146, 64, 14, 0.35);
  background: #fffaf0;
}

.assessment-status-card[data-status="ready"] {
  border-color: rgba(22, 101, 52, 0.4);
  background: #f0fdf4;
}

.assessment-status-label {
  display: block;
  font-size: 0.88rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.16rem;
}

.assessment-timer-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.59rem 1.04rem;
  font-size: 1.01rem;
  color: var(--muted);
}

.assessment-meter {
  width: 100%;
  height: 0.55rem;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.assessment-meter span {
  display: block;
  height: 100%;
  width: 0%;
  background: currentColor;
  color: #166534;
  transition: width 0.25s ease;
}

/* Compact course header and assessment status */
.course-header {
  padding: 0.65rem 0.8rem;
  gap: 0.75rem;
}

.course-header h2 {
  font-size: 1rem;
  line-height: 1.15;
  margin: 0;
}

.course-header p {
  font-size: 0.74rem;
  margin: 0.15rem 0 0;
}

#courseMeta {
  display: none !important;
}

.progress-card {
  margin-top: 0 !important;
  gap: 0.46rem;
  font-size: 0.72rem;
}

.assessment-status-card {
  margin-top: 0.42rem;
  padding: 0.59rem 0.72rem;
  gap: 0.33rem;
  border-radius: 0.85rem;
  max-width: 572px;
}

.assessment-status-label {
  font-size: 0.75rem;
  margin-bottom: 0.07rem;
}

#assessmentStatusText {
  font-size: 1.01rem;
  line-height: 1.1;
}

.assessment-timer-line {
  font-size: 0.88rem;
  gap: 0.33rem 0.72rem;
}

.assessment-meter {
  height: 0.36rem;
}

#markCompleteButton {
  font-size: 0.94rem;
  padding: 0.55rem 0.81rem;
  white-space: nowrap;
}

/* One-line assessment readiness bar */
.assessment-status-card {
  display: flex !important;
  align-items: center;
  gap: 0.59rem;
  margin-top: 0.29rem !important;
  padding: 0.31rem 0.59rem !important;
  border-radius: 999px !important;
  max-width: 100% !important;
  min-height: 0 !important;
  white-space: nowrap;
  overflow: hidden;
}

.assessment-status-card > div:first-child {
  display: flex;
  align-items: center;
  gap: 0.46rem;
  min-width: 0;
}

.assessment-status-label {
  font-size: 0.73rem !important;
  margin: 0 !important;
  line-height: 1 !important;
}

#assessmentStatusText {
  font-size: 0.88rem !important;
  line-height: 1 !important;
}

.assessment-timer-line {
  display: flex !important;
  align-items: center;
  gap: 0.52rem !important;
  font-size: 0.81rem !important;
  line-height: 1 !important;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

#assessmentTimerText,
#assessmentBoundaryText {
  overflow: hidden;
  text-overflow: ellipsis;
}

.assessment-meter {
  flex: 0 0 80px;
  height: 0.29rem !important;
  margin-left: auto;
}

.course-header {
  align-items: flex-start;
}

/* Floating assessment readiness pill - avoids course header clipping */
.assessment-status-card {
  position: fixed !important;
  left: 1rem !important;
  bottom: 1rem !important;
  z-index: 120 !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.72rem !important;
  width: auto !important;
  max-width: min(680px, calc(100vw - 2rem)) !important;
  margin: 0 !important;
  padding: 0.59rem 0.91rem !important;
  border: 1px solid rgba(22, 101, 52, 0.35) !important;
  border-radius: 999px !important;
  background: #ffffff !important;
  color: #17211e !important;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
}

.assessment-modal[hidden] {
  display: none !important;
}

.assessment-modal .muted {
  color: var(--chat-muted);
}

.assessment-status-card[hidden] {
  display: none !important;
}

.assessment-status-card > div:first-child {
  display: flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
}

.assessment-status-label {
  font-size: 0.62rem !important;
  line-height: 1 !important;
  margin: 0 !important;
}

#assessmentStatusText {
  font-size: 0.74rem !important;
  line-height: 1 !important;
}

.assessment-timer-line {
  display: flex !important;
  align-items: center !important;
  gap: 0.55rem !important;
  font-size: 0.7rem !important;
  line-height: 1 !important;
  min-width: 0 !important;
}

.assessment-meter {
  flex: 0 0 90px !important;
  height: 0.25rem !important; /* Leaving green bar height unchanged as requested */
  margin-left: 0.35rem !important;
}

/* Move assessment readiness pill to visible top-center test position */
.assessment-status-card {
  position: fixed !important;
  left: 50% !important;
  top: 40px !important;
  bottom: auto !important;
  border-top: none !important;
  border-top-left-radius: 0 !important;
  border-top-right-radius: 0 !important;
  transform: translateX(-50%) !important;
  z-index: 200 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  width: auto !important;
  max-width: 520px !important;
  min-width: 360px !important;
  margin: 0 !important;
  padding: 0.22rem 0.65rem !important; /* Reduced vertical space to ~60% */
  border-radius: 999px !important;
  background: #ffffff !important;
  box-shadow: 0 8px 26px rgba(0,0,0,0.16) !important;
  white-space: nowrap !important;
  overflow: visible !important;
}

.assessment-status-card > div:first-child {
  flex: 0 0 auto !important;
}

.assessment-status-label {
  display: none !important;
}

#assessmentStatusText {
  font-size: 0.44rem !important; /* Reduced to ~60% */
  font-weight: 700 !important;
}

.assessment-timer-line {
  flex: 1 1 auto !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.45rem !important;
  min-width: 0 !important;
  font-size: 0.42rem !important; /* Reduced to ~60% */
}

#assessmentTimerText {
  flex: 0 0 auto !important;
}

#assessmentBoundaryText {
  flex: 1 1 auto !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.assessment-meter {
  flex: 0 0 70px !important;
}

/* Assessment feedback polish */
body.assessment-modal-open .assessment-status-card {
  display: none !important;
}

.assessment-missing {
  margin-top: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.75rem;
  background: var(--chat-bg);
  border: 1px solid var(--chat-line);
}

.assessment-missing ul {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
}

.assessment-missing li {
  margin: 0.22rem 0;
}

.assessment-rationale {
  margin-top: 0.65rem;
  font-size: 0.82rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 0.55rem;
}

/* Fix assessment modal click layer */
.assessment-modal {
  pointer-events: auto !important;
}

.assessment-modal-backdrop {
  z-index: 0 !important;
  pointer-events: none !important;
}

.assessment-card {
  z-index: 2 !important;
  pointer-events: auto !important;
}

.assessment-card button,
.assessment-card textarea {
  pointer-events: auto !important;
}
