@font-face {
  font-family: 'Archivo';
  src: url('/vendor/fonts/archivo-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Archivo';
  src: url('/vendor/fonts/archivo-latin-ext.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Colours live in palettes.css (made by scripts/make-palettes.mjs). */

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--sky);
  color: var(--anvil);
  font-family: 'Archivo', system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  font-stretch: 100%;
}

a {
  color: var(--bruise);
  text-underline-offset: 0.15em;
}

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

button {
  font: inherit;
  cursor: pointer;
}

.masthead {
  display: flex;
  align-items: center;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
  padding: 0.9rem 16px 0.6rem;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 0.4rem 1rem;
  flex-wrap: wrap;
  flex: 1 1 auto;
  min-width: 0;
}
.account-nav {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}
.account-nav a {
  color: var(--anvil);
  font-weight: 600;
}
.account-nav .button {
  margin: 0;
  color: var(--sky);
}
.theme-panel select,
.staff-bar select,
.form-page select,
dialog select {
  font: inherit;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--anvil);
}

.wordmark {
  font-size: 1.6rem;
  font-weight: 850;
  font-stretch: 125%;
  letter-spacing: -0.01em;
  color: var(--anvil);
  text-decoration: none;
}

.tagline {
  margin: 0;
  color: var(--rain);
  font-size: 0.95rem;
}

.feed-problem {
  margin: 0 16px 0.75rem;
  padding: 0.6rem 0.9rem;
  border-left: 4px solid var(--siren);
  background: var(--surface);
}

main {
  padding: 0 16px 2rem;
}
main:focus {
  outline: none;
}

/* Phones and iPads in portrait: your area, then the map, then the lists, in one column.
   Wide screens (iPad landscape, computers): the map on the left, the rest beside it. */
.home {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: 'card' 'map' 'panel';
}
.home-card {
  grid-area: card;
}
.home .map {
  grid-area: map;
  height: 40dvh;
  min-height: 240px;
}
.home .panel {
  grid-area: panel;
}
@media (min-width: 1024px) {
  .home {
    grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr);
    grid-template-areas: 'map card' 'map panel';
    grid-template-rows: auto 1fr;
    align-items: start;
  }
  .home .map {
    position: sticky;
    top: 1rem;
    height: calc(100vh - 8rem);
  }
}

.map {
  height: 52vh;
  min-height: 280px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
}
.leaflet-container {
  font-family: inherit;
  background: var(--surface);
}

.panel h2 {
  font-size: 1.05rem;
  font-weight: 750;
  font-stretch: 112%;
  margin: 1.5rem 0 0.5rem;
}
.panel h2:first-child {
  margin-top: 0;
}

/* "Your sky": the first thing that matters, so it carries the storm light. */
.your-sky {
  padding: 1rem 1.1rem;
  background: var(--surface);
  border-radius: 6px;
  border-left: 6px solid var(--line);
}
.your-sky.inside {
  border-left-color: var(--storm-light);
}
.your-sky h2 {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
  font-stretch: 118%;
  font-weight: 800;
  line-height: 1.2;
}
.your-sky p {
  margin: 0.25rem 0;
}

.button,
.primary {
  display: inline-block;
  margin-top: 0.6rem;
  padding: 0.6rem 1rem;
  border: 0;
  border-radius: 4px;
  background: var(--primary);
  color: var(--primary-ink);
  font-weight: 650;
  text-decoration: none;
}
.quiet {
  padding: 0.6rem 1rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--anvil);
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.list li + li {
  border-top: 1px solid var(--line);
}
.list a {
  display: block;
  padding: 0.65rem 0;
  color: var(--anvil);
  text-decoration: none;
}
.list a:hover .item-title {
  text-decoration: underline;
}
.item-title {
  display: block;
  font-weight: 650;
  line-height: 1.3;
}
.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.9rem;
  color: var(--rain);
  font-size: 0.875rem;
}
.flag {
  color: var(--siren);
  font-weight: 650;
}
.empty {
  color: var(--rain);
  margin: 0.25rem 0;
}
.state-name {
  margin: 0.9rem 0 0.1rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--rain);
}

/* Warning room */
.room-head h1 {
  margin: 0.25rem 0 0.35rem;
  font-size: clamp(1.5rem, 4vw, 2.4rem);
  line-height: 1.08;
  font-weight: 850;
  font-stretch: 122%;
  letter-spacing: -0.015em;
  max-width: 28ch;
}
.room-head .item-meta {
  font-size: 0.95rem;
}
.back {
  font-size: 0.9rem;
}
.ended-note {
  margin: 0.75rem 0 0;
  padding: 0.6rem 0.9rem;
  background: var(--surface);
  border-left: 4px solid var(--rain);
}

.room {
  display: grid;
  gap: 1.25rem;
  margin-top: 1rem;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 1024px) {
  .room {
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr);
    align-items: start;
  }
}
.room .map {
  height: 260px;
}

.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--line);
}
.tabs button {
  padding: 0.55rem 0.9rem;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--rain);
  font-weight: 650;
}
.tabs button[aria-selected='true'] {
  color: var(--anvil);
  border-bottom-color: var(--storm-light);
}
@media (min-width: 1024px) {
  .tabs {
    display: none;
  }
  .room [data-pane] {
    display: block !important;
  }
}


.bureau {
  background: var(--surface);
  border-radius: 6px;
  border: 1px solid var(--line);
  padding: 0.9rem 1.1rem;
}
.bureau h2 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 750;
}
.bureau .source {
  margin: 0 0 0.75rem;
  color: var(--rain);
  font-size: 0.875rem;
}
.bureau-text {
  white-space: pre-line;
  max-width: 68ch;
}
.bureau-text + .bureau-text {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.room-side {
  display: grid;
  gap: 1rem;
}

.safety {
  padding: 1.25rem 16px 2rem;
  border-top: 1px solid var(--line);
  color: var(--rain);
  font-size: 0.9rem;
}
.safety p {
  margin: 0 0 0.5rem;
  max-width: 80ch;
}
.safety a[href^='tel'] {
  color: var(--siren);
  font-weight: 700;
}
.credits {
  font-size: 0.8rem;
}

dialog {
  border: 0;
  border-radius: 8px;
  padding: 1.25rem;
  max-width: min(420px, calc(100vw - 32px));
  background: var(--surface);
  color: var(--anvil);
}
dialog::backdrop {
  background: rgba(20, 23, 38, 0.55);
}
dialog h2 {
  margin: 0 0 0.25rem;
  font-stretch: 115%;
}
dialog label {
  display: block;
  font-weight: 650;
  margin-top: 0.75rem;
}
dialog input {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--sky);
  color: var(--anvil);
  font: inherit;
}
.form-error {
  color: var(--siren);
  min-height: 1.25rem;
  margin: 0.4rem 0 0;
  font-size: 0.9rem;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.dialog-actions .primary {
  margin: 0;
}

/* Where the Bureau detected storms: the one thing on the page that moves. */
.storm-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--storm-glow);
  border: 3px solid var(--anvil);
  box-shadow: 0 0 0 0 rgba(230, 214, 90, 0.7);
  animation: storm-pulse 2.4s ease-out infinite;
}
@keyframes storm-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(230, 214, 90, 0.7);
  }
  100% {
    box-shadow: 0 0 0 22px rgba(230, 214, 90, 0);
  }
}
.you-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bruise);
  border: 3px solid var(--surface);
}
@media (prefers-reduced-motion: reduce) {
  .storm-dot {
    animation: none;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Accounts */
.form-page {
  max-width: 34rem;
}
.form-page h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 850;
  font-stretch: 122%;
  line-height: 1.1;
  margin: 0.5rem 0 0.5rem;
}
.form-page label {
  display: block;
  font-weight: 650;
  margin-top: 1rem;
}
.form-page input {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--anvil);
  font: inherit;
}
.form-page input:disabled {
  opacity: 0.6;
}
.form-page .primary {
  margin-top: 0.75rem;
}
[aria-invalid='true'] {
  border-color: var(--siren) !important;
  outline-color: var(--siren);
}
.hint {
  display: block;
  color: var(--rain);
  font-size: 0.875rem;
  font-weight: 400;
  margin: 0.15rem 0 0;
}
.notice,
.dev-note {
  padding: 0.6rem 0.9rem;
  background: var(--surface);
  border-left: 4px solid var(--storm-light);
}
.details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1rem;
  margin: 1rem 0;
}
.details dt {
  font-weight: 650;
}
.details dd {
  margin: 0;
}
.small-note {
  color: var(--rain);
  font-size: 0.9rem;
  margin: 0.75rem 0 0;
}

.button.small {
  padding: 0.4rem 0.75rem;
  margin: 0;
}
.quiet-button {
  background: transparent;
  color: var(--anvil);
  border: 1px solid var(--line);
}
.link-button {
  border: 0;
  padding: 0;
  background: none;
  color: var(--bruise);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  font: inherit;
}
.danger {
  padding: 0.6rem 1rem;
  border: 0;
  border-radius: 4px;
  background: var(--siren);
  color: #fff;
  font-weight: 650;
}
.danger-text {
  color: var(--siren);
}
.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Staff */
.badge {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  border-radius: 3px;
  background: var(--storm-light);
  color: var(--on-accent);
  font-size: 0.72rem;
  font-weight: 750;
  vertical-align: 0.1em;
  line-height: 1.4;
}
.staff-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.5rem 0.9rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
.home-dot {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--surface);
  border: 3px solid var(--bruise);
}
.ban-who p {
  margin: 0.25rem 0;
}

.team-tabs {
  display: flex;
  gap: 0.25rem;
  margin: 0.75rem 0 1rem;
  border-bottom: 1px solid var(--line);
}
.team-tabs a {
  padding: 0.55rem 0.9rem;
  border-bottom: 3px solid transparent;
  color: var(--rain);
  font-weight: 650;
  text-decoration: none;
}
.team-tabs a[aria-current='page'] {
  color: var(--anvil);
  border-bottom-color: var(--storm-light);
}
@media (min-width: 900px) {
  .team-tabs {
    display: flex;
  }
}
#team-body,
#log-body {
  overflow-x: auto;
}
.stats-section {
  margin: 0 0 1.75rem;
}
.stats-section h2 {
  margin: 0 0 0.75rem;
}
.stats-section h3 {
  margin: 1.1rem 0 0.4rem;
  font-size: 1rem;
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.75rem;
}
.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}
.stat-value {
  font-size: 1.75rem;
  font-weight: 750;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  color: var(--rain);
  font-size: 0.9rem;
}
.bar-table {
  width: 100%;
  max-width: 44rem;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.bar-table th,
.bar-table td {
  padding: 0.35rem 0;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}
.bar-table th {
  text-align: left;
  font-weight: 400;
  padding-right: 0.75rem;
  width: 42%;
  overflow-wrap: anywhere;
}
.bar-cell {
  width: 46%;
}
.bar {
  display: block;
  height: 0.7rem;
  border-radius: 0 4px 4px 0;
  background: var(--bruise);
}
.bar-count {
  text-align: right;
  white-space: nowrap;
  padding-left: 0.6rem;
  font-variant-numeric: tabular-nums;
}
.bar-table tr:hover .bar {
  background: var(--anvil);
}
.form-page .show-password {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.4rem 0 0;
  font-weight: 400;
  font-size: 0.95rem;
}
.form-page .show-password input {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
}
.team-search {
  display: flex;
  gap: 0.5rem;
  max-width: 32rem;
  margin: 0 0 0.5rem;
}
.team-search input {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--sky);
  color: var(--anvil);
  font: inherit;
}
.team-search button {
  margin: 0;
}
.profile-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1.25rem;
  margin: 0 0 1rem;
}
.profile-facts dt {
  color: var(--rain);
}
.profile-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.log-line.removed .item-title {
  opacity: 0.65;
  text-decoration: line-through;
}
.team-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.team-table th,
.team-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.6rem 0.75rem 0.6rem 0;
  border-bottom: 1px solid var(--line);
}
.team-table thead th {
  color: var(--rain);
  font-size: 0.85rem;
  font-weight: 650;
}
.team-table tbody th {
  font-weight: 400;
  min-width: 14rem;
}
.team-table tr.removed td {
  opacity: 0.65;
}
.row-actions {
  white-space: nowrap;
}
.row-actions a,
.row-actions button {
  margin-right: 0.9rem;
}
.log-line .item-title {
  font-weight: 500;
}

/* Privacy policy */
.policy {
  max-width: 44rem;
  padding-bottom: 3rem;
}
.policy h1 {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 850;
  font-stretch: 122%;
  line-height: 1.05;
  margin: 0.5rem 0 0.25rem;
}
.policy h2 {
  font-size: 1.25rem;
  font-weight: 800;
  font-stretch: 112%;
  margin: 2rem 0 0.5rem;
}
.policy h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 1.25rem 0 0.25rem;
}
.policy p,
.policy li {
  max-width: 68ch;
}
.policy li + li {
  margin-top: 0.35rem;
}
.policy mark {
  background: var(--storm-light);
  color: var(--on-accent);
  padding: 0 0.2rem;
}

/* Theme menu */
.theme-menu {
  position: relative;
}
.theme-menu summary {
  cursor: pointer;
  list-style: none;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  font-weight: 600;
}
.theme-menu summary::-webkit-details-marker {
  display: none;
}
.theme-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  z-index: 1000;
  width: min(17rem, calc(100vw - 32px));
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.theme-panel fieldset {
  border: 0;
  margin: 0 0 0.75rem;
  padding: 0;
}
.theme-panel legend,
.theme-panel > label {
  font-weight: 650;
  margin-bottom: 0.4rem;
  display: block;
}
.swatches {
  display: grid;
  gap: 0.35rem;
}
.swatches label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0.4rem;
  border-radius: 4px;
  cursor: pointer;
}
.swatches input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.swatches label:has(input:checked) {
  outline: 2px solid var(--anvil);
}
.swatches label:has(input:focus-visible) {
  outline: 3px solid var(--focus);
}
.theme-panel select {
  width: 100%;
}
/* Each swatch shows its palette's page, accent and highlight colours. */
.swatch {
  width: 2.6rem;
  height: 1.3rem;
  border-radius: 3px;
  border: 1px solid var(--line);
  flex: none;
}
.swatch[data-swatch='huddle'] { background: linear-gradient(90deg, #0a1330 0 34%, #2563eb 34% 67%, #7c3aed 67%); }
.swatch[data-swatch='storm'] { background: linear-gradient(90deg, #2e3350 0 34%, #5b4e8c 34% 67%, #e2d458 67%); }
.swatch[data-swatch='gum'] { background: linear-gradient(90deg, #22352b 0 34%, #3d6a53 34% 67%, #e8bc5a 67%); }
.swatch[data-swatch='dusk'] { background: linear-gradient(90deg, #3a2340 0 34%, #86386b 34% 67%, #f5a05a 67%); }
.swatch[data-swatch='reef'] { background: linear-gradient(90deg, #12343b 0 34%, #1d777d 34% 67%, #ff8c7a 67%); }
.swatch[data-swatch='clear'] { background: linear-gradient(90deg, #000 0 34%, #fff 34% 67%, #ffd400 67%); }

/* Private chats */
.count {
  display: inline-block;
  min-width: 1.3rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--siren);
  color: #fff;
  font-size: 0.78rem;
  text-align: center;
  line-height: 1.3rem;
}
.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 2000;
  display: grid;
  gap: 0.6rem;
  width: min(24rem, calc(100vw - 32px));
}
.toast {
  position: relative;
  padding: 0.85rem 2.2rem 0.85rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--storm-light);
  background: var(--surface);
  color: var(--anvil);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
.toast-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
}
.toast-actions button {
  margin: 0;
  padding: 0.45rem 0.85rem;
}
.toast-close {
  position: absolute;
  top: 0.3rem;
  right: 0.4rem;
  border: 0;
  background: none;
  color: var(--rain);
  font-size: 1.3rem;
  line-height: 1;
  padding: 0.2rem 0.4rem;
}
.form-page.wide {
  max-width: 44rem;
}
.form-page h2 {
  font-size: 1.1rem;
  font-weight: 750;
  margin: 1.5rem 0 0.4rem;
}
.list .request {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.65rem 0;
}
.request .primary.small {
  margin: 0;
  padding: 0.4rem 0.8rem;
}
.dm-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin: 0.5rem 0 0;
}
.delete-account {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.delete-account summary {
  cursor: pointer;
  color: var(--siren);
  font-weight: 650;
}

/* ---------- Phones and iPads ---------- */

html {
  -webkit-tap-highlight-color: transparent;
}
a,
button,
select,
summary,
input {
  touch-action: manipulation;
}

/* The tab bar: shown on phones and iPads in portrait, hidden on wide screens. */
.tabbar {
  display: none;
}
@media (max-width: 1023px) {
  body {
    padding-bottom: calc(68px + env(safe-area-inset-bottom));
  }
  .tagline {
    display: none;
  }
  .account-nav {
    display: none;
  }
  .masthead {
    padding-top: calc(0.7rem + env(safe-area-inset-top));
    padding-left: calc(16px + env(safe-area-inset-left));
    padding-right: calc(16px + env(safe-area-inset-right));
  }
  .tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1500;
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: var(--surface);
    border-top: 1px solid var(--line);
  }
  .tabbar a {
    position: relative;
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    min-height: 64px;
    color: var(--rain);
    font-size: 0.85rem;
    font-weight: 650;
    text-decoration: none;
  }
  .tabbar a[aria-current='page'] {
    color: var(--anvil);
    box-shadow: inset 0 3px 0 var(--storm-light);
  }
  .tabbar .count {
    position: absolute;
    top: 6px;
    left: calc(50% + 6px);
  }
  .toasts {
    bottom: calc(80px + env(safe-area-inset-bottom));
    left: 16px;
    right: 16px;
    width: auto;
  }
  main,
  .safety {
    padding-left: calc(16px + env(safe-area-inset-left));
    padding-right: calc(16px + env(safe-area-inset-right));
  }

  /* Rooms: a shorter title, and the chat fills the screen with the message box always in reach. */
  .room-head h1 {
    font-size: clamp(1.3rem, 5.5vw, 1.9rem);
  }
  .room {
    margin-top: 0.5rem;
  }
  .tabs {
    position: sticky;
    top: 0;
    z-index: 500;
    background: var(--sky);
  }
  .tabs button {
    flex: 1;
    min-height: 48px;
    font-size: 1rem;
  }
  body.typing {
    padding-bottom: 0;
  }
  body.typing .tabbar {
    display: none;
  }
}

/* Comfortable tap targets wherever the screen is touched. */
@media (pointer: coarse) {
  .list a {
    padding: 0.85rem 0;
  }
  .link-button {
    padding: 0.4rem 0.1rem;
  }
  .theme-menu summary {
    padding: 0.55rem 0.9rem;
  }
  .swatches label {
    padding: 0.55rem 0.5rem;
  }
  .row-actions a,
  .row-actions button {
    display: inline-block;
    padding: 0.45rem 0;
  }
}

/* Team panel tables become stacked cards on narrow screens. */
@media (max-width: 760px) {
  .team-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .team-table,
  .team-table tbody,
  .team-table tr,
  .team-table th,
  .team-table td {
    display: block;
    width: 100%;
  }
  .team-table tr {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--line);
  }
  .team-table th,
  .team-table td {
    border: 0;
    padding: 0.2rem 0;
  }
  .team-table td[data-label]::before {
    content: attr(data-label) ': ';
    color: var(--rain);
    font-weight: 600;
  }
  .row-actions {
    white-space: normal;
    display: flex !important;
    flex-wrap: wrap;
    gap: 0.25rem 1.25rem;
  }
  .row-actions a,
  .row-actions button {
    margin-right: 0;
  }
}


/* Postcode requests in the Team panel */
.team-h2 {
  font-size: 1.05rem;
  font-weight: 750;
  margin: 1.25rem 0 0.4rem;
}
.postcode-request {
  display: grid;
  gap: 0.4rem;
  padding: 0.85rem 0;
}
.staff-note {
  width: 100%;
  max-width: 32rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--sky);
  color: var(--anvil);
  font: inherit;
}
.postcode-request .row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.postcode-request .primary.small {
  margin: 0;
  padding: 0.55rem 0.9rem;
}
.form-page h2 + .hint {
  margin-bottom: 0.25rem;
}
/* Staff tabs scroll sideways on narrow phones rather than squashing. */
.team-tabs {
  overflow-x: auto;
  scrollbar-width: none;
}
.team-tabs a {
  white-space: nowrap;
}

/* Power */
.power-card {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border-radius: 6px;
  border-left: 6px solid var(--siren);
}
.power-card h2,
.power-inline h2 {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
  font-weight: 800;
  font-stretch: 115%;
}
.power-card p {
  margin: 0.25rem 0;
}
/* The one big thing to tap when the lights go out. */
.power-button {
  display: block;
  width: 100%;
  max-width: 22rem;
  margin-top: 0.6rem;
  min-height: 56px;
  padding: 0.75rem 1rem;
  border: 0;
  border-radius: 6px;
  font-size: 1.1rem;
  font-weight: 750;
}
.power-button.out {
  background: var(--siren);
  color: var(--sky); /* white on the pale dark-theme red was too faint */
}
.power-button.back {
  background: var(--anvil);
  color: var(--sky);
}
.power-button:disabled {
  opacity: 0.6;
}
.power-inline {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border-radius: 6px;
  border-left: 6px solid var(--siren);
}
.power-strip {
  margin: 0.5rem 0 0;
  font-size: 0.95rem;
}
.quiet-list li {
  padding: 0.6rem 0;
}
.quiet-list .item-title {
  font-weight: 500;
}
.safety-box ul {
  margin: 0.25rem 0 0;
  padding-left: 1.2rem;
}
.safety-box li + li {
  margin-top: 0.4rem;
}
.room-side .list a {
  padding: 0.55rem 0;
}

/* Logo */
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.logo {
  width: 2.1rem;
  height: 2.5rem;
  flex: none;
}
/* The pin is always night navy; its edge is white on dark themes, like the logo. */
.logo-pin {
  fill: #0a1330;
  stroke: var(--anvil);
  stroke-width: 3;
  stroke-linejoin: round;
}
.logo-bubble {
  fill: #ffffff;
  stroke: #0a1330;
  stroke-width: 1.6;
  stroke-linejoin: round;
}
.logo-dots {
  fill: #0a1330;
}

/* Statistics on phones: the name on its own line, the bar and count underneath. */
@media (max-width: 599px) {
  .bar-table tr {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    column-gap: 0.6rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--line);
  }
  .bar-table th,
  .bar-table td {
    border-bottom: 0;
    padding: 0;
    width: auto;
  }
  .bar-table th {
    grid-column: 1 / -1;
    margin-bottom: 0.25rem;
  }
  .bar-count .hint {
    display: inline;
  }
}
.bar-table .hint {
  display: inline;
  margin: 0 0 0 0.25rem;
}

/* ---------- Chat ----------
   Messages read like a phone messenger: other people's on the left with a round letter picture,
   yours on the right in the theme colour. A run of messages from one person shares one name. */

.chat {
  display: flex;
  flex-direction: column;
  min-height: 420px;
  max-height: 72vh;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.chat-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.15rem 0.75rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
.chat-title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
}
.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #23a55a;
  box-shadow: 0 0 0 0 rgba(35, 165, 90, 0.5);
  animation: live-pulse 2.4s ease-out infinite;
}
.chat.ended .live-dot,
.chat.offline .live-dot {
  background: var(--rain);
  animation: none;
}
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(35, 165, 90, 0.45); }
  70%, 100% { box-shadow: 0 0 0 7px rgba(35, 165, 90, 0); }
}
.here-count {
  margin-left: auto;
  color: var(--rain);
}
.slow-note {
  flex-basis: 100%;
  color: var(--rain);
  font-size: 0.82rem;
}
.slow-note:empty {
  display: none;
}

.messages-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.messages {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 0.4rem 0.75rem 0.9rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
}

.msg {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  max-width: min(86%, 34rem);
  margin: 0;
}
.msg.first {
  margin-top: 0.65rem;
}
.msg.theirs {
  max-width: min(94%, 36rem);
}
.msg.mine {
  align-self: flex-end;
  max-width: min(84%, 34rem);
}
.msg.mine.first {
  margin-top: 0.5rem;
}

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--bruise-wash);
  color: var(--anvil);
  font-size: 0.9rem;
  font-weight: 750;
  line-height: 1;
}
.msg.first .avatar {
  margin-top: 1.3rem; /* level with the bubble, under the name */
}
.msg.together .avatar {
  height: 0;
  visibility: hidden;
}
.avatar.staff {
  background: var(--storm-light);
  color: var(--on-accent);
}

.msg-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}
.msg.mine .msg-body {
  align-items: flex-end;
}
.msg-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 1.3rem;
  margin-left: 0.7rem;
  font-size: 0.82rem;
}
.msg .who {
  font-weight: 700;
  color: var(--anvil);
}
.who-button {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  text-decoration: underline dotted var(--rain);
  text-underline-offset: 0.2em;
}
.who-button:hover {
  color: var(--bruise);
}

.bubble {
  padding: 0.5rem 0.85rem 0.45rem;
  border-radius: 18px;
  background: var(--sky);
  background: color-mix(in srgb, var(--anvil) 6%, var(--surface));
  color: var(--anvil);
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.msg.theirs .bubble {
  border-top-left-radius: 6px;
}
.msg.mine .bubble {
  border-top-right-radius: 6px;
  background: var(--bruise);
  color: var(--sky);
}
.bubble time {
  margin-left: 0.55rem;
  font-size: 0.72rem;
  white-space: nowrap;
  color: var(--rain);
}
.msg.mine .bubble time {
  color: inherit;
}

.msg.removed .bubble {
  background: transparent;
  border: 1px dashed var(--line);
  color: var(--rain);
}
.msg.removed .bubble .msg-text {
  text-decoration: line-through;
}
.removed-note {
  font-size: 0.78rem;
}

.msg-tools {
  display: flex;
  gap: 1rem;
  margin: 0.15rem 0.7rem 0;
  font-size: 0.78rem;
}
.msg-tools .link-button {
  color: var(--rain);
  text-decoration: none;
}
.msg-tools .link-button:hover,
.msg-tools .link-button:focus-visible {
  text-decoration: underline;
}
.msg-tools .danger-text {
  color: var(--siren);
}

.msg.system {
  align-self: center;
  max-width: 94%;
  margin: 0.7rem 0 0.2rem;
}
.system-note {
  display: inline-block;
  padding: 0.45rem 0.85rem;
  border-radius: 12px;
  background: var(--bruise-wash);
  font-size: 0.86rem;
  text-align: center;
}
.system-note time {
  margin-left: 0.25rem;
  font-size: 0.72rem;
  color: var(--rain);
  white-space: nowrap;
}

.day-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.9rem 0 0.1rem;
  color: var(--rain);
  font-size: 0.78rem;
  font-weight: 650;
}
.day-divider::before,
.day-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.empty-room {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: auto;
  padding: 2rem 1rem;
  max-width: 22rem;
  text-align: center;
  color: var(--rain);
}
.empty-room strong {
  color: var(--anvil);
  font-size: 1.05rem;
}

.jump-new {
  position: absolute;
  left: 50%;
  bottom: 0.7rem;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.95rem;
  border: 0;
  border-radius: 999px;
  background: var(--anvil);
  color: var(--sky);
  font-size: 0.86rem;
  font-weight: 650;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}
.jump-new[hidden] {
  display: none;
}

.composer-slot {
  border-top: 1px solid var(--line);
}
.composer-slot:empty {
  display: none;
}
.composer {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.6rem 0.6rem 0.6rem 0.75rem;
}
.composer-field {
  display: flex;
  align-items: flex-end;
  flex: 1;
  min-width: 0;
  background: var(--sky);
  border: 1.5px solid var(--line);
  border-radius: 22px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.composer-field:focus-within {
  border-color: var(--bruise);
  box-shadow: 0 0 0 3px var(--bruise-wash);
}
.composer textarea {
  flex: 1;
  min-width: 0;
  max-height: 132px;
  padding: 0.6rem 1rem;
  border: 0;
  background: transparent;
  color: var(--anvil);
  font: inherit;
  line-height: 1.4;
  resize: none;
}
/* The ring round the whole box shows where typing goes. */
.composer textarea:focus-visible {
  outline: none;
}
.char-left {
  padding: 0 0.9rem 0.7rem 0;
  color: var(--rain);
  font-size: 0.75rem;
  white-space: nowrap;
}
.char-left:empty {
  display: none;
}
.send-button {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--bruise);
  color: var(--sky);
  transition: transform 0.12s, opacity 0.15s;
}
.send-button:disabled {
  opacity: 0.4;
  cursor: default;
}
.send-button:not(:disabled):active {
  transform: scale(0.92);
}

.composer-note {
  margin: 0.6rem;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  background: var(--bruise-wash);
  font-size: 0.92rem;
}
.composer-note.problem {
  margin-bottom: 0;
  background: color-mix(in srgb, var(--siren) 14%, transparent);
}
.composer-note .button,
.composer-note button {
  margin: 0.4rem 0.5rem 0 0;
}
.countdown {
  margin: 0.6rem 0.6rem 0;
  padding: 0.55rem 0.9rem;
  border-radius: 12px;
  background: var(--bruise-wash);
  font-size: 0.92rem;
}
.countdown strong {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1023px) {
  .chat {
    min-height: 320px;
    max-height: none;
  }
  .send-button {
    width: 48px;
    height: 48px;
  }
  .composer textarea {
    padding: 0.75rem 1rem;
  }
  .msg-tools button,
  .who-button {
    padding: 0.35rem 0.1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot {
    animation: none;
  }
  .send-button,
  .composer-field {
    transition: none;
  }
}

/* ---------- Home ----------
   A Home button at the top of room pages (and the privacy page), a Home link in the desktop header,
   and the first tab of the tab bar on phones and iPads. */
.home-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 40px;
  padding: 0.35rem 0.95rem 0.35rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--anvil);
  font-size: 0.92rem;
  font-weight: 650;
  text-decoration: none;
}
.home-button:hover {
  border-color: var(--bruise);
  color: var(--bruise);
}
.home-button svg,
.home-link svg {
  width: 18px;
  height: 18px;
  flex: none;
}
.home-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.account-nav a[aria-current='page'] {
  text-decoration-thickness: 2px;
  text-decoration-color: var(--storm-light);
}
@media (pointer: coarse) {
  .home-button {
    min-height: 44px;
  }
}
.room-head .home-button,
.policy .home-button {
  margin-bottom: 0.4rem;
}

/* Role picker on a member's profile (admins only) */
.role-form fieldset {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  border: 0;
  max-width: 38rem;
}
.role-option {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.75rem 0.9rem;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
}
.role-option:has(input:checked) {
  border-color: var(--bruise);
  background: var(--bruise-wash);
}
.role-option:has(input:disabled) {
  opacity: 0.55;
  cursor: not-allowed;
}
.role-option input {
  margin: 0.25rem 0 0;
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--bruise);
  flex: none;
}
.role-option > span {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.role-option .hint {
  font-size: 0.88rem;
}
.role-option:has(input:checked) .hint {
  color: var(--anvil);
}

/* Sign out: in the desktop header and at the top of the Me page. */
.signout-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 40px;
  margin: 0;
  padding: 0.4rem 0.9rem 0.4rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--anvil);
  font-weight: 650;
}
.signout-button:hover {
  border-color: var(--siren);
  color: var(--siren);
}
.signout-button svg {
  width: 18px;
  height: 18px;
  flex: none;
}
.account-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}
.account-head h1 {
  margin-right: auto;
}
@media (pointer: coarse) {
  .signout-button {
    min-height: 44px;
  }
}

/* Timeout or ban dialog, and the ban page */
.choice-list {
  display: grid;
  gap: 0.5rem;
  margin: 0.75rem 0 0;
  padding: 0;
  border: 0;
}
.choice-list legend {
  margin-bottom: 0.4rem;
  font-weight: 650;
}
.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.profile-actions .button {
  margin: 0;
}
.banned-page h1 {
  color: var(--siren);
}

/* Rooms staff open: the map to draw the circle on, and the room's description */
.new-room-map {
  height: 340px;
  margin: 0.75rem 0 0.25rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: crosshair;
}
.new-room input[type='range'] {
  width: 100%;
  accent-color: var(--bruise);
}
.new-room textarea {
  width: 100%;
  font: inherit;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--anvil);
  resize: vertical;
}
.room-about {
  max-width: 62ch;
  margin: 0.5rem 0 0;
}
/* Choice cards inside a form page: the radio sits beside its text, not above it. */
.form-page .role-option {
  display: flex;
  margin-top: 0;
  font-weight: 400;
}
.form-page .role-option input {
  width: 1.15rem;
}
/* The tagline gives way before the header's links wrap. */
@media (max-width: 1400px) {
  .tagline {
    display: none;
  }
}

/* A room's chat for someone outside its area: a calm note in place of the messages. */
.locked-chat .chat-title svg {
  width: 18px;
  height: 18px;
  color: var(--storm-light);
}
.locked-body {
  padding: 1.25rem 1.1rem 1.4rem;
}
.locked-body > p:first-child {
  margin-top: 0;
  font-size: 1.05rem;
}
.locked-actions .button {
  margin-right: 0.4rem;
}
