/* 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;
}
.msg, .person, .post {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.msg img, .post img {
  display: block;
  max-width: 100%;
  margin-top: 8px;
  border-radius: 12px;
}
.msg strong, .person strong, .post strong { display: block; }
.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 { display: none; }

#map {
  flex: 1;
  min-height: 240px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}
.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; }
.star { color: var(--focus); }
.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;
}
