:root {
  --sa-bg: #0b1020;
  --sa-panel: rgba(18, 26, 47, 0.78);
  --sa-panel-strong: rgba(18, 26, 47, 0.94);
  --sa-text: #f5f7fb;
  --sa-muted: #9aa7bd;
  --sa-muted-strong: #c7d0df;
  --sa-blue: #4ea1ff;
  --sa-green: #46d39a;
  --sa-border: rgba(255, 255, 255, 0.1);
  --sa-border-strong: rgba(255, 255, 255, 0.18);
  --sa-radius: 8px;
}

.sa-shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.sa-site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--sa-border);
  background: rgba(11, 16, 32, 0.86);
  backdrop-filter: blur(14px);
}

.site-header.sa-site-header {
  padding: 0;
}

.sa-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 12px 0;
}

.sa-brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--sa-text);
  font-size: 1.18rem;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.sa-brand span,
.sa-brand-accent {
  color: var(--sa-blue);
}

.sa-desktop-nav,
.sa-current-links {
  align-items: center;
  gap: 6px;
}

.sa-desktop-nav {
  display: none;
}

.sa-current-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sa-current-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.sa-nav-link,
.sa-current-links a,
.sa-mobile-link,
.sa-footer-link {
  border-radius: 999px;
  color: var(--sa-muted-strong);
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}

.sa-nav-link,
.sa-current-links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 9px 12px;
}

.sa-nav-link:hover,
.sa-current-links a:hover,
.sa-mobile-link:hover,
.sa-footer-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--sa-text);
}

.sa-user-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
}

.sa-user-status {
  display: none;
  color: var(--sa-muted);
  font-size: 0.9rem;
}

.sa-secondary-action {
  display: none;
}

.sa-menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--sa-border);
  border-radius: var(--sa-radius);
  background: rgba(255, 255, 255, 0.04);
  color: var(--sa-text);
  cursor: pointer;
}

.sa-menu-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--sa-border-strong);
}

.sa-menu-toggle svg {
  width: 1.5rem;
  height: 1.5rem;
}

.sa-mobile-menu {
  border-top: 1px solid var(--sa-border);
  background: rgba(11, 16, 32, 0.96);
}

.sa-mobile-menu.hidden {
  display: none;
}

.sa-mobile-menu-panel {
  display: grid;
  gap: 6px;
  padding: 10px 0 14px;
}

.sa-mobile-link {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 12px;
}

.sa-site-footer {
  border-top: 1px solid var(--sa-border);
  color: var(--sa-muted);
  background: rgba(11, 16, 32, 0.58);
}

.site-footer.sa-site-footer {
  padding: 0;
}

.sa-footer-inner {
  display: grid;
  gap: 22px;
  padding: 34px 0;
}

.sa-footer-meta {
  font-size: 0.92rem;
  line-height: 1.6;
}

.sa-footer-pulse {
  display: grid;
  gap: 6px;
}

.sa-footer-title {
  margin: 0;
  color: var(--sa-muted-strong);
  font-size: 0.94rem;
  font-weight: 800;
}

.sa-footer-copy {
  margin: 0;
  color: var(--sa-muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.sa-socials,
.sa-footer-links,
.sa-current-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.sa-socials {
  margin-top: 8px;
}

.sa-social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--sa-border);
  border-radius: 999px;
  color: var(--sa-muted-strong);
  text-decoration: none;
}

.sa-social-link:hover {
  color: var(--sa-text);
  background: rgba(255, 255, 255, 0.06);
}

.sa-social-link svg {
  width: 1.1rem;
  height: 1.1rem;
}

.sa-footer-links,
.sa-current-footer-links {
  align-content: flex-start;
}

.sa-current-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
  padding: 30px 0;
}

.sa-footer-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 10px;
}

.sa-card {
  border: 1px solid var(--sa-border);
  border-radius: var(--sa-radius);
  background: var(--sa-panel);
}

.sa-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--sa-border);
  border-radius: 999px;
  padding: 10px 16px;
  color: var(--sa-text);
  font-weight: 800;
  text-decoration: none;
}

.sa-button:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--sa-border-strong);
}

.sa-legacy-main {
  color: var(--sa-text);
}

.sa-panel,
.sa-test-card,
.sa-question-card {
  border-radius: var(--sa-radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.035));
}

.sa-test-card,
.sa-question-card {
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.sa-test-card:hover {
  border-color: rgba(78, 161, 255, 0.35);
  background: rgba(255, 255, 255, 0.07);
  transform: translateY(-1px);
}

.sa-page-actions {
  align-items: center;
}

.sa-page-actions > a,
.sa-page-actions > button {
  min-height: 44px;
}

.sa-browse-main {
  --sa-card-bg: rgba(255, 255, 255, 0.052);
}

.sa-browse-hero {
  position: relative;
}

.sa-browse-actions > a,
.sa-primary-cta,
.sa-secondary-cta {
  min-height: 44px;
}

.sa-primary-cta,
.sa-secondary-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.sa-primary-cta {
  box-shadow: 0 12px 30px rgba(255, 255, 255, 0.08);
}

.sa-secondary-cta {
  border-color: var(--sa-border);
}

.sa-section-head,
.sa-listing-header {
  min-width: 0;
}

.sa-count-card {
  flex: 0 0 auto;
  min-width: 96px;
  border: 1px solid var(--sa-border);
  border-radius: var(--sa-radius);
  background: rgba(15, 23, 42, 0.38);
  padding: 10px 12px;
}

.sa-card-grid {
  align-items: stretch;
}

.sa-category-card,
.sa-listing-card {
  display: flex;
  min-height: 100%;
  flex-direction: column;
}

.sa-card-top {
  min-width: 0;
}

.sa-card-icon {
  flex: 0 0 auto;
  color: var(--sa-muted-strong);
  font-weight: 900;
}

.sa-card-title {
  min-width: 0;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.sa-card-meta {
  line-height: 1.45;
}

.sa-card-description {
  line-height: 1.58;
}

.sa-card-side,
.sa-difficulty-pill,
.sa-card-action {
  flex: 0 0 auto;
}

.sa-card-footer {
  margin-top: auto;
  padding-top: 16px;
}

.sa-empty-state {
  grid-column: 1 / -1;
  border-style: dashed;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.025));
}

.sa-category-hero {
  min-width: 0;
}

.sa-meta-pills {
  flex-wrap: wrap;
}

.sa-test-chrome {
  row-gap: 10px;
}

.sa-test-title-card h1 {
  line-height: 1.15;
}

.sa-test-form {
  margin-top: 1.5rem;
}

.sa-choice-label {
  min-height: 52px;
  align-items: flex-start;
  border-color: rgba(255, 255, 255, 0.12);
  line-height: 1.45;
}

.sa-choice-label:focus-within {
  border-color: rgba(78, 161, 255, 0.55);
  background: rgba(15, 23, 42, 0.72);
}

.sa-choice-input {
  flex: 0 0 auto;
  accent-color: #f8fafc;
}

.sa-choice-text,
.sa-question-prompt {
  min-width: 0;
  overflow-wrap: anywhere;
}

.sa-question-meta,
.sa-progress-meta {
  line-height: 1.45;
}

.sa-question-list {
  margin-top: 1rem;
}

.sa-question-card {
  overflow: hidden;
  scroll-margin-top: 150px;
}

.sa-test-progress {
  top: 76px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22);
}

.sa-progress-count {
  color: var(--sa-muted-strong);
  font-weight: 800;
}

.sa-progress-track {
  height: 0.625rem;
}

.sa-progress-bar {
  height: 0.625rem;
}

.sa-results-summary {
  align-items: flex-start;
}

.sa-results-actions {
  margin-left: auto;
}

.sa-result-choice {
  line-height: 1.45;
}

.sa-result-badges {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.sa-test-submit-row {
  padding-bottom: max(0px, env(safe-area-inset-bottom));
}

@media (min-width: 640px) {
  .sa-user-status {
    display: inline-block;
  }

  .sa-secondary-action {
    display: inline-flex;
  }
}

@media (min-width: 768px) {
  .sa-desktop-nav {
    display: flex;
  }

  .sa-menu-toggle {
    display: none;
  }

  .sa-mobile-menu {
    display: none;
  }

  .sa-footer-inner {
    grid-template-columns: 1fr minmax(220px, 0.8fr) 1fr;
    align-items: center;
  }

  .sa-footer-pulse {
    justify-items: center;
    text-align: center;
  }

  .sa-footer-links,
  .sa-current-footer-links {
    justify-content: flex-end;
  }
}

@media (max-width: 560px) {
  .sa-shell {
    width: min(100% - 28px, 1120px);
  }

  .sa-header-inner {
    min-height: 62px;
  }

  .sa-current-nav {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .sa-current-links {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px 8px;
    overflow-x: visible;
  }

  .sa-current-links a {
    flex: 0 1 auto;
    padding: 7px 8px;
    white-space: nowrap;
  }

  .sa-brand {
    font-size: 1.08rem;
  }

  .sa-footer-inner {
    padding: 28px 0;
  }

  .sa-legacy-main {
    font-size: 0.98rem;
  }

  .sa-home-stats {
    gap: 8px;
  }

  .sa-page-actions {
    align-items: stretch;
  }

  .sa-page-actions > a,
  .sa-page-actions > button {
    justify-content: center;
  }

  .sa-browse-actions > a,
  .sa-primary-cta,
  .sa-secondary-cta {
    width: 100%;
  }

  .sa-section-head,
  .sa-listing-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .sa-count-card {
    width: 100%;
    text-align: left;
  }

  .sa-card-top {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .sa-card-side {
    width: 100%;
    align-items: flex-start;
    flex-direction: row;
    justify-content: space-between;
  }

  .sa-difficulty-pill {
    max-width: 100%;
  }

  .sa-card-action {
    white-space: nowrap;
  }

  .sa-card-footer {
    flex-wrap: wrap;
    gap: 8px;
  }

  .sa-test-chrome > a {
    justify-content: center;
  }

  .sa-test-title-card h1 {
    font-size: 1.9rem;
  }

  .sa-test-form {
    margin-top: 1.25rem;
  }

  .sa-test-progress {
    top: 62px;
    padding: 12px;
  }

  .sa-progress-row {
    display: grid;
    gap: 4px;
  }

  .sa-progress-meta {
    font-size: 0.82rem;
  }

  .sa-question-list {
    margin-top: 0.9rem;
  }

  .sa-question-prompt {
    font-size: 1rem;
    line-height: 1.42;
  }

  .sa-question-meta {
    font-size: 0.82rem;
  }

  .sa-choice-label {
    min-height: 58px;
    gap: 12px;
    padding: 14px;
  }

  .sa-choice-input {
    width: 22px;
    height: 22px;
    margin-top: 1px;
  }

  .sa-choice-text {
    font-size: 0.95rem;
  }

  .sa-results-summary {
    display: grid;
    gap: 14px;
  }

  .sa-results-actions {
    width: 100%;
    margin-left: 0;
  }

  .sa-results-actions > a {
    flex: 1 1 150px;
  }

  .sa-result-badges {
    justify-content: flex-start;
  }

  .sa-test-submit-row {
    align-items: stretch;
  }

  .sa-test-submit-row > a,
  .sa-test-submit-row > button {
    flex: 1 1 150px;
  }

  .sa-test-card,
  .sa-question-card,
  .sa-panel {
    border-radius: var(--sa-radius);
  }
}
