:root {
  --bg: #0b141a;
  --panel: #111b21;
  --panel-2: #1f2c34;
  --accent: #00a884;
  --text: #e9edef;
  --muted: #8696a0;
  --bubble-me: #005c4b;
  --bubble-them: #202c33;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 720px;
  margin: 0 auto;
}

.screen { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.hidden { display: none !important; }

/* ---------- Lobby ---------- */
#lobby { padding: 24px 18px; gap: 18px; justify-content: center; }

#lobby h1 {
  margin: 0;
  font-size: 40px;
  letter-spacing: 1px;
  text-align: center;
  color: var(--accent);
}
.tagline { margin: 0 0 8px; text-align: center; color: var(--muted); }

.card {
  background: var(--panel);
  border: 1px solid var(--panel-2);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card h2 { margin: 0; font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }

.code-row { display: flex; gap: 10px; align-items: center; }
.code {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
  color: var(--accent);
  word-break: break-all;
  user-select: all;
}
.hint { margin: 0; font-size: 13px; color: var(--muted); }

.input {
  flex: 1;
  min-width: 0;
  background: var(--panel-2);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 16px;
  color: var(--text);
  outline: none;
}
.input:focus { border-color: var(--accent); }

.btn {
  background: var(--panel-2);
  color: var(--text);
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn.primary { background: var(--accent); color: #04231c; }
.btn:active { opacity: .8; }

.status { text-align: center; min-height: 20px; color: var(--muted); font-size: 14px; margin: 0; }
.status.error { color: #f15c6d; }

/* ---------- Chat ---------- */
.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--panel-2);
}
.peer-name { font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.online { background: var(--accent); }
.dot.offline { background: #f15c6d; }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bubble {
  max-width: 78%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.35;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.bubble.me { align-self: flex-end; background: var(--bubble-me); border-bottom-right-radius: 3px; }
.bubble.them { align-self: flex-start; background: var(--bubble-them); border-bottom-left-radius: 3px; }
.bubble .time { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; text-align: right; }
.system { align-self: center; color: var(--muted); font-size: 12px; padding: 4px 0; text-align: center; }

.compose {
  display: flex;
  gap: 10px;
  padding: 12px;
  background: var(--panel);
  border-top: 1px solid var(--panel-2);
}
.send { padding: 12px 20px; }
