:root {
  --bg: #0f1115;
  --bg2: #171a21;
  --bg3: #1f232c;
  --border: #2a2f3a;
  --text: #e8e9ec;
  --text2: #9aa0ab;
  --accent: #ff5c8a;
  --accent2: #6c8cff;
  --ok: #3ecf8e;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
}
.screen { height: 100%; }
.hidden { display: none !important; }

#profile-screen { display: flex; align-items: center; justify-content: center; padding: 20px; }
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 380px;
}
.card h1 { margin: 0 0 4px; background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline { color: var(--text2); font-size: 14px; margin: 0 0 24px; }
label { display: block; font-size: 13px; color: var(--text2); margin: 14px 0 6px; }
input, textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
}
textarea { min-height: 70px; resize: vertical; }
button {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
button:hover { opacity: 0.9; }
#profile-save { width: 100%; margin-top: 20px; }
.fineprint { color: var(--text2); font-size: 11px; margin-top: 16px; line-height: 1.5; }

#main-screen { display: flex; flex-direction: column; height: 100%; }
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--bg2);
}
header > div { display: flex; align-items: center; gap: 10px; }
.pill {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  padding: 3px 9px; border-radius: 999px; background: var(--bg3); color: var(--text2);
}
.pill.offline { color: var(--text2); }
.pill.online { color: var(--ok); background: rgba(62,207,142,0.12); }
.pill.connecting { color: #f5b942; background: rgba(245,185,66,0.12); }
.pill.connected { color: var(--ok); background: rgba(62,207,142,0.12); }

.layout { display: flex; flex: 1; min-height: 0; }
#peer-list-panel {
  width: 260px; border-right: 1px solid var(--border); padding: 16px; overflow-y: auto; flex-shrink: 0;
}
#peer-list-panel h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--text2); margin: 0 0 12px; }
#peer-list { list-style: none; padding: 0; margin: 0; }
#peer-list li {
  padding: 10px 12px; border-radius: 8px; cursor: pointer; margin-bottom: 4px; font-size: 14px;
}
#peer-list li:hover, #peer-list li.active { background: var(--bg3); }
.muted { color: var(--text2); font-size: 13px; line-height: 1.6; }

#chat-panel { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#chat-placeholder { margin: auto; }
#chat-active { display: flex; flex-direction: column; height: 100%; }
.chat-header { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
#chat-log { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 65%; padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.4; }
.msg.mine { align-self: flex-end; background: var(--accent); color: white; border-bottom-right-radius: 4px; }
.msg.theirs { align-self: flex-start; background: var(--bg3); border-bottom-left-radius: 4px; }
.msg.unsent { align-self: flex-end; background: transparent; border: 1px dashed var(--border); color: var(--text2); border-bottom-right-radius: 4px; }
.msg .badge { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .3px; margin-top: 3px; opacity: 0.75; }
.chat-input-row { display: flex; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--border); }
.chat-input-row input { flex: 1; }
