*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #000;
  --card-bg:   #0a0a0a;
  --card-bd:   #1a1a1a;
  --line:      #181818;
  --text:      #c8c8cc;
  --dim:       #333;
  --muted:     #222;
  --accent:    #7c6af7;
  --font-mono: 'Fragment Mono', monospace;
  --font-ui:   'DM Sans', sans-serif;
  --ease:      cubic-bezier(0.4, 0, 0.2, 1);
  --card-w:    300px;
  --gap:       20px;       /* connector height */
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ── LAYOUT ── */
.screen {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── HEADER ── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid #0f0f0f;
  flex-shrink: 0;
}
.brand {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: #c8c8cc;
  letter-spacing: 0.04em;
}
.header-right { display: flex; align-items: center; gap: 12px; }
.reader-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.1em;
}
.auth-btn {
  background: transparent;
  border: 1px solid #161616;
  border-radius: 5px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.auth-btn:hover { border-color: #2a2a2a; color: #555; }
.author-name {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: #3a3a3a;
  letter-spacing: 0.05em;
}

/* ── VIEWPORT / FEED ── */
.viewport {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
}
.viewport::-webkit-scrollbar { width: 2px; }
.viewport::-webkit-scrollbar-thumb { background: #111; }

.feed {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 0 25vh;
  min-height: 100%;
  justify-content: flex-end;
}

/* ── EMPTY STATE ── */
.empty {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #1a1a1a;
  letter-spacing: 0.08em;
}

/* ── CONNECTOR LINE ── */
.connector {
  width: 1px;
  height: var(--gap);
  background: #111;
  flex-shrink: 0;
  /* opacity set by JS */
}

/* ── MESSAGE CARD ── */
.card {
  width: var(--card-w);
  background: var(--card-bg);
  border: 1px solid var(--card-bd);
  border-radius: 6px;
  padding: 9px 14px;
  flex-shrink: 0;
  /* opacity set by JS */
}
.card-meta {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 4px;
}
.card-user {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--dim);
  letter-spacing: 0.06em;
  text-transform: lowercase;
}
.card-time {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--muted);
}
.card-text {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text);
  word-break: break-word;
  white-space: pre-wrap;
}

/* entry animation */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card.new { animation: slideUp 0.25s cubic-bezier(0.25, 0.8, 0.25, 1) forwards; }

/* ── COMPOSER ── */
.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 28px 20px;
  border-top: 1px solid #0f0f0f;
  flex-shrink: 0;
}
.composer.hidden { display: none; }

.input {
  flex: 1;
  background: #0a0a0a;
  border: 1px solid #1a1a1a;
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  line-height: 1.5;
  padding: 11px 16px;
  outline: none;
  resize: none;
  min-height: 44px;
  max-height: 160px;
  overflow-y: hidden;
  transition: border-color 0.2s;
  scrollbar-width: none;
}
.input::-webkit-scrollbar { display: none; }
.input::placeholder { color: #222; }
.input:focus { border-color: #2a2a2a; }

.send-btn {
  width: 42px; height: 42px;
  background: #0a0a0a;
  border: 1px solid #1a1a1a;
  border-radius: 10px;
  color: #2a2a2a;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}
.send-btn.ready {
  border-color: #2a2a2a;
  color: #888;
}
.send-btn.ready:hover { background: #111; color: #aaa; }
.send-btn.ready:active { transform: scale(0.94); }

/* ── MODAL ── */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.9);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  animation: fadeIn 0.15s ease;
}
.modal-bg.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: min(320px, 88vw);
  background: #080808;
  border: 1px solid #181818;
  border-radius: 10px;
  padding: 28px 24px;
}
.modal-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--dim);
  letter-spacing: 0.1em;
  margin-bottom: 14px;
}
.modal-row { display: flex; gap: 0; align-items: stretch; overflow: hidden; border: 1px solid #181818; border-radius: 7px; }
.modal-input {
  flex: 1;
  background: #050505;
  border: none;
  border-right: 1px solid #181818;
  border-radius: 0;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.2s;
  min-width: 0;
}
.modal-input::placeholder { color: #1e1e1e; }
.modal-input:focus { background: #080808; }
.modal-submit {
  background: #0d0d0d;
  border: none;
  border-radius: 0;
  color: #444;
  font-size: 1rem;
  padding: 10px 14px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}
.modal-submit:hover { background: #111; color: #888; }
.modal-error {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: #7f3f3f;
  margin-top: 10px;
  letter-spacing: 0.04em;
}
.modal-error.hidden { display: none; }

/* ── UTIL ── */
.hidden { display: none !important; }

/* ── COLOR PICKER ── */
.color-picker {
  display: flex;
  gap: 6px;
  padding: 0 0 8px 0;
}
.color-btn {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1px solid #1a1a1a;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.15s, transform 0.1s;
  flex-shrink: 0;
}
.color-btn:hover { transform: scale(1.1); }
.color-btn.active { border-color: #444; transform: scale(1.08); }

/* ── DELETE BUTTON ── */
.delete-btn {
  margin-left: auto;
  background: transparent;
  border: none;
  color: #2a2a2a;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  transition: color 0.15s;
  flex-shrink: 0;
}
.delete-btn:hover { color: #f87171; }

/* Ensure card-meta has space for delete btn */
.card-meta { justify-content: flex-start; }
