/* A shared type scale for navigation, the ranking matrix, and content panels. */
:root {
  --ah-font-body: Arial, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --ah-type-page: clamp(30px, 2.6vw, 40px);
  --ah-type-section: 20px;
  --ah-type-body: 14px;
  --ah-type-caption: 12px;
}
:is(body.ah-app, body.ah-admin-app) {
  font-family: var(--ah-font-body);
  font-size: var(--ah-type-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
:is(body.ah-app, body.ah-admin-app) :is(h1,h2,h3,h4,h5,h6,p,a,span,strong,b,small,button,input,select,textarea,label,th,td,li,time) {
  font-family: var(--ah-font-body) !important;
}
:is(body.ah-app:not(.ah-preauth), body.ah-admin-app) :is(.jumbotron h1,.ah-list-title h1,.ah-page-hero h1),
body.ah-app .ah-score-screen .ah-score-title h2 {
  font: 700 var(--ah-type-page)/1.18 var(--ah-font-body) !important;
  letter-spacing: -.025em;
  text-wrap: balance;
}
:is(body.ah-app, body.ah-admin-app) :is(.ah-sidebar,.ah-admin-sidebar) .nav-link {
  font-size: var(--ah-type-body);
  font-weight: 500;
  letter-spacing: 0;
}
body.ah-app :is(.ah-page-hero > p,.ah-track-description,.ah-score-stats span,.ah-score-stats .ah-score-clock span) {
  font-size: var(--ah-type-body);
  line-height: 1.6;
  letter-spacing: 0;
}
body.ah-app .ah-page-hero > p { margin-top: 12px; }
body.ah-app .ah-workspace .ah-track-identity h2,
body.ah-app .category-header h3 { font-size: var(--ah-type-section); font-weight: 600; line-height: 1.35; letter-spacing: -.015em; }
body.ah-app .ah-workspace .ah-callout-title { font-size: 14px; font-weight: 600; line-height: 1.35; letter-spacing: -.015em; }
body.ah-app .ah-workspace .ah-3d-callout b { font-size: var(--ah-type-caption); font-weight: 400; line-height: 1.4; }
body.ah-app .ah-workspace .ah-3d-callout { grid-template-columns: 22px minmax(0,1fr); column-gap: 10px; padding: 13px; }
body.ah-app .ah-workspace .ah-callout-icon { width: 22px; height: 22px; }
body.ah-app :is(.ah-track-eyebrow,.ah-track-problem-heading,.ah-track-facts,.ah-overline,.ah-challenge-status,.ah-map-legend,.ah-orbit-hint) { font-size: var(--ah-type-caption); line-height: 1.5; letter-spacing: .035em; }
body.ah-app .ah-track-facts { flex-wrap: wrap; gap: 10px 22px; }
body.ah-app .ah-track-facts strong { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
body.ah-app .ah-track-problem strong { font-size: var(--ah-type-body); font-weight: 500; line-height: 1.6; }
body.ah-app .ah-track-problem :is(small,b),
body.ah-app .ah-track-session :is(span,small) { font-size: var(--ah-type-caption); line-height: 1.5; }
body.ah-app .ah-track-session > strong { font-size: 24px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
body.ah-app .challenge-button .challenge-inner p { font-size: 15px; font-weight: 500; line-height: 1.5; }
body.ah-app .ah-challenge-points b { font-size: 22px; font-weight: 600; }
body.ah-app .ah-score-stats strong { font-size: 30px; font-weight: 600; letter-spacing: -.02em; }
body.ah-app .ah-score-stats .ah-score-clock strong { font-size: clamp(32px,3vw,44px); }
body.ah-app #ah-pit.ah-pit--board .ah-head-track > div > span { font-size: 14px; font-weight: 600; line-height: 1.35; letter-spacing: -.015em; }
body.ah-app #ah-pit.ah-pit--board :is(.ah-track-count,.ah-team-meta,.ah-sector-legend,.ah-board-tools > summary) { font-size: var(--ah-type-caption); }
:is(body.ah-app,body.ah-admin-app) :is(.form-control,.form-select,.custom-select,.btn,label) { font-size: var(--ah-type-body); line-height: 1.5; }
:is(body.ah-app,body.ah-admin-app) .table thead th { font-size: var(--ah-type-caption); letter-spacing: .02em; }

/* Reserve separate space for rank, team name, and score even on narrow boards. */
body.ah-app .ah-score-screen #ah-pit.ah-pit--board :is(.ah-head-account,.ah-lane-account) {
  grid-template-columns: 36px minmax(0,1fr) 64px;
  gap: 12px;
  padding-inline: 14px;
}
body.ah-app .ah-score-screen #ah-lanes .ah-lane-account > .ah-lane-name-cell {
  justify-self: stretch !important;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}
body.ah-app #ah-pit.ah-pit--board :is(.ah-lane-account .ah-lane-name,.ah-lane-score,.ah-position) { font-size: 14px; font-weight: 500; }
body.ah-app #ah-pit.ah-pit--board :is(.ah-head-account span,.ah-head-track small,.ah-legend) { font-size: var(--ah-type-caption); }

/* The backdrop sits behind an opaque, centered, readable challenge dialog. */
body.ah-app #challenge-window { z-index: 1060; }
body.ah-app .modal-backdrop { background: #02050b; }
body.ah-app .modal-backdrop.show { opacity: .66; }
body.ah-app #challenge-window .modal-dialog {
  display: flex;
  align-items: center;
  width: calc(100% - 48px);
  max-width: 720px;
  min-height: calc(100% - 48px);
  margin: 24px auto;
}
body.ah-app #challenge-window .modal-dialog.modal-sm { max-width: 540px; }
body.ah-app #challenge-window .modal-dialog:is(.modal-lg,.modal-xl) { max-width: 900px; }
body.ah-app #challenge-window .modal-content {
  width: 100%;
  background: #10151f !important;
  border: 1px solid #354052 !important;
  border-radius: 12px !important;
  box-shadow: 0 24px 100px #0009 !important;
}
body.ah-app #challenge-window .modal-body { padding: 28px 32px !important; max-height: calc(100dvh - 48px); overflow-y: auto; }
body.ah-app #challenge-window .btn-close { position: absolute; top: 20px; right: 20px; width: 20px; height: 20px; padding: 10px; opacity: .85; z-index: 1; }
body.ah-app #challenge-window .nav-tabs { gap: 6px; padding-right: 40px; padding-bottom: 16px; margin-bottom: 26px; border-color: #ffffff14; }
body.ah-app #challenge-window .nav-tabs .nav-link { padding: 7px 12px; font-size: 13px; line-height: 1.5; color: #a4aec1; border: 1px solid transparent; border-radius: 6px !important; background: transparent; }
body.ah-app #challenge-window .nav-tabs .nav-link.active { color: #d6f0ff; border-color: #4aa8ff40; background: #4aa8ff14; }
.ah-challenge-heading-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin: 0 0 16px; }
body.ah-app #challenge-window .challenge-name { margin: 0; padding: 0; text-align: left !important; color: #f1f5fa; font-size: clamp(22px,2vw,28px); font-weight: 600; line-height: 1.4; letter-spacing: -.025em; overflow-wrap: anywhere; }
body.ah-app #challenge-window .challenge-value { flex-shrink: 0; display: flex; align-items: baseline; gap: 6px; margin: 4px 0 0; padding: 7px 12px; background: #4aa8ff12; border: 1px solid #4aa8ff2b; border-radius: 6px; color: #b7d7ff; font-size: 22px; font-weight: 600; line-height: 1.3; font-variant-numeric: tabular-nums; }
body.ah-app #challenge-window .challenge-value small { font-size: 11px; font-weight: 500; letter-spacing: .04em; }
body.ah-app #challenge-window :is(.challenge-tags,.challenge-attribution,.challenge-ratings) { text-align: left !important; color: #9aa6bc !important; font-size: 12px; line-height: 1.6; }
body.ah-app #challenge-window .challenge-ratings { margin: 0 0 22px; }
body.ah-app #challenge-window .challenge-desc { display: flow-root; font-size: 15px; line-height: 1.8; color: #d2ddea; overflow-wrap: anywhere; }
body.ah-app #challenge-window .challenge-desc :is(p,li) { font-size: inherit; line-height: inherit; }
body.ah-app #challenge-window .challenge-desc :is(h1,h2,h3) { font-size: 19px; line-height: 1.45; margin: 24px 0 12px; }
body.ah-app #challenge-window .challenge-desc img { max-width: 100%; height: auto; }
body.ah-app #challenge-window :is(pre,code) { font-family: ui-monospace,SFMono-Regular,Consolas,monospace !important; font-size: 13px; }
body.ah-app #challenge-window :is(pre,code) * { font-family: inherit !important; }
body.ah-app #challenge-window pre { max-width: 100%; overflow-x: auto; padding: 16px; background: #090e17; border-radius: 6px; }
body.ah-app #challenge-window .ah-challenge-empty-description { margin: 4px 0 26px; padding: 22px 18px; background: #ffffff03; border: 1px dashed #ffffff1f; border-radius: 6px; color: #929eb3; font-size: 14px; text-align: left; }
.ah-challenge-submit-label { margin-top: 28px; padding-top: 22px; border-top: 1px solid #ffffff14; }
.ah-challenge-submit-label label { margin-bottom: 10px; color: #bdcbdc; font-weight: 500; }
body.ah-app #challenge-window .submit-row { --bs-gutter-x: 12px; }
body.ah-app #challenge-window .submit-row :is(input,button) { min-height: 44px; }
body.ah-app #challenge-window #challenge-submit { background: #2a8ae8 !important; border-color: #81b3f1 !important; color: #fff; font-weight: 600; }
@media (max-width: 767px) {
  :root { --ah-type-page: 30px; --ah-type-section: 18px; }
  body.ah-app #challenge-window .modal-dialog { width: calc(100% - 24px); min-height: calc(100% - 24px); margin: 12px auto; }
  body.ah-app #challenge-window .modal-body { padding: 22px 20px !important; max-height: calc(100dvh - 24px); }
  body.ah-app #challenge-window .nav-tabs { gap: 2px; margin-bottom: 22px; padding-right: 30px; }
  body.ah-app #challenge-window .nav-tabs .nav-link { padding: 6px 8px; font-size: 12px; }
  body.ah-app #challenge-window .btn-close { top: 14px; right: 12px; }
  .ah-challenge-heading-row { gap: 12px; }
  body.ah-app #challenge-window .challenge-value { font-size: 20px; padding: 6px 9px; }
}

/* A compact ranking header and one consistent type scale across all columns. */
body.ah-app #ah-pit.ah-pit--board #ah-lanes {
  font-family: var(--ah-font-body);
  line-height: 1.4;
}
body.ah-app #ah-pit.ah-pit--board #ah-lanes > .ah-track-head { min-height: 52px; }
body.ah-app #ah-pit.ah-pit--board .ah-track-head > .ah-head-track { padding: 10px 16px; gap: 10px; }
body.ah-app #ah-pit.ah-pit--board .ah-track-icon { flex-basis: 24px; width: 24px; height: 24px; }
body.ah-app #ah-pit.ah-pit--board :is(.ah-head-account span,.ah-head-track > div > span) {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0;
  white-space: nowrap;
}
body.ah-app #ah-pit.ah-pit--board :is(.ah-lane-name,.ah-lane-score,.ah-position) {
  font-size: 14px;
  line-height: 1.4;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
body.ah-app #ah-pit.ah-pit--board .ah-lane-account .ah-lane-name { font-weight: 400; }
@media (min-width: 992px) {
  body.ah-app #ah-pit.ah-pit--board #ah-lanes {
    grid-template-rows: 52px repeat(var(--rows), minmax(0, 1fr));
  }
  /* One screen at any problem count: no fixed column minimums, dots shrink with their slot. */
  body.ah-app #ah-pit.ah-pit--board #ah-lanes {
    --ah-cols: clamp(240px, 20%, 360px) var(--track-fit, repeat(var(--tracks), minmax(0, 1fr)));
    min-width: 0;
  }
  body.ah-app #ah-pit.ah-pit--board .ah-track-head > .ah-head-track { container-type: inline-size; padding-inline: 8px; }
  body.ah-app #ah-pit.ah-pit--board .ah-head-track > div > span { display: block; overflow: hidden; text-overflow: ellipsis; }
  @container (max-width: 96px) {
    body.ah-app #ah-pit.ah-pit--board .ah-head-track .ah-track-icon { display: none; }
  }
  body.ah-app #ah-pit.ah-pit--board .ah-lane-track { gap: 0; }
  body.ah-app #ah-pit.ah-pit--board .ah-sector i { width: min(clamp(12px, 1.85vh, 23px), 80%); height: auto; aspect-ratio: 1; }
}
