/* App Shell: base, responsive and interaction states. */
.brand {
  font-size: 29px;
  font-weight: 800;
  letter-spacing: -1.4px;
  display: flex;
}

.brand svg {
  width: 28px;
  height: 28px;
}

.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 36px 25px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  width: 240px;
}

.nav {
  display: grid;
  gap: 7px;
  margin-top: 60px;
}

.nav button {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  border-radius: 12px;
  padding: 15px;
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
}

.nav button.active {
  background: var(--avatar);
  color: var(--avatar-text);
  font-weight: 700;
}

.sidebar-bottom {
  margin-top: auto;
}

.workspace {
  grid-column: 2;
  padding: 45px 54px;
  max-width: 1500px;
  width: 100%;
}

.topbar {
  margin-bottom: 35px;
}

.avatar {
  width: 43px;
  height: 43px;
  background: var(--soft-surface);
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 700;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr);
  gap: 30px;
}

.aside {
  display: grid;
  align-content: start;
  gap: 20px;
}

.mobile-brand {
  display: none;
}

@media (min-width: 1600px) {
  .workspace {
    padding-top: 65px;
  }
}

@media (max-width: 1100px) {
  .workspace {
    padding: 35px 30px;
  }

  .shell {
    grid-template-columns: 205px 1fr;
  }

  .sidebar {
    width: 205px;
    padding: 30px 18px;
  }

  .main-grid {
    grid-template-columns: 1fr;
  }

  .aside {
    grid-template-columns: 1fr 1fr;
  }

  .aside .tip {
    grid-column: 1/-1;
  }
}

@media (max-width: 700px) {
  .shell {
    display: block;
  }

  .sidebar {
    inset: auto 0 0;
    border-top: 1px solid var(--line);
    z-index: 5;
    backdrop-filter: blur(12px);
  }

  .sidebar > .brand,
  .sidebar-bottom {
    display: none;
  }

  .nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    margin: 0;
    gap: 0;
    height: 100%;
  }

  .nav button {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    font-size: 11px;
    padding: 10px 4px;
    border-radius: 0;
  }

  .nav button.active {
    background: transparent;
    color: var(--accent);
  }

  .nav .icon {
    width: 20px;
    height: 20px;
  }

  .workspace {
    padding: 22px 22px 105px;
  }

  .mobile-brand {
    display: flex;
    margin-bottom: 28px;
    font-size: 25px;
  }

  .topbar {
    margin-bottom: 24px;
  }

  .topbar > .pill {
    display: none;
  }

  .main-grid {
    gap: 24px;
  }

  .aside {
    grid-template-columns: 1fr;
  }

  .aside .tip {
    grid-column: auto;
  }
}

button.app-home-brand {
  border: 0;
  background: none;
  padding: 0;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.topbar > div:first-child {
  min-width: 0;
}

.topbar > div:last-child {
  flex-shrink: 0;
}

.topbar .pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.avatar {
  flex-shrink: 0;
}

.brand {
  gap: 0;
}

@media (max-width: 700px) {
  .workspace {
    position: relative;
  }

  .workspace .mobile-brand {
    display: flex;
    position: absolute;
    margin: 0;
  }

  .workspace .header-actions {
    position: absolute;
    margin: 0;
  }

  .header-actions .pill {
    min-width: 43px;
    min-height: 43px;
    justify-content: center;
    padding: 11px;
  }
}

@media (max-width: 700px) {
  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .topbar > div:first-child {
    flex: 1 1 200px;
  }

  .topbar > div:last-child {
    margin-left: auto;
  }

  .topbar .pill {
    font-size: 12px;
    padding: 8px 10px;
  }

  .workspace {
    padding-bottom: 180px;
    padding-top: 98px;
  }

  .workspace .mobile-brand {
    top: 24px;
    left: 22px;
  }

  .workspace .header-actions {
    top: 22px;
    right: 22px;
  }
}

@media (max-width: 380px) {
  .workspace {
    padding-left: 18px;
    padding-right: 18px;
  }
}

.workspace {
  margin: 0 auto;
  align-self: start;
}

.beta-badge {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  padding: 3px 6px;
  border: 1px solid var(--accent-outline);
  border-radius: 5px;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
}

.brand-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.instagram-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 43px;
  height: 43px;
  border-radius: 50%;
  background: var(--card);
  color: var(--text);
  flex-shrink: 0;
}

.instagram-link:hover {
  background: var(--line);
  color: var(--accent);
}

.instagram-link .icon {
  width: 21px;
  height: 21px;
}

.instagram-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 380px) {
  .workspace .header-actions {
    gap: 8px;
  }

  .workspace .header-actions .instagram-link,
  .workspace .header-actions .avatar,
  .workspace .header-actions .pill {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 8px;
  }

  .workspace .header-actions .icon {
    width: 20px;
    height: 20px;
  }
}

.theme-toggle {
  border: 0;
  padding: 11px;
}

@media (width < 450px) {
  .workspace .header-actions .avatar {
    display: none;
  }
}

.brand {
  align-items: center;
}

.brand .soft-bagel {
  width: 32px;
  height: 32px;
  margin-right: 8px;
}

.brand-wordmark {
  white-space: nowrap;
}

.sidebar .brand {
  padding-left: 0;
}

@media (max-width: 380px) {
  .workspace {
    padding-top: 142px;
  }

  .workspace .header-actions {
    top: 76px;
    left: 22px;
    right: auto;
  }

  .brand-header {
    flex-wrap: wrap;
    row-gap: 16px;
  }
}

.page-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.brand .soft-bagel {
  padding: 3px;
  border: 1px solid #812e2d;
  border-radius: 8px;
  background: #812e2d;
}

.page-eyebrow-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 9px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 18px;
  align-items: center;
}

.topbar > div:first-child {
  display: contents;
}

.page-title-row {
  grid-column: 1;
  min-width: 0;
}

.page-title-row > .beta-badge {
  display: none;
}

.topbar .header-actions {
  grid-column: 2;
  grid-row: 1;
}

.sidebar .brand .beta-badge {
  margin-left: 4px;
  flex-shrink: 0;
}

@media (max-width: 700px) {
  .page-title-row {
    grid-column: 1 / -1;
    flex-wrap: nowrap;
    align-items: center;
  }

  .page-title-row h1 {
    min-width: 0;
  }

  .page-title-row > .beta-badge {
    display: inline-flex;
    margin-left: auto;
    flex-shrink: 0;
  }
}

.brand .beta-badge {
  margin-left: 8px;
}

@media (max-width:700px) {
  .sidebar {
    inset: auto 12px calc(12px + env(safe-area-inset-bottom,0px));
    width: auto;
    height: 76px;
    padding: 5px;
    background: var(--page);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 5px 20px #00000018;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .sidebar .nav {
    gap: 3px;
  }

  .sidebar .nav button {
    border-radius: 13px;
    min-width: 0;
    min-height: 44px;
    color: var(--muted);
  }

  .sidebar .nav button.active {
    background: var(--card);
    color: var(--accent);
    box-shadow: 0 1px 4px #0000000d;
  }

  .sidebar .nav button:focus-visible {
    outline-offset: -3px;
  }

  .workspace {
    padding-bottom: calc(210px + env(safe-area-inset-bottom,0px));
  }
}

@supports ((backdrop-filter:blur(8px)) or (-webkit-backdrop-filter:blur(8px))) {
  @media (max-width:700px) {
    .sidebar {
      background: var(--nav-surface);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
    }
  }
}

@media (max-width:700px) and (prefers-reduced-transparency:reduce) {
  .sidebar {
    background: var(--page);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@media (max-width:700px) and (forced-colors:active) {
  .sidebar {
    background: Canvas;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .sidebar .nav button.active {
    outline: 2px solid Highlight;
    outline-offset: -3px;
  }
}

@media(max-width:700px) {
  .sidebar .nav {
    position: relative;
  }

  .sidebar .nav button {
    position: relative;
    z-index: 1;
  }

  .sidebar .nav:has(.nav-selection) button.active {
    background: transparent;
    box-shadow: none;
  }

  .nav-selection {
    position: absolute;
    z-index: 0;
    pointer-events: none;
    border-radius: 13px;
    background: var(--card);
    box-shadow: 0 1px 4px #0000000d;
  }
}

@media(max-width:1100px) {
  .main-grid>.aside>.race-card {
    grid-column: 1 / -1;
    width: 100%;
    box-sizing: border-box;
  }
}
