:root {
  --bg: #edf2ef;
  --surface: #ffffff;
  --surface-soft: #f7faf8;
  --ink: #17231d;
  --muted: #65736b;
  --line: #d5dfd9;
  --green: #1d7f5c;
  --green-dark: #126247;
  --green-soft: #e5f4ed;
  --amber: #a16207;
  --amber-soft: #fff4d8;
  --red: #b42318;
  --red-soft: #fff0ee;
  --blue: #245da8;
  --blue-soft: #eaf2ff;
  --shadow: 0 16px 40px rgba(26, 45, 36, 0.09);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.brand p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-soft);
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.strong {
  color: var(--green-dark);
  border-color: #9fd8bf;
  background: var(--green-soft);
}

.top-actions,
.inline-actions,
.queue-actions,
.task-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  min-height: 40px;
  border: 1px solid #b9c9bf;
  border-radius: var(--radius);
  padding: 0 16px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--green);
  color: var(--green-dark);
}

.btn.primary {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.btn.primary:hover {
  background: var(--green-dark);
  border-color: var(--green-dark);
  color: #fff;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.78);
}

.btn.small {
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.btn.wide {
  width: 100%;
}

.workspace {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 330px;
  gap: 20px;
  padding: 20px;
  align-items: start;
}

.sidebar,
.right-rail {
  position: sticky;
  top: 96px;
}

.sidebar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
}

.sidebar nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  min-height: 42px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius);
  padding: 0 12px;
  text-align: left;
  font-weight: 900;
}

.nav-item.active {
  color: var(--ink);
  background: #eaf2ed;
}

.sidebar-note {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding: 16px 12px 4px;
  color: var(--muted);
  line-height: 1.55;
}

.sidebar-note strong {
  display: block;
  color: var(--ink);
  margin-bottom: 4px;
}

.main-panel {
  min-width: 0;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 18px;
}

.page-head h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.page-head p,
.panel-head p,
.hero-copy p,
.rail-card p,
.queue-main p,
.review-card p,
.task-card p,
.rule-card p,
.plain-text {
  color: var(--muted);
  line-height: 1.6;
}

.page-head p {
  margin: 6px 0 0;
  font-size: 16px;
}

.hero-card,
.panel,
.rail-card,
.rule-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  padding: 20px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.hero-copy h3 {
  margin: 0;
  font-size: 27px;
  line-height: 1.35;
}

.hero-copy h3 em {
  color: var(--green);
  font-style: normal;
}

.best-box {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #a8d9c0;
  border-radius: var(--radius);
  background: var(--green-soft);
}

.best-box span,
.metric-card span,
.rail-card span,
.score-part span,
.material-detail-grid span,
.impact-board span,
.version-row small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.best-box strong {
  display: block;
  margin-top: 4px;
  font-size: 16px;
}

.best-box p {
  margin: 6px 0 12px;
}

.hero-stats {
  display: grid;
  gap: 12px;
}

.metric-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.metric-card strong {
  display: block;
  margin: 4px 0;
  font-size: 30px;
  line-height: 1;
}

.metric-card p {
  margin: 0;
  color: var(--muted);
}

.metric-card.ok {
  background: var(--green-soft);
  border-color: #a8d9c0;
}

.metric-card.warn {
  background: var(--amber-soft);
  border-color: #f1cb78;
}

.metric-card.danger {
  background: var(--red-soft);
  border-color: #f0b8b1;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.48fr);
  gap: 18px;
}

.panel {
  padding: 18px;
}

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

.panel-head h3,
.rail-card h3,
.rule-card h3,
.detail-section h3 {
  margin: 0;
  font-size: 19px;
}

.panel-head p {
  margin: 0;
}

.queue-list,
.review-stack,
.review-list,
.version-list,
.download-list {
  display: grid;
  gap: 12px;
}

.queue-item {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 112px;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.queue-item.is-direct {
  border-color: #c6ded1;
}

.thumb {
  min-height: 82px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f3f7f4;
  text-align: center;
}

.thumb span {
  max-width: 72px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thumb strong,
.grade-badge {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  border-radius: var(--radius);
  color: #fff;
  background: var(--green);
  font-weight: 900;
}

.thumb small {
  color: var(--muted);
  font-weight: 800;
}

.title-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.title-line h4,
.review-card h4,
.task-card h4 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.rank {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  color: #fff;
  background: var(--green);
  font-weight: 900;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag-row span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #e0c579;
  border-radius: 999px;
  padding: 0 10px;
  background: #fff8df;
  color: #875c03;
  font-size: 12px;
  font-weight: 900;
}

.queue-actions {
  justify-content: stretch;
}

.queue-actions .btn {
  width: 100%;
}

.review-card,
.task-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.grade-badge.b {
  background: var(--blue);
}

.grade-badge.c,
.grade-badge.- {
  background: var(--amber);
}

.review-card dl {
  display: flex;
  gap: 18px;
  margin: 10px 0 0;
}

.review-card dt,
.review-card dd {
  margin: 0;
}

.review-card dt {
  color: var(--muted);
  font-size: 12px;
}

.review-card dd {
  font-weight: 900;
}

.right-rail {
  display: grid;
  gap: 18px;
}

.rail-card {
  padding: 18px;
}

.selected-material {
  display: block;
  width: 100%;
  min-height: 42px;
  margin: 8px 0 14px;
  border: 1px solid #b9c9bf;
  border-radius: var(--radius);
  background: var(--surface-soft);
  text-align: left;
  padding: 8px 12px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.mini-grid div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface-soft);
}

.mini-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 23px;
}

.rail-card ol,
.plain-steps {
  margin: 12px 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.segmented button,
.review-summary button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 900;
}

.segmented button.active,
.review-summary button.active {
  color: var(--green-dark);
  border-color: #9fd8bf;
  background: var(--green-soft);
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.search input {
  width: 260px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  background: #fff;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.material-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

.material-table th,
.material-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.material-table th {
  color: var(--muted);
  font-size: 13px;
}

.material-table td strong {
  display: block;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.material-table td span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.rec-badge {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  font-weight: 900;
}

.rec-badge.ok {
  color: var(--green-dark);
  background: var(--green-soft);
}

.rec-badge.warn {
  color: var(--amber);
  background: var(--amber-soft);
}

.rec-badge.danger {
  color: var(--red);
  background: var(--red-soft);
}

.rec-badge.neutral {
  color: var(--blue);
  background: var(--blue-soft);
}

.risk-text,
.negative {
  color: var(--red);
}

.review-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.review-product-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.review-product-tabs button {
  min-height: 66px;
  display: grid;
  align-content: center;
  gap: 4px;
  border-color: #d7e6df;
  background: var(--surface);
  text-align: left;
}

.review-product-tabs button.active {
  border-color: var(--green);
  background: var(--green-soft);
  box-shadow: inset 0 0 0 1px rgba(28, 126, 88, 0.14);
}

.review-product-tabs strong {
  color: var(--green-dark);
  font-size: 24px;
}

.review-summary button {
  height: 72px;
  display: grid;
  align-content: center;
  gap: 4px;
  text-align: left;
}

.review-summary strong {
  color: var(--ink);
  font-size: 24px;
}

.task-type {
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-weight: 900;
  white-space: nowrap;
}

.task-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.task-meta-row span {
  padding: 3px 7px;
  border-radius: 999px;
  background: #eef4f1;
  color: #4d6258;
  font-size: 12px;
  font-weight: 800;
}

.evidence-line {
  border-left: 3px solid #d1b66c;
  padding-left: 10px;
  color: var(--muted);
  line-height: 1.6;
}

.learning-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 16px;
  align-items: stretch;
  margin-bottom: 18px;
}

.learning-hero > div:first-child {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.learning-hero h3 {
  margin: 4px 0 10px;
  font-size: 26px;
}

.sample-summary,
.coverage-grid,
.learning-baseline {
  display: grid;
  gap: 10px;
}

.sample-summary {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.learning-baseline {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.learning-baseline div,
.coverage-grid div,
.learning-flow div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.learning-baseline span,
.coverage-grid span,
.learning-flow p,
.learning-flow small,
.candidate-card small {
  color: var(--muted);
}

.learning-baseline strong,
.coverage-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  line-height: 1.5;
}

.coverage-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.coverage-grid strong {
  color: var(--green-dark);
  font-size: 28px;
  line-height: 1;
}

.candidate-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.candidate-card {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.candidate-card h4,
.candidate-card p {
  margin: 0;
}

.candidate-card small {
  line-height: 1.6;
}

.candidate-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.candidate-meta span {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 12px;
  font-weight: 900;
}

.learning-flow {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.learning-flow span {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-bottom: 8px;
  border-radius: 999px;
  color: #fff;
  background: var(--green);
  font-weight: 900;
}

.learning-flow small {
  display: block;
  margin-top: 6px;
  line-height: 1.5;
}

.preview-list {
  min-width: 0;
}

.rule-scope-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.rule-scope-switch button {
  min-height: 34px;
  padding: 6px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.rule-scope-switch button.active {
  color: var(--green-dark);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.rule-scope-note {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #cfe5dc;
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--green-soft);
  line-height: 1.6;
}

.rule-scope-note strong {
  color: var(--green-dark);
}

.keyword-board {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.keyword-board-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.keyword-board-head h3 {
  margin: 4px 0 4px;
  font-size: 22px;
}

.keyword-board-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.keyword-version-card {
  display: grid;
  gap: 5px;
  min-width: 220px;
  padding: 12px;
  border: 1px solid #cfe5dc;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.keyword-version-card strong {
  overflow-wrap: anywhere;
}

.keyword-version-card small {
  color: var(--muted);
  line-height: 1.45;
}

.keyword-meta-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.keyword-meta-row div {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.keyword-meta-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.keyword-meta-row strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.keyword-groups {
  display: grid;
  gap: 10px;
}

.keyword-group {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfc;
}

.keyword-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.keyword-group-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.keyword-group p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.keyword-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.keyword-chip-row span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 900;
}

.rule-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.rule-card {
  padding: 18px;
}

.rule-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--green-dark);
  font-weight: 900;
}

.scope-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 12px;
  white-space: nowrap;
}

.scope-badge.muted {
  color: var(--muted);
  background: var(--surface-soft);
}

.rule-card h3 {
  margin-top: 8px;
}

.rule-card .btn {
  margin-top: 8px;
}

.version-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.version-row strong {
  overflow-wrap: anywhere;
}

.version-row span {
  color: var(--green-dark);
  font-weight: 900;
}

.version-row small {
  grid-column: 1 / -1;
}

.score-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 18px;
}

.score-panel .breakdown-grid {
  grid-column: 1 / -1;
}

.score-meter {
  display: grid;
  place-items: center;
  border: 1px solid #9fd8bf;
  border-radius: var(--radius);
  background: var(--green-soft);
}

.score-meter strong {
  font-size: 42px;
  line-height: 1;
}

.score-meter span {
  color: var(--muted);
  font-weight: 900;
}

.breakdown-grid,
.material-detail-grid,
.explain-grid,
.impact-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.score-part,
.material-detail-grid div,
.explain-grid div,
.impact-board article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface-soft);
}

.score-part strong,
.material-detail-grid strong,
.impact-board strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.impact-board {
  margin-bottom: 18px;
}

.impact-board.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 18px 0 0;
}

.impact-board article {
  background: var(--surface);
  box-shadow: var(--shadow);
}

.impact-board p {
  color: var(--muted);
  line-height: 1.5;
}

.timeline {
  display: grid;
  gap: 0;
}

.timeline div {
  position: relative;
  padding: 0 0 18px 28px;
  border-left: 2px solid var(--line);
}

.timeline div:last-child {
  border-left-color: transparent;
}

.timeline span {
  position: absolute;
  left: -7px;
  top: 0;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--green);
}

.timeline strong {
  display: block;
}

.timeline p {
  margin: 4px 0 0;
  color: var(--muted);
}

.loading-state,
.empty {
  display: grid;
  place-items: center;
  min-height: 180px;
  color: var(--muted);
  text-align: center;
}

.loader {
  width: 36px;
  height: 36px;
  border: 3px solid var(--line);
  border-top-color: var(--green);
  border-radius: 999px;
  animation: spin 1s linear infinite;
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 32, 26, 0.44);
}

.modal {
  position: relative;
  width: min(1080px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 26px 70px rgba(10, 20, 14, 0.28);
  padding: 24px;
}

.modal h2 {
  margin: 0 42px 16px 0;
  font-size: 26px;
}

.source-video-panel {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(220px, 0.6fr);
  gap: 14px;
  margin-bottom: 16px;
  align-items: stretch;
}

.source-video-frame {
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #111c17;
}

.source-video-frame video {
  width: 100%;
  height: 100%;
  min-height: 260px;
  display: block;
  background: #111c17;
}

.video-placeholder {
  min-height: 260px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 18px;
  color: #dbe8e1;
  text-align: center;
}

.video-placeholder span {
  color: #aebeb6;
  font-size: 13px;
}

.source-video-meta {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface-soft);
}

.source-video-meta h3 {
  margin: 0 0 8px;
}

.source-video-meta p {
  color: var(--muted);
  line-height: 1.6;
}

.source-actions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.source-actions .btn {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  font-weight: 900;
}

.detail-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.transcript-grid {
  display: grid;
  gap: 10px;
}

.transcript-grid article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface-soft);
}

.transcript-grid strong {
  display: block;
  margin-bottom: 6px;
  color: var(--green-dark);
}

.transcript-grid p {
  max-height: 160px;
  overflow: auto;
  margin: 0;
  color: var(--ink);
  line-height: 1.7;
  white-space: pre-wrap;
}

.code-preview {
  max-height: 360px;
  overflow: auto;
  padding: 14px;
  border-radius: var(--radius);
  background: #16231c;
  color: #e6f2ec;
  font-size: 12px;
  line-height: 1.5;
}

.download-list div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.download-list span {
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 70;
  transform: translateX(-50%);
  max-width: min(560px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: var(--radius);
  color: #fff;
  background: #17231d;
  box-shadow: var(--shadow);
  font-weight: 800;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .right-rail {
    display: none;
  }

  .hero-card,
  .learning-hero,
  .two-column {
    grid-template-columns: 1fr;
  }

  .rule-grid,
  .keyword-meta-row,
  .candidate-grid,
  .learning-flow,
  .source-video-panel,
  .breakdown-grid,
  .material-detail-grid,
  .explain-grid,
  .impact-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar,
  .brand,
  .page-head,
  .keyword-board-head,
  .toolbar,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .top-actions .btn {
    width: 100%;
  }

  .rule-scope-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .rule-scope-switch button {
    width: 100%;
  }

  .rule-card-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace {
    display: block;
    padding: 12px;
  }

  .sidebar {
    position: static;
    margin-bottom: 14px;
  }

  .sidebar nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-card,
  .panel,
  .rail-card {
    padding: 14px;
  }

  .hero-copy h3 {
    font-size: 22px;
  }

  .queue-item,
  .review-card,
  .task-card,
  .score-panel {
    grid-template-columns: 1fr;
  }

  .queue-actions,
  .task-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .review-summary,
  .review-product-tabs,
  .rule-grid,
  .keyword-meta-row,
  .sample-summary,
  .learning-baseline,
  .coverage-grid,
  .candidate-grid,
  .learning-flow,
  .source-video-panel,
  .breakdown-grid,
  .material-detail-grid,
  .explain-grid,
  .impact-board,
  .impact-board.compact {
    grid-template-columns: 1fr;
  }

  .search,
  .search input {
    width: 100%;
  }

  .modal-backdrop {
    padding: 10px;
  }
}
