body {
  font-family: Arial, sans-serif;
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 16px 48px;
  color: #1f2937;
  background: linear-gradient(180deg, #f6f8ff 0%, #eef2ff 100%);
}

h1,
h2,
p {
  margin-top: 0;
}

.panel {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 20px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  padding: 20px;
  margin-bottom: 20px;
}

.panel-collapsed {
  padding: 0;
  overflow: hidden;
}

.panel-collapsed > *:not(.panel-collapsed-strip) {
  display: none;
}

.panel-collapsed-strip {
  display: none;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #334155;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.panel-collapsed .panel-collapsed-strip {
  display: flex;
}

.panel-collapsed-label {
  flex: 1;
}

.panel-expand-button {
  padding: 8px 12px;
  border-radius: 10px;
  background: #1d4ed8;
  color: #fff;
  font-size: 0.86rem;
}

label {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  margin: 12px 0 8px;
}

.helper-text {
  margin: 8px 0 0;
  color: #64748b;
  font-size: 0.88rem;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-weight: 600;
}

.toggle-row input {
  width: auto;
  margin: 0;
}

input,
button {
  font: inherit;
}

.tag-input-row {
  display: flex;
  align-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.tag-input-row:focus-within {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

#addTagButton {
  white-space: nowrap;
  border-radius: 0;
  border-left: 1px solid #cbd5e1;
  background: #1d4ed8;
  padding: 12px 14px;
}

#booksInput {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
}

.suggestions {
  margin-top: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.12);
  overflow: hidden;
}

.suggestion-item {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
  color: #0f172a;
  border-radius: 0;
}

.suggestion-item:last-child {
  border-bottom: 0;
}

.suggestion-item:hover,
.suggestion-item.active {
  background: #eff6ff;
}

.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 12px;
  border-radius: 999px;
  background: #dbeafe;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  font-weight: 700;
}

.tag-chip-remove {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 999px;
  background: #1d4ed8;
  color: #fff;
  line-height: 1;
}

button {
  padding: 12px 18px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  background: #0f172a;
  color: #fff;
}

#joinButton,
#sendButton {
  margin-top: 14px;
}

#status {
  min-height: 1.2em;
  margin-bottom: 0;
  color: #334155;
}

.hidden {
  display: none;
}

.chat-header {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

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

.section-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-collapse-button {
  background: #334155;
}

.rooms-list {
  display: grid;
  gap: 12px;
}

.room-card {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 14px;
  padding: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.room-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.room-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.room-actions {
  margin-top: 12px;
}

.room-join-button {
  background: #1d4ed8;
}

.room-meta,
.empty-state {
  color: #64748b;
  font-size: 0.9rem;
}

.chat-messages {
  min-height: 280px;
  max-height: 420px;
  overflow-y: auto;
  display: grid;
  gap: 10px;
  padding: 4px 2px;
}

.message {
  padding: 12px 14px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.message.mine {
  background: #dbeafe;
  border-color: #bfdbfe;
}

.message-author {
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 4px;
}

.message-text {
  white-space: pre-wrap;
  line-height: 1.5;
}

.chat-compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-top: 16px;
}

#participants {
  font-size: 0.9rem;
  color: #475569;
  text-align: right;
}

.shared-tags {
  margin-top: 6px;
  color: #1d4ed8;
  font-weight: 700;
}

@media (max-width: 640px) {
  body {
    padding: 16px 12px 32px;
  }

  .chat-header,
  .chat-compose {
    grid-template-columns: 1fr;
    display: grid;
  }

  #participants {
    text-align: left;
  }
}