* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
  width: 100%;
  border-bottom: 1px solid #ccc;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 5;
}

#logo {
  margin: 0;
  color: #000;
  font-size: 8px;
  line-height: 1.1;
  white-space: pre;
  overflow-x: auto;
  max-width: 100%;
}

#bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

main {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 12px 12px 48px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

#panel {
  width: 100%;
  padding: 0 0 8px;
  background: #fff;
}

@media (min-width: 769px) {
  main:not(:has(#feed .item)) {
    justify-content: center;
    min-height: calc(100dvh - 120px);
  }
}

#f {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

#note {
  margin: 0;
  font-size: 0.85rem;
  color: #444;
}

.hidden {
  display: none !important;
}

#modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

#modalBg {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

#modalBox {
  position: relative;
  width: min(720px, 100%);
  max-height: min(80vh, 100%);
  overflow: auto;
  background: #fff;
  padding: 12px;
}

#modalHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

#rooms {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 80px;
}

#rooms:empty::before {
  content: "no posts yet";
  color: #888;
}

#mode {
  flex: 0 0 auto;
  font-size: 16px;
}

#q {
  flex: 1 1 180px;
  min-width: 0;
  font-size: 16px;
}

button {
  flex: 0 0 auto;
}

#feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.item {
  border-top: 1px solid #ccc;
  padding-top: 12px;
}

.item img,
.item video {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}

.item audio {
  width: 100%;
}

.meta {
  word-break: break-word;
}

.meta a {
  color: LinkText;
}

.meta pre.ascii {
  margin: 8px 0 0;
  padding: 8px;
  overflow-x: auto;
  white-space: pre;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.2;
  border: 1px solid #ddd;
  background: #fafafa;
}

.meta .prose {
  white-space: pre-wrap;
}

.who {
  color: #666;
  font-size: 0.85rem;
  margin-bottom: 4px;
}

@media (max-width: 640px) {
  #logo {
    font-size: 5px;
  }
}

@media (max-width: 480px) {
  header {
    flex-direction: column;
    align-items: flex-start;
  }

  #f {
    flex-direction: column;
  }

  #mode,
  #q,
  #f > button {
    width: 100%;
  }
}
