html,
body,
#react-root {
  height: 100%;
  overflow: hidden;
}

#react-root {
  display: flex;
  flex-direction: column;
}

.app-shell,
.login-splash,
.boot-splash {
  flex: 1;
  min-height: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 600px) minmax(0, 350px);
  width: min(100%, 1210px);
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  overflow: hidden;
  background: var(--black);
}

.app-shell--wide {
  grid-template-columns: 260px minmax(0, 1fr);
}

.side-nav {
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  user-select: none;
}

.side-nav__inner {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100%;
  padding: 2px 20px 12px 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  margin: 10px 0 12px;
  color: inherit;
  text-decoration: none;
}

.brand__mark {
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
}

.brand__word {
  display: none;
}

.side-nav__links {
  display: grid;
  gap: 3px;
}

.side-nav__link {
  display: flex;
  align-items: center;
  gap: 19px;
  min-height: 50px;
  padding: 0 13px;
  border-radius: 999px;
  color: var(--text);
  font-size: 1.25rem;
  text-decoration: none;
}

.side-nav__link:hover {
  background: var(--surface-hover);
  color: var(--text);
  text-decoration: none;
}

.side-nav__link--active {
  font-weight: 700;
}

.nav-icon {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  color: var(--text);
}

.nav-icon svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

.side-nav__avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface);
}

.stig-button {
  display: grid;
  place-items: center;
  width: calc(100% - 8px);
  min-height: 52px;
  margin: 14px 4px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
}

.stig-button:hover {
  background: var(--accent-hover);
  color: var(--accent-text);
  text-decoration: none;
}

.stig-button__add {
  display: none;
}

.side-account {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 9px;
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
}

.side-account:hover {
  background: var(--surface-hover);
  color: var(--text);
  text-decoration: none;
}

.side-account img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface);
}

.side-account__text {
  display: grid;
  min-width: 0;
  font-size: 0.9rem;
}

.side-account__text span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-account__handle {
  color: var(--muted);
  font-size: 0.88rem;
}

.mobile-header,
.mobile-nav,
.drawer-close,
.rail__close,
.backdrop {
  display: none;
}

.feed-column {
  min-width: 0;
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  border-right: 1px solid var(--border);
}

.app-shell--wide .feed-column {
  border-right: 0;
}

.page-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 53px;
  margin: 0;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--chrome);
  backdrop-filter: blur(12px);
}

.page-header h1 {
  margin: 0;
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 700;
}

.rail {
  align-self: stretch;
  height: 100%;
  min-height: 0;
  padding: 5px 0 24px 30px;
  overflow-y: auto;
}

.rail__search {
  position: sticky;
  top: 0;
  z-index: 5;
  margin-bottom: 16px;
  background: var(--black);
}

.rail__card {
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.rail__card--signup {
  border-color: rgb(74 221 128 / 28%);
  background: rgb(52 121 72 / 14%);
}

.rail__card--error {
  border-color: rgb(210 75 85 / 55%);
  background: rgb(100 25 32 / 28%);
}

.rail__card h2 {
  margin: 0 0 10px;
  font-size: 1.25rem;
}

.rail__card p {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.4;
}

.rail__card .terms {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.rail__card .terms a {
  color: var(--muted);
}

button.rail__button,
.rail__button {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 15px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.rail__button:hover {
  background: var(--accent-hover);
  color: var(--accent-text);
  text-decoration: none;
}

.rail__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 0 14px;
  color: var(--muted);
  font-size: 0.72rem;
}

.rail__footer a {
  color: var(--muted);
  text-decoration: none;
}

.rail__footer a:hover {
  text-decoration: underline;
}

.boot-splash {
  display: grid;
  place-items: center;
  background: var(--black);
}

.boot-splash__mark {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent);
}

button.feed-error {
  display: none;
  width: calc(100% - 32px);
  margin: 12px 16px;
  padding: 14px 16px;
  border: 1px solid rgb(210 75 85 / 55%);
  border-radius: 16px;
  background: rgb(100 25 32 / 28%);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 88px minmax(0, 600px) minmax(0, 330px);
    width: min(100%, 1018px);
  }

  .app-shell--wide {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .side-nav__inner {
    align-items: center;
    padding: 2px 8px 12px;
  }

  .side-nav__link {
    justify-content: center;
    width: 50px;
    padding: 0;
  }

  .side-nav__label,
  .side-account__text {
    display: none;
  }

  .stig-button {
    width: 50px;
    height: 50px;
    min-height: 50px;
    overflow: hidden;
    font-size: 0;
  }

  .stig-button__label {
    display: none;
  }

  .stig-button__add {
    display: block;
    font-size: 1.7rem;
    font-weight: 400;
  }
}

@media (max-width: 930px) {
  .app-shell,
  .app-shell--wide {
    grid-template-columns: 88px minmax(0, 600px);
    width: min(100%, 688px);
  }

  .rail {
    display: none;
  }

  button.feed-error {
    display: block;
  }
}

@media (max-width: 760px) {
  .app-shell,
  .app-shell--wide {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  .side-nav {
    display: none;
  }

  .side-nav--open {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    display: block;
    width: min(320px, calc(100% - 48px));
    overflow-y: auto;
    border-right: 1px solid var(--border);
    background: var(--black);
    box-shadow: 18px 0 50px rgb(0 0 0 / 35%);
  }

  .side-nav--open .side-nav__inner {
    position: static;
    align-items: stretch;
    height: auto;
    min-height: 100%;
    padding: 12px 16px 24px;
  }

  .side-nav--open .side-nav__link {
    justify-content: flex-start;
    width: auto;
    padding: 0 13px;
  }

  .side-nav--open .side-nav__label,
  .side-nav--open .side-account__text,
  .side-nav--open .stig-button__label {
    display: inline;
  }

  .side-nav--open .stig-button {
    width: calc(100% - 8px);
    height: auto;
    min-height: 52px;
    font-size: 1rem;
  }

  .side-nav--open .stig-button__add {
    display: none;
  }

  .drawer-close {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    margin: 0 0 8px auto;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text);
    cursor: pointer;
  }

  .drawer-close svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
  }

  .mobile-header {
    position: relative;
    flex: none;
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    height: 53px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    background: var(--chrome);
    backdrop-filter: blur(12px);
  }

  .mobile-header .brand {
    justify-self: center;
    width: auto;
    margin: 0;
  }

  .mobile-header__avatar,
  .mobile-header__menu {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text);
    cursor: pointer;
  }

  .mobile-header__avatar {
    justify-self: start;
  }

  .mobile-header__menu {
    justify-self: end;
  }

  .mobile-header__avatar img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
  }

  .mobile-header__menu svg {
    width: 23px;
    height: 23px;
    fill: currentColor;
  }

  .mobile-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: calc(54px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--border);
    background: var(--chrome);
  }

  .mobile-nav a {
    display: grid;
    place-items: center;
    flex: 1;
    height: 100%;
    color: var(--text);
  }

  .feed-column {
    flex: 1;
    height: auto;
    border-right: 0;
    padding-bottom: calc(54px + env(safe-area-inset-bottom));
  }

  .page-header {
    top: 0;
  }

  .rail--open {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 50;
    display: block;
    width: min(360px, calc(100% - 48px));
    height: 100dvh;
    padding: 12px 16px 24px;
    border-left: 1px solid var(--border);
    background: var(--black);
    box-shadow: -18px 0 50px rgb(0 0 0 / 35%);
  }

  .rail--open .rail__close {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    margin: 0 0 8px auto;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text);
    cursor: pointer;
  }

  .rail--open .rail__close svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
  }

  .backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: var(--scrim);
    cursor: pointer;
  }
}

