:root {
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #17211f;
  --muted: #63716d;
  --line: #d9e0de;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #d9f0ed;
  --warn: #b42318;
  --good: #16784a;
  --shadow: 0 14px 30px rgba(22, 33, 31, 0.08);
}

* {
  box-sizing: border-box;
}

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

a {
  color: var(--accent-strong);
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

.hidden {
  display: none !important;
}

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

.error-text {
  min-height: 22px;
  color: var(--warn);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
  min-height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  color: var(--ink);
  font-size: 20px;
  font-weight: 800;
}

.nav-title {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tabs {
  display: inline-flex;
  width: max-content;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3f1;
}

.tab {
  min-width: 92px;
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.tab.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 2px 10px rgba(23, 33, 31, 0.08);
}

.topbar-actions,
.button-row,
.input-row,
.qa-compose,
.watch-title-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 34px auto 64px;
}

.watch-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 22px;
  width: min(1380px, calc(100vw - 32px));
  margin: 24px auto 64px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 22px;
}

.section-head h1,
.watch-title-row h1 {
  margin-bottom: 6px;
  font-size: 34px;
  line-height: 1.1;
}

.primary-btn,
.secondary-btn,
.text-btn,
.icon-btn {
  min-height: 40px;
  border-radius: 8px;
  font-weight: 800;
}

.primary-btn {
  border: 1px solid var(--accent-strong);
  background: var(--accent);
  color: #fff;
  padding: 0 18px;
}

.secondary-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 0 16px;
}

.text-btn,
.icon-btn {
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  padding: 0 8px;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.login-body {
  min-height: 100vh;
  background:
    linear-gradient(rgba(245, 247, 248, 0.88), rgba(245, 247, 248, 0.95)),
    url("https://images.unsplash.com/photo-1554224155-6726b3ff858f?auto=format&fit=crop&w=1800&q=80") center/cover;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  display: grid;
  gap: 28px;
  width: min(430px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.login-panel h1 {
  margin-bottom: 8px;
  font-size: 44px;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.stack {
  display: grid;
  gap: 10px;
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 18px;
}

.course-card,
.video-row,
.news-card,
.qa-panel,
.transcript-aside,
.progress-panel,
.modal-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 20px rgba(22, 33, 31, 0.04);
}

.course-card {
  display: grid;
  overflow: hidden;
  min-height: 320px;
  padding: 0;
  color: inherit;
  text-align: left;
}

.course-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #dfe7e4;
}

.course-card-body {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 16px;
}

.course-card-body strong {
  font-size: 18px;
  line-height: 1.25;
}

.course-card-body span:not(.badge-gray) {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.badge-gray,
.tag {
  display: inline-flex;
  width: max-content;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  background: #edf2f0;
  color: #4b5b57;
  font-size: 12px;
  font-weight: 800;
  padding: 0 9px;
}

.course-detail {
  display: grid;
  gap: 18px;
}

.course-heading {
  margin-bottom: 18px;
}

.course-heading h2 {
  margin-bottom: 8px;
  font-size: 28px;
}

.video-list {
  display: grid;
  gap: 12px;
}

.video-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 14px;
  width: 100%;
  padding: 10px;
  color: inherit;
  text-align: left;
}

.video-row img {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  object-fit: cover;
  background: #dfe7e4;
}

.video-row-info {
  display: grid;
  gap: 6px;
  align-content: center;
}

.news-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.news-feed {
  display: grid;
  gap: 14px;
}

.news-card {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.news-card h2 {
  margin-bottom: 0;
  font-size: 22px;
}

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

.news-card-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.player-frame {
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background: #111;
}

.player-frame iframe,
#yt-player {
  width: 100%;
  height: 100%;
}

.watch-main {
  display: grid;
  gap: 18px;
  align-content: start;
}

.watch-title-row {
  justify-content: space-between;
}

.qa-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.chat-profile {
  display: flex;
  gap: 12px;
  align-items: center;
}

.chat-profile h2,
.transcript-aside h2 {
  margin-bottom: 0;
  font-size: 20px;
}

.chat-profile p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.chat-avatar,
.qa-avatar {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 900;
}

.chat-avatar {
  width: 42px;
  height: 42px;
  background: var(--accent);
  color: #fff;
}

.qa-messages {
  display: grid;
  gap: 10px;
  min-height: 160px;
  max-height: 320px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
}

.qa-message {
  display: grid;
  grid-template-columns: 34px minmax(0, max-content);
  gap: 8px;
  align-items: end;
  max-width: 88%;
}

.qa-message.user {
  grid-template-columns: minmax(0, max-content) 34px;
  justify-self: end;
}

.qa-message.user .qa-avatar {
  grid-column: 2;
}

.qa-message.user .qa-bubble {
  grid-column: 1;
  grid-row: 1;
}

.qa-avatar {
  width: 34px;
  height: 34px;
  background: #dce8e5;
  color: var(--accent-strong);
  font-size: 11px;
}

.qa-message.user .qa-avatar {
  background: var(--accent);
  color: #fff;
}

.qa-bubble {
  max-width: 82%;
  padding: 10px 12px;
  border-radius: 8px;
  line-height: 1.45;
  white-space: normal;
}

.qa-bubble p {
  margin: 0 0 8px;
}

.qa-bubble p:last-child {
  margin-bottom: 0;
}

.qa-bubble ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.qa-bubble li {
  margin: 3px 0;
}

.qa-bubble strong {
  font-weight: 900;
}

.qa-bubble code {
  border-radius: 5px;
  background: rgba(16, 22, 21, 0.08);
  padding: 1px 4px;
}

.qa-message.user .qa-bubble {
  background: var(--accent);
  color: #fff;
}

.qa-message.ai .qa-bubble {
  background: #e9efed;
}

.qa-compose {
  grid-template-columns: 1fr auto;
}

.transcript-aside {
  position: sticky;
  top: 86px;
  display: grid;
  max-height: calc(100vh - 110px);
  padding: 16px;
  align-content: start;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.transcript-panel {
  display: grid;
  gap: 8px;
  overflow: auto;
}

.transcript-chunk {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  line-height: 1.5;
  padding: 10px;
  text-align: left;
}

.transcript-chunk.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}

.input-row {
  grid-template-columns: 1fr auto;
}

.progress-panel {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding: 16px;
}

.refresh-panel {
  display: grid;
  gap: 8px;
  margin: -6px 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px 12px;
}

.refresh-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.refresh-log {
  display: grid;
  gap: 3px;
  max-height: 96px;
  overflow: auto;
  color: var(--muted);
  font-size: 12px;
}

.refresh-log-row.error {
  color: var(--warn);
}

.progress-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.bar-track {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: #e6ecea;
}

.bar-track span,
.quiz-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width 160ms ease;
}

.log-lines {
  display: grid;
  gap: 6px;
  max-height: 240px;
  overflow: auto;
  color: var(--muted);
  font-size: 14px;
}

.log-line.error {
  color: var(--warn);
}

.log-line.ok {
  color: var(--good);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(12, 18, 16, 0.55);
}

.modal-panel {
  position: relative;
  width: min(620px, 100%);
  padding: 24px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-weight: 900;
}

.quiz-topline {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.quiz-progress {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: #e6ecea;
}

.quiz-options {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.quiz-option {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px 14px;
  text-align: left;
}

.quiz-option.correct {
  border-color: var(--good);
  background: #e8f5ef;
}

.quiz-option.wrong {
  border-color: var(--warn);
  background: #fcedea;
}

.quiz-explanation {
  border-left: 4px solid var(--accent);
  background: #f3f8f6;
  padding: 12px;
}

.score-text {
  font-size: 28px;
  font-weight: 900;
}

.loading,
.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.65);
  color: var(--muted);
  padding: 28px;
  text-align: center;
}

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

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr auto;
    padding: 0 16px;
  }

  .tabs {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-bottom: 10px;
  }

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

  .transcript-aside {
    position: static;
    max-height: none;
  }

  .section-head,
  .watch-title-row {
    align-items: start;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .app-shell,
  .watch-shell {
    width: min(100% - 20px, 1180px);
    margin-top: 18px;
  }

  .topbar-actions,
  .input-row,
  .qa-compose {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .video-row {
    grid-template-columns: 1fr;
  }

  .login-panel {
    padding: 24px;
  }

  .section-head h1,
  .watch-title-row h1 {
    font-size: 28px;
  }
}

/* Compact product pass */
.topbar {
  min-height: 56px;
  padding: 0 22px;
}

.brand {
  font-size: 18px;
}

.tab {
  min-width: 84px;
  min-height: 32px;
}

.app-shell {
  margin-top: 24px;
}

.section-head {
  margin-bottom: 16px;
}

.section-head h1,
.watch-title-row h1 {
  font-size: 28px;
}

.primary-btn,
.secondary-btn,
.text-btn,
.icon-btn {
  min-height: 34px;
}

.primary-btn {
  padding: 0 14px;
}

.secondary-btn {
  padding: 0 13px;
}

.course-grid {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.course-card {
  min-height: 260px;
}

.course-card-body {
  gap: 8px;
  padding: 12px;
}

.course-card-body strong {
  font-size: 16px;
}

.video-list,
.news-feed {
  gap: 8px;
}

.video-row {
  grid-template-columns: 126px 1fr;
  gap: 10px;
  padding: 8px;
}

.video-row-info {
  gap: 4px;
}

.badge-gray,
.tag {
  min-height: 21px;
  font-size: 11px;
  padding: 0 8px;
}

.news-card {
  gap: 7px;
  padding: 12px 14px;
}

.news-card h2 {
  font-size: 17px;
  line-height: 1.25;
}

.news-card p {
  margin-bottom: 0;
  font-size: 14px;
  line-height: 1.4;
}

.news-card-meta {
  font-size: 12px;
}

.news-card-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.news-card-foot a {
  flex: 0 0 auto;
  font-weight: 800;
}

@media (max-width: 620px) {
  .section-head h1,
  .watch-title-row h1 {
    font-size: 24px;
  }

  .video-row {
    grid-template-columns: 1fr;
  }
}

/* Full visual overhaul */
:root {
  --bg: #eef2f3;
  --panel: #ffffff;
  --ink: #101615;
  --muted: #65736f;
  --line: #d5ddda;
  --accent: #0b7a68;
  --accent-strong: #07594d;
  --accent-soft: #dff3ee;
  --shadow: 0 18px 45px rgba(16, 22, 21, 0.09);
}

body {
  background:
    linear-gradient(180deg, #f9fbfb 0, #eef2f3 280px),
    var(--bg);
}

.topbar {
  grid-template-columns: 160px 1fr auto;
  min-height: 60px;
  border-bottom-color: rgba(16, 22, 21, 0.08);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.brand {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.brand::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: var(--accent);
  box-shadow: 9px 0 0 #82b8a9;
}

.tabs {
  justify-self: center;
  background: #e7edeb;
}

.tab {
  color: #51625d;
}

.app-shell {
  width: min(1240px, calc(100vw - 40px));
  margin-top: 26px;
}

.section-head {
  min-height: 42px;
}

.section-head h1 {
  font-size: 24px;
}

.course-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.course-card {
  grid-template-rows: auto 1fr;
  min-height: 236px;
  border-color: rgba(16, 22, 21, 0.08);
  box-shadow: var(--shadow);
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.course-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 55px rgba(16, 22, 21, 0.13);
}

.course-card-body strong {
  font-size: 17px;
}

.course-card-body span:not(.badge-gray) {
  -webkit-line-clamp: 2;
}

.course-detail {
  gap: 12px;
}

.course-heading {
  margin-bottom: 10px;
}

.course-heading h2 {
  font-size: 24px;
}

.video-list {
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}

.video-row {
  grid-template-columns: 112px 1fr;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  padding: 8px 10px;
}

.video-row:last-child {
  border-bottom: 0;
}

.video-row:hover {
  background: #f6faf8;
}

.video-row img {
  border-radius: 4px;
}

.video-row-info strong {
  font-size: 15px;
}

.video-row-info > span {
  color: var(--muted);
  font-size: 13px;
}

.watch-shell {
  grid-template-columns: minmax(0, 1fr) 360px;
  width: min(1420px, calc(100vw - 32px));
}

.player-frame,
.qa-panel,
.transcript-aside,
.news-card,
.modal-panel,
.refresh-panel {
  border-color: rgba(16, 22, 21, 0.08);
  box-shadow: var(--shadow);
}

.watch-title-row {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.watch-title-row h1 {
  font-size: 24px;
}

.qa-panel,
.transcript-aside {
  padding: 14px;
}

.qa-messages {
  min-height: 220px;
  max-height: 360px;
  background: #f3f7f6;
}

.qa-bubble {
  max-width: min(560px, 100%);
}

.transcript-panel {
  padding-right: 4px;
}

.transcript-chunk {
  font-size: 13px;
}

.news-card {
  grid-template-columns: 1fr auto;
  column-gap: 18px;
  align-items: start;
}

.news-card h2,
.news-card p,
.news-card .news-card-meta {
  grid-column: 1;
}

.news-card-foot {
  grid-column: 2;
  grid-row: 1 / span 3;
  height: 100%;
  flex-direction: column;
  align-items: end;
  justify-content: space-between;
}

.news-tags {
  justify-content: end;
}

.modal-panel {
  border-radius: 8px;
}

.quiz-option:hover:not(:disabled) {
  border-color: var(--accent);
  background: #f4faf8;
}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .tabs {
    justify-self: stretch;
  }

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

  .news-card {
    grid-template-columns: 1fr;
  }

  .news-card-foot {
    grid-column: 1;
    grid-row: auto;
    flex-direction: row;
    align-items: center;
  }
}
