/* ══════════════════════════════════════════════════════════════
   livechat.css — Enhanced Live Chat panel for monitor.html
   Premium glassmorphism design, SVG-only (no emoji)
   Mobile-first responsive: 320px → 1200px+
   ══════════════════════════════════════════════════════════════ */

/* ── Panel Container ── */
.lc-panel {
  background: var(--surface, rgba(13,17,23,.6));
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0;
  margin-bottom: .75rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color .4s, box-shadow .4s;
  position: relative;
}
.lc-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(168,85,247,.15), transparent);
  pointer-events: none;
}
.lc-panel:hover {
  border-color: rgba(168,85,247,.12);
  box-shadow: 0 0 20px rgba(168,85,247,.04);
}
.lc-panel.open {
  border-color: rgba(168,85,247,.18);
  box-shadow: 0 4px 30px rgba(168,85,247,.06);
}

/* ── Header ── */
.lc-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  transition: background .2s;
  -webkit-tap-highlight-color: transparent;
  min-height: 48px; /* touch target */
}
.lc-header:hover {
  background: rgba(255,255,255,.015);
}

.lc-header-orb {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(168,85,247,.08);
  border: 1px solid rgba(168,85,247,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .3s;
}
.lc-header-orb svg {
  width: 14px; height: 14px;
  color: var(--ac);
  transition: color .3s;
}
.lc-panel.open .lc-header-orb {
  background: rgba(168,85,247,.14);
  border-color: rgba(168,85,247,.3);
  box-shadow: 0 0 12px rgba(168,85,247,.12);
}
.lc-panel.open .lc-header-orb svg { color: #c084fc; }

.lc-header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.lc-header-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: .52rem;
  font-weight: 700;
  color: var(--dim);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  line-height: 1;
}
.lc-header-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: .36rem;
  color: var(--mute);
  letter-spacing: .5px;
  line-height: 1;
}

.lc-header-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: .4rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.lc-badge-live {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--green);
  background: rgba(52,211,153,.06);
  border: 1px solid rgba(52,211,153,.15);
  margin-left: auto;
}
.lc-live-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px rgba(52,211,153,.5);
  animation: lcDotPulse 2.5s ease-in-out infinite;
  flex-shrink: 0;
  will-change: opacity;
}
@keyframes lcDotPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}
.lc-badge-count {
  color: var(--ac);
  background: rgba(168,85,247,.06);
  border: 1px solid rgba(168,85,247,.15);
  margin-left: 4px;
  min-width: 18px;
  text-align: center;
}

.lc-chevron {
  width: 12px; height: 12px;
  color: var(--mute);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  margin-left: 4px;
  flex-shrink: 0;
}
.lc-panel.open .lc-chevron {
  transform: rotate(180deg);
  color: var(--ac);
}

/* ── Fullscreen Button ── */
.lc-fullscreen-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: var(--mute);
  cursor: pointer;
  border-radius: 6px;
  padding: 0;
  margin-left: 4px;
  flex-shrink: 0;
  transition: color .2s, background .2s;
  pointer-events: all; /* don't bubble to header toggle */
}
.lc-fullscreen-btn:hover { color: var(--ac); background: rgba(168,85,247,.1); }
.lc-fullscreen-btn svg { width: 13px; height: 13px; display: block; }

/* ── Fullscreen Mode ── */
.lc-panel.lc-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 10000; /* above page-nav (9999) */
  border-radius: 0;
  margin: 0;
  border: none;
  display: flex;
  flex-direction: column;
  background: var(--bg, #0d1117);
}
.lc-panel.lc-fullscreen .lc-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.lc-panel.lc-fullscreen .lc-messages {
  flex: 1;
  height: auto;
  min-height: 0;
}
/* Hide page-nav and prevent page scroll when fullscreen active */
body.lc-fs-active { overflow: hidden; }
body.lc-fs-active #pn { display: none !important; }

/* ── Body ── */
.lc-body {
  display: none;
  flex-direction: column;
  position: relative;
}
.lc-panel.open .lc-body {
  display: flex;
  animation: lcBodyIn .35s ease;
}
@keyframes lcBodyIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Messages ── */
.lc-messages {
  height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(168,85,247,.12) transparent;
  position: relative;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain; /* prevent scroll chaining to page */
  /* [PERF] Skip paint+layout for off-screen rows — ~60% render cost reduction
     when chat has 100+ messages and user is not scrolling */
  content-visibility: auto;
  contain-intrinsic-size: 0 300px;
}

/* ── Skeleton Loading (absolute overlay over message list) ── */
.lc-loading {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  z-index: 5;
}
.lc-skeleton {
  height: 22px;
  border-radius: 6px;
  background: linear-gradient(90deg,
    rgba(255,255,255,.04) 0%,
    rgba(255,255,255,.09) 50%,
    rgba(255,255,255,.04) 100%);
  background-size: 200% 100%;
  animation: lcShimmer 1.4s infinite ease-in-out;
  width: 90%;
}
.lc-skeleton-short { width: 55%; }
.lc-skeleton-med   { width: 72%; }
@keyframes lcShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Top loader (inline, prepended when loading older) ── */
.lc-top-loader {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 0 10px;
}

/* ── Scroll to bottom (wrapper anchors to lc-input-wrap top-right) ── */
.lc-scroll-wrap {
  position: absolute;
  top: -44px;
  right: 10px;
  z-index: 12;
}
.lc-scroll-btn {
  display: grid;
  place-items: center;     /* perfect centering, no flex span interference */
  width: 30px;
  height: 30px;
  padding: 0;
  background: rgba(15, 15, 20, 0.82);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  transition: all 0.2s ease;
}
.lc-scroll-btn svg {
  width: 14px;
  height: 14px;
  display: block;
  /* chevron polyline "6 9 12 15 18 9" center-of-mass ~y=11, viewBox center=12
     +1px nudge so visual center aligns with geometric center */
  transform: translateY(1px);
  pointer-events: none;
}
.lc-scroll-btn:hover {
  background: rgba(30, 30, 40, 0.95);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

/* [PERF] Scroll badge: pulse only fires when JS adds .has-unseen class */
.lc-scroll-badge {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 22px; height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  pointer-events: none;
  background: transparent;
}
.lc-scroll-badge.has-unseen {
  box-shadow: 0 0 6px rgba(168,85,247,.45);
  animation: lcBadgePulse 2s ease-in-out infinite;
  /* [PERF] box-shadow is compositor-friendly — no layout or paint cost */
}
@keyframes lcBadgePulse {
  0%, 100% { box-shadow: 0 0 6px rgba(168,85,247,.45); }
  50%       { box-shadow: 0 0 14px rgba(168,85,247,.75); }
}
@keyframes lcFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.lc-scroll-wrap { animation: lcFadeUp .3s ease-out; }
/* Scrollbar */
.lc-messages::-webkit-scrollbar { width: 3px; }
.lc-messages::-webkit-scrollbar-thumb {
  background: rgba(168,85,247,.15);
  border-radius: 2px;
}

/* ── Empty State ── */
.lc-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 6px;
  padding: 2rem 1rem;
  text-align: center;
}
.lc-empty-icon {
  width: 48px; height: 48px;
  color: var(--mute);
  opacity: .2;
  margin-bottom: 4px;
}
.lc-empty-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: .52rem;
  font-weight: 600;
  color: var(--dim);
  letter-spacing: .5px;
}
.lc-empty-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: .4rem;
  color: var(--mute);
  letter-spacing: .3px;
}

/* Message Row */
.lc-msg {
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 6px;
  min-height: 28px;
  /* [PERF] contain:layout prevents this row from affecting ancestor layout on changes */
  contain: layout;
}
/* [PERF] Use opacity transition only (compositor-only, zero repaints) */
.lc-msg:not(.lc-bg-galaxy):hover { background: rgba(255,255,255,.025); }
@keyframes lcMsgIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Source Badge */
.lc-src {
  font-family: 'JetBrains Mono', monospace;
  font-size: .34rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 4px;
  flex-shrink: 0;
  letter-spacing: .6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  line-height: 1;
  height: 22px;
  box-sizing: border-box;
}
.lc-src svg { width: 10px; height: 10px; opacity: .85; }
.lc-src-game {
  color: var(--green);
  background: rgba(52,211,153,.1);
  border: 1px solid rgba(52,211,153,.2);
}
.lc-src-web {
  color: var(--ac);
  background: rgba(168,85,247,.1);
  border: 1px solid rgba(168,85,247,.2);
}

/* Message Content */
.lc-msg-body {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0;
  line-height: 1.4;
  overflow: visible;
}
.lc-msg-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: .44rem;
  font-weight: 700;
  color: rgba(255,255,255,.9);
  margin-right: 6px;
  white-space: nowrap;
}
.lc-msg-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: .44rem;
  color: rgba(255,255,255,.7);
  word-break: break-word;
  overflow-wrap: anywhere;
}
.lc-msg-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: .34rem;
  color: rgba(255,255,255,.35);
  flex-shrink: 0;
  white-space: nowrap;
  margin-left: auto;
  padding-left: 8px;
}

/* Verified Badge (SVG checkmark) */
.lc-verified {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #34d399;
  background: rgba(52,211,153,.12);
  border: 1px solid rgba(52,211,153,.25);
  border-radius: 50%;
  width: 14px;
  height: 14px;
  margin-left: 3px;
  vertical-align: middle;
  flex-shrink: 0;
  filter: drop-shadow(0 0 3px rgba(52,211,153,.35));
}
.lc-verified svg {
  display: block;
}

/* Supporter Badge (Diamond) - Performance-Optimized Premium Design */
.lc-supporter {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(168, 85, 247, 0.08);
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: 4px;
  width: 14px;
  height: 14px;
  margin-left: 4px;
  vertical-align: middle;
  flex-shrink: 0;
  overflow: hidden; /* [PERF] clip ::after shimmer — required for sweep effect */
  /* [PERF] Single static shadow — no animation on ambient state */
  box-shadow: 0 0 5px rgba(168, 85, 247, 0.2);
  /* [PERF] Only box-shadow + border on hover — no transform, no repaint trigger */
  transition: box-shadow 0.3s, border-color 0.3s;
}
.lc-supporter:hover {
  border-color: rgba(236, 72, 153, 0.5);
  box-shadow: 0 0 10px rgba(236, 72, 153, 0.4), inset 0 0 6px rgba(56, 189, 248, 0.2);
}
/* [PERF] Shimmer sweep only on hover — eliminates N always-running animations for N badges */
.lc-supporter::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  transform: skewX(-25deg);
  opacity: 0;
  transition: none;
  pointer-events: none;
}
.lc-supporter:hover::after {
  animation: lcShineSweep 0.6s ease-out forwards;
}
.lc-supporter svg {
  display: block;
  position: relative;
  z-index: 2;
  /* [PERF] Static drop-shadow only — no keyframe animation on idle badges */
  filter: drop-shadow(0 0 3px rgba(168, 85, 247, 0.7));
}
@keyframes lcShineSweep {
  from { left: -100%; opacity: 1; }
  to   { left: 200%; opacity: 0; }
}
/* Removed: lcDiamondPulse — was running 24/7 on every badge in DOM */

/* ── Custom Chat Backgrounds (GIF — Performance-Optimized) ── */
.lc-bg-galaxy {
  position: relative;
  /* Dark base — ensures text is always readable even before GIF loads */
  background: rgba(10, 5, 22, 0.92);
  border: 1px solid rgba(168, 85, 247, 0.22);
  border-radius: 4px;
  overflow: hidden;
  /* [PERF] Single-layer ambient shadow only — no heavy multi-layer glow */
  box-shadow:
    0 4px 16px rgba(10, 5, 20, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  margin-top: 4px;
  margin-bottom: 4px;
}
/* [PERF] GIF rendered as its own GPU composite layer via pseudo-element.
   Separating GIF from text content prevents GIF decode from triggering
   repaint on the text layer above it. Opacity kept low for readability. */
.lc-bg-galaxy::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('../assets/galaxy.gif') center / cover no-repeat;
  opacity: 0.35;
  /* [PERF] Force GPU compositing — GIF frames decode on compositor thread */
  will-change: opacity;
  pointer-events: none;
  z-index: 0;
}
/* Crisp accent left border — rendered above GIF */
.lc-bg-galaxy > * { position: relative; z-index: 1; }
.lc-bg-galaxy::after {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, #c084fc, #9333ea, #6366f1);
  z-index: 2;
  pointer-events: none;
}
body.light .lc-bg-galaxy {
  background: linear-gradient(135deg, rgba(250,204,21,0.15) 0%, rgba(236,72,153,0.15) 33%, rgba(168,85,247,0.15) 66%, rgba(56,189,248,0.15) 100%);
}
body.light .lc-bg-galaxy::before { opacity: 0.15; }


/* ── System Messages (join/leave/death) ── */
.lc-msg-sys {
  background: transparent !important;
  padding: 3px 12px !important;
  gap: 8px !important;
  min-height: 24px;
}
.lc-msg-sys:hover { background: rgba(255,255,255,.015) !important; }
.lc-sys-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 14px; height: 14px;
}
.lc-sys-icon svg { width: 14px; height: 14px; display: block; }
.lc-sys-join { color: #34d399; }
.lc-sys-leave { color: #f87171; }
.lc-sys-death { color: #f87171; }
.lc-sys-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: .42rem;
  color: rgba(255,255,255,.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.lc-sys-text b {
  color: rgba(255,255,255,.75);
  font-weight: 700;
}

/* ── Input Area ── */
.lc-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,.05);
  background: transparent;
}

/* Auth Gate (not logged in — clickable prompt) */
.lc-auth-gate {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-xs);
  background: rgba(168,85,247,.04);
  border: 1px dashed rgba(168,85,247,.15);
  cursor: pointer;
  transition: all .2s;
  -webkit-tap-highlight-color: transparent;
}
.lc-auth-gate:hover {
  background: rgba(168,85,247,.08);
  border-color: rgba(168,85,247,.25);
}
.lc-auth-icon {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: rgba(168,85,247,.08);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lc-auth-icon svg { width: 13px; height: 13px; color: var(--ac); }
.lc-auth-info { min-width: 0; }
.lc-auth-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: .48rem; font-weight: 700;
  color: var(--dim); letter-spacing: .3px;
}
.lc-auth-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: .36rem;
  color: var(--mute); letter-spacing: .2px;
  margin-top: 1px;
}

/* Login Form */
.lc-login-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative; /* anchor for close button */
}
/* Close (X) button on forms */
.lc-form-close {
  position: absolute;
  top: 0;
  right: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: rgba(255,255,255,.25);
  cursor: pointer;
  transition: color .2s, background .2s;
  padding: 0;
  z-index: 2;
}
.lc-form-close:hover {
  color: rgba(255,255,255,.7);
  background: rgba(255,255,255,.06);
}
.lc-login-row {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  padding-left: 10px;
  height: 40px;
  transition: border-color .25s, box-shadow .25s;
}
.lc-login-row:focus-within {
  border-color: rgba(168,85,247,.4);
  box-shadow: 0 0 0 2px rgba(168,85,247,.08);
}
.lc-login-icon {
  width: 14px; height: 14px;
  color: var(--mute); opacity: .5;
  flex-shrink: 0;
}
.lc-login-input {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: .46rem;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 0 10px;
  outline: none;
  height: 100%;
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
}
.lc-login-input::placeholder { color: var(--mute); opacity: .5; }
.lc-login-btn {
  width: 100%;
  font-family: 'JetBrains Mono', monospace;
  font-size: .42rem; font-weight: 700;
  padding: 0;
  border-radius: var(--r-xs);
  border: none;
  background: linear-gradient(135deg, rgba(168,85,247,.2), rgba(139,92,246,.3));
  color: #e0d0ff;
  cursor: pointer;
  transition: all .25s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  letter-spacing: 1px;
  text-transform: uppercase;
  -webkit-tap-highlight-color: transparent;
  height: 40px;
}
.lc-login-btn:hover {
  background: linear-gradient(135deg, rgba(168,85,247,.3), rgba(139,92,246,.45));
  box-shadow: 0 2px 12px rgba(168,85,247,.15);
}
.lc-login-btn:active { transform: scale(.98); }
.lc-login-btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.lc-login-error {
  font-family: 'JetBrains Mono', monospace;
  font-size: .38rem;
  color: var(--red);
  background: rgba(248,113,113,.06);
  border: 1px solid rgba(248,113,113,.12);
  border-radius: var(--r-xs);
  padding: 6px 10px;
  text-align: center;
}
.lc-switch-link {
  font-family: 'JetBrains Mono', monospace;
  font-size: .36rem;
  color: var(--mute);
  text-align: center;
  padding-top: 2px;
}
.lc-switch-link a {
  color: var(--ac);
  text-decoration: none;
  font-weight: 700;
  transition: color .2s;
}
.lc-switch-link a:hover { color: #c084fc; text-decoration: underline; }

/* Authenticated State */
.lc-authed-wrap {
  display: flex;
  align-items: stretch;
  gap: 6px;
  height: 36px;
}
.lc-user-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px;
  background: rgba(52,211,153,.05);
  border: 1px solid rgba(52,211,153,.12);
  border-radius: var(--r-xs);
  flex-shrink: 0;
  max-width: 120px;
}
.lc-user-badge svg { color: var(--green); opacity: .7; flex-shrink: 0; }
.lc-user-badge span {
  font-family: 'JetBrains Mono', monospace;
  font-size: .44rem; font-weight: 700;
  color: var(--green);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lc-logout-btn {
  flex-shrink: 0;
  width: 32px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-xs);
  color: var(--mute);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}
.lc-logout-btn:hover {
  color: var(--red);
  border-color: rgba(248,113,113,.25);
  background: rgba(248,113,113,.06);
}

/* Verification Code Step */
.lc-code-wrap {
  text-align: center;
  padding: 6px 0;
}
.lc-code-header {
  font-family: 'JetBrains Mono', monospace;
  font-size: .44rem;
  color: var(--dim);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-bottom: 8px;
  letter-spacing: .3px;
}
.lc-code-header svg { color: var(--ac); opacity: .7; }
.lc-code-display {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 8px;
  color: var(--ac);
  background: rgba(168,85,247,.06);
  border: 1px solid rgba(168,85,247,.15);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 0 auto 8px;
  max-width: 200px;
  animation: lcCodePulse 2s ease-in-out infinite;
  user-select: all;
}
@keyframes lcCodePulse {
  0%,100% { border-color: rgba(168,85,247,.15); box-shadow: 0 0 0 rgba(168,85,247,0); }
  50% { border-color: rgba(168,85,247,.35); box-shadow: 0 0 16px rgba(168,85,247,.08); }
}
.lc-code-hint {
  font-family: 'JetBrains Mono', monospace;
  font-size: .38rem;
  color: var(--mute);
  letter-spacing: .2px;
  line-height: 1.5;
  margin-bottom: 4px;
}
.lc-code-timer {
  font-family: 'JetBrains Mono', monospace;
  font-size: .36rem;
  color: var(--gold);
  opacity: .7;
}


.lc-msg-wrap {
  flex: 1;
  display: flex;
  align-items: stretch;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  transition: border-color .2s;
  overflow: hidden;
  height: 36px;
  min-width: 0;
}
.lc-msg-wrap:focus-within { border-color: var(--ac); }
.lc-msg-input {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: .5rem;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 0 10px;
  outline: none;
  min-width: 0;
  height: 100%;
  -webkit-appearance: none;
  appearance: none;
}
.lc-msg-input::placeholder { color: var(--mute); opacity: .6; }

.lc-send-btn {
  flex-shrink: 0;
  width: 38px;
  border: none;
  background: linear-gradient(135deg, rgba(168,85,247,.12), rgba(168,85,247,.2));
  color: var(--ac);
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  border-left: 1px solid rgba(168,85,247,.1);
  -webkit-tap-highlight-color: transparent;
  padding: 0;
  margin: 0;
}
.lc-send-btn svg {
  width: 13px; height: 13px;
  transition: transform .2s;
  display: block;
}
.lc-send-btn:hover {
  background: linear-gradient(135deg, rgba(168,85,247,.2), rgba(168,85,247,.3));
}
.lc-send-btn:hover svg { transform: translate(1px,-1px); }
.lc-send-btn:active svg { transform: scale(.9); }
.lc-send-btn:disabled { opacity: .3; cursor: not-allowed; }
.lc-send-btn:disabled svg { transform: none; }

/* ── Footer ── */
.lc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 12px 7px;
  border-top: 1px solid rgba(255,255,255,.02);
}
.lc-status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: .36rem;
  color: var(--mute);
  letter-spacing: .3px;
}
.lc-status-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background .3s, box-shadow .3s;
}
.lc-status-dot.connected {
  background: var(--green);
  box-shadow: 0 0 6px rgba(52,211,153,.4);
}
.lc-status-dot.polling {
  background: var(--gold);
  animation: lcDotPulse 1.5s ease-in-out infinite;
}
.lc-status-dot.offline {
  background: var(--red);
  box-shadow: 0 0 6px rgba(248,113,113,.3);
}
.lc-rate-notice {
  display: flex;
  align-items: center;
  gap: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-size: .36rem;
  color: var(--mute);
  letter-spacing: .3px;
  opacity: .5;
}
.lc-rate-notice svg { opacity: .5; }


/* ══════════════════════════════════════════════════════════════
   LIGHT THEME
   ══════════════════════════════════════════════════════════════ */
body.light .lc-panel {
  background: linear-gradient(135deg, rgba(255,255,255,.85), rgba(240,240,245,.9));
}
body.light .lc-panel::before {
  background: linear-gradient(90deg, transparent, rgba(168,85,247,.1), transparent);
}
body.light .lc-header:hover { background: rgba(0,0,0,.015); }
body.light .lc-header-orb {
  background: rgba(168,85,247,.06);
  border-color: rgba(168,85,247,.12);
}
body.light .lc-msg:not(.lc-bg-galaxy):hover { background: rgba(0,0,0,.015); }
body.light .lc-msg-wrap {
  background: rgba(0,0,0,.02);
  border-color: rgba(0,0,0,.06);
}
body.light .lc-send-btn {
  background: linear-gradient(135deg, rgba(168,85,247,.06), rgba(168,85,247,.12));
}


/* ══════════════════════════════════════════════════════════════
   RESPONSIVE — Tablet (≤768px)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .lc-messages { height: 280px; }
  .lc-header { padding: 10px 14px; }
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile (≤560px)
   Input stacks vertically. Reduced padding. Tighter layout.
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 560px) {
  .lc-panel { border-radius: 8px; }

  .lc-header {
    gap: 8px;
    padding: 10px 12px;
    min-height: 44px;
  }
  .lc-header-orb { width: 28px; height: 28px; border-radius: 6px; }
  .lc-header-orb svg { width: 12px; height: 12px; }
  .lc-header-title { font-size: .46rem; letter-spacing: 1px; }
  .lc-header-sub { font-size: .32rem; }
  .lc-header-badge { font-size: .34rem; padding: 2px 6px; }

  .lc-messages {
    height: 220px;
    padding: 8px 10px;
    gap: 0;
  }
  .lc-messages::after { height: 14px; }

  .lc-empty-icon { width: 36px; height: 36px; }
  .lc-empty-text { font-size: .44rem; }
  .lc-empty-sub { font-size: .36rem; }

  .lc-msg { gap: 6px; padding: 4px 8px; border-radius: 5px; min-height: 26px; }
  .lc-src { font-size: .32rem; padding: 2px 6px; gap: 3px; height: 20px; }
  .lc-src svg { width: 9px; height: 9px; }
  .lc-msg-name { font-size: .42rem; }
  .lc-msg-text { font-size: .42rem; }
  .lc-msg-time { font-size: .32rem; }

  .lc-sys-text { font-size: .38rem; }
  .lc-sys-icon { width: 12px; height: 12px; }
  .lc-sys-icon svg { width: 12px; height: 12px; }
  .lc-msg-sys { padding: 3px 8px !important; min-height: 22px; }

  /* Input area */
  .lc-input-wrap { gap: 8px; padding: 10px 12px; }
  .lc-login-form { gap: 8px; }
  .lc-login-row { height: 38px; }
  .lc-login-btn { height: 38px; font-size: .4rem; }
  .lc-login-input { font-size: .42rem; }
  .lc-switch-link { font-size: .34rem; }
  .lc-auth-gate { padding: 8px 10px; }
  .lc-auth-title { font-size: .42rem; }
  .lc-auth-sub { font-size: .32rem; }
  .lc-code-display { font-size: 1.2rem; letter-spacing: 6px; padding: 10px 12px; }
  .lc-code-hint { font-size: .34rem; }
  .lc-authed-wrap { height: 36px; }
  .lc-msg-wrap { height: 36px; }
  .lc-send-btn { width: 44px; }

  .lc-footer { padding: 4px 10px 6px; }
  .lc-status { font-size: .32rem; }
  .lc-rate-notice { font-size: .32rem; }
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE — Small Phone (≤400px)
   Extreme compactness for narrow devices (iPhone SE, etc)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 400px) {
  .lc-header {
    gap: 6px;
    padding: 8px 10px;
  }
  .lc-header-orb { width: 26px; height: 26px; }
  .lc-header-orb svg { width: 11px; height: 11px; }
  .lc-header-title { font-size: .44rem; }
  .lc-header-sub { display: none; } /* hide subtitle on tiny screens */
  .lc-badge-live { padding: 2px 5px; font-size: .34rem; }
  .lc-badge-count { font-size: .34rem; padding: 2px 5px; }
  .lc-chevron { width: 10px; height: 10px; }

  .lc-messages {
    height: 200px;
    padding: 4px 6px;
  }
  .lc-empty { padding: 1.5rem .5rem; }
  .lc-empty-icon { width: 36px; height: 36px; }
  .lc-empty-text { font-size: .44rem; }
  .lc-empty-sub { font-size: .36rem; }

  .lc-msg {
    gap: 4px;
    padding: 4px 6px;
    min-height: 24px;
  }
  .lc-src {
    font-size: .3rem;
    padding: 2px 4px;
    letter-spacing: .4px;
    height: 18px;
  }
  .lc-src svg { width: 8px; height: 8px; }
  .lc-msg-name { font-size: .4rem; margin-right: 4px; }
  .lc-msg-text { font-size: .4rem; }
  .lc-msg-time { font-size: .3rem; }
  .lc-sys-text { font-size: .36rem; }
  .lc-sys-icon { width: 10px; height: 10px; }
  .lc-sys-icon svg { width: 10px; height: 10px; }

  .lc-input-wrap { padding: 6px 8px; gap: 5px; }
  .lc-code-display { font-size: 1.2rem; letter-spacing: 5px; padding: 8px 10px; }
  .lc-authed-wrap { height: 36px; }
  .lc-msg-wrap { height: 36px; }
  .lc-msg-input { font-size: .46rem; padding: 5px 8px; }
  .lc-send-btn { width: 40px; }
  .lc-send-btn svg { width: 12px; height: 12px; }

  .lc-footer { padding: 3px 8px 5px; }
  .lc-status { font-size: .32rem; gap: 3px; }
  .lc-status-dot { width: 4px; height: 4px; }
  .lc-rate-notice { font-size: .32rem; }
  .lc-rate-notice svg { width: 7px; height: 7px; }
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE — Extra small (≤320px)
   Minimal viable layout for very narrow screens
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 320px) {
  .lc-messages { height: 180px; }
  .lc-badge-live span.lc-live-dot { width: 4px; height: 4px; }
  .lc-badge-count { display: none; }

  .lc-msg { gap: 3px; padding: 3px; }
  .lc-src { font-size: .3rem; padding: 1px 3px; }
  .lc-msg-name { font-size: .4rem; }
  .lc-msg-text { font-size: .44rem; }

  .lc-code-display { font-size: 1rem; letter-spacing: 4px; }
  .lc-msg-input { font-size: .44rem; }
}

/* ══════════════════════════════════════════════════════════════
   Reduced Motion — accessibility
   ══════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .lc-live-dot { animation: none; }
  .lc-status-dot.polling { animation: none; }
  .lc-panel.open .lc-body { animation: none; }
  .lc-msg { animation: none; }
  .lc-chevron { transition-duration: 0s; }
  .lc-code-display { animation: none; }
  /* Perf refactor animations */
  .lc-scroll-badge.has-unseen { animation: none; }
  .lc-supporter::after { display: none; }
  .lc-supporter:hover::after { animation: none; }
  /* GIF layer — ::before is the galaxy.gif pseudo-element.
     Hide it for users who prefer reduced motion (animated GIFs = motion). */
  .lc-bg-galaxy::before { opacity: 0; }
}

