
:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: #e9edf7;
  background: #111827;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --muted: #9aa7bd;
  --line: #303b50;
  --accent: #9de8cb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 36px 16px;
  background:
    radial-gradient(ellipse at top left, #24334a 0, transparent 45%),
    #111827;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.app {
  width: min(820px, 100%);
  margin: 0 auto;
}

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

.eyebrow,
.reply-label {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 44px);
  letter-spacing: -0.04em;
}

h1 span {
  color: var(--accent);
}

.subtitle,
.chat-toolbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.connection {
  flex-shrink: 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #f4bd91;
  font-size: 12px;
}

.connection.online {
  color: var(--accent);
  border-color: #356956;
}

.chat-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #192235;
  box-shadow: 0 25px 80px #0003;
}

.chat-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

h2 {
  margin: 0;
  font-size: 17px;
}

.count {
  color: var(--muted);
  font-size: 12px;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 300px;
  max-height: 55vh;
  overflow-y: auto;
  padding: 24px;
}

.empty-state {
  margin: auto;
  padding: 35px 10px;
  color: var(--muted);
  text-align: center;
}

.message-card {
  width: fit-content;
  max-width: 85%;
  padding: 13px 15px;
  border: 1px solid #344056;
  border-radius: 5px 16px 16px;
  background: #222e43;
  overflow-wrap: anywhere;
}

.message-card.mine {
  align-self: flex-end;
  border-color: #376655;
  border-radius: 16px 5px 16px 16px;
  background: #203c3b;
}

.message-header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
}

.message-author {
  color: var(--accent);
  font-size: 13px;
}

.message-header time {
  color: var(--muted);
  font-size: 11px;
}

.message-text {
  margin: 8px 0 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.quoted-message {
  margin-top: 10px;
  padding: 8px 10px;
  border-left: 3px solid var(--accent);
  border-radius: 3px;
  background: #101a2a80;
  color: #c3d0df;
  font-size: 12px;
}

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

.action-button,
.icon-button {
  border: 1px solid #3b4860;
  border-radius: 9px;
  padding: 6px 9px;
  background: #172033;
  color: #dce4f2;
  font-size: 12px;
}

.action-button:hover,
.icon-button:hover {
  border-color: var(--accent);
}

.reply-preview {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  border-top: 1px solid var(--line);
  background: #202d40;
}

.reply-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.reply-label {
  margin: 0;
  font-size: 10px;
}

#reply-summary {
  overflow: hidden;
  color: #cbd5e1;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer {
  padding: 18px 24px 14px;
  border-top: 1px solid var(--line);
  background: #151e2f;
}

#username,
#message {
  width: 100%;
  border: 1px solid #39465d;
  border-radius: 10px;
  outline: none;
  background: #101827;
  color: #f5f7fb;
}

#username {
  max-width: 260px;
  margin-bottom: 10px;
  padding: 10px 12px;
}

#message {
  min-height: 48px;
  max-height: 150px;
  padding: 12px;
  resize: vertical;
}

#username:focus,
#message:focus {
  border-color: var(--accent);
}

.compose-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.send-button {
  flex-shrink: 0;
  align-self: flex-end;
  padding: 13px 18px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #14251f;
  font-weight: 800;
}

.send-button:hover:not(:disabled) {
  background: #c3f8e4;
}

.composer-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 11px;
}

#feedback {
  text-align: right;
}

.footer {
  padding: 18px 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 540px) {
  body {
    padding: 18px 10px;
  }

  .header {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .chat-toolbar,
  .messages,
  .composer {
    padding-right: 14px;
    padding-left: 14px;
  }

  .message-card {
    max-width: 96%;
  }

  .compose-row {
    flex-direction: column;
  }

  .send-button {
    align-self: stretch;
  }
}
