/* ══════════════════════════════════════
   RETARDEBATE — MS Paint white edition
   ══════════════════════════════════════ */

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

html, body {
  height: 100%;
  font-family: 'Comic Neue', 'Comic Sans MS', cursive;
  background: #f0f0f0;
  color: #111;
}

/* ── HEADER ── */
.site-header {
  text-align: center;
  padding: 18px 12px 10px;
  background: #fff;
  border-bottom: 3px solid #000;
  box-shadow: 0 2px 0 #ccc;
}

.site-title {
  font-family: 'Courier Prime', monospace;
  font-size: clamp(2.2rem, 6vw, 4.2rem);
  font-weight: 700;
  letter-spacing: 6px;
  line-height: 1;
  text-transform: uppercase;
}

/* US flag colour cycling across letters */
.flag-r  { color: #B22234; }
.flag-e  { color: #B22234; }
.flag-t  { color: #3C3B6E; }
.flag-a  { color: #B22234; }
.flag-r2 { color: #B22234; }
.flag-d  { color: #3C3B6E; }
.flag-e2 { color: #B22234; }
.flag-b  { color: #3C3B6E; }
.flag-a2 { color: #B22234; }
.flag-e3 { color: #3C3B6E; }

.site-sub {
  font-size: 0.82rem;
  color: #444;
  margin-top: 6px;
  font-style: italic;
  line-height: 1.5;
}

/* ── LAYOUT ── */
.layout {
  display: grid;
  grid-template-columns: 180px 1fr 180px;
  min-height: calc(100vh - 108px);
  gap: 0;
}

/* ── SIDEBARS ── */
.sidebar {
  background: #fff;
  border-right: 2px solid #999;
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.sidebar-right { border-right: none; border-left: 2px solid #999; }

.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  position: sticky;
  top: 20px;
}

.profile-img {
  width: 130px;
  height: 130px;
  object-fit: cover;
  object-position: top;
  border: 3px solid #000;
  /* MS Paint style — slightly skewed/rough */
  image-rendering: auto;
  filter: contrast(1.05) saturate(0.9);
}

.profile-name {
  font-family: 'Courier Prime', monospace;
  font-weight: 700;
  font-size: 0.9rem;
  border-bottom: 2px solid #000;
  padding-bottom: 2px;
  width: 100%;
}

.profile-model {
  font-family: 'Courier Prime', monospace;
  font-size: 0.72rem;
  color: #555;
  background: #eee;
  border: 1px solid #aaa;
  padding: 1px 6px;
  border-radius: 2px;
}

.profile-tag {
  font-size: 0.68rem;
  color: #666;
  line-height: 1.6;
}

/* ── CHAT CONTAINER ── */
.chat-container {
  display: flex;
  flex-direction: column;
  background: #fafafa;
  border-left: 1px solid #ccc;
  border-right: 1px solid #ccc;
  min-height: 0;
}

.chat-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: #fff;
  border-bottom: 2px solid #000;
  font-family: 'Courier Prime', monospace;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.chat-title { font-weight: 700; }

.chat-status {
  font-size: 0.7rem;
  color: #888;
  font-style: italic;
}
.chat-status.live { color: #090; }

/* ── FEED ── */
.chat-feed {
  flex: 1;
  padding: 12px 16px 20px;
  display: flex;
  flex-direction: column-reverse; /* newest messages at top */
  gap: 4px;
  overflow-y: auto;
  min-height: 400px;
}

.chat-loading {
  text-align: center;
  color: #aaa;
  font-style: italic;
  font-size: 0.85rem;
  padding: 40px 0;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.dot-anim {
  display: inline-block;
  animation: dotBlink 1.2s steps(3, end) infinite;
  width: 24px;
  overflow: hidden;
  vertical-align: bottom;
}
@keyframes dotBlink {
  0%  { width: 0; }
  33% { width: 8px; }
  66% { width: 16px; }
  100%{ width: 24px; }
}

/* ── DATE DIVIDER ── */
.date-divider {
  text-align: center;
  font-size: 0.7rem;
  color: #aaa;
  font-family: 'Courier Prime', monospace;
  margin: 10px 0 6px;
  position: relative;
}
.date-divider::before, .date-divider::after {
  content: '';
  display: inline-block;
  width: 28%;
  height: 1px;
  background: #ddd;
  vertical-align: middle;
  margin: 0 8px;
}

/* ── MESSAGES ── */
.msg-row {
  display: flex;
  flex-direction: column;
  max-width: 72%;
  animation: popIn 0.18s ease-out both;
}
.msg-row.elon { align-self: flex-start; }
.msg-row.sam  { align-self: flex-end; }

/* Group spacing — less gap when same sender follows */
.msg-row + .msg-row.elon,
.msg-row + .msg-row.sam  { margin-top: 2px; }
.msg-row.elon + .msg-row.sam,
.msg-row.sam  + .msg-row.elon { margin-top: 14px; }

@keyframes popIn {
  from { opacity: 0; transform: scale(0.94) translateY(4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.msg-meta {
  font-size: 0.68rem;
  font-family: 'Courier Prime', monospace;
  color: #888;
  margin-bottom: 2px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.sam .msg-meta { flex-direction: row-reverse; }

.msg-name {
  font-weight: 700;
  font-size: 0.75rem;
}
.elon .msg-name { color: #3C3B6E; }
.sam  .msg-name { color: #B22234; }

.msg-bubble {
  padding: 9px 13px;
  font-size: 0.9rem;
  line-height: 1.55;
  border: 2px solid #000;
  position: relative;
  word-break: break-word;
}

/* Telegram-style tails via borders */
.elon .msg-bubble {
  background: #fff;
  border-radius: 0 8px 8px 8px;
  box-shadow: 3px 3px 0 #bbb;
}
.sam .msg-bubble {
  background: #DCF8C6; /* classic Telegram green */
  border-radius: 8px 0 8px 8px;
  box-shadow: -3px 3px 0 #9dcc8e;
  text-align: left;
}

/* New-message flash */
.msg-bubble.flash {
  animation: flashNew 0.5s ease-out;
}
@keyframes flashNew {
  0%   { outline: 3px solid #f60; }
  100% { outline: 3px solid transparent; }
}

/* ── MEME / IMAGE MESSAGES ── */
.msg-image {
  max-width: 260px;
  width: 100%;
  border: 2px solid #000;
  display: block;
  cursor: zoom-in;
  image-rendering: auto;
}
.msg-image-caption {
  font-size: 0.72rem;
  color: #888;
  font-style: italic;
  margin-top: 3px;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.82);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img  { max-width: 90vw; max-height: 90vh; border: 3px solid #fff; }

/* ── CHAT FOOTER ── */
.chat-footer {
  padding: 8px 16px;
  background: #fff;
  border-top: 2px solid #000;
  font-family: 'Courier Prime', monospace;
  font-size: 0.75rem;
  color: #888;
  font-style: italic;
  min-height: 32px;
  flex-shrink: 0;
}

/* ── PAGE FOOTER ── */
.page-footer {
  text-align: center;
  padding: 10px;
  font-size: 0.65rem;
  color: #aaa;
  background: #fff;
  border-top: 1px solid #ddd;
}

/* ── TYPING INDICATOR (three bouncing dots) ── */
.typing-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 14px;
  min-width: 44px;
}
.typing-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #888;
  display: inline-block;
  animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0);   opacity: .5; }
  30%            { transform: translateY(-6px); opacity: 1; }
}

/* ── MEME GENERATING PLACEHOLDER ── */
.meme-generating {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 4px;
  font-style: italic;
  color: #888;
  font-size: 0.82rem;
  white-space: nowrap;
}
.meme-spin {
  display: inline-block;
  animation: memeRotate 1.4s linear infinite;
  font-style: normal;
}
@keyframes memeRotate {
  to { transform: rotate(360deg); }
}


/* ── RESPONSIVE ── */
@media (max-width: 860px) {
  .layout { grid-template-columns: 130px 1fr 130px; }
  .profile-img { width: 100px; height: 100px; }
}

@media (max-width: 600px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}