:root {
  color-scheme: light;
  --tb-bg: #edf2f1;
  --tb-surface: #ffffff;
  --tb-surface-soft: #f7f5ee;
  --tb-ink: #14201d;
  --tb-muted: #63716b;
  --tb-line: rgba(44, 58, 53, 0.14);
  --tb-primary: #8a6f42;
  --tb-primary-dark: #5f4b2b;
  --tb-green: #2f7a63;
  --tb-blue: #2f5f7a;
  --tb-amber: #d6a14a;
  --tb-shadow: 0 18px 42px rgba(20, 32, 29, 0.10);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--tb-bg); scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--tb-ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(214, 161, 74, 0.16), transparent 28%),
    radial-gradient(circle at 88% 12%, rgba(47, 122, 99, 0.14), transparent 30%),
    linear-gradient(180deg, #fbfaf6 0, #edf2f1 430px, #f5f6f4 100%);
}
a { color: inherit; }
button, a { touch-action: manipulation; }
button { font: inherit; }
[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  left: 16px;
  top: 10px;
  z-index: 100;
  padding: 10px 14px;
  background: #0f1724;
  color: #fff;
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.tb-sync {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 74px;
}

.tb-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(270px, 0.8fr);
  gap: 28px;
  min-height: 286px;
  padding: clamp(26px, 4vw, 46px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  background:
    radial-gradient(circle at 82% 18%, rgba(216, 166, 79, 0.42), transparent 24%),
    radial-gradient(circle at 14% 20%, rgba(47, 122, 99, 0.42), transparent 32%),
    linear-gradient(135deg, #101827 0%, #183630 54%, #2d261c 100%);
  color: #fffaf0;
  box-shadow: var(--tb-shadow);
}

.tb-hero::after {
  content: "";
  position: absolute;
  inset: 14% -12% auto 48%;
  height: 74%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  transform: rotate(-10deg);
  pointer-events: none;
}

.tb-hero-copy,
.tb-hero-stats {
  position: relative;
  z-index: 1;
}

.tb-kicker {
  margin: 0;
  color: #dcb66e;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tb-hero h1 {
  max-width: 760px;
  margin: 10px 0 12px;
  font-size: clamp(40px, 6vw, 76px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.tb-hero-copy > p:not(.tb-kicker) {
  max-width: 660px;
  margin: 0;
  color: rgba(255, 250, 240, 0.80);
  font-size: 17px;
  line-height: 1.7;
}

.tb-hero-actions {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tb-primary-action,
.tb-secondary-action {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  padding: 0 18px;
  text-decoration: none;
  font-weight: 830;
  white-space: nowrap;
}

.tb-primary-action {
  border: 1px solid var(--tb-amber);
  background: linear-gradient(180deg, #f4cf80, #c8862c);
  color: #24180b;
  box-shadow: 0 10px 22px rgba(216, 166, 79, 0.22);
}

.tb-secondary-action {
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
  color: #fffaf0;
}

.tb-secondary-action:hover { background: rgba(255, 255, 255, 0.14); }
.tb-compact-action { min-height: 40px; padding-inline: 14px; }

.tb-primary-action:focus-visible,
.tb-secondary-action:focus-visible,
.tb-book-card:focus-visible,
.tb-unit-button:focus-visible,
.tb-module-card:focus-visible,
.tb-path-option:focus-visible,
.tb-theme-card:focus-visible,
.tb-coverage-map-link:focus-visible {
  outline: 3px solid rgba(47, 95, 122, 0.42);
  outline-offset: 3px;
}

.tb-hero-stats {
  margin: 0;
  align-self: end;
  display: grid;
  gap: 12px;
}

.tb-hero-stats div {
  min-height: 78px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 15px 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
}

.tb-hero-stats dt {
  color: rgba(255, 250, 240, 0.68);
  font-size: 12px;
  font-weight: 750;
}

.tb-hero-stats dd {
  margin: 0;
  font-size: 28px;
  line-height: 1;
  font-weight: 920;
  font-variant-numeric: tabular-nums;
}

.tb-section {
  margin-top: 28px;
  display: grid;
  gap: 18px;
  padding-top: 14px;
}

.tb-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.tb-section-head h2 {
  margin: 5px 0 3px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.04;
  letter-spacing: -0.035em;
}

.tb-section-head span {
  color: var(--tb-muted);
  font-size: 15px;
  line-height: 1.6;
}

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

.tb-book-card {
  position: relative;
  display: grid;
  gap: 16px;
  min-height: 210px;
  padding: 20px;
  border: 1px solid var(--tb-line);
  border-radius: 20px;
  background:
    radial-gradient(circle at 90% 8%, color-mix(in srgb, var(--book-accent) 26%, transparent), transparent 34%),
    linear-gradient(180deg, #fff, var(--tb-surface-soft));
  color: var(--tb-ink);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--tb-shadow);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.tb-book-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--book-accent) 54%, var(--tb-line));
}

.tb-book-card.is-active {
  border-color: color-mix(in srgb, var(--book-accent) 74%, var(--tb-line));
  box-shadow: 0 22px 44px rgba(20, 32, 29, 0.14);
}

.tb-book-card h3 {
  margin: 6px 0 6px;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.tb-book-card p {
  margin: 0;
  color: var(--tb-muted);
  font-size: 14px;
  line-height: 1.6;
}

.tb-book-meta,
.tb-module-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tb-chip {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  background: color-mix(in srgb, var(--book-accent, var(--tb-green)) 12%, #fff);
  color: color-mix(in srgb, var(--book-accent, var(--tb-green)) 72%, #17211d);
  font-size: 12px;
  font-weight: 820;
}

.tb-workspace {
  border: 1px solid rgba(44, 58, 53, 0.10);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
  padding: 20px;
  box-shadow: var(--tb-shadow);
}

.tb-workspace-head .tb-secondary-action {
  border-color: rgba(44, 58, 53, 0.16);
  background: #fff;
  color: var(--tb-ink);
}

.tb-unit-layout {
  display: grid;
  grid-template-columns: minmax(190px, 0.28fr) minmax(0, 1fr);
  gap: 16px;
}

.tb-unit-rail,
.tb-unit-panel {
  border: 1px solid var(--tb-line);
  border-radius: 18px;
  background: #fff;
}

.tb-unit-rail {
  align-self: start;
  position: sticky;
  top: 16px;
  padding: 12px;
}

.tb-rail-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 4px 12px;
  color: var(--tb-muted);
  font-size: 13px;
}

.tb-rail-title strong {
  color: var(--tb-ink);
  font-size: 15px;
}

.tb-unit-list {
  display: grid;
  gap: 8px;
}

.tb-unit-button {
  min-height: 58px;
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--tb-line);
  border-radius: 12px;
  background: #fbfaf6;
  color: var(--tb-ink);
  text-align: left;
  cursor: pointer;
}

.tb-unit-button strong,
.tb-unit-button small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tb-unit-button small {
  color: var(--tb-muted);
  font-size: 12px;
}

.tb-unit-button.is-active {
  border-color: var(--tb-primary);
  background: #f6eadc;
  color: var(--tb-primary-dark);
}

.tb-unit-panel {
  overflow: hidden;
}

.tb-unit-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 150px;
  padding: 22px;
  background:
    radial-gradient(circle at 88% 8%, rgba(214, 161, 74, 0.22), transparent 30%),
    linear-gradient(135deg, #f9f7ef, #eef4ef);
  border-bottom: 1px solid var(--tb-line);
}

.tb-unit-hero p,
.tb-unit-hero h3,
.tb-unit-hero span {
  margin: 0;
}

.tb-unit-hero p {
  color: var(--tb-primary-dark);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.tb-unit-hero h3 {
  margin-top: 6px;
  font-size: clamp(30px, 5vw, 58px);
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.tb-unit-hero span {
  display: block;
  margin-top: 10px;
  color: var(--tb-muted);
  font-size: 15px;
  line-height: 1.5;
}

.tb-unit-hero .tb-primary-action {
  flex: none;
}

.tb-path-section {
  display: grid;
  gap: 12px;
  padding: 14px 16px 16px;
  border-bottom: 1px solid var(--tb-line);
  background:
    radial-gradient(circle at 96% 0%, rgba(47, 95, 122, 0.10), transparent 28%),
    linear-gradient(180deg, #fffdfa, #fbfaf6);
}

.tb-path-intro {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.tb-path-intro h4 {
  margin: 3px 0 4px;
  font-size: clamp(20px, 2.6vw, 28px);
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.tb-path-intro p {
  max-width: 760px;
  margin: 0;
  color: var(--tb-muted);
  font-size: 14px;
  line-height: 1.65;
}

.tb-path-badge {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  flex: none;
  border-radius: 999px;
  padding: 0 11px;
  background: #f5f0e6;
  color: #6a5a40;
  font-size: 12px;
  font-weight: 860;
  white-space: nowrap;
}

.tb-path-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.tb-path-option {
  min-height: 66px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px 13px;
  border: 1px solid var(--tb-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--tb-ink);
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.tb-path-option:hover {
  transform: translateY(-1px);
  border-color: rgba(47, 95, 122, 0.32);
  background: #fff;
}

.tb-path-option.is-primary {
  border-color: rgba(138, 111, 66, 0.34);
  background: #f8f1e6;
}

.tb-path-option strong {
  font-size: 14px;
  line-height: 1.25;
}

.tb-path-option span {
  color: var(--tb-muted);
  font-size: 12px;
  line-height: 1.35;
}

.tb-theme-rebuild {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(47, 95, 122, 0.12);
  border-radius: 16px;
  background: rgba(242, 247, 246, 0.78);
}

.tb-theme-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.tb-theme-copy strong {
  min-width: max-content;
  color: var(--tb-blue);
  font-size: 14px;
  font-weight: 880;
}

.tb-theme-copy p {
  flex: 1;
  margin: 0;
  color: var(--tb-muted);
  font-size: 13px;
  line-height: 1.6;
}

.tb-coverage-map-link {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border: 1px solid rgba(47, 95, 122, 0.18);
  border-radius: 999px;
  padding: 0 13px;
  background: #fff;
  color: var(--tb-blue);
  font-size: 12px;
  font-weight: 860;
  text-decoration: none;
  white-space: nowrap;
}

.tb-coverage-map-link:hover {
  border-color: rgba(47, 95, 122, 0.34);
  background: #f5f9f8;
}

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

.tb-theme-card {
  min-height: 176px;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--tb-line);
  border-radius: 15px;
  background:
    radial-gradient(circle at 92% 0%, rgba(47, 95, 122, 0.12), transparent 35%),
    #fff;
  color: var(--tb-ink);
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(20, 32, 29, 0.05);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.tb-theme-card:not(.is-disabled):hover {
  transform: translateY(-1px);
  border-color: rgba(47, 95, 122, 0.36);
  box-shadow: 0 12px 24px rgba(20, 32, 29, 0.08);
}

.tb-theme-card.is-disabled {
  background: #f6f5f1;
  color: rgba(20, 32, 29, 0.56);
  box-shadow: none;
}

.tb-theme-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.tb-theme-card-head > span:first-child {
  display: grid;
  gap: 3px;
}

.tb-theme-card strong {
  font-size: 18px;
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.tb-theme-card em {
  color: var(--tb-muted);
  font-size: 13px;
  font-style: normal;
  line-height: 1.25;
}

.tb-theme-status {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  flex: none;
  border-radius: 999px;
  padding: 0 9px;
  background: #f5f0e6;
  color: #6a5a40;
  font-size: 11px;
  font-weight: 860;
  white-space: nowrap;
}

.tb-theme-card:not(.is-disabled) .tb-theme-status {
  background: color-mix(in srgb, var(--tb-blue) 12%, #fff);
  color: color-mix(in srgb, var(--tb-blue) 76%, #17211d);
}

.tb-theme-units {
  color: var(--tb-blue);
  font-size: 12px;
  font-weight: 820;
  line-height: 1.35;
}

.tb-theme-card p {
  margin: 0;
  color: var(--tb-muted);
  font-size: 13px;
  line-height: 1.55;
}

.tb-theme-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tb-theme-meta small {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 8px;
  background: #eef3f1;
  color: #596b64;
  font-size: 11px;
  font-weight: 760;
}

.tb-theme-action {
  align-self: end;
  color: var(--tb-primary-dark);
  font-size: 12px;
  font-weight: 860;
}

.tb-theme-card.is-disabled .tb-theme-action {
  color: rgba(20, 32, 29, 0.46);
}

.tb-module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.tb-module-card {
  min-height: 168px;
  display: grid;
  align-content: space-between;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--tb-line);
  border-radius: 16px;
  background:
    radial-gradient(circle at 88% 0%, color-mix(in srgb, var(--module-accent) 20%, transparent), transparent 34%),
    #fff;
  text-decoration: none;
  box-shadow: 0 10px 20px rgba(20, 32, 29, 0.06);
}

.tb-module-card.is-disabled {
  color: rgba(20, 32, 29, 0.48);
  background: #f2f3f0;
  box-shadow: none;
  cursor: not-allowed;
}

.tb-module-card:not(.is-disabled):hover {
  border-color: color-mix(in srgb, var(--module-accent) 58%, var(--tb-line));
  transform: translateY(-1px);
}

.tb-module-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.tb-module-card h4 {
  margin: 0;
  font-size: 21px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.tb-module-status {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  background: color-mix(in srgb, var(--module-accent) 13%, #fff);
  color: color-mix(in srgb, var(--module-accent) 78%, #17211d);
  font-size: 11px;
  font-weight: 860;
  white-space: nowrap;
}

.tb-module-card.is-disabled .tb-module-status {
  background: rgba(20, 32, 29, 0.08);
  color: rgba(20, 32, 29, 0.48);
}

.tb-module-card p {
  margin: 0;
  color: var(--tb-muted);
  font-size: 13px;
  line-height: 1.55;
}

.tb-module-card.is-disabled p {
  color: rgba(20, 32, 29, 0.45);
}

.tb-module-meta small {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  background: #f5f0e6;
  color: #6a5a40;
  font-size: 11px;
  font-weight: 760;
}

.tb-status,
.tb-empty {
  margin: 24px 0 0;
  color: var(--tb-muted);
  text-align: center;
}

@media (max-width: 980px) {
  .tb-sync {
    width: min(100% - 28px, 760px);
    padding-top: 74px;
  }

  .tb-hero,
  .tb-book-grid,
  .tb-unit-layout {
    grid-template-columns: 1fr;
  }

  .tb-unit-rail {
    position: static;
  }

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

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

  .tb-path-switch {
    grid-template-columns: 1fr;
  }

  .tb-theme-copy {
    display: grid;
  }

  .tb-coverage-map-link {
    justify-self: start;
  }
}

@media (max-width: 640px) {
  .tb-sync {
    width: min(100% - 22px, 520px);
    padding-bottom: 48px;
  }

  .tb-hero,
  .tb-workspace {
    border-radius: 18px;
    padding: 18px;
  }

  .tb-section-head,
  .tb-unit-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .tb-hero-actions,
  .tb-unit-hero .tb-primary-action,
  .tb-workspace-head .tb-secondary-action {
    width: 100%;
  }

  .tb-unit-list,
  .tb-module-grid,
  .tb-theme-grid {
    grid-template-columns: 1fr;
  }

  .tb-module-grid {
    padding: 12px;
  }

  .tb-path-section {
    padding: 12px;
  }

  .tb-path-intro {
    display: grid;
  }

  .tb-coverage-map-link {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
