:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #202124;
  --muted: #676f7a;
  --line: #d9dee5;
  --accent: #0f766e;
  --murmur: #6d5dfc;
  --question: #1f6feb;
  --notice: #c47d12;
  --star: #c026d3;
  --action: #15803d;
  --danger: #b42318;
  --shadow: 0 10px 30px rgba(20, 25, 35, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "YuGothic", "Noto Sans JP", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
textarea,
input {
  font: inherit;
}

button {
  min-height: 42px;
  border: 1px solid transparent;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 247, 249, 0.94);
  backdrop-filter: blur(10px);
}

.brand {
  font-weight: 800;
  font-size: 19px;
}

.top-tools,
.navlinks {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.top-tools {
  justify-content: flex-end;
}

.navlinks a {
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 700;
}

.navlinks a.active {
  background: var(--ink);
  color: white;
}

.layout {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 28px;
  display: grid;
  gap: 18px;
}

.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 34px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.site-footer a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.participant-layout {
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  align-items: start;
}

.single-layout {
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  align-items: start;
}

.host-layout {
  grid-template-columns: 310px minmax(0, 1fr);
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.composer {
  position: sticky;
  top: 78px;
  padding: 18px;
}

.composer-message {
  min-height: 22px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  line-height: 1.25;
}

h2 {
  font-size: 15px;
  margin: 18px 0 10px;
}

h2:first-child {
  margin-top: 0;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 8px 11px;
  font-weight: 800;
}

.chip.selected {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.chip.murmur.selected,
.stat.murmur strong,
.kind-mark.murmur {
  background: var(--murmur);
}

.chip.question.selected,
.stat.question strong,
.kind-mark.question {
  background: var(--question);
}

.chip.notice.selected,
.stat.notice strong,
.kind-mark.notice {
  background: var(--notice);
}

.chip.star.selected,
.stat.star strong,
.kind-mark.star {
  background: var(--star);
}

.chip.action.selected,
.stat.action strong,
.kind-mark.action {
  background: var(--action);
}

textarea {
  width: 100%;
  min-height: 160px;
  margin-top: 16px;
  padding: 14px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  line-height: 1.7;
}

textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.28);
  outline-offset: 2px;
}

.composer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.composer-actions input {
  display: none;
}

.primary-button,
.secondary-button,
.text-button,
.danger-button,
.reaction-button {
  border-radius: 8px;
  padding: 9px 14px;
  font-weight: 800;
}

.primary-button {
  background: var(--accent);
  color: white;
}

.secondary-button,
.reaction-button {
  background: #eef2f7;
  color: var(--ink);
  border-color: var(--line);
}

.reaction-button.selected {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.text-button {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.danger-button {
  color: var(--danger);
  background: #fff5f3;
  border-color: #f1c2bd;
}

.stream-panel {
  min-width: 0;
  padding: 18px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.filters {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.filter-kind .chip,
.sort .chip {
  min-height: 36px;
  padding: 7px 10px;
  font-size: 14px;
}

.timeline {
  display: grid;
  gap: 12px;
}

.post {
  border: 1px solid var(--line);
  border-left: 7px solid var(--accent);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.post.murmur {
  border-left-color: var(--murmur);
}

.post.question {
  border-left-color: var(--question);
}

.post.notice {
  border-left-color: var(--notice);
}

.post.star {
  border-left-color: var(--star);
}

.post.action {
  border-left-color: var(--action);
}

.hidden-post {
  opacity: 0.48;
}

.post-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.kind-mark {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  font-size: 16px;
}

.post-text {
  margin: 12px 0 0;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 17px;
}

.post.collapsed .post-text {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}

.expand-button {
  margin-top: 10px;
}

.post-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.replies-panel {
  display: grid;
  gap: 12px;
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.replies-list {
  display: grid;
  gap: 8px;
}

.reply {
  display: grid;
  gap: 5px;
  padding: 10px 11px;
  border-left: 3px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.reply-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.reply-text {
  margin: 0;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 15px;
}

.reply-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.reply-actions button {
  min-height: 34px;
  padding: 6px 9px;
  font-size: 13px;
}

.reply-form {
  display: grid;
  gap: 8px;
}

.reply-form textarea {
  min-height: 82px;
  margin-top: 0;
  padding: 10px 11px;
  font-size: 15px;
  line-height: 1.6;
}

.reply-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.reply-form-actions button {
  min-height: 38px;
  padding: 7px 12px;
}

.reply-message,
.reply-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.empty,
.fatal {
  padding: 34px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: #fff;
}

.host-side {
  position: sticky;
  top: 78px;
  padding: 18px;
}

.stats {
  display: grid;
  gap: 8px;
  margin: 14px 0 18px;
}

.stat {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat strong {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  height: 34px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-size: 18px;
}

.stat span {
  color: var(--muted);
  font-weight: 800;
}

.host-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.compact-stats {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  text-align: right;
}

.export-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.top-exports {
  margin-top: 0;
}

.export-links a {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
  font-weight: 800;
}

.wall {
  min-height: 100vh;
  padding: 22px;
  background: #101214;
  color: #fff;
}

.wall-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.wall h1 {
  font-size: 34px;
}

.wall-sub {
  color: rgba(255, 255, 255, 0.68);
  font-weight: 800;
}

.wall-timeline {
  margin-top: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wall .post {
  background: #fff;
  color: var(--ink);
  box-shadow: none;
}

.wall .post-text {
  font-size: 23px;
  line-height: 1.65;
}

.wall .post-footer {
  display: none;
}

.gift-layout {
  width: min(980px, calc(100% - 32px));
  margin: 28px auto 56px;
  display: grid;
  gap: 18px;
}

.gift-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.gift-head h1 {
  font-size: 34px;
}

.is-reconnecting::after {
  content: "再接続中";
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 30;
  padding: 8px 11px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  font-weight: 800;
}

.toast {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 40;
  padding: 10px 13px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 12, 16, 0.45);
}

.qr-modal {
  width: min(92vw, 380px);
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 22px;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.qr-modal svg {
  width: 260px;
  height: 260px;
}

.qr-modal p {
  max-width: 100%;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.modal-actions {
  display: flex;
  width: 100%;
  gap: 10px;
}

.modal-actions button {
  flex: 1;
}

.admin-page {
  width: min(1080px, calc(100% - 32px));
  margin: 28px auto 56px;
  display: grid;
  gap: 18px;
}

.admin-page h1 {
  font-size: 30px;
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.admin-password-form,
.create-board-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.create-board-form {
  grid-template-columns: minmax(0, 1fr) auto;
}

.admin-card input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
}

.create-board-message {
  min-height: 18px;
  margin: -6px 0 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.board-list {
  display: grid;
  gap: 10px;
}

.board-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.board-row h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.board-title-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  margin-bottom: 6px;
}

.board-title-form button {
  min-height: 38px;
  padding: 7px 10px;
}

.board-row p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.board-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.link-button {
  display: inline-grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
}

@media (max-width: 900px) {
  .participant-layout,
  .single-layout,
  .host-layout {
    grid-template-columns: 1fr;
  }

  .composer,
  .host-side,
  .topbar {
    position: static;
  }

  .layout {
    width: min(100% - 20px, 720px);
    margin-top: 14px;
  }

  .wall-timeline {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-tools {
    width: 100%;
    justify-content: flex-start;
  }

  .brand {
    font-size: 18px;
  }

  .composer-actions,
  .top-tools,
  .gift-head,
  .wall-head,
  .reply-form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .composer-actions button,
  .top-tools button,
  .reply-form-actions button,
  .export-links a {
    width: 100%;
    text-align: center;
  }

  .wall {
    padding: 14px;
  }

  .wall h1,
  .gift-head h1 {
    font-size: 27px;
  }

  .wall .post-text {
    font-size: 19px;
  }

  .admin-password-form,
  .create-board-form,
  .board-row,
  .board-title-form {
    grid-template-columns: 1fr;
  }

  .admin-head {
    align-items: stretch;
    flex-direction: column;
  }

  .board-actions,
  .modal-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
