.track-page .main-content {
  padding: 24px 0 36px;
}

.track-shell {
  width: min(1120px, 96vw);
  margin: 0 auto;
}

.track-inner {
  border: 1px solid #dbe4f2;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #fbfdff);
  box-shadow: 0 12px 28px rgba(22, 33, 60, 0.08);
  padding: 16px;
}

.track-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.track-heading {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.track-title {
  font-size: 24px;
  color: #1f2937;
}

.track-identity {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin: 0;
  padding: 6px 10px;
  border: 1px solid #d7e1ef;
  border-radius: 999px;
  background: #f4f8fd;
  color: #324257;
  font-size: 13px;
  font-weight: 600;
}

.track-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.track-actions input {
  width: min(300px, 78vw);
  border: 1px solid #d5dce8;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
}

.track-actions button {
  border: 1px solid #0f4d8a;
  border-radius: 8px;
  background: #0f4d8a;
  color: #ffffff;
  padding: 8px 10px;
  font-size: 13px;
  cursor: pointer;
}

.track-actions button:hover {
  background: #0b3e70;
}

.track-status {
  min-height: 22px;
  margin-top: 10px;
  color: #4b5563;
  font-size: 14px;
}

.track-status.error {
  color: #b42318;
}

.track-disclaimer-panel {
  margin-top: 8px;
}

.track-disclaimer-card {
  border: 1px solid #dce5f3;
  border-radius: 16px;
  padding: 20px;
  background:
    linear-gradient(180deg, #ffffff, #f7fbff),
    linear-gradient(135deg, rgba(15, 77, 138, 0.04), rgba(20, 184, 166, 0.04));
  box-shadow: 0 12px 28px rgba(22, 33, 60, 0.08);
}

.track-disclaimer-eyebrow {
  margin: 0 0 6px;
  color: #0f4d8a;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.track-disclaimer-card h2 {
  margin: 0 0 10px;
  color: #1f2937;
  font-size: 22px;
}

.track-disclaimer-copy {
  margin: 0;
  color: #425466;
  font-size: 15px;
  line-height: 1.7;
}

.track-disclaimer-copy br {
  content: "";
  display: block;
  margin-top: 10px;
}

.track-disclaimer-agree-btn {
  margin-top: 18px;
  border: 1px solid #0f4d8a;
  border-radius: 10px;
  background: #0f4d8a;
  color: #ffffff;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.track-disclaimer-agree-btn:hover {
  background: #0b3e70;
}

.track-actions input:disabled,
.track-actions button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.track-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: minmax(420px, 1.5fr) minmax(220px, 1fr);
  gap: 12px;
}

.tree-panel {
  border: 1px solid #dce5f3;
  border-radius: 12px;
  padding: 12px;
  min-height: 60vh;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.tree-panel h2 {
  font-size: 16px;
  margin-bottom: 10px;
  color: #1f2937;
}

.tree-muted {
  color: #6b7280;
}

.tree-root {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tree-node {
  border: 1px solid #dce5f3;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  margin: 0;
  box-shadow: 0 10px 22px rgba(22, 33, 60, 0.06);
  overflow: hidden;
}

.tree-head {
  cursor: pointer;
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 2px;
  padding: 12px 14px;
  color: #243244;
  font-weight: 600;
  text-align: left;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 249, 255, 0.95)),
    linear-gradient(90deg, rgba(37, 99, 235, 0.06), rgba(15, 118, 110, 0.03));
}

.tree-head::-webkit-details-marker {
  display: none;
}

.tree-title {
  color: #182437;
  font-weight: 700;
}

.tree-demo-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 5px 16px;
  border: 1px solid #f0abfc;
  border-radius: 999px;
  background: linear-gradient(120deg, #fef08a, #fbcfe8, #e9d5ff);
  color: #581c87;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.4;
  vertical-align: middle;
  white-space: nowrap;
}

.tree-title-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tree-toggle {
  width: 9px;
  height: 9px;
  border-right: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  transform: rotate(-45deg);
  margin-top: -2px;
}

.tree-node[open] > .tree-head .tree-toggle {
  transform: rotate(45deg);
}

.tree-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  color: #ffffff;
}

.tree-icon.chapter {
  background: #2563eb;
}

.tree-icon.topic {
  background: linear-gradient(135deg, #2563eb, #0891b2);
}

.tree-icon.tts {
  background: linear-gradient(135deg, #0f766e, #14b8a6);
}

.tree-meta-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tree-children {
  position: relative;
  margin-left: 26px;
  padding: 0 14px 14px 18px;
}

.tree-leaf {
  margin: 4px 0;
  list-style: none;
}

.tree-topic-children::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 18px;
  width: 2px;
  background: linear-gradient(180deg, #c9d9ec, rgba(201, 217, 236, 0.1));
}

.tree-topic-play-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 44px;
  flex-wrap: wrap;
}

.tree-branch {
  position: relative;
  width: 14px;
  height: 2px;
  flex: 0 0 14px;
  background: #c9d9ec;
}

.tree-topic-launch-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tree-topic-play-button,
.tree-topic-exam-button {
  min-width: 124px;
  border: 1px solid #c9ddd7;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff, #f2fbf8);
  color: #243244;
  padding: 9px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.tree-topic-play-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
  color: #4b5563;
  font-size: 12px;
}

.tree-topic-last-used {
  font-weight: 600;
}

.tree-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.tree-status-badge.active {
  border-color: #9cd5bc;
  background: #eaf9f1;
  color: #14643e;
}

.tree-status-badge.inactive {
  border-color: #d6dce5;
  background: #f5f7fa;
  color: #526071;
}

.tree-topic-node.is-active {
  border-color: #b8e0cb;
  background: linear-gradient(180deg, #ffffff, #f2fbf6);
  box-shadow: 0 12px 24px rgba(15, 118, 110, 0.1);
}

.tree-topic-node.is-active > .tree-head {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(239, 250, 243, 0.95)),
    linear-gradient(90deg, rgba(15, 118, 110, 0.12), rgba(37, 99, 235, 0.03));
}

.tree-topic-node.is-active .tree-title {
  color: #144b33;
}

.tree-topic-node.is-active .tree-topic-play-button,
.tree-topic-node.is-active .tree-topic-exam-button {
  border-color: #9cd5bc;
  background: linear-gradient(180deg, #ffffff, #ecfaf2);
}

.tree-topic-exam-button {
  border-color: #c7d7ef;
  background: linear-gradient(180deg, #ffffff, #f3f7ff);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.08);
}

.tree-topic-play-button:hover,
.tree-topic-exam-button:hover {
  border-color: #8bc5b6;
  box-shadow: 0 10px 20px rgba(15, 118, 110, 0.14);
  transform: translateY(-1px);
}

.tree-topic-play-button:focus-visible,
.tree-topic-exam-button:focus-visible {
  outline: 2px solid #0f4d8a;
  outline-offset: 2px;
}

.tree-summary .row {
  display: flex;
  justify-content: space-between;
  border: 1px solid #dce5f3;
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 8px;
  background: #ffffff;
}

@media (max-width: 920px) {
  .track-grid {
    grid-template-columns: 1fr;
  }

  .tree-topic-play-row {
    align-items: flex-start;
  }

  .tree-topic-play-meta {
    width: 100%;
    padding-left: 24px;
  }
}

/* Learning progress actions use the API permissions for the clicked content item. */
.tree-topic-learning-button {
  min-width: 124px;
  border: 1px solid #b8cce5;
  border-radius: 999px;
  background: #eef4fc;
  color: #25476d;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
}

.tree-topic-learning-button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.tree-learning-status {
  display: inline-flex;
  padding: 4px 10px;
  border: 1px solid #d6dce5;
  border-radius: 999px;
  background: #f5f7fa;
  color: #526071;
  font-size: 12px;
  font-weight: 600;
}

.tree-learning-status.in_progress {
  border-color: #b8cce5;
  background: #eef4fc;
  color: #25476d;
}

.tree-learning-status.completed_pass,
.tree-learning-status.completed {
  border-color: #9cd5bc;
  background: #eaf9f1;
  color: #14643e;
}

.tree-learning-status.completed_fail {
  border-color: #ebc595;
  background: #fff6e8;
  color: #885414;
}

.tree-learning-details {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 8px 0 0 24px;
  color: #4b5563;
  font-size: 12px;
  line-height: 1.5;
}

.tree-learning-note {
  color: #64748b;
}

.tree-topic-learning-button:not(:disabled) {
  background: #0f4d8a;
  border-color: #0f4d8a;
  color: #ffffff;
  cursor: pointer;
}

.tree-topic-learning-button:not(:disabled):hover {
  background: #0b3e70;
}

.tree-topic-learning-button:focus-visible {
  outline: 2px solid #0f4d8a;
  outline-offset: 2px;
}
