/* Home and global shell only. Existing training surfaces retain their styles. */
:root {
  --db-bg: #07121b;
  --db-surface: #0c1b27;
  --db-surface-raised: #102333;
  --db-border: #294758;
  --db-cyan: #42d2ef;
  --db-blue: #139ee8;
  --db-orange: #ff791f;
  --db-orange-soft: #ffb16b;
  --db-teal: #63e0be;
  --db-violet: #b3a6ff;
  --db-train-tint: #352416;
  --db-workshop-tint: #0b354b;
  --db-learn-tint: #143d35;
  --db-profile-tint: #30254c;
  --db-ink: #f4f7fa;
  --db-muted: #abc0d0;
  --db-space-1: 4px;
  --db-space-2: 8px;
  --db-space-3: 12px;
  --db-space-4: 16px;
  --db-space-5: 24px;
  --db-space-6: 32px;
  --db-space-7: 48px;
  --db-radius: 16px;
  --db-radius-small: 10px;
  --db-title: clamp(28px, 3vw, 38px);
  --db-shadow: 0 18px 50px #00000026;
}
body:has(.db-topbar) { background: var(--db-bg); }
.app:has(.db-topbar) { max-width: 1240px; padding-inline: var(--db-space-6); }
.db-topbar.topbar {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center;
  gap: var(--db-space-5); min-height: 88px; border-bottom: 1px solid var(--db-border);
}
.db-topbar .brand { gap: var(--db-space-3); text-decoration: none; }
.db-topbar .brand-emblem { position: static; width: 28px; height: 36px; color: var(--db-cyan); }
.db-topbar .brand .brand-word { font-size: 26px; font-weight: 800; letter-spacing: -.7px; color: var(--db-ink); white-space: nowrap; }
.db-topbar .brand .brand-accent { color: var(--db-brand-orange); }
.shell-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); min-width: 0; gap: var(--db-space-2); }
.shell-tab {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--db-space-2);
  min-width: 0; min-height: 48px; padding: var(--db-space-3); background: transparent;
  border: 1px solid transparent; border-radius: var(--db-radius-small); color: var(--db-muted);
  font-size: 16px; line-height: 1.4; font-weight: 600;
}
.shell-tab svg { width: 21px; height: 21px; flex: 0 0 auto; }
.shell-label-short { display: none; }
.db-topbar #homeButton { margin-left: 0; }
.shell-tab:hover { background: var(--db-surface-raised); color: var(--db-ink); }
.shell-tab.active { color: var(--db-cyan); background: #15313e; border-color: var(--db-border); }
.shell-account { display: flex; gap: var(--db-space-2); flex-wrap: wrap; justify-content: flex-end; }
.shell-account:has(> [hidden]):not(:has(> :not([hidden]))) { display: none; }
.shell-account .quiet { margin: 0; border: 1px solid var(--db-border); }
.db-section-nav.section-navigation { gap: var(--db-space-4); padding: var(--db-space-3) 0; border-color: var(--db-border); }
.db-section-nav[hidden] { display: none; }
.db-section-nav .top-label { margin: 0 auto 0 0; max-width: none; text-align: left; font-size: 13px; color: var(--db-muted); }
.shell-section-picker { display: flex; align-items: center; gap: var(--db-space-3); min-width: 0; }
.shell-section-picker label { white-space: nowrap; flex-shrink: 0; width: auto; }
.db-section-nav #sectionNav { width: 260px; max-width: 100%; margin: 0; font-size: 14px; background: var(--db-surface); border-color: var(--db-border); }
.db-section-nav .quiet { font-size: 14px; white-space: nowrap; }
.app > .db-home { max-width: 1120px; margin: var(--db-space-6) auto 0; padding: 0 0 var(--db-space-5); color: var(--db-ink); }
.app[data-view="home"] { background: radial-gradient(ellipse at 90% 32%, #008bcc12, transparent 55%); }
.db-home *, .db-topbar *, .db-section-nav * { box-sizing: border-box; }
.db-home button { font-family: inherit; cursor: pointer; white-space: normal; }
.db-home button:focus-visible, .shell-tab:focus-visible, .db-topbar a:focus-visible, .db-directory summary:focus-visible {
  outline: 3px solid var(--db-cyan); outline-offset: 4px;
}
.db-welcome { display: flex; align-items: center; justify-content: space-between; gap: var(--db-space-5); margin-bottom: var(--db-space-5); }
.db-kicker { font-size: 12px; letter-spacing: 1.8px; line-height: 1.6; font-weight: 700; color: var(--db-cyan); }
.db-welcome h1 { margin: var(--db-space-2) 0; font-size: clamp(32px, 3.4vw, 44px); letter-spacing: -1.3px; }
.db-welcome h1 > span { color: var(--db-cyan); background: linear-gradient(100deg, #71e6fb, #4ab8ff); background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.db-welcome p { margin: 0; color: #c4d3df; font-size: 17px; }
.db-workshop-mark { color: var(--db-cyan); font: 12px/1.7 ui-monospace, monospace; letter-spacing: 1px; text-align: right; max-width: 160px; padding-left: var(--db-space-4); border-left: 2px solid var(--db-orange); }
.db-continue {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  background: linear-gradient(115deg, #102c40, #0b1c2c 68%);
  border: 1px solid #377b96; border-radius: var(--db-radius); box-shadow: 0 16px 60px #0076ae16, inset 0 1px 0 #88ddff14;
  overflow: hidden;
}
.db-continue-content { min-width: 0; padding: var(--db-space-6); position: relative; z-index: 1; }
.db-status-tag { display: inline-flex; align-items: center; gap: var(--db-space-2); padding: 6px 12px; border: 1px solid #236170; border-radius: 30px; color: var(--db-cyan); font-size: 12px; font-weight: 750; line-height: 1.6; letter-spacing: 1.6px; background: #0a2831; }
.db-status-tag > span { width: 6px; height: 6px; background: var(--db-cyan); border-radius: 50%; }
.db-continue h2 { font-size: clamp(27px, 3.1vw, 40px); line-height: 1.15; letter-spacing: -.9px; margin: var(--db-space-4) 0 var(--db-space-3); text-wrap: balance; }
.db-continue-content > p { margin: 0; font-size: 17px; line-height: 1.6; max-width: 47ch; color: #c3d2de; }
.db-course-status { display: flex; gap: var(--db-space-3); align-items: center; margin: var(--db-space-4) 0 0; color: var(--db-muted); font-size: 14px; }
.db-course-line { flex: 0 0 32px; height: 3px; background: var(--db-cyan); border-radius: 4px; }
.db-continue-button {
  display: flex; align-items: center; justify-content: center; gap: var(--db-space-3);
  width: 100%; min-height: 58px; padding: 14px 20px; border: 1px solid #ff9b50;
  background: linear-gradient(110deg, #ff8b27, #ff6d14); border-radius: var(--db-radius-small);
  color: #07121b; font-size: 19px; font-weight: 800; line-height: 1.4; box-shadow: 0 5px 24px #ff791f20;
  margin-top: var(--db-space-5);
}
.db-continue-button:hover { background: #ff9943; border-color: #ffb474; }
.db-continue-button svg { width: 21px; height: 21px; flex-shrink: 0; }
.db-continue-button svg:last-child { margin-left: auto; }
.db-continue-button span { flex: 1; text-align: center; }
.db-text-action { display: inline-flex; align-items: center; gap: var(--db-space-2); padding: 10px 0; min-height: 44px; background: transparent; border: 0; color: var(--db-muted); font-size: 14px; font-weight: 600; text-align: left; line-height: 1.5; }
.db-text-action:hover { color: var(--db-cyan); background: transparent; }
.db-text-action svg { width: 17px; height: 17px; flex-shrink: 0; }
.db-continue-content > .db-text-action { margin-top: var(--db-space-2); }
.db-continue-art { position: relative; display: grid; place-items: center; overflow: hidden; isolation: isolate; min-width: 0; padding: var(--db-space-5) var(--db-space-4) var(--db-space-7); border-left: 1px solid #36728d66; background: radial-gradient(ellipse at 45% 40%, #007fbb45, transparent 72%), radial-gradient(ellipse at 80% 85%, #ff791f28, transparent 60%), #0c2334; }
.db-art-grid { position: absolute; inset: 0; z-index: -1; background-image: linear-gradient(#8fcde214 1px, transparent 1px), linear-gradient(90deg, #8fcde214 1px, transparent 1px); background-size: 32px 32px; mask-image: linear-gradient(transparent, #000 20%, #000 80%, transparent); }
.db-continue-art img { width: 310px; height: 340px; max-width: 92%; object-fit: contain; filter: drop-shadow(0 18px 16px #0009); }
.db-art-caption { position: absolute; bottom: var(--db-space-5); left: var(--db-space-5); right: var(--db-space-5); color: var(--db-muted); font: 11px/1.5 ui-monospace, monospace; letter-spacing: 1.6px; text-align: center; }
.db-art-cross { position: absolute; color: #508094; font: 24px/1 ui-monospace, monospace; }
.db-art-cross-one { top: var(--db-space-5); left: var(--db-space-5); }
.db-art-cross-two { bottom: var(--db-space-5); right: var(--db-space-5); }
.db-destinations { margin-top: var(--db-space-6); }
.db-section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: var(--db-space-4); margin-bottom: var(--db-space-4); }
.db-section-heading h2 { font-size: 20px; letter-spacing: -.35px; margin: 0; }
.db-section-heading > span { color: var(--db-muted); font-size: 11px; letter-spacing: 1.6px; }
.db-destination-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--db-space-4); }
.db-destination {
  --destination-accent: var(--db-cyan); --destination-tint: var(--db-workshop-tint);
  display: grid; grid-template-columns: 56px minmax(0, 1fr) 18px; align-items: center; gap: var(--db-space-4);
  width: 100%; min-width: 0; padding: var(--db-space-5); text-align: left;
  position: relative; overflow: hidden; background: linear-gradient(110deg, color-mix(in srgb, var(--destination-tint), var(--db-surface) 50%), var(--db-surface) 78%); border: 1px solid color-mix(in srgb, var(--destination-accent), #07121b 70%); border-radius: var(--db-radius);
  color: var(--db-ink); transition: border-color .15s, background-color .15s;
}
.db-destination::before { content: ''; position: absolute; left: var(--db-space-5); right: 58%; top: 0; height: 2px; background: linear-gradient(90deg, var(--destination-accent), transparent); }
.db-destination:hover { border-color: var(--destination-accent); background: linear-gradient(110deg, var(--destination-tint), var(--db-surface-raised)); }
.db-home #openAssessments { --destination-accent: var(--db-orange-soft); --destination-tint: var(--db-train-tint); }
.db-home #openLearning { --destination-accent: var(--db-teal); --destination-tint: var(--db-learn-tint); }
.db-home #profileButton { --destination-accent: var(--db-violet); --destination-tint: var(--db-profile-tint); }
.db-destination-icon { display: grid; place-items: center; width: 56px; height: 56px; border: 1px solid color-mix(in srgb, var(--destination-accent), transparent 60%); border-radius: var(--db-radius-small); color: var(--destination-accent); background: var(--destination-tint); box-shadow: inset 0 1px 0 #ffffff0d; }
.db-destination-icon svg { position: static; width: 28px; height: 28px; }
.db-destination-copy { display: flex; flex-direction: column; gap: var(--db-space-2); min-width: 0; }
.db-destination-copy strong { font-size: 21px; line-height: 1.3; letter-spacing: -.4px; color: color-mix(in srgb, var(--destination-accent), white 55%); }
.db-destination-copy > span { color: var(--db-muted); font-size: 15px; line-height: 1.5; }
.db-arrow { display: flex; color: #87aec2; }
.db-arrow svg { width: 18px; height: 18px; }
.db-snapshot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--db-space-3) var(--db-space-5); padding: var(--db-space-4) 0; margin: var(--db-space-5) 0; border-top: 1px solid var(--db-border); border-bottom: 1px solid var(--db-border); }
.db-snapshot h2 { margin: 0; font-size: 15px; }
.db-snapshot p { flex: 1; margin: 0; font-size: 14px; color: var(--db-muted); }
.db-snapshot .db-text-action { padding-block: 0; }
.db-secondary { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--db-space-5); align-items: start; }
.db-community-link { display: grid; grid-template-columns: 28px minmax(0, 1fr) 18px; gap: var(--db-space-4); align-items: center; padding: var(--db-space-4) 0; background: transparent; border: 0; text-align: left; color: var(--db-ink); }
.db-community-link:hover { background: transparent; color: var(--db-cyan); }
.db-community-icon { color: var(--db-cyan); }
.db-community-icon svg { width: 26px; height: 26px; }
.db-community-link > span:nth-child(2) { display: flex; flex-direction: column; gap: var(--db-space-1); }
.db-community-link strong { font-size: 16px; }
#homeLeaderboard { color: var(--db-muted); font-size: 14px; line-height: 1.5; }
.db-directory { border: 1px solid var(--db-border); border-radius: var(--db-radius-small); background: var(--db-surface); }
.db-directory summary { min-height: 60px; padding: var(--db-space-4); display: flex; align-items: center; justify-content: space-between; gap: var(--db-space-4); cursor: pointer; font-size: 16px; font-weight: 650; list-style: none; }
.db-directory summary::-webkit-details-marker { display: none; }
.db-directory-plus { color: var(--db-cyan); font-size: 23px; line-height: 1; }
.db-directory[open] .db-directory-plus { transform: rotate(45deg); }
.db-directory-groups { padding: 0 var(--db-space-4) var(--db-space-4); }
.db-directory h3 { padding-top: var(--db-space-4); margin: 0 0 var(--db-space-2); font-size: 14px; color: var(--db-cyan); border-top: 1px solid var(--db-border); }
.db-directory-link { display: flex; align-items: center; justify-content: space-between; gap: var(--db-space-4); width: 100%; min-height: 48px; padding: var(--db-space-2) 0; background: transparent; border: 0; border-radius: 0; color: var(--db-muted); text-align: left; font-size: 15px; line-height: 1.5; }
.db-directory-link svg { width: 16px; height: 16px; flex-shrink: 0; }
.db-directory-link:hover { color: var(--db-ink); background: transparent; }
.db-home .independence-note { font-size: 13px; max-width: 96ch; margin-top: var(--db-space-6); color: var(--db-muted); }
@media (max-width: 1000px) and (min-width: 701px) {
  .db-topbar.topbar { grid-template-columns: 1fr auto; gap: var(--db-space-3); padding-block: var(--db-space-4); }
  .shell-tabs { grid-column: 1 / -1; grid-row: 2; }
  .shell-account { grid-column: 2; grid-row: 1; }
}
@media (max-width: 700px) {
  .app:has(.db-topbar) { padding-inline: var(--db-space-4); padding-bottom: var(--db-space-5); }
  .db-topbar.topbar { grid-template-columns: minmax(0, 1fr) auto; min-height: 76px; gap: var(--db-space-3); }
  .db-topbar .brand { gap: var(--db-space-2); }
  .db-topbar .brand .brand-word { font-size: 26px; }
  .db-topbar .brand-emblem { width: 23px; height: 30px; }
  .shell-account { gap: var(--db-space-2); grid-column: 1 / -1; justify-content: flex-start; padding-bottom: var(--db-space-3); }
  .shell-account .quiet { font-size: 14px; padding-inline: var(--db-space-2); }
  .shell-tabs {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0;
    padding: var(--db-space-2) max(var(--db-space-2), env(safe-area-inset-right)) max(var(--db-space-2), env(safe-area-inset-bottom)) max(var(--db-space-2), env(safe-area-inset-left));
    background: #081721f7; border-top: 1px solid var(--db-border); box-shadow: 0 -10px 24px #0004;
  }
  .shell-tab { flex-direction: column; gap: var(--db-space-1); border: 0; padding: var(--db-space-2) 0; min-height: 60px; font-size: 13px; border-radius: 0; position: relative; }
  .shell-tab svg { width: 25px; height: 25px; }
  .shell-tab.active { color: #ffad64; background: transparent; }
  .shell-tab.active::before { content: ''; position: absolute; top: -8px; left: 22%; right: 22%; height: 3px; border-radius: 5px; background: var(--db-orange); }
  .db-section-nav.section-navigation { gap: var(--db-space-2); flex-wrap: wrap; }
  .db-section-nav .top-label { display: block; font-size: 12px; max-width: 45%; }
  .shell-section-picker { margin-left: auto; max-width: 53%; }
  .shell-section-picker label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .db-section-nav #sectionNav { width: 100%; font-size: 14px; min-width: 0; }
  .db-section-nav #guideButton { display: none; } /* Available through All sections and the Home directory. */
  .app > .db-home { margin-top: var(--db-space-5); }
  .db-welcome { margin-bottom: var(--db-space-5); }
  .db-welcome h1 { font-size: 32px; letter-spacing: -.8px; }
  .db-welcome p { font-size: 16px; }
  .db-workshop-mark { display: none; }
  .db-kicker { font-size: 11px; letter-spacing: 1.3px; }
  .db-continue { grid-template-columns: minmax(0, 1fr) 112px; gap: 0 var(--db-space-3); padding: var(--db-space-5); }
  .db-continue-content { display: contents; }
  .db-continue-content > * { grid-column: 1 / -1; }
  .db-status-tag { justify-self: start; }
  .db-continue h2 { grid-column: 1; grid-row: 2; align-self: center; font-size: 29px; margin: var(--db-space-4) 0; }
  .db-continue-art { grid-column: 2; grid-row: 2; display: grid; align-self: center; height: 148px; padding: 0; border: 0; overflow: visible; background: radial-gradient(ellipse, #00bbeb24, transparent 72%); }
  .db-continue-art img { height: 148px; width: 112px; max-width: 100%; filter: drop-shadow(0 7px 10px #0008); }
  .db-continue-art .db-art-grid, .db-continue-art .db-art-caption, .db-continue-art .db-art-cross { display: none; }
  .db-continue-content > p { font-size: 16px; }
  .db-section-heading > span { display: none; }
  .db-destination-grid { grid-template-columns: minmax(0, 1fr); gap: var(--db-space-3); }
  .db-destination { grid-template-columns: 48px minmax(0, 1fr) 16px; padding: var(--db-space-4); gap: var(--db-space-3); }
  .db-destination-icon { width: 48px; height: 48px; }
  .db-destination-copy strong { font-size: 20px; }
  .db-destination-copy > span { font-size: 15px; }
  .db-snapshot { display: grid; grid-template-columns: 1fr auto; gap: var(--db-space-2); }
  .db-snapshot p { grid-column: 1 / -1; grid-row: 2; }
  .db-snapshot .db-text-action { grid-column: 2; grid-row: 1; }
  .db-secondary { grid-template-columns: minmax(0, 1fr); gap: var(--db-space-4); }
  body:has(.db-topbar) .site-footer { padding-bottom: calc(100px + env(safe-area-inset-bottom)); margin-top: var(--db-space-5); }
}
@media (max-width: 360px) {
  .shell-label-long { display: none; }
  .shell-label-short { display: inline; }
  .db-topbar .brand .brand-word { font-size: 24px; }
  .db-topbar .brand-emblem { width: 20px; }
  .db-continue { padding: var(--db-space-4); grid-template-columns: minmax(0, 1fr) 96px; }
  .db-continue-art img { width: 96px; }
  .db-status-tag { letter-spacing: 1px; }
  .db-continue-button { padding-inline: var(--db-space-3); gap: var(--db-space-2); }
  .db-continue-button > svg:first-child { display: none; }
  .db-destination { grid-template-columns: 44px minmax(0, 1fr) 14px; gap: var(--db-space-3); padding: var(--db-space-4) var(--db-space-3); }
  .db-destination-icon { width: 44px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) { .db-destination { transition: none; } }

/* Preserve current back/history controls and real Train/Learn hub routes. */
.db-topbar.topbar { grid-template-columns: auto auto minmax(0, 1fr) auto auto; }
.db-topbar #backButton[hidden] { display: none; }
.db-topbar:has(#backButton[hidden]) { grid-template-columns: auto minmax(0, 1fr) auto auto; }
.db-topbar .top-nav.shell-tabs { margin: 0; width: 100%; }
.db-topbar .top-nav .shell-tab { justify-content: center; min-height: 48px; font-size: 16px; padding: 12px 8px; }
.db-topbar .profile-shortcut { margin: 0; }
.db-home #openTrainHub { --destination-accent: var(--db-orange-soft); --destination-tint: var(--db-train-tint); }
.db-home #openLearnHub { --destination-accent: var(--db-teal); --destination-tint: var(--db-learn-tint); }
.db-section-nav #homeButton { display: none; }
.db-topbar .brand-accent { color: var(--db-brand-orange); }
@media (max-width: 1000px) and (min-width: 701px) {
 .db-topbar.topbar, .db-topbar:has(#backButton[hidden]) { grid-template-columns: auto minmax(0, 1fr) auto; }
 .db-topbar .brand { grid-column: 2; }
 .db-topbar:has(#backButton[hidden]) .brand { grid-column: 1 / 3; }
 .db-topbar .top-nav.shell-tabs { grid-column: 1 / -1; grid-row: 2; }
 .db-topbar .shell-account { grid-column: 1 / -1; grid-row: auto; }
}
@media (max-width: 700px) {
 .db-topbar.topbar, .db-topbar:has(#backButton[hidden]) { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; }
 .db-topbar:has(#backButton[hidden]) { grid-template-columns: minmax(0, 1fr) auto; }
 .db-topbar .top-nav.shell-tabs { display: none; }
 .db-topbar .brand .brand-word { font-size: 26px; }
 .db-section-nav #sectionNav { flex: 1; width: auto; max-width: 65%; }
 .db-section-nav .nav-note { display: none; }
 .mobile-bottom-nav .shell-tab { font-size: 13px; min-height: 60px; padding: 8px 0; }
 .mobile-bottom-nav .shell-tab.active { color: var(--db-orange-soft); }
 .mobile-bottom-nav .shell-tab svg { width: 25px; height: 25px; }
}
@media (max-width: 360px) {
 .db-topbar .brand .brand-word { font-size: 24px; }
 .db-topbar .brand-emblem { width: 20px; }
 .db-topbar .back-button { width: 36px; }
}
@media (min-width: 1001px) {
 .db-topbar > * { grid-row: 1; }
 .db-topbar #backButton { grid-column: 1; }
 .db-topbar .brand { grid-column: 2; }
 .db-topbar .top-nav.shell-tabs { grid-column: 3; }
 .db-topbar .profile-shortcut { grid-column: 4; }
 .db-topbar .shell-account { grid-column: 5; }
 .db-topbar:has(#backButton[hidden]) .brand { grid-column: 1; }
 .db-topbar:has(#backButton[hidden]) .top-nav.shell-tabs { grid-column: 2; }
 .db-topbar:has(#backButton[hidden]) .profile-shortcut { grid-column: 3; }
 .db-topbar:has(#backButton[hidden]) .shell-account { grid-column: 4; }
}
