/* App pages. Normal document flow. The browser owns the keyboard. */
[hidden] { display: none !important; }
.app-page {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.app-page .site-nav { flex: none; }
.app-page main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 12px;
}
.app-page h1 {
  font-size: 28px;
  line-height: 1.2;
  margin: 0;
}
.hint, .status {
  color: var(--muted);
  margin: 0;
  font-size: 16px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}
.stack { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

button, .app-page input, .app-page textarea, .app-page select {
  font: inherit;
  color: var(--text);
}
.app-page input, .app-page textarea, .app-page select {
  width: 100%;
  min-height: 52px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.app-page button, .app-page summary {
  min-height: 52px;
  min-width: 52px;
  padding: 0 16px;
  border-radius: 12px;
  border: 0;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  cursor: pointer;
}
.app-page summary {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
}
.app-page summary::-webkit-details-marker { display: none; }
.app-page summary h1 {
  margin: 0;
  font-size: 22px;
}
.app-page button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.app-page button[disabled] { opacity: .5; cursor: not-allowed; }

#log, #people, #posts, #thread {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#log, #thread { gap: 2px; }
.person, .post {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.msg {
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  font-size: 14px;
  line-height: 1.35;
}
.msg strong, .msg p {
  display: inline;
  margin: 0;
  font-size: inherit;
  line-height: inherit;
}
.msg strong {
  font-weight: 700;
  color: var(--accent);
}
.msg strong::after { content: ": "; }
.msg.notice {
  color: var(--muted);
}
.msg.notice strong::after { content: none; }
.msg img, .post img {
  border-radius: 12px;
}
.msg img {
  display: inline-block;
  max-width: 96px;
  max-height: 64px;
  margin: 0 6px;
  vertical-align: middle;
}
.post img {
  display: block;
  max-width: 100%;
  margin-top: 8px;
}
.person strong, .post strong { display: block; }
#people .person a {
  display: inline-flex;
  align-items: center;
  min-height: 52px;
  min-width: 52px;
  padding: 0 4px;
}
.map-pin {
  background: #14b8a6;
  color: #042f2e;
  padding: 4px 8px;
  border-radius: 8px;
  font: 14px Heebo, sans-serif;
  text-align: center;
  direction: rtl;
  max-width: 220px;
}
.map-pin .map-note {
  font-weight: 700;
  margin-bottom: 2px;
}
.map-pin .map-tags {
  font-size: 13px;
  line-height: 1.35;
  margin-bottom: 2px;
}
.map-profile {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.map-profile label { margin: 0; }
.app-page .map-profile input {
  flex: 1 1 160px;
  width: auto;
  min-width: 0;
}
#nick-alt[hidden], #nick-hint[hidden] { display: none; }
.map-bar, .map-note-box, .map-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  flex: none;
}
.map-bar button, .map-note-box button, .map-panel-actions button {
  flex: 1 1 0;
  min-width: 52px;
  min-height: 52px;
  padding: 0 8px;
}
.map-note-box input { flex: 1 1 auto; min-width: 0; }
.map-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: none;
  min-width: 0;
}
.map-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  max-height: 32vh;
  overflow: auto;
  min-width: 0;
}
.map-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  min-width: 52px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-weight: 700;
}
.app-page .map-choice input[type="checkbox"] {
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  padding: 0;
  flex: none;
  accent-color: var(--accent);
}
.map-choice:has(input:disabled) {
  color: var(--muted);
}
#map-error.is-muted { color: var(--muted); }
#filter-count {
  margin: 0;
  min-height: 52px;
  display: flex;
  align-items: center;
  font-weight: 700;
}
@media (max-width: 767px) {
  .map-bar button { flex: 1 1 22%; }
}
@media (min-width: 768px) {
  .map-choices { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.map-stage {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.map-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: none;
  min-width: 0;
}
.map-side:not(:has(#note-box:not([hidden]), #tags-box:not([hidden]), #filter-box:not([hidden]), #map-error:not(:empty))) {
  display: none;
}
#map { flex: 1 1 auto; min-height: 0; min-width: 0; }
.composer {
  flex: none;
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
}
.composer input, .composer textarea { flex: 1; min-width: 0; width: auto; }
.attach {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-height: 52px;
  min-width: 52px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}
.app-page .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  min-width: 0;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.file-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  min-height: 52px;
}
.file-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-chip button { flex: none; }
.room-switch { flex: none; }
.room-switch summary { cursor: pointer; }
#room-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
#room-list button {
  width: 100%;
  text-align: start;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
#room-list button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
#room-counts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
}
#board-error:empty, #map-error:empty { display: none; }

#map {
  flex: 1;
  min-height: 240px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}
/* Phones: the filter and tag panels float over the map so the pins stay visible. */
@media (max-width: 1023px) {
  .map-stage { position: relative; }
  #map {
    position: absolute;
    inset: 0;
    z-index: 1;
    height: auto;
    min-height: 0;
  }
  .map-side {
    position: absolute;
    z-index: 3;
    inset-inline: 0;
    bottom: 0;
    max-height: 46%;
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px 12px 0 0;
    padding: 8px;
  }
  .map-side .map-choices { max-height: 22vh; }
}
@media (min-width: 1024px) {
  .map-stage { position: static; flex-direction: row; align-items: stretch; }
  .map-side {
    position: static;
    inset: auto;
    z-index: auto;
    flex: 0 1 420px;
    width: 420px;
    max-width: 40%;
    max-height: 100%;
    overflow: auto;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
  }
  #map { position: relative; inset: auto; min-height: 60dvh; }
  .map-side .map-choices {
    grid-template-columns: 1fr 1fr;
    max-height: none;
  }
}
.guest-name {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.guest-name[hidden] { display: none !important; }
.guest-name label { margin: 0; }
.app-page .guest-name input {
  flex: 1 1 140px;
  width: auto;
  min-width: 0;
}
.guest-name button { min-height: 52px; min-width: 52px; }
.stage-videos {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.stage-videos video {
  width: 100%;
  max-height: 40dvh;
  background: #000;
  border-radius: 12px;
}
@media (min-width: 768px) {
  .stage-videos { grid-template-columns: 1fr 1fr; }
  .app-page main { padding: 16px 24px; }
}

.join-card { max-width: 480px; }
.app-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.app-body[hidden] { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
