/* Shared interactive surfaces, dialogs, and the small-screen layouts. */
.mobile-sections { display: none; }
button {
  transition:
    background 0.15s,
    opacity 0.15s;
}
button:hover:not(:disabled) {
  filter: brightness(1.1);
}
button:disabled {
  cursor: default;
  opacity: 0.45;
}
.classification {
  padding: 0 18px 16px;
  max-height: 300px;
  overflow: auto;
}
.classification-head,
.classification-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px 70px 40px;
  align-items: center;
  gap: 8px;
  padding: 10px 6px;
  font-size: 11px;
  border-bottom: 1px solid var(--glass-line);
}
.classification-head {
  position: sticky;
  top: 0;
  background: var(--inset);
  color: var(--muted);
  font-weight: 700;
}
.classification-row {
  width: 100%;
  background: transparent;
  color: var(--text-2);
  text-align: left;
  border-radius: 0;
}
.classification-row:hover:not(:disabled) {
  background: var(--raised);
}
.classification-row:has(.classification-follow[aria-pressed="true"]) {
  background: var(--raised);
  box-shadow: inset 3px 0 var(--ink);
  color: var(--text);
}
.classification-row button:focus-visible {
  outline-offset: -2px;
}
.classification-follow {
  grid-column: span 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--tower-gap-width, 64px);
  gap: inherit;
  align-items: center;
}
.classification-row button {
  min-width: 0;
  align-self: stretch;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
}
.classification-row .classification-data {
  text-align: center;
  color: var(--ink);
  border-left: 1px solid var(--glass-line);
}
.classification-row button:hover { background: var(--raised); }
.classification-status { min-width: 0; }
.classification-row .classification-gap {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.classification-driver {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 5px;
}
.classification-driver > b {
  flex: 0 0 2ch;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
/* Team colours are tuned for a dark ground, so the emblem brings its own. */
.classification-team {
  display: inline-flex;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  padding: 2px;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  background: var(--rail);
}
/* The compound is a dot, so the text stays readable in both themes. */
.classification-tyre {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.classification-tyre::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--compound);
  box-shadow: 0 0 0 1px var(--ring);
}
.team-logo { display: block; width: 100%; height: 100%; }
.classification-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.classification-row b {
  margin-right: 0;
  color: var(--muted);
}
.classification-row.ours {
  background: var(--raised);
  box-shadow: inset 3px 0 var(--team);
  color: var(--text);
}
.classification-row.ours .classification-name {
  font-weight: 700;
}
.classification-row.ours b {
  color: var(--team);
}
dialog {
  --dpad: 22px;
  width: min(570px, calc(100vw - 32px));
  max-height: 85vh;
  overflow: auto;
  padding: 0 var(--dpad) var(--dpad);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 25px 100px #000a;
}
dialog::backdrop {
  background: #05071dcc;
  backdrop-filter: blur(5px);
}
dialog p {
  font-size: 13px;
  line-height: 1.8;
}
.dialog-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
  margin: 0 calc(-1 * var(--dpad)) 16px;
  padding: 8px var(--dpad);
  background: linear-gradient(180deg, var(--head-a), var(--head-b));
  color: var(--head-text);
}
.dialog-head h2 {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  margin: 0;
  font: 800 20px var(--display);
  letter-spacing: 0.5px;
}
.dialog-head button {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 3px;
  background: var(--head-btn);
  color: #fff;
  font-size: 24px;
}
.dialog-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.file-label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.file-label input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
}
.ledger {
  display: grid;
  gap: 6px;
  margin-top: 18px;
}
.ledger > div {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 9px 12px;
  font-size: 12px;
}
.tyre-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
/* Compound colours are tuned for a dark ground, so the tiles keep the rail
   colours in both themes. */
.tyre-options button {
  padding: 16px 8px;
  background: var(--rail);
  border: 2px solid var(--compound);
  border-radius: 3px;
  min-height: 80px;
}
.tyre-options b {
  display: block;
  margin-bottom: 8px;
  color: var(--compound);
  font: 800 17px var(--display);
}
.tyre-options small {
  font-size: 11px;
  color: var(--rail-text);
}
@media (max-height: 500px) {
  #modal:has(.audio-controls) { --dpad: 18px; max-height: 94dvh; padding-bottom: 12px; }
  #modal:has(.audio-controls) .dialog-head { margin-bottom: 6px; padding-block: 3px; }
  #modal:has(.audio-controls) p { font-size: 10px; line-height: 1.4; margin: 5px 0; }
  #modal .audio-controls { gap: 3px; margin: 6px 0; }
  #modal .audio-controls label { font-size: 11px; }
  #modal #audio-preview { min-height: 30px; padding: 6px 12px; font-size: 11px; }
}
@media (max-width: 1100px) {
  .content {
    padding: 20px;
  }
  .columns,
  .calendar-grid,
  .research-grid {
    grid-template-columns: 1fr;
  }
  .hero-track {
    right: -12%;
    opacity: 0.6;
  }
}
/* Icon-only rail. */
@media (max-width: 950px) {
  .sidebar {
    width: 64px;
    flex-basis: 64px;
  }
  .brand b,
  .season,
  .header-actions .next {
    display: none;
  }
  /* Rail labels shrink to nothing instead of display:none, so the icon
     buttons keep their accessible names. */
  .nav,
  .settings {
    gap: 0;
    font-size: 0;
  }
  .nav {
    min-height: 56px;
  }
  .nav svg {
    width: 26px;
    height: 26px;
  }
  .content {
    padding: 18px;
  }
  .hero-track {
    right: -10%;
  }
  .management-grid {
    grid-template-columns: 1fr;
  }
  .management-wide {
    grid-column: auto;
  }
}
@media (max-width: 800px) {
  .metrics {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .driver-cards {
    grid-template-columns: 1fr;
  }
  .hero {
    padding: 24px 22px;
  }
  .hero-track {
    right: -28%;
    opacity: 0.4;
    transform: scale(0.85);
  }
}
@media (max-width: 560px) {
  main > header {
    height: 58px;
    gap: 8px;
    padding-left: 12px;
  }
  #crumb,
  .budget small,
  #advance b,
  .panel-head > div > small,
  .metrics article > span i {
    display: none;
  }
  header h1 {
    margin: 0;
    font-size: 19px;
  }
  .header-actions {
    gap: 6px;
  }
  .budget {
    padding: 7px 11px 7px 8px;
  }
  #advance {
    margin-left: 0;
    padding: 0 12px 0 26px;
    clip-path: polygon(16px 0, 100% 0, 100% 100%, 0 100%);
    font-size: 15px;
    letter-spacing: 0;
  }
  .content {
    padding: 12px 10px 32px;
  }
  .hero {
    min-height: 280px;
    padding: 20px 18px;
  }
  .hero-text h2 {
    font-size: 31px;
  }
  .hero-text .primary,
  .hero-text .ghost {
    padding: 10px;
    font-size: 12px;
  }
  .hero-text .ghost {
    display: block;
    width: fit-content;
    margin: 8px 0 0;
  }
  .hero-track {
    top: 85px;
    right: -200px;
  }
  .weather {
    right: 14px;
    top: 16px;
    font-size: 16px;
  }
  .weather small {
    max-width: 80px;
    line-height: 1.5;
  }
  .metrics {
    gap: 8px;
  }
  .metrics article {
    min-height: 112px;
    padding: 12px;
  }
  .metrics article > b {
    font-size: 25px;
  }
  .panel {
    --pad: 12px;
  }
  .timeline > div {
    gap: 8px;
    padding: 8px 10px;
  }
  .timeline > div > strong {
    width: 36px;
  }
  .heading {
    flex-wrap: wrap;
  }
  .classification {
    padding: 0 6px 10px;
  }
  .classification-row,
  .classification-head {
    --tower-gap-width: 50px;
    font-size: 10px;
    grid-template-columns: minmax(0, 1fr) 50px 56px 40px;
    gap: 3px;
    padding-inline: 4px;
  }
  .event {
    grid-template-columns: 24px minmax(0, 1fr) 58px 24px;
    gap: 5px;
    padding: 10px 8px;
  }
  .event > em {
    font-size: 11px;
  }
  .rating {
    gap: 10px;
  }
  .rating > b {
    flex-basis: 56px;
    font-size: 38px;
  }
  .staff {
    flex-wrap: wrap;
  }
  .upgrade {
    gap: 8px;
    padding: 10px;
  }
  .upgrade > i {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }
  .upgrade .queue {
    padding: 7px 8px;
  }
  .car-art {
    height: 140px;
  }
  .toast {
    right: 12px;
    bottom: 12px;
  }
  dialog {
    --dpad: 16px;
  }
}
/* Short landscape phones: every rail item has to fit in the viewport height. */
@media (max-height: 500px) and (min-width: 700px) {
  .sidebar {
    width: 60px;
    flex-basis: 60px;
    padding-top: 8px;
  }
  .brand {
    margin-bottom: 6px;
  }
  .brand b {
    display: none;
  }
  .nav,
  .settings {
    gap: 0;
    font-size: 0;
  }
  .nav {
    min-height: 42px;
    padding: 6px 0;
  }
  .nav svg {
    width: 24px;
    height: 24px;
  }
  .settings {
    min-height: 38px;
  }
  main > header {
    position: static;
    height: 52px;
  }
  header h1 {
    font-size: 20px;
  }
  .driver-cards {
    grid-template-columns: 1fr 1fr;
  }
  .hero {
    min-height: 240px;
  }
}

/* Race-only narrow layouts. Management screens retain their own breakpoints. */
.race-start-sequence {
  position: absolute;
  z-index: 6;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  pointer-events: none;
  background: radial-gradient(ellipse, #0a0e3016 10%, #0a0e3085 100%);
}
.race-start-sequence[hidden] { display: none; }
.start-light-panel {
  width: min(360px, 100%);
  padding: 24px;
  border: 1px solid #ffffff3d;
  border-radius: 4px;
  background: linear-gradient(145deg, #1c2468f7, #0a0e30f5);
  box-shadow: 0 16px 60px #0008;
  text-align: center;
}
.start-light-panel > small { color: #b4bdea; font: 700 10px var(--ui); letter-spacing: 3px; }
.start-lights { display: flex; justify-content: center; gap: 12px; margin: 20px 0 12px; }
.start-lights i {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid #05071d;
  background: #271720;
  box-shadow: inset 0 2px 8px #000b, 0 0 0 1px #4a55a0;
}
.start-lights i.lit { background: #ff3a48; box-shadow: inset 0 2px 5px #ff9b94, 0 0 24px #ff263c95; }
.start-light-panel > strong { display: block; font: 800 56px/1.1 var(--display); color: #f5f6ff; }
.start-light-panel > span { display: block; margin-top: 10px; font-size: 12px; color: #b4bdea; }
.lights-out .start-light-panel > strong { color: #abe33c; }
@media (max-width: 700px), (max-height: 500px) {
  .start-light-panel { width: 260px; padding: 14px; }
  .start-lights { gap: 8px; margin: 12px 0 8px; }
  .start-lights i { width: 32px; height: 32px; }
  .start-light-panel > strong { font-size: 38px; }
  .start-light-panel > span { margin-top: 6px; font-size: 10px; }
}
@media (min-width: 701px) and (max-width: 1100px) {
  #race { --race-left: 296px; --race-right: 264px; --race-bottom: 108px; }
  .race-controls { gap: 8px 16px; flex-wrap: wrap; }
  .race-tools { gap: 8px; }
  .race-stats { display: none; }
  #race-classification { max-height: calc(100% - var(--race-top) - var(--race-bottom)); }
  .commands .tip { display: none; }
}
@media (max-width: 700px) and (min-height: 501px), (max-width: 600px) {
  #race { --race-left: 8px; --race-right: 8px; --race-top: 70px; --race-bottom: 8px; --race-scene-height: 45dvh; }
  #race .heading { height: 64px; padding: 7px 10px; gap: 8px; align-items: flex-start; }
  #race .heading h2 { font-size: 16px; }
  #race .heading small { font-size: 9px; letter-spacing: 0; }
  #race .race-home, #race .race-save { padding: 5px 9px; font-size: 10px; }
  #race .race-home { margin-left: auto; }
  #race .race-status { position: absolute; left: 10px; top: 45px; margin: 0; font-size: 10px; }
  #race .track { height: var(--race-scene-height); bottom: auto; }
  #race-classification, #race .race-stats { display: none; }
  #race .race-controls {
    top: var(--race-scene-height);
    bottom: auto;
    left: 6px;
    right: 6px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 8px;
    padding: 6px;
  }
  #race .race-tools { grid-column: 1 / -1; justify-content: space-between; gap: 4px; font-size: 10px; }
  #race .race-tools > span, #race .race-tools > div { gap: 3px; }
  #race .race-controls button { padding: 4px 7px; font-size: 10px; }
  #race .camera-tools { padding: 0; border: 0; gap: 4px; }
  #race .camera-tools button { flex: 1; }
  #race .race-options { grid-column: 2; grid-row: 2; }
  #race .view-distance { grid-column: 1 / -1; gap: 5px; }
  #race .view-distance input { flex: 1; width: 50px; }
  #race .commands {
    top: calc(var(--race-scene-height) + 122px);
    bottom: 6px;
    left: 6px;
    right: 6px;
    width: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-content: start;
    gap: 7px;
  }
  #race .driver.panel { --pad: 8px; }
  #race .driver > header { gap: 5px; padding-block: 4px; }
  #race .driver .avatar { display: none; }
  #race .driver header b { font-size: 16px; }
  #race .driver header b i { font-size: 9px; }
  #race .driver header small { font-size: 8px; }
  #race .driver header > strong em { font-size: 21px; }
  #race .driver label { margin-top: 8px; }
  #race .driver .tire { margin: 4px 0; }
  #race .driver .segments { margin-top: 3px; }
  #race .driver .strategy-feedback { min-height: 20px; font-size: 8px; line-height: 1.35; padding: 0; }
  #race .driver > small { font-size: 8px; margin-top: 3px; }
  #race .segments button { font-size: 10px; }
  #race .pit { padding: 5px 4px; font-size: 10px; margin-top: 6px; }
  #race .pit small { float: right; font-size: 8px; }
  #race .tip { grid-column: 1 / -1; padding: 8px; }
  #race .tip p { margin-top: 3px; }
  #race .camera-caption { max-width: calc(100% - 175px); font-size: 10px; padding: 5px 7px; }
  #race .race-clock { font-size: 10px; padding: 5px 7px; }
  #race #banner { max-width: calc(100% - 175px); font-size: 10px; padding: 6px 8px; }
  #race .track > #race-minimap { width: 198px; height: 119px; }
  #race-render-error { top: 32%; padding: 12px; font-size: 12px; }
}

/* Phone management screens: use the available width and select a section
   instead of stacking every department. Long lists keep their own scrollbar;
   the page itself remains scrollable for larger text and unusually short views. */
@media (max-width: 700px), (max-height: 500px) {
  .sidebar { width: 48px; flex-basis: 48px; padding-top: 0; }
  .sidebar .brand { display: none; }
  .sidebar .nav, .sidebar .settings { gap: 0; font-size: 0; min-height: 44px; padding: 5px 0; }
  .sidebar .nav svg { width: 24px; height: 24px; }
  main > header { height: 48px; padding-left: 10px; gap: 6px; }
  header h1 { margin: 0; font-size: 18px; }
  #crumb, .season, .header-actions .next, .budget small, #advance b { display: none; }
  .header-actions { gap: 4px; }
  .budget { padding: 6px 8px; }
  .budget b { font-size: 16px; }
  #advance { margin-left: 0; padding: 0 12px; clip-path: none; font-size: 14px; letter-spacing: 0; }
  .content { padding: 8px; }
  .view:not(#race) { --pad: 10px; }
  .view:not(#race) .panel { --pad: 10px; min-width: 0; }
  .view:not(#race) .panel-head, .schedule-head { min-height: 36px; margin-bottom: 8px; padding-block: 5px; }
  .view:not(#race) .panel-head h3 { font-size: 16px; }
  .view:not(#race) .panel-head > div > small { display: none; }
  .view:not(#race) button { min-height: 44px; }
  .view:not(#race) .heading { margin-bottom: 6px; gap: 6px; }
  #management > .heading, #research > .heading, #calendar > .heading > p { display: none; }
  .mobile-sections { display: flex; gap: 4px; margin-bottom: 8px; }
  .mobile-sections button { flex: 1; min-width: 0; padding: 6px 4px; border: 1px solid var(--line); border-radius: 3px; background: var(--inset); color: var(--text-2); font: 700 13px var(--ui); }
  .mobile-sections button[aria-pressed="true"] { background: var(--cta); border-color: var(--cta); color: var(--cta-text); }
  .portrait-sections { display: none; }
  #home .columns { display: contents; }
  #home [data-compact-panel]:not(.compact-current),
  #management [data-compact-panel]:not(.compact-current) { display: none; }
  #home:has(.compact-current) > :is(.team-home, .hero, .metrics) { display: none; }
  .team-home { flex-wrap: nowrap; gap: 8px; padding: 8px; margin-bottom: 8px; }
  .team-home-mark { width: 40px; height: 40px; }
  .team-home-mark .team-logo { width: 30px; height: 30px; }
  .team-home h3 { font-size: 18px; margin: 0; }
  .team-home p, .team-home small { display: none; }
  .team-home > button { width: auto; padding: 6px 10px; font-size: 12px; }
  .hero { min-height: 0; padding: 10px; }
  .hero-text h2 { margin: 6px 0; font-size: 25px; }
  .hero-text p { margin-bottom: 8px; font-size: 12px; }
  .hero-text > small { font-size: 11px; letter-spacing: 1px; }
  .hero-text .primary, .hero-text .ghost { display: inline-block; width: auto; padding: 6px 8px; margin: 0 4px 0 0; font-size: 12px; }
  .hero-track { width: 260px; height: 170px; top: 6px; right: -90px; opacity: .2; transform: none; }
  .hero-track > div { display: none; }
  .weather { right: 10px; top: 10px; font-size: 16px; }
  .weather b { font-size: 16px; margin-left: 3px; }
  .weather small { font-size: 10px; margin: 0; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 8px; gap: 6px; }
  .metrics article { min-height: 0; padding: 8px; }
  .metrics article > b { margin: 4px 0; font-size: 24px; }
  .metrics article > span i { display: none; }
  .metrics .bar { margin: 5px 0; height: 4px; }
  #home .timeline > div { min-height: 58px; padding: 6px; gap: 8px; }
  #home .feed-entry { padding: 8px; gap: 8px; }
  #home .panel-head button { padding-block: 4px; }
  #home-weekend { max-height: calc(100dvh - 116px); overflow: auto; }
  #home-weekend .prep-list { max-height: none; overflow: visible; }
  .driver-cards, .research-grid, .calendar-grid, .management-grid { gap: 8px; }
  /* Let wrapped weekend notices reserve space above the scrolling department. */
  #management.active { display: flex; flex-direction: column; max-height: calc(100dvh - 64px); }
  #management > .mobile-sections, #management-lock { flex-shrink: 0; }
  .management-grid { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .management-grid > .panel { min-height: 0; max-height: calc(100dvh - 116px); overflow: auto; }
  .management-list { gap: 5px; }
  .management-row { padding: 7px 8px; gap: 8px; }
  .management-row button { padding: 6px 10px; }
  .management-proposal { padding: 8px; }
  .management-history { max-height: 120px; overflow: auto; }
  .profile .banner { height: 36px; }
  .profile .banner > strong { font-size: 44px; bottom: -10px; }
  .profile .banner > svg { width: 70px; height: 58px; bottom: -12px; }
  .profile .card-head { padding: 3px 10px; font-size: 14px; }
  .profile-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 0 6px; padding: 6px; }
  .profile-body > .profile-title, .profile-body > .rating { grid-column: 1 / -1; }
  .profile-title { gap: 4px; }
  .profile-name { font-size: 20px; }
  .profile-meta { font-size: 11px; }
  .profile-title > em { padding: 4px; font-size: 11px; }
  .rating { gap: 8px; margin: 4px 0; }
  .rating > b { flex-basis: 48px; font-size: 34px; }
  .stat-list { gap: 3px; }
  .stat-list p { grid-template-columns: 28px minmax(0, 1fr) 24px; gap: 5px; padding: 3px 6px; }
  .profile-body > label { align-self: center; margin: 0; padding: 4px; font-size: 11px; }
  .profile .wide { padding: 6px; font-size: 12px; letter-spacing: 0; }
  .staff { gap: 8px; flex-wrap: nowrap; padding: 8px; }
  .staff > b { display: none; }
  .staff small { display: none; }
  .staff span > strong { font-size: 16px; margin: 0; }
  .staff p { font-size: 11px; }
  .staff > button { padding: 6px 8px; font-size: 12px; }
  .car-art { height: 78px; margin-bottom: 8px; }
  .car-art svg { max-height: 100%; }
  .performance { gap: 4px; }
  .performance p { padding: 5px 6px; gap: 5px; }
  .upgrades { max-height: calc(100dvh - 64px); overflow: auto; }
  .upgrade { gap: 6px; padding: 8px; margin-top: 5px; }
  .upgrade > i { display: none; }
  .upgrade b { font-size: 13px; }
  .upgrade small { margin: 4px 0; line-height: 1.4; }
  .upgrade em { margin: 0 0 2px 4px; padding: 2px 4px; }
  .upgrade .queue { padding: 6px 8px; font-size: 12px; }
  .calendar-grid > .panel { max-height: calc(100dvh - 114px); overflow: auto; }
  #calendar .heading { justify-content: flex-end; }
  #calendar .switch button { min-height: 38px; }
  .event { padding: 7px 6px; gap: 5px; grid-template-columns: 22px minmax(0, 1fr) 64px 22px; }
  .event > span > small { font-size: 11px; line-height: 1.45; }
  .standing-row { margin-block: 5px; padding: 5px 6px; }
  dialog { --dpad: 12px; width: min(700px, calc(100vw - 16px)); max-height: calc(100dvh - 16px); }
  .dialog-head { margin-bottom: 8px; padding-block: 4px; }
  .dialog-head h2 { font-size: 18px; }
  .dialog-head button { min-width: 44px; min-height: 44px; }
  dialog p { line-height: 1.5; margin-block: 8px; }
}

@media (max-height: 500px) and (min-width: 601px) {
  #home.active { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 8px; }
  #home > .mobile-sections, #home > .team-home, #home .columns > .panel { grid-column: 1 / -1; margin: 0; }
  #home .hero { min-height: 184px; }
  #home .hero-text h2 { font-size: 23px; }
  #home .hero-text h2 br { display: none; }
  #home .hero-text h2 strong { display: block; font-size: 19px; margin-top: 3px; }
  #home .weather { font-size: 12px; }
  #home .weather b { font-size: 13px; }
  #home .weather small { font-size: 10px; }
  #home .metrics { margin: 0; }
  #home .metrics article { padding: 6px; }
  #home .metrics article > b { font-size: 22px; margin-block: 3px; }
  #home .metrics article > span { display: block; line-height: 1.3; }
  #home .metrics .bar { margin-block: 3px; }
  .driver-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #drivers .heading > p { font-size: 12px; }
  #drivers .heading > button { padding: 5px 12px; }
  #drivers .profile .banner { display: none; }
  #drivers .stat-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #drivers .stat-list p { grid-template-columns: 1fr auto; gap: 3px; padding: 4px; }
  #drivers .stat-list i { grid-row: 2; grid-column: 1 / -1; height: 4px; }
  #drivers .stat-list strong { grid-column: 2; grid-row: 1; }
  .research-grid { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); }
  .calendar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px), (max-width: 700px) and (min-height: 501px) {
  .portrait-sections { display: flex; }
  #research [data-compact-panel]:not(.compact-current),
  #calendar [data-compact-panel]:not(.compact-current) { display: none; }
  #calendar:has(.schedule.compact-current) > .heading { display: none; }
  .research-grid, .calendar-grid { grid-template-columns: minmax(0, 1fr); }
  .upgrades, .calendar-grid > .schedule { max-height: calc(100dvh - 116px); }
  .calendar-grid > .standings { max-height: calc(100dvh - 166px); }
  .team-home { display: grid; grid-template-columns: 40px minmax(0, 1fr); }
  .team-home > button { grid-column: 1 / -1; }
  .hero-text h2 { font-size: 24px; }
  .hero-text .primary, .hero-text .ghost { padding-inline: 6px; margin-right: 2px; font-size: 11px; }
  #drivers .heading > p { display: none; }
  #drivers .heading > button { width: 100%; padding: 5px; }
  #drivers .profile .banner { display: none; }
  .management-row { flex-wrap: wrap; }
  .management-row > span { flex-basis: 100%; }
  .management-row button { flex: 1; }
}

@media (max-height: 500px) and (min-width: 601px) and (max-width: 740px) {
  #home.active { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 6px; }
  #home .hero-text h2 { font-size: 20px; }
  #home .hero-text h2 strong { font-size: 17px; }
  #home .hero { min-height: 176px; padding-block: 6px; }
  #home .hero-text p { margin-bottom: 4px; }
  #home .hero-text .primary, #home .hero-text .ghost { padding-inline: 5px; font-size: 11px; margin: 0 2px 0 0; }
  #home .metrics article { padding: 6px; }
  #home .metrics article > b { font-size: 21px; }
}

@media (max-width: 600px) and (max-height: 700px) {
  .team-home { grid-template-columns: minmax(0, 1fr) auto; }
  .team-home-mark { display: none; }
  .team-home h3 { font-size: 15px; }
  .team-home > button { grid-column: auto; padding-inline: 6px; max-width: 142px; }
  #drivers .stat-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #drivers .stat-list p { grid-template-columns: 1fr auto; gap: 3px; padding: 4px; }
  #drivers .stat-list i { grid-row: 2; grid-column: 1 / -1; height: 4px; }
  #drivers .stat-list strong { grid-column: 2; grid-row: 1; }
}
