:root {
  --bg: #0f1115;
  --bg-card: #171a21;
  --fg: #e6e6e6;
  --fg-dim: #8a8f98;
  --border: #2a2e37;
  --accent: #4fc3f7;
  --you: #4fd1c5;
  --them: #d68fff;
  --error: #f5c542;
  --green: #4caf50;
  --red: #e05d5d;
  --amber: #e0a53d;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
}

header {
  padding: 1.25rem 1rem 0.5rem;
  text-align: center;
}

header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.4rem;
}

.tagline {
  margin: 0;
  color: var(--fg-dim);
  font-size: 0.85rem;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  gap: 1rem;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

.entry-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  width: 100%;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  flex: 1 1 280px;
  max-width: 360px;
  width: 100%;
}

.card h2 {
  margin-top: 0;
  font-size: 1.05rem;
}

.card p {
  color: var(--fg-dim);
  font-size: 0.9rem;
}

label {
  display: block;
  margin: 0.75rem 0 0.25rem;
  font-size: 0.85rem;
  color: var(--fg-dim);
}

input[type="text"],
input[type="password"],
select {
  width: 100%;
  padding: 0.6rem 0.7rem;
  background: #0c0e12;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  font-size: 1rem;
}

button {
  margin-top: 1rem;
  width: 100%;
  padding: 0.65rem 0.9rem;
  background: var(--accent);
  color: #06222e;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
}

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

button:hover:not(:disabled) {
  filter: brightness(1.08);
}

.error-text {
  color: var(--error);
  font-size: 0.85rem;
  text-align: center;
}

.room-code {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-align: center;
  background: #0c0e12;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
  margin: 0.5rem 0;
}

.share-link-row {
  display: flex;
  gap: 0.5rem;
}

.share-link-row input {
  flex: 1;
}

.share-link-row button {
  width: auto;
  margin-top: 0;
  white-space: nowrap;
}

.status-text {
  text-align: center;
  font-size: 0.9rem;
  margin-top: 1rem;
}

.status-waiting {
  color: var(--amber);
}

.status-bar {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  text-align: center;
}

.status-bar.status-connected {
  color: var(--green);
  background: rgba(76, 175, 80, 0.1);
}

.status-bar.status-waiting {
  color: var(--amber);
  background: rgba(224, 165, 61, 0.1);
}

.status-bar.status-disconnected {
  color: var(--red);
  background: rgba(224, 93, 93, 0.1);
}

.blur-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--fg-dim);
  margin: 0;
  cursor: pointer;
  user-select: none;
}

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

.messages {
  flex: 1;
  width: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.5rem 0;
}

.text-wrap {
  position: relative;
}

.reveal-hint {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-style: italic;
  color: var(--fg);
  background: rgba(12, 14, 18, 0.55);
  border-radius: 4px;
  pointer-events: none;
  white-space: nowrap;
}

/* filter is applied per-element, so the hint has to be a sibling of
   .text (not nested inside it) — a blurred parent blurs everything
   painted as part of it, pseudo-elements included, so there's no way to
   keep a child crisp while its own ancestor is blurred. */
.messages.blur-mode .message:not(.revealed) .text-wrap {
  cursor: pointer;
}

.messages.blur-mode .message:not(.revealed) .text {
  filter: blur(8px);
  user-select: none;
}

.messages.blur-mode .message:not(.revealed) .reveal-hint {
  display: flex;
}

.message {
  max-width: 85%;
}

.message.from-me {
  align-self: flex-end;
  text-align: right;
}

.message .who {
  font-size: 0.75rem;
  font-weight: 700;
}

.message.from-me .who {
  color: var(--you);
}

.message:not(.from-me) .who {
  color: var(--them);
}

.message.is-error .who {
  color: var(--error);
}

.message .text {
  font-size: 0.95rem;
  word-break: break-word;
}

.message.is-error .text {
  color: var(--error);
}

.message .wire {
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.72rem;
  color: var(--fg-dim);
  word-break: break-all;
  margin-top: 0.15rem;
}

.send-form {
  display: flex;
  gap: 0.5rem;
  width: 100%;
  padding-top: 0.5rem;
}

.send-form input {
  flex: 1;
}

.send-form button {
  width: auto;
  margin-top: 0;
  padding: 0.65rem 1.2rem;
}

[hidden] {
  display: none !important;
}
