/* ============================================================
   LOOPBBS CHAT — Terminal Stylesheet
   Phosphor green on void black. BBS aesthetic since 1983.
   ============================================================ */

/* --- CSS Variables (matching loopfarmstead.com/bbs.css) --- */
:root {
  --void: #050505;
  --void-light: #0a0a0a;
  --void-mid: #111111;
  --phosphor: #00ff41;
  --phosphor-dim: #00aa2a;
  --phosphor-dark: #004d14;
  --amber: #ffb000;
  --amber-dim: #cc8d00;
  --red: #ff2040;
  --white: #e0e0e0;
  --white-dim: #888888;
  --gray: #333333;
  --gray-light: #555555;
  --mono: 'Courier New', 'Lucida Console', monospace;
  --glow: 0 0 8px rgba(0, 255, 65, 0.6), 0 0 16px rgba(0, 255, 65, 0.3);
  --glow-amber: 0 0 8px rgba(255, 176, 0, 0.6), 0 0 16px rgba(255, 176, 0, 0.3);
  --glow-subtle: 0 0 4px rgba(0, 255, 65, 0.4);
  --sidebar-width: 220px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  background: var(--void);
  color: var(--phosphor);
  font-family: var(--mono);
  font-size: 1rem;
  line-height: 1.6;
  height: 100vh;
  height: 100dvh;  /* dynamic viewport: accounts for mobile browser chrome */
  overflow: hidden;
  position: relative;
}

/* --- Scanline Overlay --- */
.scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 1px,
    rgba(0, 0, 0, 0.15) 1px,
    rgba(0, 0, 0, 0.15) 2px
  );
}

/* --- CRT Flicker --- */
@keyframes crt-flicker {
  0%   { opacity: 1; }
  3%   { opacity: 0.97; }
  6%   { opacity: 1; }
  7.5% { opacity: 0.98; }
  9%   { opacity: 1; }
  50%  { opacity: 1; }
  52%  { opacity: 0.98; }
  53%  { opacity: 1; }
  100% { opacity: 1; }
}

body {
  animation: crt-flicker 8s infinite;
}

/* --- CRT Curvature (subtle vignette) --- */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9998;
  background: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 0) 60%,
    rgba(0, 0, 0, 0.3) 100%
  );
}

/* --- Selection --- */
::selection {
  background: var(--phosphor-dark);
  color: var(--phosphor);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--void);
}
::-webkit-scrollbar-thumb {
  background: var(--phosphor-dark);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--phosphor-dim);
}

/* ============================================================
   SCREEN SWITCHING
   ============================================================ */

.screen {
  display: none;
  width: 100%;
  height: 100vh;
  height: 100dvh;  /* dynamic viewport: accounts for mobile browser chrome */
}

.screen.active {
  display: flex;
}

.screen.hidden {
  display: none;
}

/* ============================================================
   AUTH SCREEN
   ============================================================ */

#auth-screen {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  height: 100dvh;  /* dynamic viewport: accounts for mobile browser chrome */
}

.auth-box {
  width: 100%;
  max-width: 400px;
  padding: 2rem 1.5rem;
  background: var(--void-light);
  border: 1px solid var(--phosphor-dark);
  box-shadow: 0 0 40px rgba(0, 255, 65, 0.1);
}

.auth-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-header h1 {
  font-size: 1.6rem;
  letter-spacing: 0.2em;
  text-shadow: var(--glow);
  color: var(--phosphor);
  margin-bottom: 0.5rem;
}

.auth-logo {
  font-family: 'DejaVu Sans Mono', 'Courier New', monospace;
  font-size: 0.7rem;
  line-height: 1.2;
  color: var(--phosphor);
  text-shadow: 0 0 8px rgba(0, 255, 65, 0.3);
  margin: 0 auto 0.5rem auto;
  text-align: center;
  white-space: pre;
  overflow: hidden;
}

.auth-subtitle {
  color: var(--white-dim);
  font-size: 0.8rem;
  line-height: 1.4;
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--phosphor-dark);
  margin-bottom: 1rem;
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--white-dim);
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 0.5rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: color 0.15s, border-color 0.15s;
}

.auth-tab:hover {
  color: var(--phosphor);
}

.auth-tab.active {
  color: var(--phosphor);
  text-shadow: var(--glow-subtle);
  border-bottom-color: var(--phosphor);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.form-group label {
  color: var(--amber);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-shadow: var(--glow-amber);
}

.form-group input {
  background: var(--void);
  border: 1px solid var(--gray);
  color: var(--phosphor);
  font-family: var(--mono);
  font-size: 1rem;
  padding: 0.6rem 0.75rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus {
  border-color: var(--phosphor);
  box-shadow: var(--glow-subtle);
}

.form-group input::placeholder {
  color: var(--gray-light);
}

.auth-submit {
  background: var(--phosphor);
  color: var(--void);
  border: none;
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: bold;
  padding: 0.7rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  transition: box-shadow 0.15s, background 0.15s;
}

.auth-submit:hover {
  box-shadow: var(--glow);
}

.auth-submit:active {
  background: var(--phosphor-dim);
}

.auth-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-error {
  color: var(--red);
  font-size: 0.85rem;
  text-align: center;
  min-height: 1.2rem;
}

.auth-error.hidden {
  display: none;
}

.auth-footer {
  text-align: center;
  color: var(--gray-light);
  font-size: 0.75rem;
  margin-top: 1rem;
  border-top: 1px solid var(--gray);
  padding-top: 0.75rem;
}

/* ============================================================
   CHAT SCREEN
   ============================================================ */

#chat-screen {
  display: none;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;  /* dynamic viewport: accounts for mobile browser chrome */
  overflow: hidden;
}

#chat-screen.active {
  display: flex;
}

/* --- Mobile Header --- */
.chat-mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--void-light);
  border-bottom: 1px solid var(--phosphor-dark);
  min-height: 44px;
  flex-shrink: 0;
}

.chat-hamburger {
  background: none;
  border: 1px solid var(--phosphor-dark);
  color: var(--phosphor);
  font-family: var(--mono);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.1rem 0.5rem;
  line-height: 1;
}

.chat-hamburger:hover {
  text-shadow: var(--glow);
}

.chat-logo {
  color: var(--phosphor);
  font-weight: bold;
  text-shadow: var(--glow-subtle);
  letter-spacing: 0.1em;
  font-size: 0.9rem;
}

.chat-handle-mobile {
  color: var(--amber);
  font-size: 0.8rem;
}

.chat-disconnect-btn {
  background: none;
  border: 1px solid var(--red);
  color: var(--red);
  font-family: var(--mono);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  transition: background 0.15s, color 0.15s;
}

.chat-disconnect-btn:hover {
  background: var(--red);
  color: var(--void);
}

/* --- Chat Body --- */
.chat-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* --- Sidebar --- */
.chat-sidebar {
  width: var(--sidebar-width);
  background: var(--void-light);
  border-right: 1px solid var(--phosphor-dark);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-section {
  padding: 0.75rem;
  border-bottom: 1px solid var(--gray);
}

.sidebar-section h3 {
  color: var(--amber);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-shadow: var(--glow-amber);
  margin-bottom: 0.5rem;
}

.sidebar-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-section li {
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  color: var(--white-dim);
  font-size: 0.9rem;
  transition: all 0.1s ease;
  border-left: 2px solid transparent;
}

.sidebar-section li:hover {
  color: var(--phosphor);
  background: var(--void-mid);
}

.sidebar-section li.active {
  color: var(--phosphor);
  text-shadow: var(--glow-subtle);
  border-left-color: var(--phosphor);
  background: var(--void-mid);
}

.sidebar-section li .online-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--phosphor);
  border-radius: 50%;
  margin-right: 0.4rem;
  box-shadow: var(--glow-subtle);
  vertical-align: middle;
}

.sidebar-footer {
  margin-top: auto;
  padding: 0.75rem;
  border-top: 1px solid var(--phosphor-dark);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chat-handle {
  color: var(--amber);
  font-size: 0.85rem;
  text-shadow: var(--glow-amber);
  word-break: break-all;
}

/* --- Sidebar overlay (mobile) --- */
.chat-sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(5, 5, 5, 0.7);
  z-index: 99;
}

.chat-sidebar-overlay.show {
  display: block;
}

/* --- Messages Area --- */
.chat-messages-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.chat-room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--phosphor-dark);
  background: var(--void-light);
  flex-shrink: 0;
}

.chat-room-name {
  color: var(--amber);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-shadow: var(--glow-amber);
}

.chat-msg-count {
  color: var(--white-dim);
  font-size: 0.75rem;
}

/* --- Messages Container --- */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-height: 0;
}

.chat-welcome {
  text-align: center;
  color: var(--white-dim);
  font-size: 0.8rem;
  padding: 2rem 1rem;
  line-height: 1.5;
}

.chat-welcome strong {
  color: var(--amber);
}

/* --- Individual Message --- */
.chat-msg {
  padding: 0.3rem 0.5rem;
  border-left: 2px solid var(--phosphor-dark);
  animation: msgAppear 0.2s ease;
  word-break: break-word;
  line-height: 1.5;
}

.chat-msg.self {
  border-left-color: var(--amber);
}

.chat-sender {
  color: var(--amber);
  font-size: 0.85rem;
  font-weight: bold;
  margin-right: 0.5rem;
  text-shadow: var(--glow-amber);
}

.chat-msg.self .chat-sender {
  color: var(--phosphor);
  text-shadow: var(--glow-subtle);
}

.chat-time {
  color: var(--gray-light);
  font-size: 0.7rem;
}

.chat-content {
  color: var(--white);
  font-size: 0.9rem;
  display: block;
}

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

/* --- Message Dissolve Effect --- */
.chat-msg.expiring {
  animation: msgExpire 5s ease forwards;
}

@keyframes msgExpire {
  0% {
    opacity: 1;
  }
  20% {
    opacity: 0.8;
  }
  100% {
    opacity: 0.2;
  }
}

.chat-msg.dissolving {
  animation: msgDissolve 5s steps(1) forwards;
}

.chat-msg.dissolving .chat-content {
  animation: charRandomize 5s steps(1) forwards;
}

@keyframes msgDissolve {
  0%   { opacity: 1; }
  20%  { opacity: 0.9; }
  40%  { opacity: 0.7; }
  60%  { opacity: 0.5; }
  80%  { opacity: 0.3; }
  100% { opacity: 0; }
}

.chat-msg.dissolved {
  opacity: 0;
  max-height: 0;
  padding: 0;
  margin: 0;
  border: none;
  overflow: hidden;
  transition: max-height 0.5s ease, opacity 0.5s ease, padding 0.5s ease;
}

/* --- Rate Limit Bar --- */
.chat-rate-bar {
  display: none;
  height: 24px;
  background: var(--void-mid);
  border-top: 1px solid var(--phosphor-dark);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.chat-rate-bar.hidden {
  display: none;
}

.chat-rate-bar:not(.hidden) {
  display: block;
}

.chat-rate-bar-fill {
  height: 100%;
  background: var(--amber);
  width: 0%;
  transition: width 0.1s linear;
}

.chat-rate-bar-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--void);
  font-size: 0.75rem;
  font-weight: bold;
  letter-spacing: 0.05em;
}

/* --- Message Form --- */
.chat-msg-form {
  display: flex;
  border-top: 1px solid var(--phosphor-dark);
  background: var(--void-light);
  flex-shrink: 0;
}

.chat-msg-form input {
  flex: 1;
  background: var(--void);
  border: none;
  color: var(--phosphor);
  font-family: var(--mono);
  font-size: 0.95rem;
  padding: 0.6rem 0.75rem;
  outline: none;
}

.chat-msg-form input::placeholder {
  color: var(--gray-light);
}

.chat-msg-form input:focus {
  box-shadow: inset 0 0 8px rgba(0, 255, 65, 0.1);
}

.chat-send-btn {
  background: var(--phosphor);
  color: var(--void);
  border: none;
  border-left: 1px solid var(--phosphor-dark);
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: bold;
  padding: 0.6rem 1rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: box-shadow 0.15s;
}

.chat-send-btn:hover {
  box-shadow: var(--glow);
}

.chat-send-btn:active {
  background: var(--phosphor-dim);
}

.chat-send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ============================================================
   RESPONSIVE — MOBILE (<768px)
   ============================================================ */

@media (max-width: 767px) {
  :root {
    --sidebar-width: 200px;
  }

  .chat-mobile-header {
    display: flex;
  }

  .chat-sidebar {
    position: fixed;
    top: 0;
    left: -260px;
    width: 260px;
    height: 100vh;
  height: 100dvh;  /* dynamic viewport: accounts for mobile browser chrome */
    z-index: 100;
    transition: left 0.25s ease;
    padding-top: 50px;
  }

  .chat-sidebar.open {
    left: 0;
  }

  .chat-sidebar-overlay.show {
    display: block;
  }

  .chat-sidebar .sidebar-footer {
    display: none;
  }

  html {
    font-size: 14px;
  }

  .auth-box {
    max-width: 100%;
    margin: 0 0.5rem;
  }

  .auth-header h1 {
    font-size: 1.3rem;
  }
}

/* ============================================================
   RESPONSIVE — DESKTOP (>=768px)
   ============================================================ */

@media (min-width: 768px) {
  /* Hide mobile hamburger header on desktop */
  .chat-mobile-header {
    display: none;
  }

  /* Sidebar always visible, static, full height */
  .chat-sidebar {
    position: static;
    height: auto;
    padding-top: 0;
  }

  /* No sidebar overlay on desktop */
  .chat-sidebar-overlay {
    display: none !important;
  }

  /* Show sidebar footer (with disconnect) on desktop */
  .chat-sidebar .sidebar-footer {
    display: flex;
  }

  /* Desktop header in sidebar — add logo at top */
  .chat-sidebar::before {
    content: 'LoopBBS';
    display: block;
    padding: 0.75rem;
    color: var(--phosphor);
    font-weight: bold;
    letter-spacing: 0.15em;
    text-shadow: var(--glow);
    font-size: 1rem;
    border-bottom: 1px solid var(--phosphor-dark);
    text-align: center;
  }
}

@media (min-width: 1200px) {
  :root {
    --sidebar-width: 260px;
  }

  html {
    font-size: 17px;
  }
}

/* ============================================================
   PROFILE POPUP / MODAL
   ============================================================ */

.profile-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 5, 5, 0.85);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-overlay.hidden {
  display: none;
}

.profile-popup {
  background: var(--void-light);
  border: 1px solid var(--phosphor-dark);
  box-shadow: 0 0 60px rgba(0, 255, 65, 0.15);
  width: 90%;
  max-width: 480px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: profileFadeIn 0.2s ease;
}

@keyframes profileFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--phosphor-dark);
  background: var(--void-mid);
}

.profile-title {
  color: var(--phosphor);
  font-size: 0.85rem;
  font-weight: bold;
  letter-spacing: 0.15em;
  text-shadow: var(--glow);
}

.profile-close {
  background: none;
  border: 1px solid var(--gray);
  color: var(--white-dim);
  font-family: var(--mono);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.1rem 0.4rem;
  line-height: 1;
  transition: border-color 0.15s, color 0.15s;
}

.profile-close:hover {
  border-color: var(--red);
  color: var(--red);
}

.profile-body {
  padding: 1rem;
  overflow-y: auto;
  flex: 1;
}

.profile-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--phosphor-dark);
}

/* --- Profile View Mode --- */
.profile-handle {
  color: var(--phosphor);
  font-size: 1.4rem;
  font-weight: bold;
  text-shadow: var(--glow);
  margin-bottom: 0.5rem;
  word-break: break-all;
}

.profile-bio {
  color: var(--white);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.profile-bio.empty {
  color: var(--gray-light);
  font-style: italic;
}

.profile-meta {
  color: var(--white-dim);
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
}

.profile-meta strong {
  color: var(--amber);
}

/* --- Profile Edit Mode --- */
.profile-edit-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}

.profile-edit-group label {
  color: var(--amber);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-shadow: var(--glow-amber);
}

.profile-edit-group input,
.profile-edit-group textarea {
  background: var(--void);
  border: 1px solid var(--gray);
  color: var(--phosphor);
  font-family: var(--mono);
  font-size: 0.9rem;
  padding: 0.5rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.profile-edit-group input:focus,
.profile-edit-group textarea:focus {
  border-color: var(--phosphor);
  box-shadow: var(--glow-subtle);
}

.profile-edit-group textarea {
  resize: vertical;
  min-height: 60px;
  max-height: 120px;
}

.profile-edit-group .char-count {
  color: var(--gray-light);
  font-size: 0.7rem;
  text-align: right;
}

.profile-btn {
  background: var(--phosphor);
  color: var(--void);
  border: none;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: bold;
  padding: 0.5rem 1rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: box-shadow 0.15s;
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
}

.profile-btn:hover {
  box-shadow: var(--glow);
}

.profile-btn:active {
  background: var(--phosphor-dim);
}

.profile-btn.secondary {
  background: var(--void-mid);
  color: var(--phosphor);
  border: 1px solid var(--phosphor-dark);
}

.profile-btn.secondary:hover {
  border-color: var(--phosphor);
  box-shadow: var(--glow-subtle);
}

.profile-btn.danger {
  background: var(--void-mid);
  color: var(--red);
  border: 1px solid var(--red);
}

.profile-btn.danger:hover {
  background: var(--red);
  color: var(--void);
}

/* --- Direct Message Section --- */
.dm-section {
  margin-top: 1rem;
  border-top: 1px solid var(--phosphor-dark);
  padding-top: 0.75rem;
}

.dm-section h4 {
  color: var(--amber);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-shadow: var(--glow-amber);
  margin-bottom: 0.5rem;
}

.dm-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dm-form textarea {
  background: var(--void);
  border: 1px solid var(--gray);
  color: var(--phosphor);
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 0.5rem;
  outline: none;
  resize: vertical;
  min-height: 50px;
  max-height: 100px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.dm-form textarea:focus {
  border-color: var(--phosphor);
  box-shadow: var(--glow-subtle);
}

.dm-form textarea::placeholder {
  color: var(--gray-light);
}

.dm-send-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dm-char-count {
  color: var(--gray-light);
  font-size: 0.7rem;
}

/* --- Inbox --- */
.inbox-section {
  margin-top: 1rem;
}

.inbox-section h4 {
  color: var(--amber);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-shadow: var(--glow-amber);
  margin-bottom: 0.5rem;
}

.inbox-empty {
  color: var(--gray-light);
  font-size: 0.8rem;
  font-style: italic;
  padding: 0.5rem 0;
}

.inbox-msg {
  background: var(--void-mid);
  border: 1px solid var(--gray);
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  position: relative;
}

.inbox-msg.unread {
  border-left: 3px solid var(--amber);
}

.inbox-msg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.inbox-msg-from {
  color: var(--amber);
  font-weight: bold;
  font-size: 0.85rem;
  text-shadow: var(--glow-amber);
  cursor: pointer;
}

.inbox-msg-from:hover {
  text-shadow: var(--glow);
  color: var(--phosphor);
}

.inbox-msg-time {
  color: var(--gray-light);
  font-size: 0.7rem;
}

.inbox-msg-content {
  color: var(--white);
  font-size: 0.85rem;
  line-height: 1.4;
  word-break: break-word;
}

.inbox-msg-delete {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  background: none;
  border: none;
  color: var(--gray-light);
  font-family: var(--mono);
  font-size: 0.7rem;
  cursor: pointer;
  padding: 0.1rem 0.3rem;
  transition: color 0.15s;
}

.inbox-msg-delete:hover {
  color: var(--red);
}

/* --- Inbox Badge --- */
.inbox-badge {
  display: inline-block;
  background: var(--red);
  color: var(--void);
  font-size: 0.65rem;
  font-weight: bold;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  padding: 0 4px;
  margin-left: 6px;
  vertical-align: middle;
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* --- Profile Button --- */
.chat-profile-btn {
  background: var(--void-mid);
  color: var(--amber);
  border: 1px solid var(--amber);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: bold;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: box-shadow 0.15s, background 0.15s;
  position: relative;
}

.chat-profile-btn:hover {
  box-shadow: var(--glow-amber);
  background: var(--void-light);
}

/* --- Clickable User Names --- */
.chat-user-list li {
  cursor: pointer;
}

.chat-sender {
  cursor: pointer;
}

.chat-sender:hover {
  text-decoration: underline;
}

/* --- Error / Success Messages --- */
.profile-error {
  color: var(--red);
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

.profile-success {
  color: var(--phosphor);
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

/* ============================================================
   PRINT
   ============================================================ */

@media print {
  body::before, body::after, .scanlines {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
    animation: none;
  }
}
.auth-subtitle.link a {
  color: var(--phosphor-dim);
  text-decoration: none;
  transition: color 0.2s, text-shadow 0.2s;
}
.auth-subtitle.link a:hover {
  color: var(--phosphor);
  text-shadow: var(--glow);
}

/* LOL button */
.chat-lol-btn {
  background: var(--void);
  color: var(--amber);
  border: 1px solid var(--phosphor-dark);
  border-left: 1px solid var(--phosphor-dark);
  font-size: 1.1rem;
  padding: 0 0.6rem;
  cursor: pointer;
  font-family: var(--mono);
  transition: background 0.15s, border-color 0.15s;
}
.chat-lol-btn:hover {
  background: var(--phosphor-dark);
  border-color: var(--amber);
}
.chat-lol-btn:active {
  background: var(--amber);
  color: var(--void);
}

/* ============================================================
   BULLETIN BOARD
   ============================================================ */

/* Sidebar toggle tabs */
.sidebar-toggle-tabs {
  display: flex;
  border-bottom: 1px solid var(--phosphor-dark);
}

.sidebar-tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--white-dim);
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 0.5rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: color 0.15s, border-color 0.15s;
}

.sidebar-tab:hover { color: var(--phosphor); }
.sidebar-tab.active { color: var(--phosphor); border-bottom-color: var(--phosphor); text-shadow: var(--glow-subtle); }

/* Board room list in sidebar */
#board-room-list li {
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  color: var(--white-dim);
  transition: color 0.1s;
}

#board-room-list li:hover { color: var(--phosphor); background: var(--void-mid); }
#board-room-list li.active { color: var(--phosphor); text-shadow: var(--glow-subtle); border-left-color: var(--phosphor); }

/* Board content area */
#board-content {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0.75rem;
  color: var(--white);
  font-size: 0.9rem;
}

#board-content h2 {
  color: var(--phosphor);
  font-size: 1rem;
  text-shadow: var(--glow-subtle);
  margin-bottom: 0.75rem;
  letter-spacing: 0.1em;
}

#board-content .board-topic {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--gray);
  cursor: pointer;
}

#board-content .board-topic:hover { color: var(--phosphor); }

#board-content .board-topic .topic-subject {
  color: var(--amber);
  font-size: 0.9rem;
  text-shadow: var(--glow-amber);
}

#board-content .board-topic .topic-meta {
  color: var(--gray-light);
  font-size: 0.75rem;
}

#board-content .board-post {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--gray);
}

#board-content .board-post .post-header {
  color: var(--amber);
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

#board-content .board-post .post-header .post-author {
  font-weight: bold;
  text-shadow: var(--glow-amber);
}

#board-content .board-post .post-header .post-time {
  color: var(--gray-light);
  font-size: 0.7rem;
}

#board-content .board-post .post-body {
  color: var(--white);
  font-size: 0.9rem;
  line-height: 1.5;
  word-break: break-word;
}

#board-content .board-reply {
  margin-left: 1rem;
  padding: 0.5rem 0;
  border-left: 2px solid var(--phosphor-dark);
  padding-left: 0.5rem;
}

/* Board forms */
#board-content textarea {
  background: var(--void);
  border: 1px solid var(--gray);
  color: var(--phosphor);
  font-family: var(--mono);
  font-size: 0.9rem;
  padding: 0.5rem;
  outline: none;
  resize: vertical;
  min-height: 60px;
  max-height: 200px;
  width: 100%;
}

#board-content textarea:focus {
  border-color: var(--phosphor);
  box-shadow: var(--glow-subtle);
}

#board-content input[type="text"] {
  background: var(--void);
  border: 1px solid var(--gray);
  color: var(--phosphor);
  font-family: var(--mono);
  font-size: 0.9rem;
  padding: 0.5rem;
  outline: none;
  width: 100%;
}

#board-content input[type="text"]:focus {
  border-color: var(--phosphor);
  box-shadow: var(--glow-subtle);
}

#board-content .board-back {
  color: var(--phosphor-dim);
  font-size: 0.8rem;
  cursor: pointer;
  margin-bottom: 0.75rem;
  display: inline-block;
}

#board-content .board-back:hover {
  color: var(--phosphor);
  text-shadow: var(--glow);
}

#board-content .board-actions {
  margin-top: 0.75rem;
}

/* ============================================================
   MOBILE CHAT FIX — Input always visible
   ============================================================ */
@media (max-width: 767px) {
  .chat-msg-form input {
    font-size: 16px; /* Prevents iOS zoom on focus */
    padding: 0.75rem;
    min-height: 44px;
  }

  .chat-send-btn {
    min-height: 44px;
    min-width: 60px;
    padding: 0.75rem;
  }

  .chat-lol-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 0.75rem 0.5rem;
  }

  .chat-messages {
    -webkit-overflow-scrolling: touch;
  }
}
