/* ==========================================================================
   TestDojo — shared styles
   ========================================================================== */

/* Brand palette, taken from the TestDojo logo: gate blue (primary), </>
   gold (accent), tile navy (dark), plus green for the secondary button and
   link-hover underlines. --color-secondary is the gold accent. */
:root {
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  /* Form-field outlines need 3:1 against the card (WCAG 1.4.11); the
     general --color-border is decorative and far lighter. */
  --color-input-border: #8492a6;
  --color-text: #0f172a;
  --color-text-muted: #64748b;
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-on-primary: #ffffff;
  --color-secondary: #f59e0b;
  --color-secondary-hover: #d97706;
  --color-green: #0e7c7b; /* white text on it: 5.0:1 (AA) */
  --color-green-hover: #0a6463;
  --color-on-green: #ffffff;
  --color-accent-bg: #eff6ff;
  --color-code-bg: #0f172a;
  --color-code-text: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 12px 32px -12px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.05);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  /* Soft brand-tinted focus/selection ring used by inputs and buttons. */
  --ring: 0 0 0 3px color-mix(in srgb, var(--color-primary) 25%, transparent);
  --header-height: 64px;
}

/* Dark mode sits on the logo's own navy tile colour. */
[data-theme="dark"] {
  --color-bg: #0f172a;
  --color-surface: #1e293b;
  --color-border: #334155;
  --color-input-border: #6b7a90;
  --color-text: #f1f5f9;
  --color-text-muted: #94a3b8;
  --color-primary: #60a5fa;
  --color-primary-hover: #93c5fd;
  /* Primary turns light blue on navy, so text on it flips to navy. */
  --color-on-primary: #0f172a;
  --color-secondary: #fbbf24;
  --color-secondary-hover: #fcd34d;
  /* Same light-on-navy flip as primary: brighter green, navy text. */
  --color-green: #2dd4d0;
  --color-green-hover: #5fe1de;
  --color-on-green: #0f172a;
  --color-accent-bg: #1e3a5f;
  --color-code-bg: #020617;
  --color-code-text: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 14px 34px -12px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}


body {
  margin: 0;
  font-family: "Inter", "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  transition: background 0.2s ease, color 0.2s ease;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}
/* Plain text links get the brand hover; buttons that happen to be <a>
   tags keep their own colours. */
a:not(.btn):hover {
  color: var(--color-primary-hover);
}

/* Hover underline: a thin line with rounded ends that grows out from the
   centre. It's a background image so it follows text across line wraps.
   Applies to plain text links (no class), sidebar labels and link-style
   buttons; classed links (badge tiles, the homepage's Tailwind chips and steps)
   skip it. */
:root {
  --swoosh: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 8' preserveAspectRatio='none'%3E%3Cpath d='M1.5 4 H 98.5' fill='none' stroke='%230e7c7b' stroke-width='2' stroke-linecap='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
}
[data-theme="dark"] {
  --swoosh: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 8' preserveAspectRatio='none'%3E%3Cpath d='M1.5 4 H 98.5' fill='none' stroke='%232dd4d0' stroke-width='2' stroke-linecap='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
}
a:not([class]),
.link-swoosh,
.pg-link-btn,
.badge-toast__link {
  background-image: var(--swoosh);
  background-repeat: no-repeat;
  background-position: 50% 100%;
  background-size: 0% 6px;
  padding-bottom: 4px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: background-size 0.35s cubic-bezier(0.4, 0, 0.2, 1), color 0.25s ease;
}
a:not([class]):hover,
a:hover > .link-swoosh,
.pg-link-btn:hover,
.badge-toast__link:hover {
  background-size: 100% 6px;
  text-decoration: none;
}
@media (prefers-reduced-motion: reduce) {
  a:not([class]),
  .link-swoosh,
  .pg-link-btn,
  .badge-toast__link {
    transition: none;
  }
}

h1, h2, h3, h4 {
  line-height: 1.25;
  letter-spacing: -0.015em;
}

img, svg {
  max-width: 100%;
}

/* ---------- Header ---------- */

:root {
  --sidebar-width: 220px;
}

#site-header-mount {
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  gap: 12px;
}

.site-header__left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-header__right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.help-toggle {
  font-weight: 700;
}
.help-toggle.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-on-primary);
}
/* #id selectors here so these reliably beat .theme-toggle:hover (defined
   later, same specificity as a plain .help-toggle:hover would be) — without
   this, hovering the active toggle was reverting it to the pale inactive
   hover tint instead of staying highlighted. */
#helpToggle:hover {
  background: var(--color-accent-bg);
  border-color: var(--color-primary);
  color: var(--color-primary);
}
#helpToggle.is-active:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  color: var(--color-on-primary);
}

.site-header__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--color-text);
}
.site-header__brand:hover {
  text-decoration: none;
}
/* The TestDojo name gets its own face so it reads as a logo, not a heading. */
.wordmark {
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.wordmark__accent {
  color: var(--color-primary);
}
.site-header__brand .wordmark {
  font-size: 1.25rem;
}
/* The footer already shows the domain in blue right after the name. */
.site-footer .wordmark__accent {
  color: inherit;
}
.site-header__brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
}

.theme-toggle {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
}
.theme-toggle:hover {
  background: var(--color-accent-bg);
}

.nav-toggle {
  display: none;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 1.1rem;
  align-items: center;
  justify-content: center;
}

@media (max-width: 860px) {
  .nav-toggle {
    display: inline-flex;
  }
}

/* ---------- Sidebar ---------- */

.app-shell {
  display: flex;
  align-items: flex-start;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  padding: 18px 12px;
  /* Own scroll region is intentional (nav stays put while content scrolls) —
     keep its scrollbar thin so two independent scrollbars doesn't feel
     jarring next to the page's default-width one. */
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}
.sidebar::-webkit-scrollbar {
  width: 6px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

.sidebar__top-link {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-weight: 700;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.sidebar__top-link:hover {
  background: var(--color-accent-bg);
  color: var(--color-text);
  text-decoration: none;
}
.sidebar__top-link[aria-current="page"] {
  background: var(--color-accent-bg);
  color: var(--color-primary);
}
.sidebar__top-link--soon {
  cursor: default;
  opacity: 0.5;
}
.sidebar__top-link--soon:hover {
  background: none;
}

.sidebar__group {
  margin-bottom: 18px;
}

.sidebar__group-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.sidebar__group-toggle:hover {
  background: var(--color-accent-bg);
}
.sidebar__group-toggle .chevron {
  transition: transform 0.15s ease;
  font-size: 0.7rem;
}
.sidebar__group.is-collapsed .chevron {
  transform: rotate(-90deg);
}

.sidebar__group-links {
  padding-left: 4px;
}
.sidebar__group.is-collapsed .sidebar__group-links {
  display: none;
}

.sidebar__link {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-size: 0.89rem;
}
.sidebar__link:hover {
  background: var(--color-accent-bg);
  color: var(--color-text);
  text-decoration: none;
}
.sidebar__link[aria-current="page"] {
  background: var(--color-accent-bg);
  color: var(--color-primary);
  font-weight: 600;
}
/* "Soon" tag on nav links that open a Coming Soon page (see nav.js). */
.sidebar__tag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-secondary) 18%, transparent);
  color: #92400e;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 1px;
}
[data-theme="dark"] .sidebar__tag {
  color: #fcd34d;
}
.sidebar__link--soon {
  cursor: default;
  opacity: 0.5;
}
.sidebar__link--soon:hover {
  background: none;
  color: var(--color-text-muted);
}

.sidebar-overlay {
  display: none;
}

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    top: var(--header-height);
    left: -100%;
    width: 260px;
    height: calc(100vh - var(--header-height));
    z-index: 95;
    transition: left 0.2s ease;
    box-shadow: var(--shadow-md);
  }
  .sidebar.is-open {
    left: 0;
  }
  .sidebar-overlay.is-open {
    display: block;
    position: fixed;
    inset: var(--header-height) 0 0 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 90;
  }
  main {
    min-width: 0;
  }
}

/* ---------- Layout helpers ---------- */

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

main {
  flex: 1;
  min-width: 0;
  min-height: calc(100vh - var(--header-height) - 160px);
}

.section {
  padding: 48px 0;
}

/* Visible keyboard focus everywhere. :where() keeps specificity at zero,
   so any component that styles its own focus still wins. */
:where(a, button, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Buttons ---------- */

/* No transform on hover: practice buttons are automation targets, and
   moving them under the cursor would make hover/drag practice flaky. */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.btn:hover {
  text-decoration: none;
}
.btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.btn--primary {
  background: var(--color-primary);
  color: var(--color-on-primary);
  box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--color-primary) 70%, transparent);
}
.btn--primary:hover {
  background: var(--color-primary-hover);
}

.btn--secondary {
  background: var(--color-green);
  color: var(--color-on-green);
  box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--color-green) 70%, transparent);
}
.btn--secondary:hover {
  background: var(--color-green-hover);
}
.btn:disabled,
.btn[aria-disabled="true"] {
  box-shadow: none;
}

/* ---------- Badges (rendered by badges.js) ---------- */

.badge-shelf {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
@media (max-width: 1200px) {
  .badge-shelf {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 860px) {
  .badge-shelf {
    grid-template-columns: repeat(2, 1fr);
  }
}
.badge-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 20px 14px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.badge-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.badge-tile__icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  font-size: 1.8rem;
  background: var(--color-accent-bg);
  border: 2px dashed var(--color-border);
  filter: grayscale(1);
  opacity: 0.55;
}
.badge-tile__name {
  font-weight: 700;
  font-size: 0.95rem;
  margin-top: 4px;
}
.badge-tile__desc {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.4;
  flex: 1;
}
.badge-tile__bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--color-border);
  overflow: hidden;
  margin-top: 4px;
}
.badge-tile__bar span {
  display: block;
  height: 100%;
  background: var(--color-primary);
  border-radius: inherit;
}
.badge-tile__count {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-muted);
}
.badge-tile.is-earned {
  border-color: color-mix(in srgb, var(--color-secondary) 55%, var(--color-border));
  background: linear-gradient(180deg, color-mix(in srgb, var(--color-secondary) 10%, var(--color-surface)), var(--color-surface));
}
.badge-tile.is-earned .badge-tile__icon {
  filter: none;
  opacity: 1;
  border: 2px solid var(--color-secondary);
  background: color-mix(in srgb, var(--color-secondary) 16%, var(--color-surface));
}
.badge-tile.is-earned .badge-tile__bar span {
  background: var(--color-secondary);
}
.badge-tile.is-earned .badge-tile__count {
  color: var(--color-secondary-hover, #d97706);
}

.badge-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  max-width: calc(100vw - 40px);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-secondary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.badge-toast.is-visible {
  transform: none;
  opacity: 1;
}
.badge-toast__icon {
  font-size: 1.8rem;
}
.badge-toast__body {
  display: flex;
  flex-direction: column;
}
.badge-toast__label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}
.badge-toast__link {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.btn--outline {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
}
.btn--outline:hover {
  background: var(--color-accent-bg);
  border-color: color-mix(in srgb, var(--color-primary) 40%, var(--color-border));
}

/* ---------- Cards ---------- */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  position: relative;
  display: flex;
  flex-direction: column;
}

.card h3 {
  margin: 8px 0 6px;
  font-size: 1.05rem;
}

.card p {
  color: var(--color-text-muted);
  font-size: 0.92rem;
  margin: 0 0 12px;
}

.card-icon {
  font-size: 1.6rem;
}

/* Coming Soon page: live pages that practise the same skills. */
.soon-related {
  max-width: 760px;
  margin: 8px auto 48px;
}
.soon-related h2 {
  font-size: 1.05rem;
  text-align: center;
  margin: 0 0 14px;
}
.soon-related__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.soon-related__card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  color: var(--color-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.soon-related__card:hover {
  border-color: color-mix(in srgb, var(--color-primary) 40%, var(--color-border));
  box-shadow: var(--shadow-md);
}
.soon-related__card strong {
  color: var(--color-primary);
}
.soon-related__card span {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* ---------- Page header (non-home pages) ---------- */

/* A soft gradient panel with a faint dot pattern, echoing the homepage hero. */
.page-header {
  position: relative;
  overflow: hidden;
  margin: 24px 0 28px;
  padding: 22px 28px 22px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--color-accent-bg), var(--color-surface) 70%);
  box-shadow: var(--shadow-sm);
}
.page-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--color-border) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse at top right, #000, transparent 65%);
  mask-image: radial-gradient(ellipse at top right, #000, transparent 65%);
  pointer-events: none;
}
.page-header > * {
  position: relative;
}
.page-header h1 {
  margin: 0 0 6px;
  font-size: clamp(1.55rem, 1.2rem + 1.1vw, 1.875rem);
  line-height: 1.2;
  letter-spacing: -0.025em;
}
.page-header p {
  color: var(--color-text-muted);
  max-width: 680px;
  margin: 0;
  font-size: 0.97rem;
  line-height: 1.6;
}
.page-header p + p {
  margin-top: 10px;
}
.breadcrumb {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: 10px;
}
.breadcrumb a {
  color: var(--color-text-muted);
}
@media (max-width: 600px) {
  .page-header {
    margin-top: 20px;
    padding: 22px 20px;
  }
}

/* ---------- Tabs (OS switcher etc.) ---------- */

.tabs {
  margin: 24px 0;
}
/* Segmented control: the tab buttons sit in one rounded track and the
   selected one becomes a raised, brand-tinted pill. */
.tabs__list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 100%;
  padding: 4px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.tabs__btn {
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-radius: 9px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.tabs__btn:hover {
  color: var(--color-text);
  background: var(--color-bg);
}
.tabs__btn[aria-selected="true"] {
  color: var(--color-primary);
  background: var(--color-accent-bg);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-primary) 30%, transparent);
}
.tabs__panel {
  display: none;
}
.tabs__panel.is-active {
  display: block;
}

/* Nested tabs (e.g. language tabs containing OS sub-tabs) */
.tabs__panel .tabs {
  margin: 12px 0 0;
}
.tabs__panel .tabs .tabs__list {
  margin-bottom: 16px;
}
.tabs__panel .tabs .tabs__btn {
  padding: 6px 12px;
  font-size: 0.84rem;
}

/* ---------- Prereq / steps ---------- */

.prereq-list {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
}
.prereq-list li {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--color-border);
  font-size: 0.94rem;
}
.prereq-list li:last-child {
  border-bottom: none;
}

.steps {
  counter-reset: step;
  padding: 0;
  list-style: none;
  margin: 0;
}
.steps > li {
  counter-increment: step;
  position: relative;
  padding: 3px 0 26px 40px;
  border-left: 2px solid var(--color-border);
  margin-left: 15px;
}
.steps > li:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}
/* Numbered bubble with a halo in the page colour, so the rail appears to
   pass behind it. */
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: -16px;
  top: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-on-primary);
  box-shadow: 0 0 0 4px var(--color-bg), 0 4px 10px -4px color-mix(in srgb, var(--color-primary) 70%, transparent);
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.steps h4 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.steps p {
  margin: 0 0 8px;
  color: var(--color-text-muted);
}

/* Steps as a grid of small cards (About page) instead of a vertical rail. */
.steps--grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.steps--grid > li,
.steps--grid > li:last-child {
  margin: 0;
  padding: 16px 16px 14px 58px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-bg);
}
.steps--grid > li::before {
  left: 16px;
  top: 16px;
  box-shadow: 0 4px 10px -4px color-mix(in srgb, var(--color-primary) 70%, transparent);
}
.steps--grid p {
  margin: 0;
  font-size: 0.9rem;
}

/* About page: "What this is" beside "Get in touch". */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
@media (max-width: 860px) {
  .about-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Code blocks ---------- */

.code-block {
  position: relative;
  background: var(--color-code-bg);
  color: var(--color-code-text);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  margin: 12px 0 18px;
  overflow: hidden;
}
.code-block pre {
  margin: 0;
  padding: 16px 44px 16px 16px;
  overflow-x: auto;
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 0.86rem;
  line-height: 1.5;
}
.code-block__copy {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--color-code-text);
  border-radius: 6px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.code-block__copy:hover {
  background: rgba(255, 255, 255, 0.2);
}
.code-block__copy.copied {
  color: #4ade80;
}

.callout {
  background: var(--color-accent-bg);
  border: 1px solid color-mix(in srgb, var(--color-primary) 22%, var(--color-border));
  border-left: 4px solid var(--color-primary);
  border-radius: 12px;
  padding: 14px 18px;
  margin: 18px 0;
  font-size: 0.93rem;
  line-height: 1.65;
}
.callout strong {
  display: block;
  margin-bottom: 4px;
}

/* ---------- Practice blocks ---------- */

.practice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  align-items: start;
  gap: 16px;
  margin: 20px 0;
}
/* A lone trailing item in an odd-count grid would otherwise sit alone in
   a half-empty final row — span it across both columns instead. */
.practice-grid > .practice-block:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

/* Hover only changes border and shadow, never position: these cards hold
   automation targets, and moving them would break hover/drag practice. */
.practice-block {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.practice-block:hover {
  border-color: color-mix(in srgb, var(--color-primary) 35%, var(--color-border));
  box-shadow: var(--shadow-md);
}

/* Last-used card highlight (see nav.js wireCardProgress) — a single
   "here's where you are" cursor, not a cumulative completion history. */
.practice-block.is-completed {
  border-left: 3px solid #22c55e;
}

.practice-block__label {
  display: block;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin-bottom: 12px;
}

.practice-block__control {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.practice-block__control--top {
  align-items: flex-start;
}

.practice-block__hint {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin: 12px 0 0;
}

.practice-status {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 10px;
}
.practice-status strong {
  color: var(--color-primary);
}

.practice-input {
  padding: 10px 12px;
  border: 1px solid var(--color-input-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.92rem;
  flex: 1;
  min-width: 120px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.practice-input:hover:not(:disabled):not([readonly]) {
  border-color: color-mix(in srgb, var(--color-primary) 45%, var(--color-input-border));
}
.practice-input:focus {
  outline: none;
  border-color: var(--color-primary);
  background: var(--color-surface);
  box-shadow: var(--ring);
}
textarea.practice-input {
  min-height: 80px;
  resize: vertical;
}

.practice-radio-group {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.practice-radio-option {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Native checkboxes/radios render at ~13px, too small to tap on a phone.
   Size and colour only, so the elements (and their locators) are unchanged. */
main input[type="checkbox"]:not(.bug-fake-checkbox__input),
main input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  cursor: pointer;
  vertical-align: middle;
}
main input[type="checkbox"]:disabled,
main input[type="radio"]:disabled {
  cursor: not-allowed;
}

/* Indeterminate uses the browser's default checked accent-color, which
   reads as "this got checked too" at a glance. Give it a distinct color
   so partial selection is visually obvious, not just semantically correct. */
.select-all-checkbox:indeterminate {
  accent-color: #f59e0b;
}

/* ---------- Forms page widgets ---------- */

.form-field {
  margin-bottom: 16px;
}
.form-field:last-of-type {
  margin-bottom: 20px;
}

.form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.form-row .form-field {
  flex: 1;
  min-width: 180px;
}

.field-error {
  color: #dc2626;
  font-size: 0.85rem;
  margin: 6px 0 0;
}
[data-theme="dark"] .field-error {
  color: #f87171;
}

.practice-input.has-error {
  border-color: #dc2626;
}
[data-theme="dark"] .practice-input.has-error {
  border-color: #f87171;
}

.form-summary {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 18px;
}
.form-summary--success {
  background: #dcfce7;
  color: #166534;
}
[data-theme="dark"] .form-summary--success {
  background: #14352499;
  color: #86efac;
}
.form-summary--error {
  background: #fee2e2;
  color: #991b1b;
}
[data-theme="dark"] .form-summary--error {
  background: #45191999;
  color: #fca5a5;
}
.form-summary--warning {
  background: #fef3c7;
  color: #92400e;
}
[data-theme="dark"] .form-summary--warning {
  background: #78350f99;
  color: #fde68a;
}

.practice-block__control--center {
  justify-content: center;
}

/* Shared row for "content + its info-btn on one line" — used for field
   errors, the form summary, checkbox items, and autosuggest options.
   Block-level content (a <p>, a <li>) otherwise pushes the icon onto its
   own line, since the icon is just the next sibling in normal flow. */
.info-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.autosuggest {
  position: relative;
  flex: 1;
  min-width: 0;
}
.autosuggest__menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 10;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  list-style: none;
  margin: 0;
  padding: 4px;
  max-height: 220px;
  overflow-y: auto;
}
.autosuggest__menu li {
  border-radius: var(--radius-sm);
}
.autosuggest__menu li:hover {
  background: var(--color-accent-bg);
}
.autosuggest__option {
  flex: 1;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 0.9rem;
}

/* ---------- Bug practice widgets ---------- */

.bug-overlay-wrap {
  position: relative;
  display: inline-block;
}
.bug-overlay-mask {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.bug-fake-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.bug-fake-checkbox__input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.bug-fake-checkbox__box {
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-border);
  border-radius: 4px;
  position: relative;
  flex-shrink: 0;
}
.bug-fake-checkbox__input:checked + .bug-fake-checkbox__box {
  background: var(--color-primary);
  border-color: var(--color-primary);
}
.bug-fake-checkbox__input:checked + .bug-fake-checkbox__box::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.bug-dropdown {
  position: relative;
  flex: 1;
  min-width: 0;
}
.bug-dropdown__trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.92rem;
  cursor: pointer;
}
.bug-dropdown__menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 10;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  list-style: none;
  margin: 0;
  padding: 4px;
  max-height: 200px;
  overflow-y: auto;
}
.bug-dropdown__option {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
}
.bug-dropdown__option:hover {
  background: var(--color-accent-bg);
}

/* ---------- Frames page widgets ---------- */

.practice-iframe {
  width: 100%;
  height: 130px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  margin-bottom: 4px;
}
.frame-row {
  display: flex;
  gap: 8px;
}
.practice-iframe--third {
  flex: 1;
  min-width: 0;
  height: 110px;
}

/* ---------- Interactions page widgets ---------- */

.hover-target {
  position: relative;
  display: inline-block;
  padding: 10px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
}
.hover-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 8px 12px;
  font-size: 0.85rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease;
  z-index: 5;
}
.hover-target:hover .hover-tooltip {
  opacity: 1;
  visibility: visible;
}

.dnd-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.dnd-source {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-weight: 600;
  cursor: grab;
  user-select: none;
}
.dnd-source:active {
  cursor: grabbing;
}
.dnd-target {
  min-width: 140px;
  min-height: 24px;
  padding: 14px 18px;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  text-align: center;
}
.dnd-target--over {
  border-color: var(--color-primary);
  background: var(--color-accent-bg);
}
.dnd-target--filled {
  border-style: solid;
  border-color: var(--color-secondary);
  color: var(--color-text);
  font-weight: 600;
}

.context-target {
  padding: 20px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  user-select: none;
  flex: 1;
  min-width: 0;
}

.context-menu {
  position: fixed;
  z-index: 150;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  list-style: none;
  margin: 0;
  padding: 4px;
  min-width: 160px;
}
.context-menu li {
  border-radius: var(--radius-sm);
}
.context-menu li:hover {
  background: var(--color-accent-bg);
}
.context-menu__item {
  display: block;
  flex: 1;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--color-text);
}

.mouse-playground {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 140px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  overflow: hidden;
}
.mouse-playground__marker {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-primary);
  transform: translate(-50%, -50%);
  top: -20px;
  left: -20px;
  pointer-events: none;
  transition: left 0.05s linear, top 0.05s linear;
}

/* ---------- Dynamic page widgets ---------- */

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: tys-spin 0.7s linear infinite;
  margin-top: 12px;
}
@keyframes tys-spin {
  to {
    transform: rotate(360deg);
  }
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: var(--color-accent-bg);
  overflow: hidden;
  margin-top: 12px;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--color-primary);
  border-radius: 999px;
  transition: width 0.15s linear;
}

/* Applied by "Try Locator" to whatever the selector actually matches on the
   live page right now — outline only, so it never disturbs layout. */
.tys-locator-highlight {
  outline: 3px solid #f59e0b !important;
  outline-offset: 2px !important;
  border-radius: 3px;
  animation: tys-highlight-pulse 0.9s ease-in-out 2;
}
@keyframes tys-highlight-pulse {
  0%, 100% { outline-color: #f59e0b; }
  50% { outline-color: #fde68a; }
}

/* ---------- Info button + modal ---------- */

/* 24px: the WCAG 2.2 minimum target size. Keep every info-btn this one size. */
.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: 1.5px solid var(--color-primary);
  background: var(--color-surface);
  color: var(--color-primary);
  cursor: pointer;
  flex-shrink: 0;
}
.info-btn:hover {
  background: var(--color-accent-bg);
}
/* An element that's hidden (e.g. a validation error not yet triggered)
   shouldn't leave its info-btn floating with nothing next to it. */
[hidden] + .info-btn {
  display: none;
}

/* Locator icons are opt-in via the header's Help toggle (see nav.js) —
   an additional rule rather than changing .info-btn's own display value,
   so it never fights the [hidden]+.info-btn rule above on specificity. */
body:not(.tys-help-on) .info-btn {
  display: none;
}

@keyframes help-hint-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.help-hint {
  position: fixed;
  top: calc(var(--header-height) + 16px);
  right: 20px;
  z-index: 150;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 260px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 12px 14px;
  font-size: 0.85rem;
  color: var(--color-text);
  animation: help-hint-in 0.22s ease-out;
}
/* Speech-bubble tail pointing up at the Help toggle. Horizontal position
   (--help-hint-arrow-x) is set inline by nav.js from the toggle button's
   actual bounding rect, so it stays aligned regardless of viewport width. */
.help-hint__arrow {
  position: absolute;
  top: -7px;
  left: var(--help-hint-arrow-x, 24px);
  width: 14px;
  height: 14px;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  border-top: 1px solid var(--color-border);
  transform: rotate(45deg);
}
.help-hint__close {
  border: none;
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
}
.help-hint__close:hover {
  color: var(--color-text);
}
/* Phones: a slim strip under the header (one line of text) instead of a
   card that covers the page title. */
@media (max-width: 600px) {
  .help-hint {
    top: calc(var(--header-height) + 8px);
    right: 12px;
    max-width: calc(100vw - 24px);
    align-items: center;
    padding: 8px 12px;
    font-size: 0.82rem;
  }
}

.info-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 20, 0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.info-modal {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  max-width: 620px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  padding: 20px;
}

.info-modal .code-block pre {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: visible;
}

.info-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.info-modal__title {
  font-size: 1rem;
  font-weight: 700;
}
.info-modal__close {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 0 4px;
}
.info-modal__close:hover {
  color: var(--color-text);
}

.locator-picker {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.locator-picker__btn {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.locator-picker__btn:hover {
  background: var(--color-accent-bg);
  color: var(--color-text);
}
.locator-picker__btn.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-on-primary);
}
.locator-picker__btn--recommended:not(.is-active) {
  border-color: #f59e0b;
  color: #b45309;
}
[data-theme="dark"] .locator-picker__btn--recommended:not(.is-active) {
  color: #fbbf24;
}
.locator-picker__star {
  color: #f59e0b;
  margin-right: 3px;
}
.locator-picker__btn.is-active .locator-picker__star {
  color: #fde68a;
}

.info-modal__locator {
  background: var(--color-accent-bg);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 0.85rem;
  margin-bottom: 8px;
  overflow-x: auto;
  white-space: nowrap;
}

.info-modal__reason {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin: 0 0 14px;
  line-height: 1.5;
}

.try-locator {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.try-locator__btn {
  padding: 7px 14px;
  font-size: 0.82rem;
}
.try-locator__result {
  font-size: 0.85rem;
  font-weight: 600;
}
.try-locator__result--ok {
  color: #16a34a;
}
.try-locator__result--warn {
  color: #b45309;
}
.try-locator__result--none {
  color: #dc2626;
}
[data-theme="dark"] .try-locator__result--ok {
  color: #4ade80;
}
[data-theme="dark"] .try-locator__result--warn {
  color: #fbbf24;
}
[data-theme="dark"] .try-locator__result--none {
  color: #f87171;
}

.info-modal .tabs {
  margin: 4px 0 0;
}

.lang-dropdown {
  position: relative;
  display: inline-block;
  min-width: 150px;
  margin: 12px 0 4px;
}
.lang-dropdown__trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.lang-dropdown__trigger:hover {
  border-color: var(--color-primary);
}
.lang-dropdown__caret {
  font-size: 0.7rem;
  color: var(--color-text-muted);
}
.lang-dropdown__menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  z-index: 10;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  list-style: none;
  margin: 0;
  padding: 4px;
}
.lang-dropdown__option {
  display: block;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--color-text);
  white-space: nowrap;
}
.lang-dropdown__option:hover {
  background: var(--color-accent-bg);
}
.lang-dropdown__option.is-active {
  color: var(--color-primary);
  font-weight: 600;
  background: var(--color-accent-bg);
}

/* ---------- Tables page widgets ---------- */

.practice-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
}

.practice-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.practice-table th,
.practice-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  white-space: nowrap;
}
.practice-table thead th {
  background: var(--color-accent-bg);
  color: var(--color-text-muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.practice-table tbody tr {
  transition: background-color 0.12s ease;
}
.practice-table tbody tr:hover {
  background: color-mix(in srgb, var(--color-accent-bg) 55%, transparent);
}
.practice-table tbody tr:last-child td {
  border-bottom: none;
}

.table-target-cell {
  background: var(--color-accent-bg);
  border-radius: var(--radius-sm);
}

.table-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  cursor: pointer;
}
.table-sort-btn:hover {
  color: var(--color-text);
}
.table-sort-btn__arrow {
  font-size: 0.7rem;
  opacity: 0;
}
.table-sort-btn.is-active {
  color: var(--color-primary);
}
.table-sort-btn.is-active .table-sort-btn__arrow {
  opacity: 1;
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* ---------- Shadow DOM page widgets ---------- */

.shadow-boundary {
  border: 2px dashed var(--color-secondary);
  border-radius: var(--radius-md);
  background: var(--color-accent-bg);
  padding: 14px;
}
.shadow-boundary__label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--color-secondary);
  margin: 0 0 10px;
}
.shadow-boundary .shadow-boundary {
  margin-top: 10px;
}

/* ---------- Upload / Download page widgets ---------- */

.upload-dropzone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.upload-dropzone:hover {
  border-color: var(--color-primary);
}
.upload-dropzone.is-dragover {
  border-color: var(--color-primary);
  background: var(--color-accent-bg);
}
.upload-dropzone__hint {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin: 0;
}
.upload-dropzone__hint strong {
  color: var(--color-primary);
}

/* ---------- Auth flow (Login) ---------- */

.auth-page {
  display: flex;
  justify-content: center;
  margin: 32px 0;
}

.auth-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: 4px solid var(--color-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 30px;
  width: 100%;
  max-width: 380px;
}

.auth-card__title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 6px;
}

.auth-card__subtitle {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  margin: 0 0 20px;
}

.auth-hint {
  background: var(--color-accent-bg);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-bottom: 18px;
}
.auth-hint code {
  color: var(--color-primary);
}

.auth-remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.auth-footer-link {
  text-align: center;
  font-size: 0.85rem;
  margin-top: 16px;
}

.dashboard-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 32px;
  text-align: center;
  max-width: 480px;
  margin: 32px auto;
}
.dashboard-card__avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.3rem;
  margin: 0 auto 16px;
}

/* ---------- Locator playgrounds ---------- */

.pg-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr);
  gap: 20px;
  align-items: start;
  margin-bottom: 40px;
}
@media (max-width: 1100px) {
  .pg-workspace {
    grid-template-columns: 1fr;
  }
}

.pg-stage__label,
.pg-section-title {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin: 0 0 8px;
}

.pg-frame {
  display: block;
  width: 100%;
  min-height: 300px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  background: #fff;
}

/* The control panel stays in view while you scroll the page under test. */
.pg-panel {
  position: sticky;
  top: calc(var(--header-height) + 16px);
  max-height: calc(100vh - var(--header-height) - 32px);
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 20px;
}
@media (max-width: 1100px) {
  .pg-panel {
    position: static;
    max-height: none;
  }
}

.pg-input-wrap {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--color-input-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  overflow: hidden;
}
.pg-input-wrap:focus-within {
  border-color: var(--color-primary);
  box-shadow: var(--ring);
}
.pg-prefix {
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-accent-bg);
  border-right: 1px solid var(--color-border);
  white-space: nowrap;
}
.pg-input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--color-text);
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 0.9rem;
}

.pg-status {
  margin: 10px 0 0;
  font-size: 0.86rem;
  color: var(--color-text-muted);
}
.pg-status--ok {
  color: #047857;
}
.pg-status--none {
  color: #b45309;
}
.pg-status--error {
  color: #dc2626;
}
[data-theme="dark"] .pg-status--ok {
  color: #34d399;
}
[data-theme="dark"] .pg-status--none {
  color: #fbbf24;
}
[data-theme="dark"] .pg-status--error {
  color: #f87171;
}

.pg-matches {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}
.pg-matches li {
  padding: 3px 0;
  border-bottom: 1px dashed var(--color-border);
  word-break: break-word;
}
.pg-matches li:last-child {
  border-bottom: none;
}

.pg-panel .code-block {
  margin-top: 14px;
}
.pg-panel .code-block pre {
  white-space: pre-wrap;
  word-break: break-word;
}

.pg-challenges-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 20px;
}
.pg-progress {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-primary);
}
.pg-challenges {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: pg-challenge;
}
.pg-challenge {
  counter-increment: pg-challenge;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
}
.pg-challenge:last-child {
  border-bottom: none;
}
.pg-challenge__row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.pg-challenge__check {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--color-text-muted);
}
.pg-challenge__check::before {
  content: counter(pg-challenge);
}
.pg-challenge.is-solved .pg-challenge__check {
  background: var(--color-green);
  border-color: var(--color-green);
  color: var(--color-on-green);
}
.pg-challenge.is-solved .pg-challenge__check::before {
  content: "\2713";
}
.pg-challenge.is-solved .pg-challenge__text {
  color: var(--color-text-muted);
}
.pg-challenge__actions,
.pg-challenge__answer {
  margin: 6px 0 0 30px;
}
.pg-challenge__answer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.pg-challenge__answer[hidden] {
  display: none;
}
.pg-challenge__answer code {
  font-size: 0.8rem;
  word-break: break-word;
}
.pg-link-btn {
  border: none;
  background-color: transparent;
  padding: 0 0 5px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-primary);
  cursor: pointer;
}

/* Cheat sheets: descriptions need to wrap, unlike the practice tables. */
.pg-cheatsheet td {
  white-space: normal;
  vertical-align: top;
}
.pg-cheatsheet td:first-child {
  white-space: nowrap;
}
.pg-cheatsheet code {
  font-size: 0.82rem;
}
.pg-reference {
  margin-bottom: 40px;
}
.pg-reference h2 {
  margin-top: 0;
}
.pg-reference p {
  color: var(--color-text-muted);
  max-width: 760px;
}

/* ---------- Shop, checkout and order confirmation (flows/) ---------- */

.container--wide {
  max-width: 1240px;
}

.shop-layout,
.checkout-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
  margin-bottom: 48px;
}
.cart-panel,
.order-summary {
  position: sticky;
  top: calc(var(--header-height) + 16px);
}
@media (max-width: 1100px) {
  .shop-layout,
  .checkout-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .cart-panel,
  .order-summary {
    position: static;
  }
}

/* Wraps rather than squeezes, so the selects stay readable when Help adds
   a locator icon beside every control. */
.shop-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
}
.shop-filters__field {
  flex: 1 1 190px;
  min-width: 0;
}
.shop-filters__field--search {
  flex: 2 1 240px;
}
.shop-filters__field--check {
  flex: 0 0 auto;
}
.shop-filters .practice-block__label {
  margin-bottom: 6px;
  font-size: 0.85rem;
}
.shop-filters__field--check {
  padding-bottom: 10px;
}
.shop-result-row {
  margin: 14px 0 10px;
}
.shop-result-row .practice-status {
  margin: 0;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.product-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.product-card:hover {
  border-color: color-mix(in srgb, var(--color-primary) 35%, var(--color-border));
  box-shadow: var(--shadow-md);
}
.product-card__media {
  display: grid;
  place-items: center;
  height: 96px;
  margin-bottom: 8px;
  border-radius: 10px;
  background: var(--color-accent-bg);
  font-size: 2.6rem;
}
.product-card__name {
  margin: 0;
  font-size: 1rem;
}
.product-card__meta {
  margin: 0;
  font-size: 0.82rem;
  color: var(--color-text-muted);
}
.product-card__rating {
  color: #b45309;
  font-weight: 600;
}
[data-theme="dark"] .product-card__rating {
  color: #fbbf24;
}
.product-card__stock {
  margin: 2px 0 0;
  font-size: 0.8rem;
  font-weight: 600;
}
.product-card__stock--in { color: #15803d; }
.product-card__stock--low { color: #b45309; }
.product-card__stock--out { color: #b91c1c; }
[data-theme="dark"] .product-card__stock--in { color: #4ade80; }
[data-theme="dark"] .product-card__stock--low { color: #fbbf24; }
[data-theme="dark"] .product-card__stock--out { color: #f87171; }
.product-card__buy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
}
.product-card__price {
  font-size: 1.15rem;
  font-weight: 700;
}
.product-card__add {
  padding: 8px 14px;
  font-size: 0.88rem;
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.cart-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.cart-panel__title,
.checkout-step__title {
  margin: 0;
  font-size: 1.1rem;
}
.cart-count {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-size: 0.82rem;
  font-weight: 700;
}
.cart-lines {
  list-style: none;
  margin: 0;
  padding: 0;
}
.cart-line {
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}
.cart-line__top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.9rem;
}
.cart-line__name {
  font-weight: 600;
}
.cart-line__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 8px;
}
.cart-line__note {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: #b45309;
}
.qty-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--color-input-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.qty-btn:hover:not(:disabled) {
  background: var(--color-accent-bg);
}
.qty-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.qty-value {
  min-width: 18px;
  text-align: center;
  font-weight: 700;
}
.link-btn {
  border: none;
  background: none;
  padding: 4px 0;
  color: var(--color-primary);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.cart-panel__subtotal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0;
  font-size: 0.95rem;
}
.cart-panel__checkout {
  flex: 1;
  justify-content: center;
}
.shop-toast {
  min-height: 1.4em;
  margin: 10px 0 0;
}

.checkout-empty__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 6px;
}

/* Checkout wizard */
.checkout-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
}
.checkout-steps__item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text-muted);
  font-weight: 600;
}
.checkout-steps__num {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--color-input-border);
  font-size: 0.82rem;
}
.checkout-steps__item[aria-current="step"] {
  color: var(--color-text);
}
.checkout-steps__item[aria-current="step"] .checkout-steps__num {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-on-primary);
}
.checkout-steps__item.is-done .checkout-steps__num {
  border-color: var(--color-green);
  color: var(--color-green);
}
.checkout-step__title {
  margin-bottom: 16px;
}
.checkout-step__title:focus {
  outline: none;
}
.promo {
  margin-top: 18px;
}
.promo__input {
  flex: 1;
  min-width: 180px;
}
.promo-message--ok {
  color: #15803d;
  font-weight: 600;
}
.promo-message--error {
  color: #b91c1c;
  font-weight: 600;
}
[data-theme="dark"] .promo-message--ok { color: #4ade80; }
[data-theme="dark"] .promo-message--error { color: #f87171; }
.checkout-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}
.checkout-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 18px;
}
.checkout-grid__wide {
  grid-column: 1 / -1;
}
@media (max-width: 640px) {
  .checkout-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
.shipping-methods {
  margin: 12px 0 0;
  padding: 0;
  border: none;
}
.shipping-methods > .info-row {
  margin-top: 8px;
}
.shipping-option {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--color-input-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.shipping-option:has(input:checked) {
  border-color: var(--color-primary);
  background: var(--color-accent-bg);
}
.shipping-option__price {
  margin-left: auto;
  font-weight: 700;
}
.btn.is-loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: tys-spin 0.7s linear infinite;
}
.order-summary__rows {
  margin: 0;
}
.order-summary__rows > div:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.92rem;
}
.order-summary__rows dt {
  color: var(--color-text-muted);
}
.order-summary__rows dd {
  margin: 0;
  font-weight: 600;
}
.order-summary__rows > .order-summary__total {
  border-bottom: none;
  font-size: 1.05rem;
}
.order-summary__total dt {
  color: var(--color-text);
  font-weight: 700;
}

/* Order confirmation */
.confirmation {
  margin-bottom: 48px;
}
.confirmation__head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
.confirmation__check {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #dcfce7;
  color: #15803d;
  font-size: 1.5rem;
  font-weight: 700;
}
[data-theme="dark"] .confirmation__check {
  background: #14352499;
  color: #86efac;
}
.confirmation__title {
  margin: 0 0 4px;
  font-size: 1.3rem;
}
.confirmation__facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 0 0 20px;
}
.confirmation__facts > div {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
}
.confirmation__facts dt {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}
.confirmation__facts dd {
  margin: 4px 0 0;
  font-weight: 600;
}
.confirmation__facts code {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.order-total-row td {
  font-weight: 700;
}

/* ---------- Challenges (list + workspace) ---------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.ch-section-title {
  margin: 0 0 16px;
  font-size: 1.15rem;
}
.ch-progress {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--color-accent-bg);
  color: var(--color-primary);
  font-size: 0.85rem;
  font-weight: 700;
}
.ch-muted {
  color: var(--color-text-muted);
}
.ch-notice {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--color-accent-bg);
}
.ch-notice--error {
  background: #fee2e2;
  color: #991b1b;
}
[data-theme="dark"] .ch-notice--error {
  background: #45191999;
  color: #fca5a5;
}

/* Signed-in bar */
.ch-account {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.ch-account:empty {
  display: none;
}
.ch-account__avatar {
  border-radius: 50%;
}
.ch-account__repo {
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 0.85rem;
}
.ch-account__repo select {
  margin-left: 6px;
  padding: 4px 8px;
  border: 1px solid var(--color-input-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
}

/* One-time setup steps */
.ch-setup-block {
  margin-bottom: 20px;
}
.ch-setup {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ch-setup__step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.ch-setup__step h3 {
  margin: 4px 0 2px;
  font-size: 1rem;
}
.ch-setup__step p {
  margin: 0;
  color: var(--color-text-muted);
}
.ch-setup__step .ch-setup__action {
  margin-top: 10px;
}
.ch-setup__num {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
  font-weight: 700;
}
.ch-setup__step.is-done .ch-setup__num {
  border-color: var(--color-green);
  background: var(--color-green);
  color: var(--color-on-green);
}
.ch-setup__step.is-done h3 {
  color: var(--color-text-muted);
}
.ch-setup__step.is-pending {
  opacity: 0.55;
}
.ch-setup__step.is-pending .ch-setup__num {
  border-color: var(--color-border);
  color: var(--color-text-muted);
}
.ch-setup__step.is-current .ch-setup__num {
  background: var(--color-primary);
  color: var(--color-on-primary);
}
.ch-setup__step .ch-setup__action {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
}
.ch-setup__alt {
  font-size: 0.82rem;
}
.btn--sm {
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
}

/* Challenge table */
.ch-table-block {
  margin-bottom: 48px;
}
.ch-table-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.ch-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.ch-table th,
.ch-table td {
  padding: 14px 12px;
  border-top: 1px solid var(--color-border);
  text-align: left;
  vertical-align: middle;
}
.ch-table thead th {
  border-top: none;
  padding-top: 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}
.ch-table tbody th {
  font-weight: 400;
}
.ch-table__title {
  font-weight: 700;
  font-size: 1rem;
}
.ch-table__summary {
  display: block;
  margin-top: 2px;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}
.ch-table__open {
  text-align: right;
}
.ch-chip {
  display: inline-block;
  margin: 2px 0;
  padding: 2px 9px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
[data-theme="dark"] .ch-chip {
  background: #14352499;
  color: #86efac;
}
@media (max-width: 760px) {
  .ch-table thead {
    display: none;
  }
  .ch-table,
  .ch-table tbody,
  .ch-table tr,
  .ch-table th,
  .ch-table td {
    display: block;
  }
  .ch-table tr {
    padding: 12px 0;
    border-top: 1px solid var(--color-border);
  }
  .ch-table th,
  .ch-table td {
    padding: 4px 0;
    border: none;
  }
  .ch-table__open {
    text-align: left;
    padding-top: 10px !important;
  }
}

/* Levels and results */
.ch-level {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ch-level--easy {
  background: #dcfce7;
  color: #166534;
}
.ch-level--moderate {
  background: #fef3c7;
  color: #92400e;
}
[data-theme="dark"] .ch-level--easy {
  background: #14352499;
  color: #86efac;
}
[data-theme="dark"] .ch-level--moderate {
  background: #78350f99;
  color: #fde68a;
}
.ch-result {
  flex-shrink: 0;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}
.ch-result--none {
  background: var(--color-bg);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}
.ch-result--pass {
  background: #dcfce7;
  color: #166534;
}
.ch-result--fail {
  background: #fee2e2;
  color: #991b1b;
}
[data-theme="dark"] .ch-result--pass {
  background: #14352499;
  color: #86efac;
}
[data-theme="dark"] .ch-result--fail {
  background: #45191999;
  color: #fca5a5;
}

/* Workspace */
.ch-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.ch-workspace {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  margin-bottom: 48px;
}
@media (max-width: 900px) {
  .ch-workspace {
    grid-template-columns: minmax(0, 1fr);
  }
}
.ch-task {
  position: sticky;
  top: 80px;
}
@media (max-width: 900px) {
  .ch-task {
    position: static;
  }
}
.ch-task__open {
  width: 100%;
  justify-content: center;
}
.ch-card__sub {
  margin: 18px 0 6px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}
.ch-card__list {
  margin: 0;
  padding-left: 20px;
  line-height: 1.6;
  font-size: 0.92rem;
}
.ch-card__list li + li {
  margin-top: 6px;
}
.ch-card__list--checks {
  list-style: none;
  padding-left: 0;
}
.ch-card__list--checks li::before {
  content: "\2713";
  margin-right: 8px;
  color: var(--color-green);
  font-weight: 700;
}
.ch-hint {
  margin-top: 14px;
}
.ch-hint summary {
  cursor: pointer;
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.9rem;
}
.ch-hint p {
  margin: 8px 0 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--color-accent-bg);
  font-size: 0.9rem;
}
.ch-task__note {
  margin: 16px 0 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.ch-editor-panel {
  min-width: 0;
}
.ch-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}
.ch-segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
}
.ch-segmented__btn {
  padding: 6px 14px;
  border: none;
  border-radius: 7px;
  background: none;
  color: var(--color-text-muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}
.ch-segmented__btn.is-active {
  background: var(--color-primary);
  color: var(--color-on-primary);
}
.ch-segmented__btn:focus-visible,
.ch-toolbar__lang select:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.ch-toolbar__lang select {
  padding: 7px 10px;
  border: 1px solid var(--color-input-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
}
.ch-file {
  margin-left: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text-muted);
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 0.8rem;
}
.ch-file.is-dirty::after {
  content: " \25CF";
  color: var(--color-secondary);
}
.ch-editor {
  height: 520px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}
@media (max-width: 600px) {
  .ch-editor {
    height: 420px;
  }
}
.ch-editor__fallback {
  width: 100%;
  height: 100%;
  padding: 12px;
  border: none;
  resize: none;
  background: var(--color-surface);
  color: var(--color-text);
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.5;
  tab-size: 4;
}
.ch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.ch-actions__spacer {
  flex: 1;
}
.ch-status {
  min-height: 1.4em;
}
.ch-status.is-error {
  color: #b91c1c;
}
[data-theme="dark"] .ch-status.is-error {
  color: #fca5a5;
}
.ch-result-panel {
  margin-top: 16px;
}
.ch-result-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ch-result-panel__head .ch-section-title {
  margin: 0;
}
.ch-result-panel__meta {
  margin: 6px 0 12px;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}
.ch-message,
.ch-log {
  margin: 0 0 10px;
  padding: 12px 14px;
  overflow: auto;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.ch-log {
  max-height: 420px;
  margin-top: 12px;
  white-space: pre;
  word-break: normal;
}
.ch-result-panel__links {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 0.85rem;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 24px 0;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}
.site-footer__brand {
  font-weight: 700;
  color: var(--color-text);
  font-size: 0.92rem;
}
/* Brand name and domain shown together so the address is learned on
   every page visit. */
.site-footer__domain {
  font-weight: 400;
  color: var(--color-primary);
}
.site-footer__tagline {
  margin-top: 2px;
}
