#app {
  min-height: 100dvh;
}

.document {
  width: min(100% - 4ch, 88ch);
  margin: 0 auto;
  padding: 2lh 0 4lh;
}

.document-narrow {
  width: min(100% - 4ch, 68ch);
  padding-top: 3lh;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 2ch;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.brand img {
  display: block;
  width: 6ch;
  height: 3lh;
  object-fit: contain;
}

.communique {
  margin: 3lh 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.auth-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 1ch;
  margin-bottom: 1lh;
  color: var(--text-dim);
}

.auth-tabs button[aria-selected="true"] {
  color: var(--accent);
}

.auth-form {
  max-width: 48ch;
}

.auth-row {
  display: grid;
  grid-template-columns: 14ch minmax(0, 1fr);
  align-items: baseline;
  margin-bottom: 0.5lh;
}

.field-line {
  display: flex;
  gap: 1ch;
  min-width: 0;
}

.field-line input {
  width: 100%;
  min-width: 0;
  padding: 0;
}

.field-line .cursor-field {
  flex: 1;
}

.field-line .cursor-field::after {
  left: 0;
  top: 0.25em;
}

.password-toggle {
  margin: 0.5lh 0;
  color: var(--text-dim);
}

.warning {
  margin: 1lh 0;
  white-space: pre-wrap;
}

.accept-rules {
  display: flex;
  align-items: baseline;
  gap: 1ch;
  margin: 1lh 0;
}

.accept-rules input {
  flex: none;
  margin: 0;
}

.form-status {
  min-height: 2lh;
  margin: 0.5lh 0;
  overflow-wrap: anywhere;
}

.action {
  display: inline-block;
  white-space: nowrap;
}

.action::before {
  content: "[ ";
}

.action::after {
  content: " ]";
}

.site-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 1ch 2ch;
  min-height: 2lh;
  padding: 0.5lh 2ch;
  border-bottom: 1px solid var(--line);
}

.site-header .site-name {
  font-weight: 600;
  text-decoration: none;
}

.header-channel {
  color: var(--text);
  text-decoration: none;
}

.header-status {
  color: var(--text-dim);
}

.header-actions {
  display: flex;
  align-items: baseline;
  gap: 2ch;
  margin-left: auto;
}

.logout-short {
  display: none;
}

.tools-menu {
  position: relative;
}

.menu-trigger {
  white-space: nowrap;
}

.menu-list {
  position: absolute;
  z-index: 2;
  top: calc(100% + 0.5lh);
  right: 0;
  width: max-content;
  min-width: 24ch;
  max-width: min(48ch, calc(100vw - 4ch));
  max-height: 50dvh;
  overflow: auto;
  padding: 0.5lh 1ch;
  border: 1px solid var(--line);
  background: var(--bg-raised);
}

.menu-list a {
  display: block;
  padding: 0.25lh 0;
  overflow-wrap: anywhere;
  text-decoration: none;
  text-transform: lowercase;
}

.page-title {
  margin: 0 0 2lh;
  font-size: 1rem;
  font-weight: 600;
}

.rules-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.back-link {
  display: inline-block;
  margin-bottom: 2lh;
}

@media (max-width: 599px) {
  .document {
    padding-top: 1lh;
  }

  .site-header {
    flex-wrap: nowrap;
    gap: 1ch;
    padding-inline: 1ch;
  }

  .header-channel,
  .site-header .header-status,
  .logout-long {
    display: none;
  }

  .logout-short {
    display: inline;
  }

  .header-actions {
    flex: none;
    gap: 1ch;
    margin-left: auto;
  }

  .tools-menu {
    position: static;
  }

  .menu-list {
    top: 100%;
    right: 0;
    left: 0;
    width: 100%;
    max-width: none;
  }

  .back-link {
    margin-bottom: 1lh;
  }

  .page-title {
    margin-bottom: 1lh;
  }
}
