:root {
  --bg: #12141c;
  --panel: #1a1d29;
  --panel-2: #232736;
  --line: #2f3447;
  --text: #eceff7;
  --muted: #9aa2b7;
  --accent: #ffb454;
  --accent-ink: #2b1c05;
  --good: #4ade80;
  --bad: #fb7185;
  --radius: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

h1, h2, h3, p { margin: 0; }
h2 { font-size: 15px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
small { font-size: 12px; }
a { color: inherit; }

.muted { color: var(--muted); }
.error { color: var(--bad); font-size: 13px; }

button {
  font: inherit;
  font-weight: 550;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  min-height: 34px;
  cursor: pointer;
}
button:hover { border-color: var(--muted); }
button:disabled { opacity: .55; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover { filter: brightness(1.07); }
button.ghost { background: transparent; }
button.chosen { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.link, a.link {
  background: none;
  border: 0;
  padding: 2px 4px;
  min-height: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}
button.link:hover, a.link:hover { color: var(--text); }
button.danger { color: var(--bad); }

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

input, select, textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}
textarea { resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
input::placeholder { color: #6c7489; }

.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field > span { font-size: 13px; font-weight: 550; }
.field small { color: var(--muted); }

.brand {
  font-weight: 750;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -.01em;
}

/* Home */

.home { max-width: 860px; margin: 0 auto; padding: 56px 16px; }
.hero { margin-bottom: 32px; }
.hero h1 { font-size: clamp(30px, 6vw, 46px); line-height: 1.1; letter-spacing: -.02em; margin: 8px 0 12px; }
.lede { color: var(--muted); font-size: 17px; max-width: 58ch; }
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.card h2 { margin-bottom: 12px; }
.card > button { align-self: flex-start; margin-top: 4px; }
.room-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }

/* The home page's text for people and crawlers. It sits outside the app, so it steps aside when a
   room takes over the page. */
.about { max-width: 860px; margin: 0 auto; padding: 0 16px 56px; color: var(--muted); }
.about h2 { color: var(--text); font-size: 20px; margin: 32px 0 8px; }
.about h2:first-child { margin-top: 0; }
.about p, .about ol, .about dl { max-width: 68ch; margin: 0; }
.about ol { padding-left: 20px; }
.about li + li { margin-top: 4px; }
.about dt { color: var(--text); font-weight: 650; margin-top: 12px; }
.about dt:first-child { margin-top: 0; }
.about dd { margin: 2px 0 0; }
.about a { color: var(--accent); }
.about code { overflow-wrap: anywhere; }
#app:not(:has(.home)):not(:empty) ~ .about { display: none; }

/* Room */

.room { max-width: 1240px; margin: 0 auto; padding: 12px 16px 40px; display: grid; gap: 14px; }

.top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.top h1 { font-size: 18px; font-weight: 650; }
.top-actions { margin-left: auto; display: flex; gap: 8px; }

.live {
  font: 700 11px/1 ui-monospace, Consolas, monospace;
  letter-spacing: .06em;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--muted);
}
.live.on { background: #e5484d; color: #fff; }
.clock { font: 13px ui-monospace, Consolas, monospace; color: var(--muted); }

.stage {
  position: relative;
  container-type: inline-size;
  aspect-ratio: 480 / 252;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #2a3450;
}
.stage canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.stage-overlay { position: absolute; inset: 0; pointer-events: none; }

.board {
  position: absolute;
  left: 31.9%;
  top: 3.6%;
  width: 36.2%;
  height: 17.2%;
  color: #20283e;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
  font-size: clamp(8px, 1.15cqw, 14px);
  padding: 0 1cqw;
  overflow: hidden;
}
.board small { font: 700 .75em ui-monospace, Consolas, monospace; letter-spacing: .1em; color: #9a5b16; }
.board b { font-size: 1.25em; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.bot-tag {
  position: absolute;
  width: 0;
  height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: clamp(8px, 1cqw, 12px);
  pointer-events: none;
}
.bot-chip {
  position: absolute;
  top: .35em;
  display: inline-flex;
  align-items: center;
  gap: .4em;
  max-width: 17em;
  padding: .12em .6em;
  border-radius: 999px;
  background: rgba(20, 23, 34, .86);
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: auto;
}
.bot-chip span { overflow: hidden; text-overflow: ellipsis; }
.bot-chip i { width: .6em; height: .6em; border-radius: 50%; flex: none; }
.bot-chip .bot-doing { color: #7fd4ff; flex: none; }
.bot-chip .bot-doing:empty { display: none; }
.bot-tag.drop .bot-chip { top: 2em; }

.bubble {
  position: absolute;
  bottom: 5cqw;
  width: max-content;
  max-width: 22em;
  padding: .4em .7em;
  border-radius: 8px;
  background: #fff;
  color: #1b2030;
  font-size: 1.1em;
  line-height: 1.3;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .3);
  z-index: 2;
}
.bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -.35em;
  width: .7em;
  height: .7em;
  background: #fff;
  transform: translateX(-50%) rotate(45deg);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: -6px;
  font-size: 12px;
}
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; }
.legend-key { color: var(--muted); margin-left: auto; }

.stage-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
  background: rgba(18, 20, 28, .35);
  font-weight: 600;
}
.stage-empty[hidden] { display: none; }

.tiles { display: grid; gap: 10px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tiles.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tile {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: grid;
  gap: 2px;
  align-content: start;
  min-width: 0;
}
.tile span { font-size: 12px; color: var(--muted); }
.tile b { font-size: 22px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.tile small { color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.columns { display: grid; gap: 14px; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
.side { display: grid; gap: 14px; min-width: 0; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  min-width: 0;
}
.panel > h2 { margin-bottom: 10px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.list { display: grid; gap: 10px; }

.chat { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 12px; }
.chat > h2 { margin-bottom: 0; }
.chat-log { height: min(62vh, 620px); overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-right: 4px; }
.chat-form { display: flex; gap: 8px; }

.msg { display: flex; gap: 10px; min-width: 0; }
.msg.system { justify-content: center; color: var(--muted); font-size: 13px; text-align: center; }
.avatar {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  color: #14161f;
}
.msg-body { min-width: 0; }
.msg-head { display: flex; flex-wrap: wrap; gap: 0 8px; align-items: baseline; font-size: 13px; }
.msg-body p { overflow-wrap: anywhere; white-space: pre-wrap; }

.event { display: flex; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.event.confirmed { border-color: var(--accent); }
.date {
  flex: none;
  width: 44px;
  height: 50px;
  border-radius: 6px;
  background: var(--panel-2);
  display: grid;
  place-content: center;
  text-align: center;
  line-height: 1.1;
}
.date small { font-size: 10px; font-weight: 700; color: var(--accent); }
.date b { font-size: 18px; }
.event-body { min-width: 0; flex: 1; display: grid; gap: 4px; }
.event-body p { font-size: 13px; overflow-wrap: anywhere; }
.pill { color: var(--muted); }
.pill.on { color: var(--accent); font-weight: 650; }
.rsvps { display: flex; flex-wrap: wrap; gap: 4px; }
.rsvp { font-size: 12px; padding: 1px 7px; border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.rsvp.yes { color: var(--good); }
.rsvp.no { color: var(--bad); }
.rsvp.maybe { color: var(--accent); }
.event-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.event-actions button:not(.link) { min-height: 30px; padding: 3px 10px; font-size: 13px; }

.check-in { display: grid; gap: 3px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.check-in.waiting { border-color: var(--accent); }
.check-in p { font-size: 14px; overflow-wrap: anywhere; }
.check-in-status { color: var(--muted); }
.check-in.waiting .check-in-status { color: var(--accent); }
.check-in.go .check-in-status { color: var(--good); }
.check-in.hold .check-in-status { color: var(--bad); }

.crew-row { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; min-width: 0; }
.crew-main { min-width: 0; flex: 1 1 150px; display: grid; }
.crew-main small { overflow-wrap: anywhere; }
.crew-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.doorbell { font-size: 11px; padding: 0 6px; border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.doorbell.listening { color: var(--good); }
.doorbell.paused { color: var(--accent); }
.crew-actions { display: flex; flex: none; margin-left: auto; }
.state { flex: none; width: 9px; height: 9px; border-radius: 50%; background: #5b6278; }
.state.active { background: var(--good); }
.state.idle { background: var(--accent); }
.state.working { background: #7fd4ff; }
.swatch { display: inline-block; width: 7px; height: 7px; border-radius: 2px; margin-right: 5px; }

.note { padding: 8px 10px; background: var(--panel-2); border-radius: 8px; }
.note p { font-size: 14px; overflow-wrap: anywhere; }

/* Dialogs */

.modal {
  width: min(520px, calc(100vw - 32px));
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.modal::backdrop { background: rgba(6, 8, 14, .65); }
.modal p { margin-bottom: 12px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h2 { font-size: 17px; }
.modal-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 12px; }
.copy-row { display: flex; gap: 8px; }
.steps { margin: 12px 0 0; padding-left: 18px; color: var(--muted); font-size: 14px; display: grid; gap: 4px; }
.steps b { color: var(--text); }
.also { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; }
.also h3 { width: 100%; font-size: 14px; }

@media (max-width: 960px) {
  .columns { grid-template-columns: minmax(0, 1fr); }
  .chat { position: static; }
  .chat-log { height: 50vh; }
  .tiles, .tiles.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .legend-key { margin-left: 0; }
  .top-actions { margin-left: 0; width: 100%; }
  .top-actions button { flex: 1; }
}

/* Cities and houses */

a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 550;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  min-height: 34px;
  text-decoration: none;
}
a.button:hover { border-color: var(--muted); }
a.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.stack { display: grid; gap: 10px; align-content: start; }
.stack > h2, .stack > h3 { margin-bottom: 0; }
.stack > * { min-width: 0; }
.stack > a.button, .stack > button { justify-self: start; }
textarea.plain { font-family: inherit; font-size: 14px; }

.cities { margin-bottom: 16px; }
.cities .panel-head { margin-bottom: 6px; }
.cities .panel-head h2 { margin: 0; }
.cities .room-list { margin: 0; }

.flash {
  padding: 8px 12px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--panel);
  font-size: 14px;
}
.flash[hidden] { display: none; }

.city-stage { width: 100%; max-width: 1000px; justify-self: center; aspect-ratio: 48 / 29; }
.city-caption { display: grid; gap: 2px; max-width: 1000px; justify-self: center; width: 100%; }
.city-title { font-size: 17px; }
.city-caption p { overflow-wrap: anywhere; }
.legend-note, .city-caption .muted { font-size: 13px; }

/* Clickable places on the map. The list under it does the same job for keyboards. */
.map-hit {
  position: absolute;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  pointer-events: auto;
  cursor: pointer;
}
.map-hit:hover { border: 0; background: rgba(255, 255, 255, .1); }
.map-label {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  max-width: 10em;
  padding: .1em .6em;
  border-radius: 999px;
  background: rgba(20, 23, 34, .82);
  color: #fff;
  font-size: clamp(7px, 1.05cqw, 12px);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.square-hit .map-label { top: 5%; transform: translate(-50%, 0); }
.lot-hit .map-label { top: auto; bottom: 0; transform: translate(-50%, 0); }
@container (max-width: 560px) {
  .map-label { display: none; }
  .map-hit:hover .map-label { display: block; }
}

.where { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.where-house { display: grid; gap: 4px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.where-house p { font-size: 13px; }
.house-btn {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 10px;
  width: 100%;
  min-width: 0;
  text-align: left;
}
.house-name { overflow-wrap: anywhere; }
.house-btn small { color: var(--muted); }
.where-bots { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; }
.where-bot { display: flex; align-items: center; gap: 8px; min-width: 0; }
.where-bot-main { min-width: 0; flex: 1; display: grid; }
.where-bot-main small { overflow-wrap: anywhere; }
.where-bot .swatch { flex: none; margin: 0; }

.ask { display: grid; gap: 4px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.ask p { font-size: 14px; overflow-wrap: anywhere; }
.goal {
  padding-left: 8px;
  border-left: 2px solid var(--accent);
  white-space: pre-wrap;
}
.panel.waiting { border-color: var(--accent); }
.panel.waiting[hidden], .panel[hidden] { display: none; }

.house { max-width: 820px; margin: 0 auto; padding: 12px 16px 40px; display: grid; gap: 14px; }
.top-link { margin-left: auto; font-size: 14px; }
.rooms, .people, .rows, .recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rooms li { display: grid; gap: 2px; }
.rooms small { overflow-wrap: anywhere; }
.people li { display: flex; align-items: center; gap: 6px; }
.row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; min-width: 0; }
.row-main { display: grid; min-width: 0; flex: 1 1 180px; }
.row-main small { overflow-wrap: anywhere; }
.row-actions { display: flex; gap: 6px; align-items: center; }
.row > .error { flex-basis: 100%; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.toggle input { width: auto; }
.recent { font-size: 13px; }
.status-ok { color: var(--good); }
.status-attention { color: var(--bad); }

.guest-banner {
  padding: 10px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--panel);
  overflow-wrap: anywhere;
}
.guest-banner[hidden] { display: none; }
.guest-tag { font-size: 11px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 650; }
